# Customization

Props, className & the file you own.

## Using props

Try a prop first: the component applies it itself.

```tsx "variant" "intent" "size" "shape"
<Badge variant="subtle" intent="success" size="lg" shape="pill">
	Shipped
</Badge>
```

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.

```tsx "w:100%"
<Button className="w:100%">Save</Button>
```

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

```tsx "c:accent"
<Button className="c:accent">Save</Button>
```

Components pass your classes through [`merge`](https://www.yummacss.com/docs/class-merge), which drops the class yours replaces, so `c:accent` wins over the component's `c:white`.

> **Note**
>
> A prop still beats `className`: it is checked, and it survives an edit to the
> component's own classes.

## Using `Shape`

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

```tsx "Shape"
import { Shape } from "@/components/ui/style";

export default function Layout({ children }) {
	return <Shape value="pill">{children}</Shape>;
}
```

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.

| Export | What it is for |
| - | - |
| `useShape` | The shape to draw: the component's prop, else the nearest `Shape`. |
| `RADIUS` | The corner classes for each kind of part, by shape. |
| `FOCUS` | The focus outline every component draws. |
| `Fit` | A box that eases its height to its content. |
| `Scroll` | A scrolling area with the library's scrollbar. |
| `asTrigger` | Your 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.

```tsx "focus"
<Dialog trigger="Rename" title="Rename file" focus="fv:oc:blue-2/60" />
```

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.

```tsx "focus={false}"
<Button variant="danger" focus={false} className="fv:bg:silver-2">
	Delete
</Button>
```