Create a family

A family is one CSS file. The components already exist, their DOM and their classes fixed; the file paints them, in one direction, and declares the parameters a theme may set. Everything the app knows about a family is read out of that file: its name and prose from its header comment, its parameters from a uu-params comment, its components from its selectors.

1Write it

The family kit is written for an assistant: the steps, the contract the file must meet (header, parameters, intrinsic sizing, slots, states, motion), and one page per component with its classes, its states and the DOM it renders. Give an assistant the link; one that cannot fetch pages takes the whole kit as a file.

./family-kit/index.md Open

Read ./family-kit/index.md and follow it to write a new Sepale family with me. Start with its first step.

Download the whole kit

The built families are the reference: their compiled stylesheets (daisy, dahlia, sunflower, cosmos, peony) are a complete answer to the contract, and the kit links their sources component by component.

2Load it here

The family joins the picker in the sidebar: walk the component pages and the theme editor with it, in a light and a dark theme. It stays in this browser, and nothing is sent anywhere. Loading a file under the same name replaces it.

4Get its types optional

A family works with its stylesheet alone: the classes draw everything, and the Svelte components run with any family. Its types are a convenience. Beside name.css, a name.css.d.ts narrows the components' props to what the family draws, so a variant it lacks is a compile error. Without it, the props accept every variant of every family, and nothing tells you which ones this family leaves unstyled.

Never write that file by hand, and do not ask an assistant to: it is derived from the stylesheet, so it cannot promise a variant the stylesheet does not draw. Get it one of three ways:

  1. Download types, on the family in step 3, once it is loaded here: the .css.d.ts alone.
  2. The bundle: theme editor → Download bundle, with the Svelte components. The stylesheet, your theme, the components and the types, together.
  3. Without this site: npx sepale-types name.css (from @sepale/components), or node lib/sepale-types.js name.css in a bundle. Add --components <dir> when you changed the components' variants, so the ones you added are typed.

Then keep it beside the stylesheet and import the stylesheet from any file of your project, a layout typically: import './name.css'. Every component's props follow. Regenerate it whenever the stylesheet changes.