@mitcsutt/kiln-ui 0.2.0 → 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/List/List.module.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/Table/Table.module.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/dist/styles.css +1 -1
- package/package.json +1 -1
- package/skills/custom-theme/SKILL.md +1 -1
- package/skills/layout-composition/SKILL.md +37 -98
- package/skills/layout-composition/references/action-bar.md +4 -4
- package/skills/layout-composition/references/app-shell.md +11 -4
- package/skills/layout-composition/references/aspect-ratio.md +3 -1
- package/skills/layout-composition/references/box.md +7 -7
- package/skills/layout-composition/references/checkout.md +1 -1
- package/skills/layout-composition/references/container.md +15 -13
- package/skills/layout-composition/references/dashboard.md +1 -1
- package/skills/layout-composition/references/divider.md +5 -5
- package/skills/layout-composition/references/section.md +69 -0
- package/skills/layout-composition/references/settings.md +1 -1
- package/skills/layout-composition/references/visually-hidden.md +4 -4
- package/skills/setup-and-theming/SKILL.md +1 -1
package/package.json
CHANGED
|
@@ -24,7 +24,7 @@ A Kiln theme is one CSS file. It sets the tokens in the [contract](references/to
|
|
|
24
24
|
```tsx
|
|
25
25
|
import { Box, Button, Heading, Inline, Stack, Text, ThemeScope } from '@mitcsutt/kiln-ui'
|
|
26
26
|
|
|
27
|
-
export
|
|
27
|
+
export function Usage() {
|
|
28
28
|
return (
|
|
29
29
|
<ThemeScope theme="harbour">
|
|
30
30
|
<Box padding={6}>
|
|
@@ -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
|
|
@@ -50,7 +50,7 @@ Vary the rhythm. Adjacent sections shouldn't share a `space` step, and a page us
|
|
|
50
50
|
```tsx
|
|
51
51
|
import { Button, Inline, Stack, Text, TextField } from '@mitcsutt/kiln-ui'
|
|
52
52
|
|
|
53
|
-
export
|
|
53
|
+
export function Density() {
|
|
54
54
|
return (
|
|
55
55
|
<Inline gap={7} align="start">
|
|
56
56
|
{(['compact', undefined, 'comfortable'] as const).map((density) => (
|
|
@@ -96,7 +96,7 @@ import { Box, Grid, Text } from '@mitcsutt/kiln-ui'
|
|
|
96
96
|
|
|
97
97
|
const STOPS = ['Harbour', 'Northpoint', 'Kelso Bay', 'Ferry Lane', 'Old Quay', 'Marram Point']
|
|
98
98
|
|
|
99
|
-
export
|
|
99
|
+
export function ResponsiveProps() {
|
|
100
100
|
return (
|
|
101
101
|
<Grid columns={{ base: 1, sm: 2, lg: 3 }} gap={{ base: 3, md: 5 }}>
|
|
102
102
|
{STOPS.map((stop) => (
|
|
@@ -121,10 +121,12 @@ 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
|
|
|
127
|
-
export
|
|
129
|
+
export function Usage() {
|
|
128
130
|
return (
|
|
129
131
|
<Stack gap={4} align="start">
|
|
130
132
|
<Heading level={3} size="xl">
|
|
@@ -137,8 +139,6 @@ export default 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.
|
|
@@ -152,7 +152,7 @@ const STOPS = [
|
|
|
152
152
|
{ name: 'Kelso Bay Pier', time: '23:31' },
|
|
153
153
|
]
|
|
154
154
|
|
|
155
|
-
export
|
|
155
|
+
export function Dividers() {
|
|
156
156
|
return (
|
|
157
157
|
<Stack gap={{ base: 3, md: 4 }} dividers>
|
|
158
158
|
{STOPS.map((stop) => (
|
|
@@ -180,8 +180,8 @@ export default 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,10 +193,12 @@ 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
|
|
|
199
|
-
export
|
|
201
|
+
export function Usage() {
|
|
200
202
|
return (
|
|
201
203
|
<Inline gap={3} justify={{ base: 'start', md: 'between' }}>
|
|
202
204
|
<Inline gap={2}>
|
|
@@ -214,8 +216,6 @@ export default 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 default 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,12 +239,14 @@ 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
|
|
|
245
247
|
const LINES = ['Red', 'Harbour', 'Coastal', 'Night', 'Airport', 'Orbital', 'Market', 'University']
|
|
246
248
|
|
|
247
|
-
export
|
|
249
|
+
export function Columns() {
|
|
248
250
|
return (
|
|
249
251
|
<Grid columns={{ base: 1, sm: 2, lg: 4 }} gap={4}>
|
|
250
252
|
{LINES.map((line) => (
|
|
@@ -266,7 +268,7 @@ import { Box, Grid, Text } from '@mitcsutt/kiln-ui'
|
|
|
266
268
|
|
|
267
269
|
const PIERS = ['North pier', 'South pier', 'Ferry terminal', 'Lifeboat station', 'Fish market']
|
|
268
270
|
|
|
269
|
-
export
|
|
271
|
+
export function AutoFill() {
|
|
270
272
|
return (
|
|
271
273
|
<Grid minItemWidth="xs" gap={4}>
|
|
272
274
|
{PIERS.map((pier) => (
|
|
@@ -286,7 +288,7 @@ export default function AutoFill() {
|
|
|
286
288
|
```tsx
|
|
287
289
|
import { Box, Grid, Text } from '@mitcsutt/kiln-ui'
|
|
288
290
|
|
|
289
|
-
export
|
|
291
|
+
export function Items() {
|
|
290
292
|
return (
|
|
291
293
|
<Grid columns={{ base: 1, md: 3 }} gap={4}>
|
|
292
294
|
<Grid.Item span={{ base: 1, md: 2 }}>
|
|
@@ -318,7 +320,7 @@ export default 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
|
|
|
@@ -357,7 +361,7 @@ const CHANGES = [
|
|
|
357
361
|
'Kelso Bay Pier reopens on 3 November.',
|
|
358
362
|
]
|
|
359
363
|
|
|
360
|
-
export
|
|
364
|
+
export function Usage() {
|
|
361
365
|
return (
|
|
362
366
|
<Split ratio="5/7" gap={{ base: 5, md: 7 }}>
|
|
363
367
|
<Heading level={3} size="2xl">
|
|
@@ -380,7 +384,7 @@ export default function Usage() {
|
|
|
380
384
|
```tsx
|
|
381
385
|
import { Box, Split, Stack, Text } from '@mitcsutt/kiln-ui'
|
|
382
386
|
|
|
383
|
-
export
|
|
387
|
+
export function Ratios() {
|
|
384
388
|
return (
|
|
385
389
|
<Stack gap={4}>
|
|
386
390
|
{(['1/1', '1/2', '1/3', '5/7'] as const).map((ratio) => (
|
|
@@ -410,82 +414,17 @@ export default 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'` |
|
|
416
|
-
|
|
417
|
-
Also accepts every prop of `HTMLAttributes<HTMLElement>`.
|
|
418
|
-
|
|
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 default 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). |
|
|
419
|
+
| `as` | `'div' \| 'section' \| 'article' \| 'header' \| 'footer'` | `div` | |
|
|
472
420
|
|
|
473
421
|
Also accepts every prop of `HTMLAttributes<HTMLElement>`.
|
|
474
422
|
|
|
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,10 +8,12 @@ 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
|
|
|
14
|
-
export
|
|
16
|
+
export function Usage() {
|
|
15
17
|
return (
|
|
16
18
|
<Stack gap={5}>
|
|
17
19
|
<TextField label="Route name" defaultValue="Morning commute" />
|
|
@@ -32,8 +34,6 @@ export default 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 default 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,
|
|
@@ -32,7 +34,7 @@ const ICONS = [
|
|
|
32
34
|
<SystemIcon key="a" />,
|
|
33
35
|
]
|
|
34
36
|
|
|
35
|
-
export
|
|
37
|
+
export function Usage() {
|
|
36
38
|
return (
|
|
37
39
|
<AppShell navBreakpoint="md">
|
|
38
40
|
<AppShell.Header>
|
|
@@ -86,8 +88,6 @@ export default 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
|
|
|
@@ -25,7 +27,7 @@ function Chart({ label }: { label: string }) {
|
|
|
25
27
|
)
|
|
26
28
|
}
|
|
27
29
|
|
|
28
|
-
export
|
|
30
|
+
export function Usage() {
|
|
29
31
|
return (
|
|
30
32
|
<Grid columns={{ base: 1, sm: 3 }} gap={4}>
|
|
31
33
|
{(['16/9', '4/3', '1/1'] as const).map((ratio) => (
|
|
@@ -8,10 +8,12 @@ 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
|
|
|
14
|
-
export
|
|
16
|
+
export function Usage() {
|
|
15
17
|
return (
|
|
16
18
|
<Stack gap={4}>
|
|
17
19
|
<Box padding={{ base: 4, md: 5 }} surface="sunken" radius="surface">
|
|
@@ -28,8 +30,6 @@ export default 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 default 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,10 +8,22 @@ 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
|
|
|
14
|
-
export
|
|
26
|
+
export function Usage() {
|
|
15
27
|
return (
|
|
16
28
|
<Stack gap={4}>
|
|
17
29
|
{(['narrow', 'text', 'content'] as const).map((width) => (
|
|
@@ -26,25 +38,15 @@ export default 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,10 +8,12 @@ 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
|
|
|
14
|
-
export
|
|
16
|
+
export function Usage() {
|
|
15
17
|
return (
|
|
16
18
|
<Stack gap={4}>
|
|
17
19
|
<Text>Morning departures</Text>
|
|
@@ -30,8 +32,6 @@ export default 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)) |
|