Five-step guide

How to use

Pick a component, tune it live, copy its code and paste it into your site. Here is every step, with a sample button that goes from scratch to yours.

01Lo esencial

Before you start,
three ideas.

With this you already understand how any component in the vault is built.

01No dependencies

Every component is HTML, CSS and, when needed, a little JavaScript with no libraries. It works on any site.

02Two ways to use it

As an custom element (<musi-…>) by loading its script, or by copying its HTML, CSS y JavaScript into your project.

03Everything is customizable

Colors, sizes and timing are variables CSS --musi-…. Behavior, atributos like icon="left".

02Step by step

From picking
to pasting.

Five steps. Scroll slowly: the line moves with you.

  1. Step 01

    Pick a component

    Go to the vault, filter by category or search by name. Every card is the real component: hover it before you decide.

  2. Step 02

    Customize it live

    On its page, the Customize tab changes texts, colors, sizes and timing. The preview responds instantly.

  3. Step 03

    Copy the code

    In the Code elige Custom element (the shortest) or the full HTML, CSS and JavaScript. Your changes are already included.

  4. Step 04

    Paste it into your site

    With the custom element it is two lines: the script, once, and the element wherever you want it.

    <script src="https://cdn.jsdelivr.net/npm/musi-ui@0.2.0/musi-basic-button.js" defer></script>
    
    <musi-basic-button href="/contacto/">Escríbeme</musi-basic-button>
  5. Step 05

    Make it yours with CSS

    Change its variables from your own stylesheet. That way it updates across your whole site at once.

    musi-basic-button {
      --musi-bg: #0b0b0e;
      --musi-fg: #ffffff;
      --musi-radius: 2px;
    }
03Hands-on example

One button,
from scratch to yours.

The same Basic Button in six steps. On the left, what you write; on the right, the live result: hover it.

01

Load the script and write the element

With nothing else, the button looks exactly as it does in the vault.

<script src="https://cdn.jsdelivr.net/npm/musi-ui@0.2.0/musi-basic-button.js" defer></script>

<musi-basic-button href="/contacto/"></musi-basic-button>
02

Change the text and the link

The text goes inside the element; the link, in href.

<musi-basic-button href="/contacto/">Escríbeme</musi-basic-button>
03

Adjust its behavior with attributes

Attributes change how it behaves. Here the icon moves to the left.

<musi-basic-button href="/contacto/" icon="left">
  Escríbeme
</musi-basic-button>
04

Paint it with CSS variables

Colors, sizes and timing are variables that start with --musi-. They go in style or in your stylesheet.

<musi-basic-button href="/contacto/"
  style="--musi-bg: #5b4ff0; --musi-fg: #ffffff;
         --musi-accent: #0b0b0e">
  Escríbeme
</musi-basic-button>
05

Change its shape

Rounding is a variable too: 0 makes it straight and a high value turns it into a pill.

<musi-basic-button href="/contacto/" style="--musi-radius: 0">
  Escríbeme
</musi-basic-button>
06

Create variants for your brand

The same button can be very formal or very creative. Define each variant once in your CSS and pick it with an attribute.

musi-basic-button[variant="formal"] {
  --musi-bg: #0b0b0e;
  --musi-fg: #ffffff;
  --musi-radius: 2px;
}

musi-basic-button[variant="creativo"] {
  --musi-bg: #f5b544;
  --musi-fg: #0b0b0e;
  --musi-radius: 60px;
}

<musi-basic-button variant="formal">Agendar reunión</musi-basic-button>
<musi-basic-button variant="creativo" icon="left">¡Hablemos!</musi-basic-button>
04Variables

The ones you’ll
use the most.

Almost every component shares these names, so what you learn in one works in all of them.

--musi-bg

The component background.

--musi-fg

The color of text and icons.

--musi-accent

The accent color: hover, lines and whatever lights up.

--musi-radius

Rounding: 0 = straight, a high value = pill.

--musi-size

Size: the whole component scales with it.

--musi-duration

How long its animations take.

Every component lists all its variables at the top of its CSS, and its vault page shows the ones you changed. To change them in every component at once, declare the variables in :root.

05Questions

What people
usually ask.

If you have another question, write to me and we’ll figure it out.

No. The elements are standard Web Components: they work in plain HTML and inside React, Vue, Svelte or Astro.

Yes. Load only the scripts you use, or all of them at once with musi.js and musi.css (put the stylesheet in the <head>). You can also install it with npm install musi-ui.

Declare the variables in :root and every musi component picks them up. For just one, put them on its element, in style or in a class.

Yes. Paste the component HTML inside the element, exactly as it appears in its HTML tab, and change options, tabs or links as you like.

They use real elements (buttons, checkboxes, radios and links) with visible focus and their accessibility attributes.

06Still have questions?

Write to me, we'll figure it out

If you're not sure which component to pick, how to tune it or how to fit it into your project, tell me what you're building and I'll help.