# Library

> Keep themes, components, styles, palettes and templates to reuse across projects and share with other people.

The **Library** keeps pieces of theme for you to use in any project. It has two tabs:

- **My items**: everything you saved. Only you see it, until you decide to share.
- **Gallery**: the items that anyone with a Folio account shared.

Open the Library from the **Library** entry in the sidebar, right above your name.

:::note
The Library needs an internet connection. Offline, it shows a notice and comes back on its own when you are online again.
:::

## Item kinds

| Kind | What it holds |
| --- | --- |
| **Theme** | A whole project theme: `@theme`, colors, fonts, styles, components, header and footer. |
| **Component** | A `@component` and everything it depends on: styles, colors and fonts, and other components. |
| **Style** | A `@style` with the colors and fonts it uses. |
| **Palette** | Only `@color` and `@font`. |
| **Template** | The project theme and its presentations, to create new projects. |

Each card shows a preview rendered on the spot: the theme applied to sample slides, the component in use, text with the style, the color grid or the first slide of the template.

## Saving from the project theme

1. Open the project theme with the palette icon next to the project name.
2. Put the cursor inside the definition you want to keep, for example a `@component`.
3. Click **Save to library**.

The dialog comes with the definition under the cursor already picked in **What to save**. You can also pick **Whole theme** or **Palette only (colors and fonts)**. Below the preview, **Also includes** lists the dependencies that go along. For example, saving this component also takes the `highlight` style and the `brand` and `surface` colors:

```folio
@color brand #349ef4
@color surface brand
@style highlight {color=brand weight=bold}

@component card {title}
::: box {.highlight bg=surface}
## $title
$content
:::
@end
```

Give it a name, write a description if you like and click **Save**. Check **Share to the gallery now** to publish it right away.

## Creating an item from scratch

In the Library, click **New item**. Pick the kind, write the definitions in the editor and follow the preview next to it. For components and styles, pick the **Main definition**: it is the one shown in the preview and the one people call when they use the item. Folio only lets you save when there are no errors; the messages show up below the editor, just like in the project theme.

## Saving a project as a template

In the sidebar, hover over the project and click **Save as a template in the library**. The template takes the project theme and all of its presentations. It then shows up in **New project**, under **My templates**. Shared templates show up for other people under **From the community**.

Uploaded images (`asset:`) go along: when someone creates a project from the template, the images are copied to the new project.

## Sharing

In **My items**, the **Share** button publishes the item to the **Gallery**. **Stop sharing** takes it out of the gallery. People who already used the item keep their own copy: using an item always copies the text and never creates a link.

## Using an item

Click **Use** on the card:

| Kind | What happens |
| --- | --- |
| **Theme** | Replaces the theme of one of your projects or creates a new project with it. |
| **Component**, **Style**, **Palette** | Adds the definitions to the theme of the chosen project. |
| **Template** | Creates a new project with the template theme and presentations. |

In the gallery, **Copy to my items** keeps a copy in **My items** for you to edit freely.

Inside the project theme, **Insert from library** does the same straight in the editor: the definitions go into the text and are saved with the theme.

### Names that already exist

If the target theme already has a color, font, style or component with the same name and different content, Folio asks what to do with each one:

| Option | Result |
| --- | --- |
| **Replace** | The item definition takes the place of yours. |
| **Rename** | The item definition comes in with another name, like `brand-2`, and the references inside the item are updated. |
| **Keep mine** | Your definition stays, and the item uses yours. |

Identical definitions do not trigger a question. New definitions go at the end of the theme, under a `// Biblioteca: <item name>` comment.

## Reporting an item

If a gallery item is spam, offensive, copies someone else's work or simply doesn't work, use **Report** (the flag icon on the card). Pick a reason (**Spam**, **Offensive**, **Copyright**, **Doesn't work** or **Other**), add details if you want and send it. The author is not told who reported it.

- You can only report other people's gallery items.
- Reporting the same item again updates your previous report.
- Each account can send up to 20 reports per day.
- An item with 5 open reports leaves the gallery automatically until a moderator reviews it.

When moderation removes one of your items, it stays in **My items** with the **Removed by moderation** notice and the reason, but it can no longer be shared. You can still use it in your projects or delete it.

## Limits

- Name up to 80 characters and description up to 500.
- Components, styles and palettes up to 64 KB; themes up to 512 KB.
- Templates with 1 to 20 presentations.
- Up to 300 items per account.

See also [Themes](/docs/en/guides/themes/) and [Components](/docs/en/guides/components/).
