@eluan/core 0.5.0 → 0.6.0
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/README.md +33 -1
- package/dist/{action-popover-D6K9aVFk.cjs → action-popover-DrHKPGqw.cjs} +1 -1
- package/dist/{action-popover-BVJQBuky.js → action-popover-NkXDAHJT.js} +1 -1
- package/dist/action-popover.cjs +1 -1
- package/dist/action-popover.js +1 -1
- package/dist/{avatar-Co-k8KqV.cjs → avatar-B-t3ctR4.cjs} +1 -1
- package/dist/{avatar-CS5f1irF.js → avatar-kDEa0rjF.js} +1 -1
- package/dist/avatar.cjs +1 -1
- package/dist/avatar.js +1 -1
- package/dist/{badge-D9NYZFWH.js → badge-BLZ8V-KC.js} +10 -10
- package/dist/{badge-DXKWztL-.cjs → badge-D1A0Tc79.cjs} +1 -1
- package/dist/badge.cjs +1 -1
- package/dist/badge.js +1 -1
- package/dist/{banner-COlEFRuK.cjs → banner-CNdwDPqA.cjs} +1 -1
- package/dist/{banner-CyYFLZXw.js → banner-DzSp5WfQ.js} +9 -9
- package/dist/banner.cjs +1 -1
- package/dist/banner.js +1 -1
- package/dist/box-DG-tkaYi.cjs +1 -0
- package/dist/box-DKbNgGGG.js +17 -0
- package/dist/box.cjs +1 -0
- package/dist/box.d.ts +1 -0
- package/dist/box.js +5 -0
- package/dist/{breadcrumb-NWXeCH5q.cjs → breadcrumb-BuxXkm6O.cjs} +1 -1
- package/dist/{breadcrumb-Cm1nb9Xj.js → breadcrumb-C6qj-tDx.js} +1 -1
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.js +1 -1
- package/dist/button--_WI-fM6.cjs +1 -0
- package/dist/{button-ANAPDrvs.js → button-DNSNShUc.js} +28 -26
- package/dist/button.cjs +1 -1
- package/dist/button.js +1 -1
- package/dist/{calendar-BpBsomy5.js → calendar-BA2tSwZD.js} +6 -6
- package/dist/{calendar-7LX5YGGT.cjs → calendar-DS5821-k.cjs} +3 -3
- package/dist/calendar.cjs +1 -1
- package/dist/calendar.js +1 -1
- package/dist/{card-C88--zB4.cjs → card-BNdR5aDa.cjs} +1 -1
- package/dist/{card-BC_4C3ns.js → card-BSgN7WSe.js} +1 -1
- package/dist/card.cjs +1 -1
- package/dist/card.js +1 -1
- package/dist/{carousel-BfL7oy_q.cjs → carousel-4AERgboz.cjs} +1 -1
- package/dist/{carousel-DuP0hvF-.js → carousel-Bb7jpzep.js} +1 -1
- package/dist/carousel.cjs +1 -1
- package/dist/carousel.js +1 -1
- package/dist/{checkbox-Bi0Kmuut.js → checkbox-CGUTGery.js} +1 -1
- package/dist/{checkbox-M8DmWKiC.cjs → checkbox-Cq9sHU_S.cjs} +1 -1
- package/dist/{checkbox-group-KBwPhjmW.cjs → checkbox-group-DGXZ4o2-.cjs} +1 -1
- package/dist/{checkbox-group-CQMEJnhD.js → checkbox-group-Tkio3IhK.js} +1 -1
- package/dist/checkbox-group.cjs +1 -1
- package/dist/checkbox-group.js +1 -1
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/{command-BCl0seLL.cjs → command-D02vvta9.cjs} +1 -1
- package/dist/{command-Chs5VlBL.js → command-sUMAxm8S.js} +1 -1
- package/dist/command.cjs +1 -1
- package/dist/command.js +1 -1
- package/dist/components/box.d.ts +12 -0
- package/dist/components/grid.d.ts +35 -0
- package/dist/components/hover-card.d.ts +14 -2
- package/dist/components/icon.d.ts +26 -0
- package/dist/components/layout-shared.d.ts +307 -0
- package/dist/components/multi-select.d.ts +1 -1
- package/dist/components/navigation-drawer.d.ts +25 -5
- package/dist/components/row.d.ts +18 -0
- package/dist/components/stack.d.ts +14 -0
- package/dist/components/tone-shared.d.ts +39 -0
- package/dist/components/tooltip.d.ts +14 -2
- package/dist/components/typography.d.ts +22 -2
- package/dist/components/visually-hidden.d.ts +11 -0
- package/dist/{credit-card-input-DN-8vaFj.js → credit-card-input-9VPlzvDm.js} +1 -1
- package/dist/{credit-card-input-CUqA9CX3.cjs → credit-card-input-DppPJBne.cjs} +1 -1
- package/dist/credit-card-input.cjs +1 -1
- package/dist/credit-card-input.js +1 -1
- package/dist/{date-picker-ni8td8Ru.js → date-picker-M5hLx_1s.js} +2 -2
- package/dist/{date-picker-DGBsfZXx.cjs → date-picker-hE7cDg2B.cjs} +1 -1
- package/dist/date-picker.cjs +1 -1
- package/dist/date-picker.js +1 -1
- package/dist/{datetime-picker-C1d63MaA.cjs → datetime-picker-BeRUPJ7s.cjs} +1 -1
- package/dist/{datetime-picker-DsnHYRK-.js → datetime-picker-CIqBZYMH.js} +3 -3
- package/dist/datetime-picker.cjs +1 -1
- package/dist/datetime-picker.js +1 -1
- package/dist/{decimal-input-yTk35W_5.js → decimal-input-Bg2BPKIr.js} +38 -38
- package/dist/decimal-input-CkTEjo2J.cjs +1 -0
- package/dist/decimal-input.cjs +1 -1
- package/dist/decimal-input.js +1 -1
- package/dist/{dialog-B8eWKqzS.js → dialog-Bsfviqvy.js} +2 -2
- package/dist/dialog-DRAoumvB.cjs +1 -0
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.js +1 -1
- package/dist/{email-input-DFI4h_KN.cjs → email-input-CehmtNUq.cjs} +1 -1
- package/dist/{email-input-pX0hlYV3.js → email-input-DIiY9Q3S.js} +1 -1
- package/dist/email-input.cjs +1 -1
- package/dist/email-input.js +1 -1
- package/dist/{footer-DB0_-IwN.cjs → footer-fovIsy-0.cjs} +1 -1
- package/dist/{footer-B3KUIwXW.js → footer-jWaFq3qk.js} +9 -9
- package/dist/footer.cjs +1 -1
- package/dist/footer.js +1 -1
- package/dist/grid-BDz4Xs6M.cjs +1 -0
- package/dist/grid-BX5vZjDo.js +612 -0
- package/dist/grid.cjs +1 -0
- package/dist/grid.d.ts +1 -0
- package/dist/grid.js +5 -0
- package/dist/{header-CDOWlOAR.js → header-Dnf8AnIx.js} +2 -2
- package/dist/{header-CiZQY_7S.cjs → header-DzItWqW4.cjs} +1 -1
- package/dist/header.cjs +1 -1
- package/dist/header.js +1 -1
- package/dist/hover-card-C5KsTSZR.cjs +1 -0
- package/dist/hover-card-C_FCzE41.js +21 -0
- package/dist/hover-card.cjs +1 -1
- package/dist/hover-card.js +1 -1
- package/dist/icon-BmLOodCQ.cjs +1 -0
- package/dist/icon-BwDfkIdR.js +153 -0
- package/dist/icon.cjs +1 -0
- package/dist/icon.d.ts +1 -0
- package/dist/icon.js +5 -0
- package/dist/index.cjs +10 -5
- package/dist/index.d.ts +6 -0
- package/dist/index.js +612 -541
- package/dist/{input-BrGJn-D9.cjs → input-BcjL2oxv.cjs} +1 -1
- package/dist/{input-Cccufiqn.js → input-CPb9yVU5.js} +8 -8
- package/dist/input-otp-BhJ3ERrY.cjs +1 -0
- package/dist/{input-otp-DmEGB1nu.js → input-otp-CTvJztkH.js} +32 -32
- package/dist/input-otp.cjs +1 -1
- package/dist/input-otp.js +1 -1
- package/dist/input.cjs +1 -1
- package/dist/input.js +1 -1
- package/dist/layout-shared-B_1iX4Hj.js +319 -0
- package/dist/layout-shared-CsBZcT4V.cjs +1 -0
- package/dist/multi-select-CVxkWW29.js +85 -0
- package/dist/multi-select-DBFINH3F.cjs +1 -0
- package/dist/multi-select.cjs +1 -1
- package/dist/multi-select.js +1 -1
- package/dist/navigation-drawer-BCBFtLEq.cjs +1 -0
- package/dist/navigation-drawer-BMyHXhhX.js +198 -0
- package/dist/navigation-drawer.cjs +1 -1
- package/dist/navigation-drawer.js +1 -1
- package/dist/{number-input-vICbRc2y.js → number-input-Cm9YPBOX.js} +1 -1
- package/dist/{number-input-Bc7jUsu-.cjs → number-input-Dr9MbuRV.cjs} +1 -1
- package/dist/number-input.cjs +1 -1
- package/dist/number-input.js +1 -1
- package/dist/{pagination-DTWRjiOm.js → pagination-D2tjMpVU.js} +2 -2
- package/dist/{pagination-4IuE_APs.cjs → pagination-yKmFlFMR.cjs} +1 -1
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.js +1 -1
- package/dist/{password-input-BwnlHPbX.cjs → password-input-CmHubHuU.cjs} +1 -1
- package/dist/{password-input-B9V45d3Q.js → password-input-ljwdGCO6.js} +2 -2
- package/dist/password-input.cjs +1 -1
- package/dist/password-input.js +1 -1
- package/dist/{phone-input-BQjZj5jI.cjs → phone-input-B8VksCer.cjs} +1 -1
- package/dist/{phone-input-CSBpGHvI.js → phone-input-qTL6K8rT.js} +2 -2
- package/dist/phone-input.cjs +1 -1
- package/dist/phone-input.js +1 -1
- package/dist/progress-BpdmBGaX.cjs +1 -0
- package/dist/{progress-Dz_it5I-.js → progress-ChFf9bIq.js} +1 -1
- package/dist/progress.cjs +1 -1
- package/dist/progress.js +1 -1
- package/dist/providers/create-theme.d.ts +10 -1
- package/dist/providers/eluan-provider.d.ts +2 -1
- package/dist/providers/portal-container.d.ts +1 -1
- package/dist/{radio-group-C--1neiq.cjs → radio-group-9gozRouT.cjs} +1 -1
- package/dist/{radio-group-CNMPZx_2.js → radio-group-Bs9933bk.js} +6 -6
- package/dist/radio-group.cjs +1 -1
- package/dist/radio-group.js +1 -1
- package/dist/{rich-text-BZSyuYSo.js → rich-text-DImwK9hN.js} +1 -1
- package/dist/{rich-text-DerWxzdn.cjs → rich-text-DzHLeG7W.cjs} +1 -1
- package/dist/rich-text.cjs +1 -1
- package/dist/rich-text.js +1 -1
- package/dist/row-BYAk7G5d.js +37 -0
- package/dist/row-Bjn-GQAC.cjs +1 -0
- package/dist/row.cjs +1 -0
- package/dist/row.d.ts +1 -0
- package/dist/row.js +5 -0
- package/dist/{search-input-Dmmo-BEL.cjs → search-input-BKTjebg7.cjs} +1 -1
- package/dist/{search-input-bFNW6oiE.js → search-input-Dgr9kT1a.js} +1 -1
- package/dist/search-input.cjs +1 -1
- package/dist/search-input.js +1 -1
- package/dist/select-Cdh991T-.cjs +1 -0
- package/dist/{select-DDSYjKtj.js → select-Dp5AJ6I-.js} +15 -15
- package/dist/select.cjs +1 -1
- package/dist/select.js +1 -1
- package/dist/sheet-CkXjinUG.cjs +1 -0
- package/dist/{sheet-D5HWF66e.js → sheet-uiyHNKEw.js} +6 -6
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.js +1 -1
- package/dist/{slider-CZQBAXup.js → slider-BQmbh0Nl.js} +1 -1
- package/dist/{slider-DdEOapYP.cjs → slider-DK2yk-YK.cjs} +1 -1
- package/dist/slider.cjs +1 -1
- package/dist/slider.js +1 -1
- package/dist/stack-Ck1w2iJu.cjs +1 -0
- package/dist/stack-D2btWM1t.js +27 -0
- package/dist/stack.cjs +1 -0
- package/dist/stack.d.ts +1 -0
- package/dist/stack.js +5 -0
- package/dist/{stepper-D5nDwJUz.cjs → stepper-ByYKX7qw.cjs} +1 -1
- package/dist/{stepper-BtlKiHtd.js → stepper-Copsj87A.js} +4 -4
- package/dist/stepper.cjs +1 -1
- package/dist/stepper.js +1 -1
- package/dist/styles.css +935 -59
- package/dist/{switch-KzBijHMJ.cjs → switch-C2OPCq5Z.cjs} +1 -1
- package/dist/{switch-C7EBLT5H.js → switch-CXBWUZcq.js} +3 -3
- package/dist/switch.cjs +1 -1
- package/dist/switch.js +1 -1
- package/dist/{tabs-DztJ2iVc.cjs → tabs-D8p6Tr5i.cjs} +1 -1
- package/dist/{tabs-C9NKBmH0.js → tabs-TV4_2wi1.js} +9 -9
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.js +1 -1
- package/dist/{textarea-Dl-daLHR.cjs → textarea-BnpQmE74.cjs} +1 -1
- package/dist/{textarea-DXUk1b_-.js → textarea-CJRmnazN.js} +1 -1
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.js +1 -1
- package/dist/{time-input-BPoFvoeM.js → time-input-A603mEFQ.js} +38 -38
- package/dist/time-input-qxljhdEb.cjs +1 -0
- package/dist/time-input.cjs +1 -1
- package/dist/time-input.js +1 -1
- package/dist/{toggle-Dv1VZ5Le.js → toggle-Bx3q15Pu.js} +6 -6
- package/dist/{toggle-Bvh1v32T.cjs → toggle-Z3t4jPdv.cjs} +1 -1
- package/dist/{toggle-group-SyHMwO90.cjs → toggle-group-BZIW4wJp.cjs} +1 -1
- package/dist/{toggle-group-DE8BPZih.js → toggle-group-LaZmOMx_.js} +7 -7
- package/dist/toggle-group.cjs +1 -1
- package/dist/toggle-group.js +1 -1
- package/dist/toggle.cjs +1 -1
- package/dist/toggle.js +1 -1
- package/dist/tooltip-DZqn4wKl.js +23 -0
- package/dist/tooltip-faf1dIXp.cjs +1 -0
- package/dist/tooltip.cjs +1 -1
- package/dist/tooltip.js +1 -1
- package/dist/{tree-view-CyeJR7cW.js → tree-view-DRmm6oL6.js} +23 -23
- package/dist/tree-view-DVQyRQDg.cjs +1 -0
- package/dist/tree-view.cjs +1 -1
- package/dist/tree-view.js +1 -1
- package/dist/visually-hidden-BQMRYGxP.js +14 -0
- package/dist/visually-hidden-DzxxOswl.cjs +1 -0
- package/dist/visually-hidden.cjs +1 -0
- package/dist/visually-hidden.d.ts +1 -0
- package/dist/visually-hidden.js +5 -0
- package/package.json +8 -8
- package/skills/eluan/DESIGN.md +409 -0
- package/skills/eluan/SKILL.md +166 -0
- package/skills/eluan/components/accordion.md +212 -0
- package/skills/eluan/components/action-popover.md +266 -0
- package/skills/eluan/components/aspect-ratio.md +169 -0
- package/skills/eluan/components/avatar.md +277 -0
- package/skills/eluan/components/badge.md +190 -0
- package/skills/eluan/components/banner.md +247 -0
- package/skills/eluan/components/box.md +166 -0
- package/skills/eluan/components/breadcrumb.md +240 -0
- package/skills/eluan/components/button.md +214 -0
- package/skills/eluan/components/calendar.md +192 -0
- package/skills/eluan/components/card.md +270 -0
- package/skills/eluan/components/carousel.md +274 -0
- package/skills/eluan/components/checkbox-group.md +228 -0
- package/skills/eluan/components/checkbox.md +226 -0
- package/skills/eluan/components/code-block.md +193 -0
- package/skills/eluan/components/collapsible.md +240 -0
- package/skills/eluan/components/command.md +359 -0
- package/skills/eluan/components/context-menu.md +296 -0
- package/skills/eluan/components/credit-card-input.md +217 -0
- package/skills/eluan/components/date-picker.md +255 -0
- package/skills/eluan/components/date-time-picker.md +196 -0
- package/skills/eluan/components/decimal-input.md +232 -0
- package/skills/eluan/components/dialog.md +322 -0
- package/skills/eluan/components/drawer.md +292 -0
- package/skills/eluan/components/dropdown-menu.md +450 -0
- package/skills/eluan/components/email-input.md +200 -0
- package/skills/eluan/components/fieldset.md +219 -0
- package/skills/eluan/components/file-input.md +249 -0
- package/skills/eluan/components/footer.md +290 -0
- package/skills/eluan/components/form-label.md +254 -0
- package/skills/eluan/components/grid.md +192 -0
- package/skills/eluan/components/header.md +242 -0
- package/skills/eluan/components/hover-card.md +215 -0
- package/skills/eluan/components/icon.md +161 -0
- package/skills/eluan/components/input-otp.md +227 -0
- package/skills/eluan/components/input.md +249 -0
- package/skills/eluan/components/kbd.md +216 -0
- package/skills/eluan/components/media.md +244 -0
- package/skills/eluan/components/menubar.md +300 -0
- package/skills/eluan/components/multi-select.md +221 -0
- package/skills/eluan/components/navigation-drawer.md +297 -0
- package/skills/eluan/components/navigation-menu.md +291 -0
- package/skills/eluan/components/number-input.md +190 -0
- package/skills/eluan/components/pagination.md +262 -0
- package/skills/eluan/components/password-input.md +218 -0
- package/skills/eluan/components/phone-input.md +205 -0
- package/skills/eluan/components/popover.md +250 -0
- package/skills/eluan/components/progress.md +185 -0
- package/skills/eluan/components/radio-group.md +232 -0
- package/skills/eluan/components/rich-text.md +195 -0
- package/skills/eluan/components/row.md +174 -0
- package/skills/eluan/components/scroll-area.md +203 -0
- package/skills/eluan/components/search-input.md +281 -0
- package/skills/eluan/components/segmented-control.md +201 -0
- package/skills/eluan/components/select.md +296 -0
- package/skills/eluan/components/separator.md +179 -0
- package/skills/eluan/components/sheet.md +326 -0
- package/skills/eluan/components/skeleton.md +202 -0
- package/skills/eluan/components/slider.md +195 -0
- package/skills/eluan/components/spinner.md +187 -0
- package/skills/eluan/components/stack.md +158 -0
- package/skills/eluan/components/stepper.md +236 -0
- package/skills/eluan/components/switch.md +218 -0
- package/skills/eluan/components/table.md +348 -0
- package/skills/eluan/components/tabs.md +277 -0
- package/skills/eluan/components/textarea.md +202 -0
- package/skills/eluan/components/time-input.md +181 -0
- package/skills/eluan/components/toast.md +251 -0
- package/skills/eluan/components/toggle-group.md +241 -0
- package/skills/eluan/components/toggle.md +198 -0
- package/skills/eluan/components/tooltip.md +222 -0
- package/skills/eluan/components/tree-view.md +213 -0
- package/skills/eluan/components/typography.md +207 -0
- package/skills/eluan/components/visually-hidden.md +132 -0
- package/skills/eluan/foundations/colour.md +252 -0
- package/skills/eluan/foundations/elevation.md +57 -0
- package/skills/eluan/foundations/iconography.md +70 -0
- package/skills/eluan/foundations/motion.md +60 -0
- package/skills/eluan/foundations/radius.md +61 -0
- package/skills/eluan/foundations/spacing.md +98 -0
- package/skills/eluan/foundations/theming.md +197 -0
- package/skills/eluan/foundations/typography.md +163 -0
- package/skills/eluan/patterns/empty-states.md +84 -0
- package/skills/eluan/patterns/feedback.md +95 -0
- package/skills/eluan/patterns/forms.md +138 -0
- package/skills/eluan/patterns/navigation.md +95 -0
- package/skills/eluan/patterns/page-layout.md +101 -0
- package/dist/button-Ny6OF8Un.cjs +0 -1
- package/dist/decimal-input-BLmifKF2.cjs +0 -1
- package/dist/dialog-DWYtFhZl.cjs +0 -1
- package/dist/hover-card-BN7Ew2Y1.js +0 -16
- package/dist/hover-card-Dft-08Ha.cjs +0 -1
- package/dist/input-otp-DcZ7wyjs.cjs +0 -1
- package/dist/multi-select-DPoOHWSC.js +0 -74
- package/dist/multi-select-fX5FXYEY.cjs +0 -1
- package/dist/navigation-drawer-BbeDYPhu.js +0 -171
- package/dist/navigation-drawer-DOOHfbY3.cjs +0 -1
- package/dist/progress-DpQjGEyn.cjs +0 -1
- package/dist/select-1Eb3NSrR.cjs +0 -1
- package/dist/sheet-7NP1LuHy.cjs +0 -1
- package/dist/time-input-DR2snTgB.cjs +0 -1
- package/dist/tooltip-BlCQKhUE.js +0 -18
- package/dist/tooltip-Cyu7fWYZ.cjs +0 -1
- package/dist/tree-view-CNvEc1TT.cjs +0 -1
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Separator
|
|
3
|
+
use_when: You need a visible line between sections, list rows or groups of inline items.
|
|
4
|
+
instead_of: A border or spacing-token line on your own element; the separator part of DropdownMenu, ContextMenu, Menubar, Select or Command inside those; BreadcrumbSeparator in a breadcrumb.
|
|
5
|
+
source: packages/core/src/components/separator.tsx
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Separator
|
|
9
|
+
|
|
10
|
+
## 1. Overview
|
|
11
|
+
|
|
12
|
+
Separator draws a 1px line in `--container-border-alt` between pieces of content. It wraps Radix Separator, runs horizontal or vertical, and is decorative by default, so assistive tech skips it. It's the system's shared divider: draw every line with it, never with a hand-made border or a spacing token.
|
|
13
|
+
|
|
14
|
+
## 2. When to use
|
|
15
|
+
|
|
16
|
+
- Dividing sections of a page, panel or card: a heading block from the content below it, one settings group from the next.
|
|
17
|
+
- Between rows of a simple list you compose yourself.
|
|
18
|
+
- Between inline items in a row, such as links in a bar (vertical).
|
|
19
|
+
- Between groups of buttons in a toolbar (vertical, `variant="toolbar"`).
|
|
20
|
+
|
|
21
|
+
### When not to use
|
|
22
|
+
|
|
23
|
+
- Inside a menu, Select or Command → use that component's separator part: [DropdownMenu](./dropdown-menu.md), [ContextMenu](./context-menu.md), [Menubar](./menubar.md), [Select](./select.md), [Command](./command.md).
|
|
24
|
+
- Between breadcrumb items → use `BreadcrumbSeparator` in [Breadcrumb](./breadcrumb.md).
|
|
25
|
+
- Between table rows → [Table](./table.md) draws its own row borders.
|
|
26
|
+
- To group form fields under a heading → use [Fieldset](./fieldset.md).
|
|
27
|
+
- To frame a block of content → use [Card](./card.md).
|
|
28
|
+
- To add space, not a line → use `gap` with a `--spacing-*` token; see [spacing](../foundations/spacing.md).
|
|
29
|
+
|
|
30
|
+
## 3. Anatomy
|
|
31
|
+
|
|
32
|
+
1. **Line**: a single `<div>` (the Radix Separator root), 1px thick, filled with `--container-border-alt`. It takes no children.
|
|
33
|
+
|
|
34
|
+
## 4. Variants
|
|
35
|
+
|
|
36
|
+
| Variant | Use for |
|
|
37
|
+
| --- | --- |
|
|
38
|
+
| `default` | Most dividers. Horizontal fills the container width; vertical stretches to the height of its flex row (at least `--size-xxs`). |
|
|
39
|
+
| `toolbar` | A vertical divider between button groups in a toolbar: `--size-sm` tall with `--spacing-xxs` side margins. RichText's toolbar uses it. |
|
|
40
|
+
| `inline` | A short vertical tick between inline text items: `--size-xxs` tall with `--spacing-xxs` side margins. |
|
|
41
|
+
| `command` | Internal to Command; bleeds into the list's padding. Use `CommandSeparator` instead of setting this yourself. |
|
|
42
|
+
|
|
43
|
+
## 5. Sizes
|
|
44
|
+
|
|
45
|
+
Separator has no size prop. Thickness is fixed at 1px; `orientation` and `variant` set the length.
|
|
46
|
+
|
|
47
|
+
## 6. States
|
|
48
|
+
|
|
49
|
+
| State | Looks like | Notes |
|
|
50
|
+
| --- | --- | --- |
|
|
51
|
+
| Default | 1px line in `--container-border-alt` | Static. No hover, focus or disabled state. |
|
|
52
|
+
|
|
53
|
+
## 7. Content guidelines
|
|
54
|
+
|
|
55
|
+
- Separator has no content. Don't pass children; Radix renders them inside the 1px line.
|
|
56
|
+
- Add a line only where spacing or a heading doesn't already make the break clear.
|
|
57
|
+
- Don't type pipes (`|`) or bullets between inline items; use a vertical Separator.
|
|
58
|
+
- For a labelled divider ("or" between sign-in options), compose a flex row: Separator, a `caption` Typography, Separator.
|
|
59
|
+
|
|
60
|
+
## 8. Rules
|
|
61
|
+
|
|
62
|
+
1. Draw every divider with Separator. Never use a border on your own element or a `--spacing-xxs` strip; that token is 0 in compact density.
|
|
63
|
+
2. Leave `decorative` at its default (`true`) when the line is purely visual. Pass `decorative={false}` when the line itself separates content and no heading or landmark already marks the break.
|
|
64
|
+
3. Space around a Separator with `gap` on the parent. It has no margin of its own (apart from `toolbar` and `inline` side margins) and drops `className` and `style`.
|
|
65
|
+
4. Put a vertical Separator inside a flex row so it can stretch to the row height.
|
|
66
|
+
5. Use `toolbar` and `inline` only with `orientation="vertical"`.
|
|
67
|
+
6. Don't set `variant="command"` outside Command.
|
|
68
|
+
7. Never recolour it. The colour comes from `--container-border-alt`.
|
|
69
|
+
8. Inside menus, use the menu's own separator part, and don't copy its styling elsewhere: menu dividers currently use other tokens, some near-invisible.
|
|
70
|
+
|
|
71
|
+
## 9. Dos and don'ts
|
|
72
|
+
|
|
73
|
+
**Do:** draw the line with Separator and space it with `gap`.
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
<div style={{ display: "flex", flexDirection: "column", gap: "var(--spacing-lg)" }}>
|
|
77
|
+
<Typography variant="heading" as="h2">Billing</Typography>
|
|
78
|
+
<Separator />
|
|
79
|
+
<Typography>Your plan renews on 1 March.</Typography>
|
|
80
|
+
</div>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Don't:** hand-draw lines or use a spacing token as a line.
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
<div style={{ borderBottom: "1px solid #e5e5e5", marginBottom: 16 }}>Billing</div>
|
|
87
|
+
<div style={{ height: "var(--spacing-xxs)", backgroundColor: "var(--container-bg-alt)" }} />
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Do:** use vertical Separators between inline items.
|
|
91
|
+
|
|
92
|
+
```tsx
|
|
93
|
+
<div style={{ display: "flex", alignItems: "center", gap: "var(--spacing-md)" }}>
|
|
94
|
+
<Button asChild variant="link"><a href="/privacy">Privacy</a></Button>
|
|
95
|
+
<Separator orientation="vertical" />
|
|
96
|
+
<Button asChild variant="link"><a href="/terms">Terms</a></Button>
|
|
97
|
+
</div>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**Don't:** type pipe characters between them.
|
|
101
|
+
|
|
102
|
+
```tsx
|
|
103
|
+
<p>
|
|
104
|
+
<a href="/privacy">Privacy</a> | <a href="/terms">Terms</a>
|
|
105
|
+
</p>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## 10. Accessibility
|
|
109
|
+
|
|
110
|
+
- Role: none by default. With `decorative={true}` Radix renders `role="none"`, so screen readers skip the line. With `decorative={false}` it renders `role="separator"`, plus `aria-orientation="vertical"` when vertical.
|
|
111
|
+
- Label: none needed.
|
|
112
|
+
- Keyboard: none. Separator isn't focusable.
|
|
113
|
+
- Focus: not focusable.
|
|
114
|
+
- Contrast: handled by the theme. Don't override colours. `--container-border-alt` is the most visible of the system's divider colours; don't swap it for a lighter token.
|
|
115
|
+
|
|
116
|
+
## 11. Behaviour
|
|
117
|
+
|
|
118
|
+
- Responsive: horizontal fills its container's width. Vertical stretches to its flex row's height, with a `--size-xxs` minimum. It never shrinks in a flex row.
|
|
119
|
+
- Density: the 1px thickness is fixed; `toolbar` and `inline` lengths and margins follow `--size-*` and `--spacing-*`, so they scale with density.
|
|
120
|
+
- Motion: none.
|
|
121
|
+
- `data-orientation` is always set to the orientation, whether decorative or not.
|
|
122
|
+
|
|
123
|
+
## 12. API
|
|
124
|
+
|
|
125
|
+
<!-- api:start -->
|
|
126
|
+
| Prop | Type | Default | Description |
|
|
127
|
+
| --- | --- | --- | --- |
|
|
128
|
+
| `orientation` | `"horizontal" \| "vertical"` | `"horizontal"` | Direction of the line. |
|
|
129
|
+
| `decorative` | `boolean` | `true` | `true`: visual only (`role="none"`). `false`: semantic (`role="separator"`). |
|
|
130
|
+
| `variant` | `"default" \| "toolbar" \| "inline" \| "command"` | `"default"` | Length and margins; see Variants. |
|
|
131
|
+
| `asChild` | `boolean` | `false` | Renders the child element as the separator (Radix Slot). |
|
|
132
|
+
| `...props` | Radix `Separator.Root` props without `className`, `style` | | Native div attributes: `id`, `aria-*`, `data-*`. `className` and `style` are omitted. |
|
|
133
|
+
<!-- api:end -->
|
|
134
|
+
|
|
135
|
+
## 13. Examples
|
|
136
|
+
|
|
137
|
+
```tsx
|
|
138
|
+
import { Button, Separator, Typography } from "@eluan/core";
|
|
139
|
+
|
|
140
|
+
export function AccountSummary() {
|
|
141
|
+
return (
|
|
142
|
+
<section style={{ display: "flex", flexDirection: "column", gap: "var(--spacing-lg)" }}>
|
|
143
|
+
<div style={{ display: "flex", flexDirection: "column", gap: "var(--spacing-xs)" }}>
|
|
144
|
+
<Typography variant="heading" as="h2">Account</Typography>
|
|
145
|
+
<Typography tone="muted">Manage your plan, invoices and team seats.</Typography>
|
|
146
|
+
</div>
|
|
147
|
+
|
|
148
|
+
<Separator />
|
|
149
|
+
|
|
150
|
+
<div style={{ display: "flex", flexDirection: "column", gap: "var(--spacing-xs)" }}>
|
|
151
|
+
<Typography variant="subheading" as="h3">Plan</Typography>
|
|
152
|
+
<Typography>Team, 12 of 15 seats used. Renews on 1 March.</Typography>
|
|
153
|
+
</div>
|
|
154
|
+
|
|
155
|
+
<Separator />
|
|
156
|
+
|
|
157
|
+
<div style={{ display: "flex", alignItems: "center", gap: "var(--spacing-md)" }}>
|
|
158
|
+
<Button asChild variant="link"><a href="/billing/invoices">Invoices</a></Button>
|
|
159
|
+
<Separator orientation="vertical" />
|
|
160
|
+
<Button asChild variant="link"><a href="/billing/payment">Payment method</a></Button>
|
|
161
|
+
<Separator orientation="vertical" />
|
|
162
|
+
<Button asChild variant="link"><a href="/team">Seats</a></Button>
|
|
163
|
+
</div>
|
|
164
|
+
</section>
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## 14. Related components
|
|
170
|
+
|
|
171
|
+
- [Command](./command.md): `CommandSeparator` renders this Separator with `variant="command"`.
|
|
172
|
+
- [RichText](./rich-text.md): its toolbar divides button groups with `variant="toolbar"`.
|
|
173
|
+
- [DropdownMenu](./dropdown-menu.md): menus have their own separator part.
|
|
174
|
+
- [Card](./card.md): frames a block instead of dividing it.
|
|
175
|
+
- [Fieldset](./fieldset.md): groups related fields under a legend.
|
|
176
|
+
|
|
177
|
+
## 15. Common agent mistakes
|
|
178
|
+
|
|
179
|
+
_Filled from evals._
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Sheet
|
|
3
|
+
use_when: Secondary content or a longer task (edit a record, filters, details) opens in a modal panel from the edge of the screen.
|
|
4
|
+
instead_of: Drawer for a non-modal panel that pushes the page; Dialog for a short confirmation; Popover, HoverCard or Tooltip for small content anchored to a control.
|
|
5
|
+
source: packages/core/src/components/sheet.tsx
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Sheet
|
|
9
|
+
|
|
10
|
+
## 1. Overview
|
|
11
|
+
|
|
12
|
+
Sheet is a modal panel that slides in from one edge of the screen. It's built on Radix Dialog, so it behaves like [Dialog](./dialog.md): it portals, covers the page with a scrim, traps focus, has a built-in close button and returns focus to its trigger. Use it when the content needs more room than a Dialog, and the page can wait until the user is done.
|
|
13
|
+
|
|
14
|
+
## 2. When to use
|
|
15
|
+
|
|
16
|
+
- Editing a record without leaving the list: customer details, a ticket, a product.
|
|
17
|
+
- A filter panel for a table or search results.
|
|
18
|
+
- Detail or help content that's too long for a Popover.
|
|
19
|
+
- A mobile navigation menu (Header and NavigationDrawer already use Sheet for this).
|
|
20
|
+
|
|
21
|
+
### When not to use
|
|
22
|
+
|
|
23
|
+
- The user must keep working in the page while the panel is open → use [Drawer](./drawer.md).
|
|
24
|
+
- A short confirmation or decision → use [Dialog](./dialog.md).
|
|
25
|
+
- A small panel anchored to the control that opened it → use [Popover](./popover.md).
|
|
26
|
+
- A preview on hover → use [HoverCard](./hover-card.md); a short label → use [Tooltip](./tooltip.md).
|
|
27
|
+
- Content revealed in place in the page flow → use [Collapsible](./collapsible.md) or [Accordion](./accordion.md).
|
|
28
|
+
- App navigation with a persistent sidebar → use [NavigationDrawer](./navigation-drawer.md), which switches to a Sheet on mobile for you.
|
|
29
|
+
|
|
30
|
+
### Choosing a surface for more content
|
|
31
|
+
|
|
32
|
+
| You need to show… | Use | Because |
|
|
33
|
+
| --- | --- | --- |
|
|
34
|
+
| A long form, record details or filters; the page can wait | Sheet | Modal: scrim, focus trap, close button, slides in from any edge. |
|
|
35
|
+
| A panel the user works beside, with the page still usable | [Drawer](./drawer.md) | Inline: pushes the page content aside; no scrim, no focus trap, no portal. Left or right only. |
|
|
36
|
+
| A short question that must be answered first | [Dialog](./dialog.md) | Modal and centred, up to 32rem wide. |
|
|
37
|
+
| A small form or set of options tied to one control | [Popover](./popover.md) | Non-modal, anchored to its trigger; Escape or a click outside closes it. |
|
|
38
|
+
| A preview of a linked item, for pointer users | [HoverCard](./hover-card.md) | Opens on hover or focus; its content can't be reached by keyboard and it never opens on touch. |
|
|
39
|
+
| A short text hint for a control | [Tooltip](./tooltip.md) | Text only; describes the control, never names it; never opens on touch. |
|
|
40
|
+
| Extra detail in the page flow | [Collapsible](./collapsible.md) or [Accordion](./accordion.md) | Expands in place; nothing floats. |
|
|
41
|
+
|
|
42
|
+
## 3. Anatomy
|
|
43
|
+
|
|
44
|
+
1. **Sheet**: the root. Holds open state; renders nothing itself.
|
|
45
|
+
2. **SheetTrigger**: opens the sheet. Wrap a Button with `asChild`. Focus returns here on close.
|
|
46
|
+
3. **SheetContent**: the panel. Renders the portal, the scrim (`--overlay-bg` at 80% opacity) and the panel (`--container-bg`, a `--container-border` edge on the inner side, `--spacing-lg` padding, `--spacing-md` gap between children). Adds a close button (X icon, "Close" for screen readers) in the top-right corner, first in the DOM.
|
|
47
|
+
4. **SheetHeader**: a column holding the title and description, `--spacing-xs` apart.
|
|
48
|
+
5. **SheetTitle**: required. Renders an `h2` and names the sheet.
|
|
49
|
+
6. **SheetDescription**: a `p` in `--font-size-sm` that describes the sheet to screen readers.
|
|
50
|
+
7. **Body**: your content.
|
|
51
|
+
8. **SheetFooter**: the button row.
|
|
52
|
+
9. **SheetClose**: closes the sheet. Wrap the Cancel Button with `asChild`.
|
|
53
|
+
10. **SheetOverlay**, **SheetPortal**: exported, but SheetContent already renders both. Don't add them yourself.
|
|
54
|
+
|
|
55
|
+
## 4. Variants
|
|
56
|
+
|
|
57
|
+
No `variant` prop. `side` on SheetContent picks the edge:
|
|
58
|
+
|
|
59
|
+
| Side | Use for |
|
|
60
|
+
| --- | --- |
|
|
61
|
+
| `right` (default) | Editing and detail panels. |
|
|
62
|
+
| `left` | Navigation, or panels tied to content on the left. |
|
|
63
|
+
| `bottom` | Short sets of options on small screens, such as share targets. |
|
|
64
|
+
| `top` | Rarely; content that drops from a top toolbar. |
|
|
65
|
+
|
|
66
|
+
`layout` on SheetContent exists for Eluan's own components:
|
|
67
|
+
|
|
68
|
+
| Layout | Use for |
|
|
69
|
+
| --- | --- |
|
|
70
|
+
| `default` | Every sheet you build. |
|
|
71
|
+
| `headerNavigation` | Header's mobile menu. Fixed widths and a different border token. |
|
|
72
|
+
| `navigationDrawer` | NavigationDrawer's mobile menu. No padding, fixed width. |
|
|
73
|
+
|
|
74
|
+
## 5. Sizes
|
|
75
|
+
|
|
76
|
+
No size prop. `left` and `right` sheets are full height and 75% of the viewport wide, up to 24rem from 640px. `top` and `bottom` sheets are full width and as tall as their content.
|
|
77
|
+
|
|
78
|
+
## 6. States
|
|
79
|
+
|
|
80
|
+
| State | Looks like | Notes |
|
|
81
|
+
| --- | --- | --- |
|
|
82
|
+
| Closed | Only the trigger renders | SheetContent is unmounted. |
|
|
83
|
+
| Open | Scrim over the page; panel against its edge | The page behind is inert: hidden from screen readers, not clickable, not scrollable. |
|
|
84
|
+
| Hover (close button) | Close icon goes from 70% to full opacity | No background change. |
|
|
85
|
+
| Focus (close button) | 1px outline in `--focus-ring`, 1px offset | Never remove or restyle the focus ring. |
|
|
86
|
+
|
|
87
|
+
SheetTitle uses `--interactive-fg` and SheetDescription `--interactive-fg-alt`, where Drawer uses the `--container-*` pair and Dialog's title inherits. They match in the default theme; don't recolour them.
|
|
88
|
+
|
|
89
|
+
## 7. Content guidelines
|
|
90
|
+
|
|
91
|
+
- Title: name the object or the task: "Edit customer", "Filters", "Invoice INV-2041".
|
|
92
|
+
- Description: one sentence on what the sheet is for, or leave it out and pass `aria-describedby={undefined}`.
|
|
93
|
+
- Footer: the primary action names the result ("Save changes", "Apply filters"); the dismiss action is "Cancel".
|
|
94
|
+
- Sentence case everywhere.
|
|
95
|
+
|
|
96
|
+
| Do | Don't |
|
|
97
|
+
| --- | --- |
|
|
98
|
+
| Edit customer | Customer Editor |
|
|
99
|
+
| Apply filters | Submit |
|
|
100
|
+
| Cancel | Close window |
|
|
101
|
+
|
|
102
|
+
## 8. Rules
|
|
103
|
+
|
|
104
|
+
1. Always render a SheetTitle. Radix logs an error without one.
|
|
105
|
+
2. Render a SheetDescription, or pass `aria-describedby={undefined}` to SheetContent.
|
|
106
|
+
3. Open the sheet from a `SheetTrigger asChild` wrapping a Button, so focus returns to it on close.
|
|
107
|
+
4. Put Cancel in `SheetClose asChild` and the primary action last in SheetFooter.
|
|
108
|
+
5. Use `layout="default"`. The other layouts belong to Header and NavigationDrawer.
|
|
109
|
+
6. Use Drawer, not Sheet, when the user must interact with the page while the panel is open.
|
|
110
|
+
7. Never pass `className` or `style` to any Sheet part; they're dropped. Lay out the body with your own wrapper element.
|
|
111
|
+
|
|
112
|
+
## 9. Dos and don'ts
|
|
113
|
+
|
|
114
|
+
**Do:** title the sheet and pair a Cancel with one primary action.
|
|
115
|
+
|
|
116
|
+
```tsx
|
|
117
|
+
<Sheet>
|
|
118
|
+
<SheetTrigger asChild>
|
|
119
|
+
<Button type="button" variant="outline">Filters</Button>
|
|
120
|
+
</SheetTrigger>
|
|
121
|
+
<SheetContent side="right">
|
|
122
|
+
<SheetHeader>
|
|
123
|
+
<SheetTitle>Filters</SheetTitle>
|
|
124
|
+
<SheetDescription>Narrow the order list by status and date.</SheetDescription>
|
|
125
|
+
</SheetHeader>
|
|
126
|
+
{/* filter fields */}
|
|
127
|
+
<SheetFooter>
|
|
128
|
+
<SheetClose asChild>
|
|
129
|
+
<Button type="button" variant="outline">Cancel</Button>
|
|
130
|
+
</SheetClose>
|
|
131
|
+
<Button type="button" onClick={applyFilters}>Apply filters</Button>
|
|
132
|
+
</SheetFooter>
|
|
133
|
+
</SheetContent>
|
|
134
|
+
</Sheet>
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
**Don't:** build a slide-in panel from a fixed `div`, or leave the sheet untitled.
|
|
138
|
+
|
|
139
|
+
```tsx
|
|
140
|
+
<div style={{ position: "fixed", right: 0, top: 0, height: "100vh", width: 400 }}>
|
|
141
|
+
{/* filter fields */}
|
|
142
|
+
</div>
|
|
143
|
+
|
|
144
|
+
<SheetContent>
|
|
145
|
+
{/* filter fields, no SheetTitle */}
|
|
146
|
+
</SheetContent>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**Do:** use Drawer when the panel sits beside work the user is still doing.
|
|
150
|
+
|
|
151
|
+
```tsx
|
|
152
|
+
<Drawer>
|
|
153
|
+
<DrawerLayout>
|
|
154
|
+
<main style={{ flex: 1, minWidth: 0 }}>{/* the table being edited */}</main>
|
|
155
|
+
<DrawerContent side="right">{/* properties of the selected row */}</DrawerContent>
|
|
156
|
+
</DrawerLayout>
|
|
157
|
+
</Drawer>
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
**Don't:** use a Sheet for an inspector the user must keep open while clicking rows in the page; the scrim blocks the page.
|
|
161
|
+
|
|
162
|
+
```tsx
|
|
163
|
+
<Sheet modal={false}>
|
|
164
|
+
<SheetContent>{/* properties of the selected row */}</SheetContent>
|
|
165
|
+
</Sheet>
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## 10. Accessibility
|
|
169
|
+
|
|
170
|
+
- Role: `dialog` on SheetContent. SheetTrigger gets `aria-haspopup="dialog"`, `aria-expanded` and `aria-controls`.
|
|
171
|
+
- Label: SheetTitle names the sheet (`aria-labelledby`); SheetDescription describes it (`aria-describedby`). The close button's name is "Close".
|
|
172
|
+
- Keyboard: Escape closes. Tab and Shift+Tab cycle through the sheet's controls and wrap at the ends. Enter and Space activate buttons.
|
|
173
|
+
- Focus: on open, focus moves to the first focusable element, which is the close button (it's first in the DOM). Focus is trapped while open and returns to SheetTrigger on close. Everything outside is hidden from assistive technology and blocked from pointer input.
|
|
174
|
+
- Contrast: handled by the theme. Don't override colours.
|
|
175
|
+
- The built-in close button is a `--size-xxs` icon with no padding, a small pointer target. Keep a Cancel or Close Button in SheetFooter.
|
|
176
|
+
|
|
177
|
+
## 11. Behaviour
|
|
178
|
+
|
|
179
|
+
- Responsive: `left` and `right` sheets take 75% of the width on small screens and stop at 24rem from 640px. Below 640px the header centres its text and the footer stacks its buttons with the last one on top.
|
|
180
|
+
- Overflow and truncation: the panel doesn't scroll. Content taller than the viewport is cut off at the bottom edge. Keep left and right sheets to what fits, or wrap the body in a [ScrollArea](./scroll-area.md) with a bounded height.
|
|
181
|
+
- Motion: the panel slides in from its edge and the scrim fades in over 300ms, and both reverse on close. Under `prefers-reduced-motion: reduce` the animation is near instant. Don't add your own.
|
|
182
|
+
- Dismissal: Escape, a click on the scrim, the close button or a SheetClose all close it and fire `onOpenChange(false)`.
|
|
183
|
+
- Portal: SheetContent mounts in `document.body`. In a scoped theme, pass `portalContainer` to the scoped EluanProvider or wrap the region in `PortalContainerProvider`; `container` overrides it for one sheet. See `../foundations/theming.md`.
|
|
184
|
+
|
|
185
|
+
## 12. API
|
|
186
|
+
|
|
187
|
+
<!-- api:start -->
|
|
188
|
+
### Sheet
|
|
189
|
+
|
|
190
|
+
| Prop | Type | Default | Description |
|
|
191
|
+
| --- | --- | --- | --- |
|
|
192
|
+
| `open` | `boolean` | | Controlled open state. |
|
|
193
|
+
| `defaultOpen` | `boolean` | `false` | Initial state when uncontrolled. |
|
|
194
|
+
| `onOpenChange` | `(open: boolean) => void` | | Called on every open and close. |
|
|
195
|
+
| `modal` | `boolean` | `true` | `false` removes the scrim, focus trap and scroll lock. Use Drawer instead. |
|
|
196
|
+
|
|
197
|
+
### SheetTrigger, SheetClose
|
|
198
|
+
|
|
199
|
+
| Prop | Type | Default | Description |
|
|
200
|
+
| --- | --- | --- | --- |
|
|
201
|
+
| `asChild` | `boolean` | `false` | Renders the child (a Button) instead of a bare `<button type="button">`. |
|
|
202
|
+
| `...props` | Radix `Dialog.Trigger` / `Dialog.Close` props | | Native button attributes. |
|
|
203
|
+
|
|
204
|
+
### SheetContent
|
|
205
|
+
|
|
206
|
+
| Prop | Type | Default | Description |
|
|
207
|
+
| --- | --- | --- | --- |
|
|
208
|
+
| `side` | `"top" \| "right" \| "bottom" \| "left"` | `"right"` | Edge the sheet slides in from. |
|
|
209
|
+
| `layout` | `"default" \| "headerNavigation" \| "navigationDrawer"` | `"default"` | Panel layout; the other two are for Header and NavigationDrawer. |
|
|
210
|
+
| `container` | `HTMLElement \| null` | nearest `PortalContainerProvider`, then `document.body` | Element to portal into. |
|
|
211
|
+
| `onOpenAutoFocus` | `(event: Event) => void` | | `preventDefault()` and focus another element to change where focus lands. |
|
|
212
|
+
| `onCloseAutoFocus` | `(event: Event) => void` | | `preventDefault()` and focus the opener when there's no SheetTrigger. |
|
|
213
|
+
| `onEscapeKeyDown` | `(event: KeyboardEvent) => void` | | `preventDefault()` keeps the sheet open. |
|
|
214
|
+
| `onPointerDownOutside` | `(event: CustomEvent) => void` | | `preventDefault()` keeps the sheet open on a scrim click. |
|
|
215
|
+
| `aria-describedby` | `string \| undefined` | SheetDescription's id | Pass `undefined` when there's no description. |
|
|
216
|
+
| `...props` | Radix `Dialog.Content` props without `className`, `style` | | |
|
|
217
|
+
|
|
218
|
+
### SheetHeader, SheetFooter
|
|
219
|
+
|
|
220
|
+
| Prop | Type | Default | Description |
|
|
221
|
+
| --- | --- | --- | --- |
|
|
222
|
+
| `...props` | `HTMLAttributes<HTMLDivElement>` without `className`, `style` | | Layout wrappers. |
|
|
223
|
+
|
|
224
|
+
### SheetTitle, SheetDescription
|
|
225
|
+
|
|
226
|
+
| Prop | Type | Default | Description |
|
|
227
|
+
| --- | --- | --- | --- |
|
|
228
|
+
| `asChild` | `boolean` | `false` | Renders the child element instead of the `h2` / `p`. |
|
|
229
|
+
| `...props` | Radix `Dialog.Title` / `Dialog.Description` props without `className`, `style` | | |
|
|
230
|
+
|
|
231
|
+
### SheetOverlay, SheetPortal
|
|
232
|
+
|
|
233
|
+
Rendered by SheetContent. Radix `Dialog.Overlay` (without `className`, `style`) and `Dialog.Portal` props.
|
|
234
|
+
<!-- api:end -->
|
|
235
|
+
|
|
236
|
+
## 13. Examples
|
|
237
|
+
|
|
238
|
+
An edit panel for a row in a customer list. The form lives in the body; the footer's submit button points at it with `form`.
|
|
239
|
+
|
|
240
|
+
```tsx
|
|
241
|
+
import {
|
|
242
|
+
Button,
|
|
243
|
+
Input,
|
|
244
|
+
Label,
|
|
245
|
+
Sheet,
|
|
246
|
+
SheetClose,
|
|
247
|
+
SheetContent,
|
|
248
|
+
SheetDescription,
|
|
249
|
+
SheetFooter,
|
|
250
|
+
SheetHeader,
|
|
251
|
+
SheetTitle,
|
|
252
|
+
SheetTrigger,
|
|
253
|
+
} from "@eluan/core";
|
|
254
|
+
|
|
255
|
+
type Customer = { id: string; name: string; email: string };
|
|
256
|
+
|
|
257
|
+
export function EditCustomerSheet({
|
|
258
|
+
customer,
|
|
259
|
+
onSave,
|
|
260
|
+
}: {
|
|
261
|
+
customer: Customer;
|
|
262
|
+
onSave: (values: { name: string; email: string }) => void;
|
|
263
|
+
}) {
|
|
264
|
+
const formId = `edit-customer-${customer.id}`;
|
|
265
|
+
|
|
266
|
+
return (
|
|
267
|
+
<Sheet>
|
|
268
|
+
<SheetTrigger asChild>
|
|
269
|
+
<Button type="button" variant="ghost" size="sm">
|
|
270
|
+
Edit
|
|
271
|
+
</Button>
|
|
272
|
+
</SheetTrigger>
|
|
273
|
+
<SheetContent side="right">
|
|
274
|
+
<SheetHeader>
|
|
275
|
+
<SheetTitle>Edit customer</SheetTitle>
|
|
276
|
+
<SheetDescription>Changes apply to all open invoices for {customer.name}.</SheetDescription>
|
|
277
|
+
</SheetHeader>
|
|
278
|
+
<form
|
|
279
|
+
id={formId}
|
|
280
|
+
onSubmit={(event) => {
|
|
281
|
+
event.preventDefault();
|
|
282
|
+
const data = new FormData(event.currentTarget);
|
|
283
|
+
onSave({ name: String(data.get("name")), email: String(data.get("email")) });
|
|
284
|
+
}}
|
|
285
|
+
style={{ display: "flex", flexDirection: "column", gap: "var(--spacing-lg)" }}
|
|
286
|
+
>
|
|
287
|
+
<div style={{ display: "flex", flexDirection: "column", gap: "var(--spacing-sm)" }}>
|
|
288
|
+
<Label htmlFor={`${formId}-name`} required>
|
|
289
|
+
Name
|
|
290
|
+
</Label>
|
|
291
|
+
<Input id={`${formId}-name`} name="name" defaultValue={customer.name} required />
|
|
292
|
+
</div>
|
|
293
|
+
<div style={{ display: "flex", flexDirection: "column", gap: "var(--spacing-sm)" }}>
|
|
294
|
+
<Label htmlFor={`${formId}-email`} required>
|
|
295
|
+
Billing email
|
|
296
|
+
</Label>
|
|
297
|
+
<Input id={`${formId}-email`} name="email" type="email" defaultValue={customer.email} required />
|
|
298
|
+
</div>
|
|
299
|
+
</form>
|
|
300
|
+
<SheetFooter>
|
|
301
|
+
<SheetClose asChild>
|
|
302
|
+
<Button type="button" variant="outline">
|
|
303
|
+
Cancel
|
|
304
|
+
</Button>
|
|
305
|
+
</SheetClose>
|
|
306
|
+
<Button type="submit" form={formId}>
|
|
307
|
+
Save changes
|
|
308
|
+
</Button>
|
|
309
|
+
</SheetFooter>
|
|
310
|
+
</SheetContent>
|
|
311
|
+
</Sheet>
|
|
312
|
+
);
|
|
313
|
+
}
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
## 14. Related components
|
|
317
|
+
|
|
318
|
+
- [Dialog](./dialog.md): the same primitive, centred, for short decisions.
|
|
319
|
+
- [Drawer](./drawer.md): a non-modal side panel that pushes the page instead of covering it.
|
|
320
|
+
- [NavigationDrawer](./navigation-drawer.md) and [Header](./header.md): use Sheet for their mobile menus.
|
|
321
|
+
- [Popover](./popover.md): small anchored content.
|
|
322
|
+
- [ScrollArea](./scroll-area.md): scroll long sheet content.
|
|
323
|
+
|
|
324
|
+
## 15. Common agent mistakes
|
|
325
|
+
|
|
326
|
+
_Filled from evals._
|