Button

Component

Button

The main action, with a soft press.

Import jellyfy/button.css with jellyfy/material.css and jellyfy/motion.css. Or import jellyfy/jellyfy.css, which already includes this file and every other component.

Classes

ClassType
btnComponentThe button.
btn-smSizeSmall size
btn-mdSizeMedium size (default)
btn-lgSizeLarge size
primaryColorIndigo by default.
secondaryColorPink by default.
tertiaryColorTeal by default.
neutralColorGray by default.
successColorGreen by default.
errorColorRed by default.
warningColorAmber by default.
infoColorSky by default.
loadingStateShows the sweep and a spinner. Put it on with a color, as in btn primary loading.

Colors

<button class="btn primary" type="button">Primary</button>
<button class="btn secondary" type="button">Secondary</button>
<button class="btn tertiary" type="button">Tertiary</button>
<button class="btn neutral" type="button">Neutral</button>
<button class="btn success" type="button">Success</button>
<button class="btn error" type="button">Error</button>
<button class="btn warning" type="button">Warning</button>
<button class="btn info" type="button">Info</button>

Sizes

Medium size (default)

<button class="btn btn-sm" type="button">Small</button>
<button class="btn btn-md" type="button">Medium</button>
<button class="btn btn-lg" type="button">Large</button>

Loading and disabled

Use the disabled attribute.

<button class="btn primary loading" type="button">Loading</button>
<button class="btn" type="button" disabled>Disabled</button>

Loading from state

Load adds loading on this button. Stop removes it. startJellyfy() sees the class change and puts the sweep on, then takes it off.

const [loading, setLoading] = useState(false);

<button
  className={loading ? "btn primary loading" : "btn primary"}
  type="button"
  aria-busy={loading}
>
  Save
</button>
<button
  className="btn"
  type="button"
  onClick={() => setLoading((current) => !current)}
>
  {loading ? "Stop" : "Load"}
</button>

A button with no color class uses the plain surface. A slot such as primary tints the fill.