@mitcsutt/kiln-ui 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/actions/Button/Button.d.ts +8 -0
- package/dist/components/actions/Button/Button.js.map +1 -1
- package/dist/components/actions/ChipGroup/ChipGroup.d.ts +9 -0
- package/dist/components/actions/ChipGroup/ChipGroup.js.map +1 -1
- package/dist/components/actions/IconButton/IconButton.d.ts +8 -0
- package/dist/components/actions/IconButton/IconButton.js.map +1 -1
- package/dist/components/actions/ModeToggle/ModeToggle.d.ts +8 -0
- package/dist/components/actions/ModeToggle/ModeToggle.js.map +1 -1
- package/dist/components/actions/SegmentedControl/SegmentedControl.d.ts +9 -0
- package/dist/components/actions/SegmentedControl/SegmentedControl.js.map +1 -1
- package/dist/components/actions/ToggleChip/ToggleChip.d.ts +9 -0
- package/dist/components/actions/ToggleChip/ToggleChip.js.map +1 -1
- package/dist/components/display/Avatar/Avatar.d.ts +10 -0
- package/dist/components/display/Avatar/Avatar.js.map +1 -1
- package/dist/components/display/AvatarGroup/AvatarGroup.d.ts +7 -0
- package/dist/components/display/AvatarGroup/AvatarGroup.js.map +1 -1
- package/dist/components/display/Badge/Badge.d.ts +7 -0
- package/dist/components/display/Badge/Badge.js.map +1 -1
- package/dist/components/display/Card/Card.js.map +1 -1
- package/dist/components/display/CodeBlock/CodeBlock.d.ts +9 -0
- package/dist/components/display/CodeBlock/CodeBlock.js.map +1 -1
- package/dist/components/display/DataList/DataList.js.map +1 -1
- package/dist/components/display/Delta/Delta.d.ts +9 -0
- package/dist/components/display/Delta/Delta.js.map +1 -1
- package/dist/components/display/EmptyState/EmptyState.d.ts +8 -0
- package/dist/components/display/EmptyState/EmptyState.js.map +1 -1
- package/dist/components/display/List/List.js.map +1 -1
- package/dist/components/display/Marquee/Marquee.d.ts +8 -0
- package/dist/components/display/Marquee/Marquee.js.map +1 -1
- package/dist/components/display/Media/Media.d.ts +7 -0
- package/dist/components/display/Media/Media.js.map +1 -1
- package/dist/components/display/Meter/Meter.d.ts +9 -0
- package/dist/components/display/Meter/Meter.js.map +1 -1
- package/dist/components/display/Progress/Progress.d.ts +8 -0
- package/dist/components/display/Progress/Progress.js.map +1 -1
- package/dist/components/display/Skeleton/Skeleton.js.map +1 -1
- package/dist/components/display/Stamp/Stamp.d.ts +8 -0
- package/dist/components/display/Stamp/Stamp.js.map +1 -1
- package/dist/components/display/Stat/Stat.d.ts +8 -0
- package/dist/components/display/Stat/Stat.js.map +1 -1
- package/dist/components/display/Table/Table.js.map +1 -1
- package/dist/components/display/Tag/Tag.d.ts +7 -0
- package/dist/components/display/Tag/Tag.js.map +1 -1
- package/dist/components/feedback/Alert/Alert.d.ts +10 -0
- package/dist/components/feedback/Alert/Alert.js.map +1 -1
- package/dist/components/feedback/LiveIndicator/LiveIndicator.d.ts +7 -0
- package/dist/components/feedback/LiveIndicator/LiveIndicator.js.map +1 -1
- package/dist/components/feedback/RelativeTime/RelativeTime.d.ts +8 -0
- package/dist/components/feedback/RelativeTime/RelativeTime.js.map +1 -1
- package/dist/components/feedback/Spinner/Spinner.d.ts +10 -1
- package/dist/components/feedback/Spinner/Spinner.js.map +1 -1
- package/dist/components/feedback/StatusDot/StatusDot.d.ts +10 -1
- package/dist/components/feedback/StatusDot/StatusDot.js.map +1 -1
- package/dist/components/inputs/AmountField/AmountField.d.ts +7 -0
- package/dist/components/inputs/AmountField/AmountField.js.map +1 -1
- package/dist/components/inputs/AmountInput/AmountInput.d.ts +8 -0
- package/dist/components/inputs/AmountInput/AmountInput.js.map +1 -1
- package/dist/components/inputs/Checkbox/Checkbox.d.ts +8 -0
- package/dist/components/inputs/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/inputs/CheckboxField/CheckboxField.d.ts +7 -0
- package/dist/components/inputs/CheckboxField/CheckboxField.js.map +1 -1
- package/dist/components/inputs/CheckboxGroup/CheckboxGroup.d.ts +8 -0
- package/dist/components/inputs/CheckboxGroup/CheckboxGroup.js.map +1 -1
- package/dist/components/inputs/CheckboxGroupField/CheckboxGroupField.d.ts +7 -0
- package/dist/components/inputs/CheckboxGroupField/CheckboxGroupField.js.map +1 -1
- package/dist/components/inputs/ChipGroupField/ChipGroupField.d.ts +7 -0
- package/dist/components/inputs/ChipGroupField/ChipGroupField.js.map +1 -1
- package/dist/components/inputs/ChoiceCards/ChoiceCards.d.ts +9 -0
- package/dist/components/inputs/ChoiceCards/ChoiceCards.js.map +1 -1
- package/dist/components/inputs/ChoiceCardsField/ChoiceCardsField.d.ts +7 -0
- package/dist/components/inputs/ChoiceCardsField/ChoiceCardsField.js.map +1 -1
- package/dist/components/inputs/ColorField/ColorField.d.ts +6 -0
- package/dist/components/inputs/ColorField/ColorField.js.map +1 -1
- package/dist/components/inputs/ColorInput/ColorInput.d.ts +8 -0
- package/dist/components/inputs/ColorInput/ColorInput.js.map +1 -1
- package/dist/components/inputs/Combobox/Combobox.d.ts +9 -0
- package/dist/components/inputs/Combobox/Combobox.js.map +1 -1
- package/dist/components/inputs/ComboboxField/ComboboxField.d.ts +7 -0
- package/dist/components/inputs/ComboboxField/ComboboxField.js.map +1 -1
- package/dist/components/inputs/DateRangeField/DateRangeField.d.ts +7 -0
- package/dist/components/inputs/DateRangeField/DateRangeField.js.map +1 -1
- package/dist/components/inputs/Field/Field.d.ts +26 -0
- package/dist/components/inputs/Field/Field.js.map +1 -1
- package/dist/components/inputs/Fieldset/Fieldset.d.ts +8 -0
- package/dist/components/inputs/Fieldset/Fieldset.js.map +1 -1
- package/dist/components/inputs/FileDrop/FileDrop.d.ts +10 -0
- package/dist/components/inputs/FileDrop/FileDrop.js.map +1 -1
- package/dist/components/inputs/FileField/FileField.d.ts +7 -0
- package/dist/components/inputs/FileField/FileField.js.map +1 -1
- package/dist/components/inputs/Input/Input.d.ts +9 -0
- package/dist/components/inputs/Input/Input.js.map +1 -1
- package/dist/components/inputs/NumberField/NumberField.d.ts +7 -0
- package/dist/components/inputs/NumberField/NumberField.js.map +1 -1
- package/dist/components/inputs/NumberInput/NumberInput.d.ts +8 -0
- package/dist/components/inputs/NumberInput/NumberInput.js.map +1 -1
- package/dist/components/inputs/OneTimeCodeField/OneTimeCodeField.d.ts +7 -0
- package/dist/components/inputs/OneTimeCodeField/OneTimeCodeField.js.map +1 -1
- package/dist/components/inputs/OneTimeCodeInput/OneTimeCodeInput.d.ts +8 -0
- package/dist/components/inputs/OneTimeCodeInput/OneTimeCodeInput.js.map +1 -1
- package/dist/components/inputs/PasswordField/PasswordField.d.ts +7 -0
- package/dist/components/inputs/PasswordField/PasswordField.js.map +1 -1
- package/dist/components/inputs/PasswordInput/PasswordInput.d.ts +10 -0
- package/dist/components/inputs/PasswordInput/PasswordInput.js.map +1 -1
- package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +9 -0
- package/dist/components/inputs/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/components/inputs/RadioGroupField/RadioGroupField.d.ts +8 -0
- package/dist/components/inputs/RadioGroupField/RadioGroupField.js.map +1 -1
- package/dist/components/inputs/RangeSlider/RangeSlider.d.ts +8 -0
- package/dist/components/inputs/RangeSlider/RangeSlider.js.map +1 -1
- package/dist/components/inputs/RangeSliderField/RangeSliderField.d.ts +7 -0
- package/dist/components/inputs/RangeSliderField/RangeSliderField.js.map +1 -1
- package/dist/components/inputs/Rating/Rating.d.ts +8 -0
- package/dist/components/inputs/Rating/Rating.js.map +1 -1
- package/dist/components/inputs/RatingField/RatingField.d.ts +7 -0
- package/dist/components/inputs/RatingField/RatingField.js.map +1 -1
- package/dist/components/inputs/SegmentedField/SegmentedField.d.ts +7 -0
- package/dist/components/inputs/SegmentedField/SegmentedField.js.map +1 -1
- package/dist/components/inputs/Select/Select.d.ts +9 -0
- package/dist/components/inputs/Select/Select.js.map +1 -1
- package/dist/components/inputs/SelectField/SelectField.d.ts +7 -0
- package/dist/components/inputs/SelectField/SelectField.js.map +1 -1
- package/dist/components/inputs/Slider/Slider.d.ts +8 -0
- package/dist/components/inputs/Slider/Slider.js.map +1 -1
- package/dist/components/inputs/SliderField/SliderField.d.ts +7 -0
- package/dist/components/inputs/SliderField/SliderField.js.map +1 -1
- package/dist/components/inputs/Switch/Switch.d.ts +8 -0
- package/dist/components/inputs/Switch/Switch.js.map +1 -1
- package/dist/components/inputs/SwitchField/SwitchField.d.ts +8 -0
- package/dist/components/inputs/SwitchField/SwitchField.js.map +1 -1
- package/dist/components/inputs/TagsField/TagsField.d.ts +6 -0
- package/dist/components/inputs/TagsField/TagsField.js.map +1 -1
- package/dist/components/inputs/TagsInput/TagsInput.d.ts +8 -0
- package/dist/components/inputs/TagsInput/TagsInput.js.map +1 -1
- package/dist/components/inputs/TextField/TextField.d.ts +8 -0
- package/dist/components/inputs/TextField/TextField.js.map +1 -1
- package/dist/components/inputs/Textarea/Textarea.d.ts +8 -0
- package/dist/components/inputs/Textarea/Textarea.js.map +1 -1
- package/dist/components/inputs/TextareaField/TextareaField.d.ts +7 -0
- package/dist/components/inputs/TextareaField/TextareaField.js.map +1 -1
- package/dist/components/layout/ActionBar/ActionBar.d.ts +7 -0
- package/dist/components/layout/ActionBar/ActionBar.js.map +1 -1
- package/dist/components/layout/AppShell/AppShell.js.map +1 -1
- package/dist/components/layout/AspectRatio/AspectRatio.d.ts +8 -0
- package/dist/components/layout/AspectRatio/AspectRatio.js.map +1 -1
- package/dist/components/layout/Box/Box.d.ts +8 -0
- package/dist/components/layout/Box/Box.js.map +1 -1
- package/dist/components/layout/Container/Container.d.ts +17 -0
- package/dist/components/layout/Container/Container.js.map +1 -1
- package/dist/components/layout/Divider/Divider.d.ts +7 -0
- package/dist/components/layout/Divider/Divider.js.map +1 -1
- package/dist/components/layout/Grid/Grid.d.ts +9 -0
- package/dist/components/layout/Grid/Grid.js.map +1 -1
- package/dist/components/layout/Inline/Inline.d.ts +8 -0
- package/dist/components/layout/Inline/Inline.js.map +1 -1
- package/dist/components/layout/Section/Section.d.ts +15 -0
- package/dist/components/layout/Section/Section.js.map +1 -1
- package/dist/components/layout/Split/Split.d.ts +9 -0
- package/dist/components/layout/Split/Split.js.map +1 -1
- package/dist/components/layout/Stack/Stack.d.ts +12 -0
- package/dist/components/layout/Stack/Stack.js.map +1 -1
- package/dist/components/layout/VisuallyHidden/VisuallyHidden.d.ts +7 -0
- package/dist/components/layout/VisuallyHidden/VisuallyHidden.js.map +1 -1
- package/dist/components/navigation/Accordion/Accordion.d.ts +7 -0
- package/dist/components/navigation/Accordion/Accordion.js.map +1 -1
- package/dist/components/navigation/BottomNav/BottomNav.d.ts +9 -0
- package/dist/components/navigation/BottomNav/BottomNav.js.map +1 -1
- package/dist/components/navigation/NavLinks/NavLinks.d.ts +9 -0
- package/dist/components/navigation/NavLinks/NavLinks.js.map +1 -1
- package/dist/components/navigation/Stepper/Stepper.d.ts +7 -0
- package/dist/components/navigation/Stepper/Stepper.js.map +1 -1
- package/dist/components/navigation/Tabs/Tabs.d.ts +8 -0
- package/dist/components/navigation/Tabs/Tabs.js.map +1 -1
- package/dist/components/overlays/Dialog/Dialog.d.ts +13 -0
- package/dist/components/overlays/Dialog/Dialog.js.map +1 -1
- package/dist/components/overlays/DropdownMenu/DropdownMenu.d.ts +8 -0
- package/dist/components/overlays/DropdownMenu/DropdownMenu.js.map +1 -1
- package/dist/components/overlays/Popover/Popover.d.ts +7 -0
- package/dist/components/overlays/Popover/Popover.js.map +1 -1
- package/dist/components/overlays/Sheet/Sheet.d.ts +8 -0
- package/dist/components/overlays/Sheet/Sheet.js.map +1 -1
- package/dist/components/overlays/Tooltip/Tooltip.d.ts +8 -0
- package/dist/components/overlays/Tooltip/Tooltip.js.map +1 -1
- package/dist/components/typography/Amount/Amount.d.ts +8 -0
- package/dist/components/typography/Amount/Amount.js.map +1 -1
- package/dist/components/typography/Code/Code.d.ts +8 -0
- package/dist/components/typography/Code/Code.js.map +1 -1
- package/dist/components/typography/Heading/Heading.d.ts +8 -0
- package/dist/components/typography/Heading/Heading.js.map +1 -1
- package/dist/components/typography/Kbd/Kbd.d.ts +6 -0
- package/dist/components/typography/Kbd/Kbd.js.map +1 -1
- package/dist/components/typography/Link/Link.d.ts +9 -0
- package/dist/components/typography/Link/Link.js.map +1 -1
- package/dist/components/typography/Numeral/Numeral.d.ts +8 -0
- package/dist/components/typography/Numeral/Numeral.js.map +1 -1
- package/dist/components/typography/Prose/Prose.d.ts +9 -0
- package/dist/components/typography/Prose/Prose.js.map +1 -1
- package/dist/components/typography/Quote/Quote.d.ts +7 -0
- package/dist/components/typography/Quote/Quote.js.map +1 -1
- package/dist/components/typography/SectionHeader/SectionHeader.d.ts +8 -0
- package/dist/components/typography/SectionHeader/SectionHeader.js.map +1 -1
- package/dist/components/typography/Text/Text.d.ts +8 -0
- package/dist/components/typography/Text/Text.js.map +1 -1
- package/package.json +1 -1
- package/skills/layout-composition/SKILL.md +27 -88
- package/skills/layout-composition/references/action-bar.md +3 -3
- package/skills/layout-composition/references/app-shell.md +10 -3
- package/skills/layout-composition/references/aspect-ratio.md +2 -0
- package/skills/layout-composition/references/box.md +6 -6
- package/skills/layout-composition/references/container.md +14 -12
- package/skills/layout-composition/references/divider.md +4 -4
- package/skills/layout-composition/references/section.md +69 -0
- package/skills/layout-composition/references/visually-hidden.md +3 -3
|
@@ -7,18 +7,18 @@ metadata:
|
|
|
7
7
|
library: "@mitcsutt/kiln-ui"
|
|
8
8
|
sources:
|
|
9
9
|
- mitcsutt/kiln:apps/docs/content/docs/ui/foundations/spacing.mdx
|
|
10
|
-
- mitcsutt/kiln:
|
|
11
|
-
- mitcsutt/kiln:
|
|
12
|
-
- mitcsutt/kiln:
|
|
13
|
-
- mitcsutt/kiln:
|
|
14
|
-
- mitcsutt/kiln:
|
|
15
|
-
- mitcsutt/kiln:
|
|
16
|
-
- mitcsutt/kiln:
|
|
17
|
-
- mitcsutt/kiln:
|
|
18
|
-
- mitcsutt/kiln:
|
|
19
|
-
- mitcsutt/kiln:
|
|
20
|
-
- mitcsutt/kiln:
|
|
21
|
-
- mitcsutt/kiln:
|
|
10
|
+
- mitcsutt/kiln:packages/ui/src/components/layout/Stack/Stack.tsx
|
|
11
|
+
- mitcsutt/kiln:packages/ui/src/components/layout/Inline/Inline.tsx
|
|
12
|
+
- mitcsutt/kiln:packages/ui/src/components/layout/Grid/Grid.tsx
|
|
13
|
+
- mitcsutt/kiln:packages/ui/src/components/layout/Split/Split.tsx
|
|
14
|
+
- mitcsutt/kiln:packages/ui/src/components/layout/Section/Section.tsx
|
|
15
|
+
- mitcsutt/kiln:packages/ui/src/components/layout/Container/Container.tsx
|
|
16
|
+
- mitcsutt/kiln:packages/ui/src/components/layout/Box/Box.tsx
|
|
17
|
+
- mitcsutt/kiln:packages/ui/src/components/layout/AppShell/AppShell.tsx
|
|
18
|
+
- mitcsutt/kiln:packages/ui/src/components/layout/ActionBar/ActionBar.tsx
|
|
19
|
+
- mitcsutt/kiln:packages/ui/src/components/layout/Divider/Divider.tsx
|
|
20
|
+
- mitcsutt/kiln:packages/ui/src/components/layout/AspectRatio/AspectRatio.tsx
|
|
21
|
+
- mitcsutt/kiln:packages/ui/src/components/layout/VisuallyHidden/VisuallyHidden.tsx
|
|
22
22
|
- mitcsutt/kiln:apps/docs/content/docs/ui/patterns/dashboard.mdx
|
|
23
23
|
- mitcsutt/kiln:apps/docs/content/docs/ui/patterns/settings.mdx
|
|
24
24
|
- mitcsutt/kiln:apps/docs/content/docs/ui/patterns/checkout.mdx
|
|
@@ -121,6 +121,8 @@ A column of things with consistent space between them. The layout you'll reach f
|
|
|
121
121
|
|
|
122
122
|
`Stack` lays its children out vertically with a gap from the space scale. Most screens are stacks of stacks, so most spacing in a Kiln app is a `gap` prop rather than a margin.
|
|
123
123
|
|
|
124
|
+
`align` sets the cross-axis alignment (`stretch` by default, so children fill the width). Use `align="start"` when a child like a button should keep its own width.
|
|
125
|
+
|
|
124
126
|
```tsx
|
|
125
127
|
import { Button, Heading, Stack, Text } from '@mitcsutt/kiln-ui'
|
|
126
128
|
|
|
@@ -137,8 +139,6 @@ export function Usage() {
|
|
|
137
139
|
}
|
|
138
140
|
```
|
|
139
141
|
|
|
140
|
-
`align` sets the cross-axis alignment (`stretch` by default, so children fill the width). Use `align="start"` when a child like a button should keep its own width.
|
|
141
|
-
|
|
142
142
|
### Rules between items
|
|
143
143
|
|
|
144
144
|
`dividers` draws a hairline between every child, centred in the gap. It's usually better than a card per item: lists, settings rows and timelines read as one document.
|
|
@@ -180,8 +180,8 @@ export function Dividers() {
|
|
|
180
180
|
| --- | --- | --- | --- |
|
|
181
181
|
| `gap` | `Responsive<Space>` | | Space between children, as a step on the theme's space scale. Responsive. |
|
|
182
182
|
| `align` | `Responsive<Align>` | `stretch` | Cross-axis alignment. Responsive. Default `stretch`. |
|
|
183
|
-
| `dividers` | `boolean` |
|
|
184
|
-
| `as` | `'div' \| 'section' \| 'article' \| 'aside' \| 'header' \| 'footer' \| 'main' \| 'nav' \| 'ul' \| 'ol' \| 'li' \| 'form' \| 'fieldset'` |
|
|
183
|
+
| `dividers` | `boolean` | `false` | Draw a hairline rule between children (the rule sits in the middle of the gap). |
|
|
184
|
+
| `as` | `'div' \| 'section' \| 'article' \| 'aside' \| 'header' \| 'footer' \| 'main' \| 'nav' \| 'ul' \| 'ol' \| 'li' \| 'form' \| 'fieldset'` | `div` | Render as a different element. Lists get `role="list"` semantics preserved. |
|
|
185
185
|
| `hideBelow` | `'sm' \| 'md' \| 'lg' \| 'xl'` | | Hide below this breakpoint (e.g. `md` → hidden on phones, shown from 48em). |
|
|
186
186
|
| `hideAbove` | `'sm' \| 'md' \| 'lg' \| 'xl'` | | Hide from this breakpoint up (e.g. `md` → shown on phones only). |
|
|
187
187
|
|
|
@@ -193,6 +193,8 @@ Things in a row that wrap when they run out of room. Button rows, tag lists, too
|
|
|
193
193
|
|
|
194
194
|
`Inline` lays its children out horizontally with a gap, vertically centred, wrapping onto new lines when they don't fit.
|
|
195
195
|
|
|
196
|
+
`justify` spreads the row (`between` pushes the groups to either end) and takes responsive values, so a header can stack its groups on a phone and spread them from `md` up. `wrap={false}` keeps everything on one line; children then shrink instead. `rowGap` sets the space between wrapped lines when it should differ from `gap`.
|
|
197
|
+
|
|
196
198
|
```tsx
|
|
197
199
|
import { Badge, Button, Inline, Text } from '@mitcsutt/kiln-ui'
|
|
198
200
|
|
|
@@ -214,8 +216,6 @@ export function Usage() {
|
|
|
214
216
|
}
|
|
215
217
|
```
|
|
216
218
|
|
|
217
|
-
`justify` spreads the row (`between` pushes the groups to either end) and takes responsive values, so a header can stack its groups on a phone and spread them from `md` up. `wrap={false}` keeps everything on one line; children then shrink instead. `rowGap` sets the space between wrapped lines when it should differ from `gap`.
|
|
218
|
-
|
|
219
219
|
### API
|
|
220
220
|
|
|
221
221
|
`InlineProps`:
|
|
@@ -227,7 +227,7 @@ export function Usage() {
|
|
|
227
227
|
| `align` | `Responsive<Align>` | `center` | Cross-axis alignment. Default `center`. Responsive. |
|
|
228
228
|
| `justify` | `Responsive<Justify>` | `start` | Main-axis distribution. Default `start`. Responsive. |
|
|
229
229
|
| `wrap` | `boolean` | `true` | Wrap onto new lines. Default `true`. |
|
|
230
|
-
| `as` | `'div' \| 'header' \| 'footer' \| 'nav' \| 'ul' \| 'ol' \| 'li' \| 'span' \| 'p'` |
|
|
230
|
+
| `as` | `'div' \| 'header' \| 'footer' \| 'nav' \| 'ul' \| 'ol' \| 'li' \| 'span' \| 'p'` | `div` | |
|
|
231
231
|
| `hideBelow` | `'sm' \| 'md' \| 'lg' \| 'xl'` | | Hide below this breakpoint (e.g. `md` → hidden on phones, shown from 48em). |
|
|
232
232
|
| `hideAbove` | `'sm' \| 'md' \| 'lg' \| 'xl'` | | Hide from this breakpoint up (e.g. `md` → shown on phones only). |
|
|
233
233
|
|
|
@@ -239,6 +239,8 @@ Two-dimensional layout, either with a column count per breakpoint or as an auto-
|
|
|
239
239
|
|
|
240
240
|
`Grid` has two modes. With `columns`, you choose how many equal columns there are, per breakpoint. With `minItemWidth`, the grid fits as many columns as there's room for, each at least that wide, so it adapts to its container without a single breakpoint.
|
|
241
241
|
|
|
242
|
+
One column on a phone, two from `sm` and four from `lg`.
|
|
243
|
+
|
|
242
244
|
```tsx
|
|
243
245
|
import { Box, Grid, Text } from '@mitcsutt/kiln-ui'
|
|
244
246
|
|
|
@@ -318,7 +320,7 @@ export function Items() {
|
|
|
318
320
|
| `gap` | `Responsive<Space>` | | Space between cells (both axes). Responsive. |
|
|
319
321
|
| `rowGap` | `Responsive<Space>` | | Row gap, if different from `gap`. Responsive. |
|
|
320
322
|
| `align` | `Responsive<Align>` | `stretch` | Cell alignment on the block axis. Default `stretch`. Responsive. |
|
|
321
|
-
| `as` | `'div' \| 'section' \| 'ul' \| 'ol' \| 'dl'` |
|
|
323
|
+
| `as` | `'div' \| 'section' \| 'ul' \| 'ol' \| 'dl'` | `div` | |
|
|
322
324
|
| `hideBelow` | `'sm' \| 'md' \| 'lg' \| 'xl'` | | Hide below this breakpoint (e.g. `md` → hidden on phones, shown from 48em). |
|
|
323
325
|
| `hideAbove` | `'sm' \| 'md' \| 'lg' \| 'xl'` | | Hide from this breakpoint up (e.g. `md` → shown on phones only). |
|
|
324
326
|
|
|
@@ -348,6 +350,8 @@ An asymmetric two-column layout that stacks on small screens. A heading beside i
|
|
|
348
350
|
|
|
349
351
|
`Split` takes exactly two children and puts them side by side in a ratio. Asymmetric splits read as designed; a 50/50 split of a heading and a list rarely does. Below `collapseBelow` (`md` by default) the two stack, first child on top.
|
|
350
352
|
|
|
353
|
+
A heading and a list of changes in a 5/7 split, stacked on a phone.
|
|
354
|
+
|
|
351
355
|
```tsx
|
|
352
356
|
import { Heading, Split, Stack, Text } from '@mitcsutt/kiln-ui'
|
|
353
357
|
|
|
@@ -410,82 +414,17 @@ export function Ratios() {
|
|
|
410
414
|
| `collapseBelow` | `'sm' \| 'md' \| 'lg'` | `md` | Stack the two children vertically below this breakpoint. Default `md`. |
|
|
411
415
|
| `gap` | `Responsive<Space>` | | Space between the two sides (and between them when stacked). Responsive. |
|
|
412
416
|
| `align` | `Responsive<Align>` | `start` | Block-axis alignment of the two sides. Default `start`. Responsive. |
|
|
413
|
-
| `reverse` | `boolean` |
|
|
417
|
+
| `reverse` | `boolean` | `false` | Put the second child first *visually* when split. DOM (and stacked) order is unchanged. |
|
|
414
418
|
| `children` (required) | `[ReactNode, ReactNode]` | | Exactly two children: the first and second side. |
|
|
415
|
-
| `as` | `'div' \| 'section' \| 'article' \| 'header' \| 'footer'` |
|
|
419
|
+
| `as` | `'div' \| 'section' \| 'article' \| 'header' \| 'footer'` | `div` | |
|
|
416
420
|
|
|
417
421
|
Also accepts every prop of `HTMLAttributes<HTMLElement>`.
|
|
418
422
|
|
|
419
|
-
## Section
|
|
420
|
-
|
|
421
|
-
A full-bleed band of vertical space, with an optional surface and rules. Put a Container inside it for width.
|
|
422
|
-
|
|
423
|
-
`Section` is how a page gets its rhythm: each band pads itself top and bottom with a step from the space scale, and can paint a surface across the full width. Width is the `Container`'s job, so a section is almost always `Section` then `Container`.
|
|
424
|
-
|
|
425
|
-
```tsx
|
|
426
|
-
import { Button, Container, Heading, Section, Stack, Text } from '@mitcsutt/kiln-ui'
|
|
427
|
-
|
|
428
|
-
export function Usage() {
|
|
429
|
-
return (
|
|
430
|
-
<>
|
|
431
|
-
<Section space={7}>
|
|
432
|
-
<Container width="text">
|
|
433
|
-
<Stack gap={3}>
|
|
434
|
-
<Heading level={3} size="2xl">
|
|
435
|
-
Ride the coast for less
|
|
436
|
-
</Heading>
|
|
437
|
-
<Text tone="muted">An annual pass covers every ferry and bus in the bay.</Text>
|
|
438
|
-
</Stack>
|
|
439
|
-
</Container>
|
|
440
|
-
</Section>
|
|
441
|
-
<Section space={6} surface="inverse" divider="top">
|
|
442
|
-
<Container width="text">
|
|
443
|
-
<Stack gap={4} align="start">
|
|
444
|
-
<Text>Commuting every day? The pass pays for itself in five weeks.</Text>
|
|
445
|
-
<Button>Buy an annual pass</Button>
|
|
446
|
-
</Stack>
|
|
447
|
-
</Container>
|
|
448
|
-
</Section>
|
|
449
|
-
</>
|
|
450
|
-
)
|
|
451
|
-
}
|
|
452
|
-
```
|
|
453
|
-
|
|
454
|
-
Vary `space` between neighbours. The scale is non-linear for this reason: a page of `space={8}` everywhere has no rhythm at all.
|
|
455
|
-
|
|
456
|
-
### Surfaces and bands
|
|
457
|
-
|
|
458
|
-
`surface` is `canvas`, `surface`, `sunken`, `inverse` or `accent`. On `inverse` and `accent`, the colour roles flip for everything inside, so text, links, focus rings and buttons stay legible with no extra props. `divider` adds a rule at the `top`, `bottom` or `both`.
|
|
459
|
-
|
|
460
|
-
### API
|
|
461
|
-
|
|
462
|
-
`SectionProps`:
|
|
463
|
-
|
|
464
|
-
| Prop | Type | Default | Description |
|
|
465
|
-
| --- | --- | --- | --- |
|
|
466
|
-
| `space` | `Responsive<Space>` | `8` | Block padding (top and bottom), as a step on the space scale. Responsive. Vary it: adjacent sections should not share the same step. Default `8`. |
|
|
467
|
-
| `surface` | `'accent' \| 'surface' \| 'canvas' \| 'sunken' \| 'inverse'` | | Full-bleed band colour. Omit to stay transparent on the canvas. `inverse` and `accent` re-point the ink, line and focus colours so children stay legible. |
|
|
468
|
-
| `divider` | `'top' \| 'bottom' \| 'both'` | | A hairline across the full bleed at the top, bottom or both edges. |
|
|
469
|
-
| `as` | `'div' \| 'section' \| 'article' \| 'aside' \| 'header' \| 'footer'` | | |
|
|
470
|
-
| `hideBelow` | `'sm' \| 'md' \| 'lg' \| 'xl'` | | Hide below this breakpoint (e.g. `md` → hidden on phones, shown from 48em). |
|
|
471
|
-
| `hideAbove` | `'sm' \| 'md' \| 'lg' \| 'xl'` | | Hide from this breakpoint up (e.g. `md` → shown on phones only). |
|
|
472
|
-
|
|
473
|
-
Also accepts every prop of `HTMLAttributes<HTMLElement>`.
|
|
474
|
-
|
|
475
|
-
#### Component tokens
|
|
476
|
-
|
|
477
|
-
Set these in a theme, or on one element, to change this component without touching the rest.
|
|
478
|
-
|
|
479
|
-
| Token | Default and use |
|
|
480
|
-
| --- | --- |
|
|
481
|
-
| `--section-fill` | / --section-on (read-only) the band's fill and ink on inverse/accent |
|
|
482
|
-
| `--section-space-default` | block padding when `space` is unset (default var(--space-8)) |
|
|
483
|
-
| `--section-divider-color` | hairline colour for `divider` (default var(--color-line)) |
|
|
484
|
-
|
|
485
423
|
## References
|
|
486
424
|
|
|
487
425
|
Read a reference when its description matches the task:
|
|
488
426
|
|
|
427
|
+
- [Section](references/section.md): A full-bleed band of vertical space, with an optional surface and rules. Put a Container inside it for width.
|
|
489
428
|
- [Container](references/container.md): Centres content at a readable maximum width, with a fluid gutter outside it.
|
|
490
429
|
- [Box](references/box.md): Padding, a surface and an edge, and nothing else. The escape hatch when no other layout fits.
|
|
491
430
|
- [AppShell](references/app-shell.md): The frame of an app screen. A header, an optional sidebar, the main region, a footer and a phone-only bottom bar.
|
|
@@ -8,6 +8,8 @@ Source: https://kiln.mitchellsutton.com/docs/ui/layout/action-bar
|
|
|
8
8
|
|
|
9
9
|
`ActionBar` is a row of buttons with consistent spacing and alignment: `end` by default, `between` to push a destructive action to the other side, `start` to follow a form's left edge.
|
|
10
10
|
|
|
11
|
+
`sticky` keeps the bar at the bottom of the viewport while a long form scrolls, so save is always in reach.
|
|
12
|
+
|
|
11
13
|
```tsx
|
|
12
14
|
import { ActionBar, Button, Stack, TextField } from '@mitcsutt/kiln-ui'
|
|
13
15
|
|
|
@@ -32,8 +34,6 @@ export function Usage() {
|
|
|
32
34
|
}
|
|
33
35
|
```
|
|
34
36
|
|
|
35
|
-
`sticky` keeps the bar at the bottom of the viewport while a long form scrolls, so save is always in reach.
|
|
36
|
-
|
|
37
37
|
## API
|
|
38
38
|
|
|
39
39
|
`ActionBarProps`:
|
|
@@ -41,7 +41,7 @@ export function Usage() {
|
|
|
41
41
|
| Prop | Type | Default | Description |
|
|
42
42
|
| --- | --- | --- | --- |
|
|
43
43
|
| `align` | `'start' \| 'end' \| 'between'` | `end` | Where the actions sit on the row. Default `end`. |
|
|
44
|
-
| `sticky` | `boolean` |
|
|
44
|
+
| `sticky` | `boolean` | `false` | Pins the bar to the bottom of its scroll container — a canvas surface above a top hairline, at `--z-sticky`. Use inside a scrolling form/dialog body so the primary action stays reachable. |
|
|
45
45
|
| `gap` | `Responsive<Space>` | `3` | Space between actions. Responsive. Default `3`. |
|
|
46
46
|
| `as` | `'div' \| 'footer'` | `div` | Render as `footer` when the bar is the form's own closing landmark. Default `div`. |
|
|
47
47
|
| `hideBelow` | `'sm' \| 'md' \| 'lg' \| 'xl'` | | Hide below this breakpoint (e.g. `md` → hidden on phones, shown from 48em). |
|
|
@@ -8,6 +8,8 @@ Source: https://kiln.mitchellsutton.com/docs/ui/layout/app-shell
|
|
|
8
8
|
|
|
9
9
|
`AppShell` is the outermost frame of an app: landmarks in the right order, a skip link, a sticky header, and a hand-over between a phone's bottom bar and a desktop's sidebar or header nav. These docs are an `AppShell`.
|
|
10
10
|
|
|
11
|
+
The window above scrolls; narrow it below `md` and the header links give way to the bottom bar.
|
|
12
|
+
|
|
11
13
|
```tsx
|
|
12
14
|
import {
|
|
13
15
|
AppShell,
|
|
@@ -86,8 +88,6 @@ export function Usage() {
|
|
|
86
88
|
}
|
|
87
89
|
```
|
|
88
90
|
|
|
89
|
-
The window above scrolls; narrow it below `md` and the header links give way to the bottom bar.
|
|
90
|
-
|
|
91
91
|
## Slots
|
|
92
92
|
|
|
93
93
|
`AppShell.Header`, `AppShell.Sidebar`, `AppShell.Main`, `AppShell.Footer` and `AppShell.BottomBar` place themselves, so their order in JSX doesn't affect the layout. Keep it the same as the reading order anyway: header, sidebar, main, footer, bottom bar.
|
|
@@ -108,7 +108,7 @@ The window above scrolls; narrow it below `md` and the header links give way to
|
|
|
108
108
|
| Prop | Type | Default | Description |
|
|
109
109
|
| --- | --- | --- | --- |
|
|
110
110
|
| `skipLinkLabel` | `string` | `"Skip to content"` | Text of the skip link rendered before everything else. Default "Skip to content". |
|
|
111
|
-
| `navBreakpoint` | `'md' \| 'lg'` |
|
|
111
|
+
| `navBreakpoint` | `'md' \| 'lg'` | `lg` | Where navigation hands over from phone to desktop: from this breakpoint up the `Sidebar` appears and the `BottomBar` is removed, so there is never a width with neither. `md` (48em) or `lg` (64em, default). Pair it with the same value on `BottomNav hideAbove` and header `NavLinks hideBelow`. |
|
|
112
112
|
| `mainId` | `string` | | Id given to `AppShell.Main` (the skip link target). Generated when omitted. |
|
|
113
113
|
|
|
114
114
|
Also accepts every prop of `HTMLAttributes<HTMLDivElement>`.
|
|
@@ -121,6 +121,9 @@ Also accepts every prop of `HTMLAttributes<HTMLDivElement>`.
|
|
|
121
121
|
|
|
122
122
|
Also accepts every prop of `HTMLAttributes<HTMLElement>`.
|
|
123
123
|
|
|
124
|
+
|
|
125
|
+
Accepts every prop of `HTMLAttributes<HTMLElement>`.
|
|
126
|
+
|
|
124
127
|
`AppShellSidebarProps`:
|
|
125
128
|
|
|
126
129
|
| Prop | Type | Default | Description |
|
|
@@ -129,6 +132,10 @@ Also accepts every prop of `HTMLAttributes<HTMLElement>`.
|
|
|
129
132
|
|
|
130
133
|
Also accepts every prop of `HTMLAttributes<HTMLElement>`.
|
|
131
134
|
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
132
139
|
### Component tokens
|
|
133
140
|
|
|
134
141
|
Set these in a theme, or on one element, to change this component without touching the rest.
|
|
@@ -8,6 +8,8 @@ Source: https://kiln.mitchellsutton.com/docs/ui/layout/aspect-ratio
|
|
|
8
8
|
|
|
9
9
|
`AspectRatio` holds a ratio as its width changes. Its child (an image, a video, an iframe, an SVG) fills it and is cropped with `object-fit: cover`. It has no edge or radius of its own: wrap it in `Media` or a `Card` for those.
|
|
10
10
|
|
|
11
|
+
The same chart framed at 16/9, 4/3 and 1/1.
|
|
12
|
+
|
|
11
13
|
```tsx
|
|
12
14
|
import { AspectRatio, Grid } from '@mitcsutt/kiln-ui'
|
|
13
15
|
|
|
@@ -8,6 +8,8 @@ Source: https://kiln.mitchellsutton.com/docs/ui/layout/box
|
|
|
8
8
|
|
|
9
9
|
`Box` adds padding, a background surface, a border and a radius to its content. Reach for `Stack`, `Inline` or `Grid` to arrange things, and for `Card` when something is a self-contained object. `Box` is for the wells and frames left over.
|
|
10
10
|
|
|
11
|
+
`surface="inverse"` flips the colour roles inside, like an inverse `Section`.
|
|
12
|
+
|
|
11
13
|
```tsx
|
|
12
14
|
import { Box, Stack, Text } from '@mitcsutt/kiln-ui'
|
|
13
15
|
|
|
@@ -28,8 +30,6 @@ export function Usage() {
|
|
|
28
30
|
}
|
|
29
31
|
```
|
|
30
32
|
|
|
31
|
-
`surface="inverse"` flips the colour roles inside, like an inverse `Section`.
|
|
32
|
-
|
|
33
33
|
## API
|
|
34
34
|
|
|
35
35
|
`BoxProps`:
|
|
@@ -39,10 +39,10 @@ export function Usage() {
|
|
|
39
39
|
| `padding` | `Responsive<Space>` | | Padding on every side. Responsive. |
|
|
40
40
|
| `paddingX` | `Responsive<Space>` | | Inline (left/right) padding; overrides `padding` on that axis. Responsive. |
|
|
41
41
|
| `paddingY` | `Responsive<Space>` | | Block (top/bottom) padding; overrides `padding` on that axis. Responsive. |
|
|
42
|
-
| `surface` | `'none' \| 'surface' \| 'canvas' \| 'sunken' \| 'raised' \| 'inverse'` |
|
|
43
|
-
| `border` | `boolean` |
|
|
44
|
-
| `radius` | `'none' \| 'surface' \| 'field' \| 'media'` |
|
|
45
|
-
| `as` | `'div' \| 'section' \| 'article' \| 'aside' \| 'header' \| 'footer' \| 'li' \| 'span'` |
|
|
42
|
+
| `surface` | `'none' \| 'surface' \| 'canvas' \| 'sunken' \| 'raised' \| 'inverse'` | `none` | Background fill. `inverse` also re-points ink and line colours for its children. |
|
|
43
|
+
| `border` | `boolean` | `false` | Hairline border in `--color-line`. One edge treatment per element — a border *or* a fill. |
|
|
44
|
+
| `radius` | `'none' \| 'surface' \| 'field' \| 'media'` | `none` | Corner radius, by role. |
|
|
45
|
+
| `as` | `'div' \| 'section' \| 'article' \| 'aside' \| 'header' \| 'footer' \| 'li' \| 'span'` | `div` | |
|
|
46
46
|
| `hideBelow` | `'sm' \| 'md' \| 'lg' \| 'xl'` | | Hide below this breakpoint (e.g. `md` → hidden on phones, shown from 48em). |
|
|
47
47
|
| `hideAbove` | `'sm' \| 'md' \| 'lg' \| 'xl'` | | Hide from this breakpoint up (e.g. `md` → shown on phones only). |
|
|
48
48
|
|
|
@@ -8,6 +8,18 @@ Source: https://kiln.mitchellsutton.com/docs/ui/layout/container
|
|
|
8
8
|
|
|
9
9
|
`Container` sets a maximum width and centres its content. The gutter sits _outside_ the width, so `width="text"` is a true reading measure at any screen size.
|
|
10
10
|
|
|
11
|
+
| `width` | Max width | For |
|
|
12
|
+
| --------- | --------- | ----------------------------------- |
|
|
13
|
+
| `narrow` | 32rem | sign-in, short forms, confirmations |
|
|
14
|
+
| `text` | 42rem | articles and long reading |
|
|
15
|
+
| `content` | 68rem | most pages (the default) |
|
|
16
|
+
| `wide` | 84rem | dashboards and wide tables |
|
|
17
|
+
| `full` | 100% | edge to edge, inside the gutter |
|
|
18
|
+
|
|
19
|
+
Pass `gutter={false}` when the parent already pads its content.
|
|
20
|
+
|
|
21
|
+
The `narrow`, `text` and `content` widths, one above the other.
|
|
22
|
+
|
|
11
23
|
```tsx
|
|
12
24
|
import { Container, Stack, Text } from '@mitcsutt/kiln-ui'
|
|
13
25
|
|
|
@@ -26,25 +38,15 @@ export function Usage() {
|
|
|
26
38
|
}
|
|
27
39
|
```
|
|
28
40
|
|
|
29
|
-
| `width` | Max width | For |
|
|
30
|
-
| --------- | --------- | ----------------------------------- |
|
|
31
|
-
| `narrow` | 32rem | sign-in, short forms, confirmations |
|
|
32
|
-
| `text` | 42rem | articles and long reading |
|
|
33
|
-
| `content` | 68rem | most pages (the default) |
|
|
34
|
-
| `wide` | 84rem | dashboards and wide tables |
|
|
35
|
-
| `full` | 100% | edge to edge, inside the gutter |
|
|
36
|
-
|
|
37
|
-
Pass `gutter={false}` when the parent already pads its content.
|
|
38
|
-
|
|
39
41
|
## API
|
|
40
42
|
|
|
41
43
|
`ContainerProps`:
|
|
42
44
|
|
|
43
45
|
| Prop | Type | Default | Description |
|
|
44
46
|
| --- | --- | --- | --- |
|
|
45
|
-
| `width` | `'content' \| 'narrow' \| 'text' \| 'wide' \| 'full'` |
|
|
47
|
+
| `width` | `'content' \| 'narrow' \| 'text' \| 'wide' \| 'full'` | `content` | Maximum content width: `narrow` 32rem · `text` 42rem (prose measure) · `content` 68rem (default) · `wide` 84rem · `full` (no maximum). |
|
|
46
48
|
| `gutter` | `boolean` | `true` | Keep the fluid page gutter on either side. Default `true`. |
|
|
47
|
-
| `as` | `'div' \| 'section' \| 'article' \| 'header' \| 'footer' \| 'main' \| 'nav'` |
|
|
49
|
+
| `as` | `'div' \| 'section' \| 'article' \| 'header' \| 'footer' \| 'main' \| 'nav'` | `div` | |
|
|
48
50
|
| `hideBelow` | `'sm' \| 'md' \| 'lg' \| 'xl'` | | Hide below this breakpoint (e.g. `md` → hidden on phones, shown from 48em). |
|
|
49
51
|
| `hideAbove` | `'sm' \| 'md' \| 'lg' \| 'xl'` | | Hide from this breakpoint up (e.g. `md` → shown on phones only). |
|
|
50
52
|
|
|
@@ -8,6 +8,8 @@ Source: https://kiln.mitchellsutton.com/docs/ui/layout/divider
|
|
|
8
8
|
|
|
9
9
|
`Divider` separates groups. For a rule between every item of a list, use `Stack dividers` instead, which spaces the rules for you.
|
|
10
10
|
|
|
11
|
+
A labelled divider names the group that follows. `spacing` adds space above and below from the space scale, `strong` uses the stronger line colour, and `decorative` hides the rule from assistive technology when it carries no meaning (it's a `separator` otherwise).
|
|
12
|
+
|
|
11
13
|
```tsx
|
|
12
14
|
import { Divider, Inline, Stack, Text } from '@mitcsutt/kiln-ui'
|
|
13
15
|
|
|
@@ -30,8 +32,6 @@ export function Usage() {
|
|
|
30
32
|
}
|
|
31
33
|
```
|
|
32
34
|
|
|
33
|
-
A labelled divider names the group that follows. `spacing` adds space above and below from the space scale, `strong` uses the stronger line colour, and `decorative` hides the rule from assistive technology when it carries no meaning (it's a `separator` otherwise).
|
|
34
|
-
|
|
35
35
|
## API
|
|
36
36
|
|
|
37
37
|
`DividerProps`:
|
|
@@ -39,11 +39,11 @@ A labelled divider names the group that follows. `spacing` adds space above and
|
|
|
39
39
|
| Prop | Type | Default | Description |
|
|
40
40
|
| --- | --- | --- | --- |
|
|
41
41
|
| `orientation` | `'horizontal' \| 'vertical'` | `horizontal` | Default `horizontal`. A vertical rule stretches to its flex/grid row. |
|
|
42
|
-
| `strong` | `boolean` |
|
|
42
|
+
| `strong` | `boolean` | `false` | Heavier rule in `--color-line-strong` at `--border-width-strong`. |
|
|
43
43
|
| `label` | `ReactNode` | | Text set into a horizontal rule, e.g. "Earlier this week". It also names the separator. |
|
|
44
44
|
| `labelPosition` | `'start' \| 'center'` | `start` | Where the label sits. Default `start` (left-aligned by default); `center` for a lone break. |
|
|
45
45
|
| `spacing` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 11 \| 12` | | Margin on both sides of the rule (block axis if horizontal, inline if vertical). |
|
|
46
|
-
| `decorative` | `boolean` |
|
|
46
|
+
| `decorative` | `boolean` | `false` | Purely visual: hide it from assistive tech. Use when the rule only repeats a boundary that headings or landmarks already convey. |
|
|
47
47
|
| `hideBelow` | `'sm' \| 'md' \| 'lg' \| 'xl'` | | Hide below this breakpoint (e.g. `md` → hidden on phones, shown from 48em). |
|
|
48
48
|
| `hideAbove` | `'sm' \| 'md' \| 'lg' \| 'xl'` | | Hide from this breakpoint up (e.g. `md` → shown on phones only). |
|
|
49
49
|
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<!-- Generated from the Kiln docs by apps/docs/src/skills. Edit the docs pages, then run `pnpm generate:skills`. -->
|
|
2
|
+
|
|
3
|
+
# Section
|
|
4
|
+
|
|
5
|
+
> A full-bleed band of vertical space, with an optional surface and rules. Put a Container inside it for width.
|
|
6
|
+
|
|
7
|
+
Source: https://kiln.mitchellsutton.com/docs/ui/layout/section
|
|
8
|
+
|
|
9
|
+
`Section` is how a page gets its rhythm: each band pads itself top and bottom with a step from the space scale, and can paint a surface across the full width. Width is the `Container`'s job, so a section is almost always `Section` then `Container`.
|
|
10
|
+
|
|
11
|
+
Vary `space` between neighbours. The scale is non-linear for this reason: a page of `space={8}` everywhere has no rhythm at all.
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { Button, Container, Heading, Section, Stack, Text } from '@mitcsutt/kiln-ui'
|
|
15
|
+
|
|
16
|
+
export function Usage() {
|
|
17
|
+
return (
|
|
18
|
+
<>
|
|
19
|
+
<Section space={7}>
|
|
20
|
+
<Container width="text">
|
|
21
|
+
<Stack gap={3}>
|
|
22
|
+
<Heading level={3} size="2xl">
|
|
23
|
+
Ride the coast for less
|
|
24
|
+
</Heading>
|
|
25
|
+
<Text tone="muted">An annual pass covers every ferry and bus in the bay.</Text>
|
|
26
|
+
</Stack>
|
|
27
|
+
</Container>
|
|
28
|
+
</Section>
|
|
29
|
+
<Section space={6} surface="inverse" divider="top">
|
|
30
|
+
<Container width="text">
|
|
31
|
+
<Stack gap={4} align="start">
|
|
32
|
+
<Text>Commuting every day? The pass pays for itself in five weeks.</Text>
|
|
33
|
+
<Button>Buy an annual pass</Button>
|
|
34
|
+
</Stack>
|
|
35
|
+
</Container>
|
|
36
|
+
</Section>
|
|
37
|
+
</>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Surfaces and bands
|
|
43
|
+
|
|
44
|
+
`surface` is `canvas`, `surface`, `sunken`, `inverse` or `accent`. On `inverse` and `accent`, the colour roles flip for everything inside, so text, links, focus rings and buttons stay legible with no extra props. `divider` adds a rule at the `top`, `bottom` or `both`.
|
|
45
|
+
|
|
46
|
+
## API
|
|
47
|
+
|
|
48
|
+
`SectionProps`:
|
|
49
|
+
|
|
50
|
+
| Prop | Type | Default | Description |
|
|
51
|
+
| --- | --- | --- | --- |
|
|
52
|
+
| `space` | `Responsive<Space>` | `8` | Block padding (top and bottom), as a step on the space scale. Responsive. Vary it: adjacent sections should not share the same step. Default `8`. |
|
|
53
|
+
| `surface` | `'accent' \| 'surface' \| 'canvas' \| 'sunken' \| 'inverse'` | | Full-bleed band colour. Omit to stay transparent on the canvas. `inverse` and `accent` re-point the ink, line and focus colours so children stay legible. |
|
|
54
|
+
| `divider` | `'top' \| 'bottom' \| 'both'` | | A hairline across the full bleed at the top, bottom or both edges. |
|
|
55
|
+
| `as` | `'div' \| 'section' \| 'article' \| 'aside' \| 'header' \| 'footer'` | `section` | |
|
|
56
|
+
| `hideBelow` | `'sm' \| 'md' \| 'lg' \| 'xl'` | | Hide below this breakpoint (e.g. `md` → hidden on phones, shown from 48em). |
|
|
57
|
+
| `hideAbove` | `'sm' \| 'md' \| 'lg' \| 'xl'` | | Hide from this breakpoint up (e.g. `md` → shown on phones only). |
|
|
58
|
+
|
|
59
|
+
Also accepts every prop of `HTMLAttributes<HTMLElement>`.
|
|
60
|
+
|
|
61
|
+
### Component tokens
|
|
62
|
+
|
|
63
|
+
Set these in a theme, or on one element, to change this component without touching the rest.
|
|
64
|
+
|
|
65
|
+
| Token | Default and use |
|
|
66
|
+
| --- | --- |
|
|
67
|
+
| `--section-fill` | / --section-on (read-only) the band's fill and ink on inverse/accent |
|
|
68
|
+
| `--section-space-default` | block padding when `space` is unset (default var(--space-8)) |
|
|
69
|
+
| `--section-divider-color` | hairline colour for `divider` (default var(--color-line)) |
|
|
@@ -8,6 +8,8 @@ Source: https://kiln.mitchellsutton.com/docs/ui/layout/visually-hidden
|
|
|
8
8
|
|
|
9
9
|
`VisuallyHidden` keeps text in the accessibility tree while hiding it from view: the rest of a sentence a glyph implies, a heading the layout already makes obvious, a table caption.
|
|
10
10
|
|
|
11
|
+
Screen readers announce the rating above as "4.2 out of 5, from 318 passenger reviews". `as` renders it as another element, such as a heading (`as="h2"`). `focusable` makes a hidden link appear when it receives focus, which is how a skip link works.
|
|
12
|
+
|
|
11
13
|
```tsx
|
|
12
14
|
import { Inline, Text, VisuallyHidden } from '@mitcsutt/kiln-ui'
|
|
13
15
|
|
|
@@ -26,15 +28,13 @@ export function Usage() {
|
|
|
26
28
|
}
|
|
27
29
|
```
|
|
28
30
|
|
|
29
|
-
Screen readers announce the rating above as "4.2 out of 5, from 318 passenger reviews". `as` renders it as another element, such as a heading (`as="h2"`). `focusable` makes a hidden link appear when it receives focus, which is how a skip link works.
|
|
30
|
-
|
|
31
31
|
## API
|
|
32
32
|
|
|
33
33
|
`VisuallyHiddenProps`:
|
|
34
34
|
|
|
35
35
|
| Prop | Type | Default | Description |
|
|
36
36
|
| --- | --- | --- | --- |
|
|
37
|
-
| `focusable` | `boolean` |
|
|
37
|
+
| `focusable` | `boolean` | `false` | Reveal the content while it (or something inside it) has keyboard focus — for skip links and other keyboard-only affordances. |
|
|
38
38
|
| `as` | `'div' \| 'span' \| 'label' \| 'a' \| 'h1' \| 'h2' \| 'h3'` | `span` | Default `span`. |
|
|
39
39
|
| `href` | `string` | | Only for `as="a"`. |
|
|
40
40
|
|