Skip to main content

Customization

Props, className & the file you own.

View as Markdown

Using props

Try a prop first: the component applies it itself.

Every component page lists its props. Most of what people reach for className to do already exists as one.

Using className

Every component takes className & merges it into its own classes.

It adds what the component does not set, like the width above, and overrides what it does.

Components pass your classes through merge, which drops the class yours replaces, so c:accent wins over the component's c:white.

Using Shape

Shape sets the corners of every component inside it, so one wrapper shapes the whole app.

A component's own shape prop still wins. Without either, a component draws rounded.

Helpers for your own components

style.tsx installs with every component & holds what they share. Your own components can reach for it too.

ExportWhat it is for
useShapeThe shape to draw: the component's prop, else the nearest Shape.
RADIUSThe corner classes for each kind of part, by shape.
FOCUSThe focus outline every component draws.
FitA box that eases its height to its content.
ScrollA scrolling area with the library's scrollbar.
asTriggerYour own element as a popup's trigger, with the focus outline merged in.

Every export documents itself on hover.

Using focus outline

Every component draws a focus outline, and one focus prop styles it.

Set the color, width & offset with fv:oc:*, fv:ow:* & fv:oo:*. It reaches every focusable part, not only the root.

focus={false} removes the outline & its danger, error & success tints.