> ## Documentation Index
> Fetch the complete documentation index at: https://www.magicpatterns.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Import from code

> Link a GitHub repository or upload a zip of your component library

Import from code when your components already live in a repository, or in a folder on your computer. Magic Patterns reads that source, then proposes the components, colors, and tokens it finds. You review them before they are added.

To start, click the **+** next to **Resources** in the left sidebar, then choose **Design System**. You can also choose **Import your design system** when you open a new project.

![The Resources menu in the left sidebar with GitHub and Design System options](https://cdn.magicpatterns.com/uploads/eoh3xxk3KJ9F12c7t2Kch2/add_new_resource_new_proj.png)

> [!NOTE]
>
> Linking GitHub only needs read access. Magic Patterns reads the repository to
> import your components and styles. It does not write to your repo.

## Link a GitHub repository

**1. Name your design system.**

In the **Import a design system** window, type a name under **Name**.

![The Import a design system window with a repository search bar and Name field](https://cdn.magicpatterns.com/uploads/aWv9gEfs2sPyS1Z5xJf911/import_design_sys.png)

**2. Connect your GitHub account.**

The first time you do this, click **Connect**, then **Connect GitHub**, then **Authorize** in the GitHub window that opens. You only need to do this once.

![The Connect your GitHub account window](https://cdn.magicpatterns.com/uploads/9s3a573bzRX9ZbyoRf2TdV/connect_github_design_sys.png)

**3. Find your repo.**

Search for it by name, or paste its URL, like `https://github.com/your-org/your-repo`.

**4. Choose folders (optional).**

For a large repo, select only the folder that holds your components, so Magic Patterns only scans that code.

**5. Click Continue.**

Magic Patterns scans your repo and suggests the components, colors, and styles it finds. You review them before anything is added.

> [!TIP]
>
> paste a link to a specific folder or file in your repo, and Magic Patterns will select it for you.

## Upload a zip

Use a zip when Magic Patterns can't reach your code in a GitHub repo. A zip is a one-time import.

**Step 1**

In the **Import a design system** window, click **Upload files instead**.

**Step 2**

Drag and drop a zip of your component library, or click to browse. You can upload `.zip`, `.tar.gz`, or `.tgz` files, and more than one at a time.

**Step 3**

Choose the folders to import (optional), like the folder that holds your components.

**Step 4**

Click **Continue**. Magic Patterns scans the code and suggests what it finds for you to review.

## Keep your design system up to date

Your design system stays linked to your GitHub repo, but new commits don't update it automatically.

In MagicOS: click **Re-sync** to pull the latest from your connected sources and create a new version. Branch or folder changes wait until someone confirms them.

## What's next

> [card] [Choose how to import](https://www.magicpatterns.com/docs/documentation/design-systems/importing/overview.md)
>
> Compare GitHub, a zip, and a production library.

> [card] [Connect your production library](https://www.magicpatterns.com/docs/documentation/design-systems/importing/npm-package.md)
>
> Book a call when you need the published React library your product ships.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.