Feedback
Sheet
A sheet holds a short task over the page, such as adding an entry at the current time, without leaving it: it rises from the bottom on phones and opens from the side on wide windows.
In kanso-ui as Sheet
Web and native
Sheet in kanso-ui 0.59.0, for React.
import { Sheet } from '@kanso-labs/kanso-ui'A modal panel that arrives from the edge of the screen: a side sheet on a wide window, a bottom sheet on a narrow one.
It pairs the Material Design side sheets and bottom sheets pages by window size. Above the medium breakpoint it is a 400px side sheet pinned to the inline end, full height, with its leading corners rounded. Below it, the same panel is a full-width bottom sheet, only as tall as its content (up to 72px short of the window), rounded along the top. Everything inside — the 24dp side padding, the header, the actions area — is drawn the same in both.
What you provide
- A
ButtonorIconButtonplaced directly insideSheet, which opens it. - A
Sheet.Contentholding the parts. ASheet.Titleis what names the sheet for assistive technology. - Buttons given
slot="close"anywhere inside the content close it, as do Escape and a press on the scrim. - A sheet nothing on the page opens leaves
Sheetout and passesisOpenandonOpenChangetoSheet.Contentdirectly.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | — |
Also takes the props of Omit<DialogTriggerProps, 'children'>.
Parts
Sheet.Content— the panel and the scrim behind it, portalled out of the page.Sheet.Handle— the bottom sheet's drag handle, placed first inside the content. On a sheet withsnapPointsit is a button with a 48px target, named "Drag handle" in the reader's locale, that moves the sheet to its next height, witharia-expandedsaying whether it rests at the last. Without them it is decoration, hidden from assistive technology, since a swipe anywhere on the panel moves it. It draws nothing on a side sheet.Sheet.Header— the row holding the title and, optionally, a closeIconButton, over a divider.Sheet.Title— the headline, in title large; names the sheet.Sheet.Body— the content. The only part that scrolls, so the header and footer keep their place.Sheet.Footer— the actions, from the leading edge, over a divider; they wrap onto further rows when they do not fit.
Example
import { Button, IconButton, Sheet, Text } from '@kanso-labs/kanso-ui'
// CloseIcon: an SVG of your own, sized 24.
<Sheet>
<Button variant="outlined">Open</Button>
<Sheet.Content>
<Sheet.Handle />
<Sheet.Header>
<Sheet.Title>Headline</Sheet.Title>
<IconButton aria-label="Close" slot="close"><CloseIcon /></IconButton>
</Sheet.Header>
<Sheet.Body>
<Text tone="muted" variant="bodyMedium">Supporting line describing what the sheet is for.</Text>
</Sheet.Body>
<Sheet.Footer>
<Button>Confirm</Button>
<Button slot="close" variant="outlined">Cancel</Button>
</Sheet.Footer>
</Sheet.Content>
</Sheet>The design’s classes
k-scrim, k-sheet, k-sheet__handle, k-sheet__title, with k-seg k-seg--fill, k-field and k-btn k-btn--ink k-btn--block. The title row (k-sheet__head) and the side sheet (k-sheet--side) are written in the preview until bundle.css has them.
Maps to Sheet in kanso-ui and react-native-kanso-ui.