@eluan/core 0.6.0 → 0.7.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 +14 -8
- package/bin/eluan.mjs +75 -0
- package/bin/lib/check.mjs +271 -0
- package/bin/lib/skill.mjs +123 -0
- package/dist/{action-popover-DrHKPGqw.cjs → action-popover-Bt7U0g8y.cjs} +1 -1
- package/dist/{action-popover-NkXDAHJT.js → action-popover-jEeycwXM.js} +2 -2
- package/dist/action-popover.cjs +1 -1
- package/dist/action-popover.js +1 -1
- package/dist/{avatar-kDEa0rjF.js → avatar-C1LUOzjw.js} +1 -1
- package/dist/{avatar-B-t3ctR4.cjs → avatar-SwIO4oyt.cjs} +1 -1
- package/dist/avatar.cjs +1 -1
- package/dist/avatar.js +1 -1
- package/dist/badge-BLInSFM-.cjs +1 -0
- package/dist/{badge-BLZ8V-KC.js → badge-Bj7i1Xf5.js} +12 -10
- package/dist/badge.cjs +1 -1
- package/dist/badge.js +1 -1
- package/dist/{banner-DzSp5WfQ.js → banner-BqEziMp4.js} +3 -4
- package/dist/{banner-CNdwDPqA.cjs → banner-C8OECYHz.cjs} +1 -1
- package/dist/banner.cjs +1 -1
- package/dist/banner.js +1 -1
- package/dist/{breadcrumb-BuxXkm6O.cjs → breadcrumb-BGH_YhOZ.cjs} +1 -1
- package/dist/{breadcrumb-C6qj-tDx.js → breadcrumb-BVXSOA4Z.js} +2 -2
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.js +1 -1
- package/dist/button-BUHQOcAo.cjs +1 -0
- package/dist/{button-DNSNShUc.js → button-fCYiYUPE.js} +52 -45
- package/dist/button.cjs +1 -1
- package/dist/button.js +1 -1
- package/dist/{calendar-DS5821-k.cjs → calendar-2s_jGUBa.cjs} +10 -10
- package/dist/{calendar-BA2tSwZD.js → calendar-BN9BkjO_.js} +18 -18
- package/dist/calendar.cjs +1 -1
- package/dist/calendar.js +1 -1
- package/dist/card-CfSvhkGH.js +81 -0
- package/dist/card-DlP39QSZ.cjs +1 -0
- package/dist/card.cjs +1 -1
- package/dist/card.js +1 -1
- package/dist/{carousel-Bb7jpzep.js → carousel-BO6KUdP8.js} +1 -1
- package/dist/{carousel-4AERgboz.cjs → carousel-dypuabh8.cjs} +1 -1
- package/dist/carousel.cjs +1 -1
- package/dist/carousel.js +1 -1
- package/dist/{code-block-C9u140Ob.js → code-block-CAXUOKNI.js} +10 -10
- package/dist/{code-block-_dFw7Su1.cjs → code-block-Co8uGXiG.cjs} +2 -2
- package/dist/code-block.cjs +1 -1
- package/dist/code-block.js +1 -1
- package/dist/command-C50Jkuv7.js +132 -0
- package/dist/command-DqNgPVsf.cjs +9 -0
- package/dist/command.cjs +1 -1
- package/dist/command.js +1 -1
- package/dist/components/card.d.ts +7 -2
- package/dist/components/input.d.ts +1 -1
- package/dist/components/table.d.ts +8 -4
- package/dist/components/typography.d.ts +2 -2
- package/dist/{context-menu-Bd6m1RYU.js → context-menu-CTyczUjx.js} +34 -34
- package/dist/context-menu-oQ6xMN6t.cjs +1 -0
- package/dist/context-menu.cjs +1 -1
- package/dist/context-menu.js +1 -1
- package/dist/{credit-card-input-DppPJBne.cjs → credit-card-input-C6oNQBAl.cjs} +1 -1
- package/dist/{credit-card-input-9VPlzvDm.js → credit-card-input-aYftFdRo.js} +1 -1
- package/dist/credit-card-input.cjs +1 -1
- package/dist/credit-card-input.js +1 -1
- package/dist/{date-picker-M5hLx_1s.js → date-picker-DK-G61Nn.js} +3 -3
- package/dist/{date-picker-hE7cDg2B.cjs → date-picker-D_aU_P3A.cjs} +1 -1
- package/dist/date-picker.cjs +1 -1
- package/dist/date-picker.js +1 -1
- package/dist/{datetime-picker-BeRUPJ7s.cjs → datetime-picker-897BvwxW.cjs} +1 -1
- package/dist/{datetime-picker-CIqBZYMH.js → datetime-picker-CECtSobs.js} +4 -4
- package/dist/datetime-picker.cjs +1 -1
- package/dist/datetime-picker.js +1 -1
- package/dist/decimal-input-B7IHYVXP.cjs +1 -0
- package/dist/decimal-input-ohejnbQg.js +177 -0
- package/dist/decimal-input.cjs +1 -1
- package/dist/decimal-input.js +1 -1
- package/dist/dialog-DIGW7qln.cjs +1 -0
- package/dist/{dialog-Bsfviqvy.js → dialog-DVhnZFqE.js} +23 -23
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.js +1 -1
- package/dist/dropdown-menu-BV2rX_ow.cjs +1 -0
- package/dist/dropdown-menu-C6NPtU9J.js +115 -0
- package/dist/dropdown-menu.cjs +1 -1
- package/dist/dropdown-menu.js +1 -1
- package/dist/{email-input-DIiY9Q3S.js → email-input-CRd87a_c.js} +1 -1
- package/dist/{email-input-CehmtNUq.cjs → email-input-Dvj1xSzJ.cjs} +1 -1
- package/dist/email-input.cjs +1 -1
- package/dist/email-input.js +1 -1
- package/dist/{fieldset-5V8wx-KE.js → fieldset-BxINrO_H.js} +6 -6
- package/dist/fieldset-C6cahGeV.cjs +1 -0
- package/dist/fieldset.cjs +1 -1
- package/dist/fieldset.js +1 -1
- package/dist/file-input-BzYcnore.cjs +1 -0
- package/dist/{file-input-B_aBgxmT.js → file-input-Ch16hNA1.js} +55 -55
- package/dist/file-input.cjs +1 -1
- package/dist/file-input.js +1 -1
- package/dist/{footer-fovIsy-0.cjs → footer-B-fRLhqP.cjs} +1 -1
- package/dist/{footer-jWaFq3qk.js → footer-BiiV6-ZD.js} +1 -1
- package/dist/footer.cjs +1 -1
- package/dist/footer.js +1 -1
- package/dist/header-CvhqGcuo.cjs +1 -0
- package/dist/{header-Dnf8AnIx.js → header-DwvyTpRi.js} +22 -22
- package/dist/header.cjs +1 -1
- package/dist/header.js +1 -1
- package/dist/hover-card-BQpzaazK.js +21 -0
- package/dist/{hover-card-C5KsTSZR.cjs → hover-card-V5A1HzEu.cjs} +1 -1
- package/dist/hover-card.cjs +1 -1
- package/dist/hover-card.js +1 -1
- package/dist/index.cjs +8 -8
- package/dist/index.js +490 -484
- package/dist/input-Dtr0tlf7.cjs +1 -0
- package/dist/{input-CPb9yVU5.js → input-Zs45H33i.js} +32 -29
- package/dist/input-otp-D-T32R3O.cjs +1 -0
- package/dist/input-otp-DwdX6VlR.js +95 -0
- 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/{menubar-F1_bhmku.js → menubar-CodcV4b7.js} +28 -28
- package/dist/menubar-bOYi1jKo.cjs +1 -0
- package/dist/menubar.cjs +1 -1
- package/dist/menubar.js +1 -1
- package/dist/{multi-select-CVxkWW29.js → multi-select-ChfbxrG3.js} +27 -27
- package/dist/multi-select-D573XqUT.cjs +1 -0
- package/dist/multi-select.cjs +1 -1
- package/dist/multi-select.js +1 -1
- package/dist/navigation-drawer-C7YYtBXz.js +198 -0
- package/dist/navigation-drawer-Cu2q1NMn.cjs +1 -0
- package/dist/navigation-drawer.cjs +1 -1
- package/dist/navigation-drawer.js +1 -1
- package/dist/{navigation-menu-BjA-PdMY.js → navigation-menu-BEp603xA.js} +16 -16
- package/dist/{navigation-menu-BtpLfxHN.cjs → navigation-menu-tw5cD7mL.cjs} +2 -2
- package/dist/navigation-menu.cjs +1 -1
- package/dist/navigation-menu.js +1 -1
- package/dist/number-input-C1RS-p2C.js +66 -0
- package/dist/number-input-N3-IvxZT.cjs +1 -0
- package/dist/number-input.cjs +1 -1
- package/dist/number-input.js +1 -1
- package/dist/{pagination-yKmFlFMR.cjs → pagination-C6e9oVes.cjs} +1 -1
- package/dist/{pagination-D2tjMpVU.js → pagination-XlaE-Plb.js} +31 -31
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.js +1 -1
- package/dist/{password-input-ljwdGCO6.js → password-input-CR6FT6Rh.js} +2 -2
- package/dist/{password-input-CmHubHuU.cjs → password-input-CZ19HPZd.cjs} +1 -1
- package/dist/password-input.cjs +1 -1
- package/dist/password-input.js +1 -1
- package/dist/{phone-input-B8VksCer.cjs → phone-input-BZhkLmI6.cjs} +1 -1
- package/dist/{phone-input-qTL6K8rT.js → phone-input-CT9W87M7.js} +2 -2
- package/dist/phone-input.cjs +1 -1
- package/dist/phone-input.js +1 -1
- package/dist/popover-CE0n5BQv.cjs +1 -0
- package/dist/popover-CguR4kP7.js +70 -0
- package/dist/popover.cjs +1 -1
- package/dist/popover.js +1 -1
- package/dist/{progress-ChFf9bIq.js → progress-BpUNvswZ.js} +8 -7
- package/dist/progress-DSy_jRee.cjs +1 -0
- package/dist/progress.cjs +1 -1
- package/dist/progress.js +1 -1
- package/dist/providers/create-theme.d.ts +1 -1
- package/dist/providers/eluan-provider.d.ts +8 -6
- package/dist/{rich-text-DImwK9hN.js → rich-text-CuAa5WkV.js} +21 -21
- package/dist/{rich-text-DzHLeG7W.cjs → rich-text-p7H-0qE7.cjs} +2 -2
- package/dist/rich-text.cjs +1 -1
- package/dist/rich-text.js +1 -1
- package/dist/{search-input-Dgr9kT1a.js → search-input-CxKLBmii.js} +53 -53
- package/dist/{search-input-BKTjebg7.cjs → search-input-XmoL2YjY.cjs} +1 -1
- package/dist/search-input.cjs +1 -1
- package/dist/search-input.js +1 -1
- package/dist/select-BCDam7PR.cjs +1 -0
- package/dist/select-QgjG43ye.js +119 -0
- package/dist/select.cjs +1 -1
- package/dist/select.js +1 -1
- package/dist/sheet-BxNmBMti.cjs +1 -0
- package/dist/{sheet-uiyHNKEw.js → sheet-D0hVuH9a.js} +2 -2
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.js +1 -1
- package/dist/slider-Cv7uIp4z.js +16 -0
- package/dist/slider-Dci7KGjg.cjs +1 -0
- package/dist/slider.cjs +1 -1
- package/dist/slider.js +1 -1
- package/dist/styles.css +260 -120
- package/dist/switch-DQ4R-gjR.cjs +1 -0
- package/dist/switch-WaESqUuN.js +9 -0
- package/dist/switch.cjs +1 -1
- package/dist/switch.js +1 -1
- package/dist/table-YKEWGYnI.js +149 -0
- package/dist/table-zbkgP43L.cjs +1 -0
- package/dist/table.cjs +1 -1
- package/dist/table.js +1 -1
- package/dist/{tabs-TV4_2wi1.js → tabs-BwNIi7Dl.js} +7 -7
- package/dist/tabs-DItFd2o9.cjs +1 -0
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.js +1 -1
- package/dist/textarea-BWAPWDRt.js +8 -0
- package/dist/textarea-CniUTipL.cjs +1 -0
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.js +1 -1
- package/dist/time-input-CeJVQKWO.js +195 -0
- package/dist/time-input-eVFFYo10.cjs +1 -0
- package/dist/time-input.cjs +1 -1
- package/dist/time-input.js +1 -1
- package/dist/{toast-BK0ulAzi.cjs → toast-84RpQJtn.cjs} +1 -1
- package/dist/{toast-hI3pdZ2X.js → toast-BGKaAZwf.js} +1 -1
- package/dist/toast.cjs +1 -1
- package/dist/toast.js +1 -1
- package/dist/{toggle-Bx3q15Pu.js → toggle-CxHqX2-V.js} +10 -10
- package/dist/toggle-DrJJAflI.cjs +1 -0
- package/dist/toggle-group-DvoxSJMq.cjs +1 -0
- package/dist/{toggle-group-LaZmOMx_.js → toggle-group-k-kiBnEe.js} +17 -17
- 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 → tooltip-1Biy6A0m.js} +3 -3
- package/dist/{tooltip-faf1dIXp.cjs → tooltip-DIerl2vz.cjs} +1 -1
- package/dist/tooltip.cjs +1 -1
- package/dist/tooltip.js +1 -1
- package/dist/{tree-view-DRmm6oL6.js → tree-view-Bswh2RGr.js} +38 -38
- package/dist/tree-view-DDX9QjzF.cjs +1 -0
- package/dist/tree-view.cjs +1 -1
- package/dist/tree-view.js +1 -1
- package/package.json +6 -2
- package/skills/eluan/DESIGN.md +171 -169
- package/skills/eluan/SKILL.md +47 -11
- package/skills/eluan/components/banner.md +2 -2
- package/skills/eluan/components/breadcrumb.md +1 -1
- package/skills/eluan/components/card.md +9 -8
- package/skills/eluan/components/code-block.md +1 -1
- package/skills/eluan/components/context-menu.md +1 -1
- package/skills/eluan/components/drawer.md +1 -1
- package/skills/eluan/components/dropdown-menu.md +1 -1
- package/skills/eluan/components/grid.md +4 -4
- package/skills/eluan/components/header.md +4 -4
- package/skills/eluan/components/input.md +2 -2
- package/skills/eluan/components/menubar.md +2 -2
- package/skills/eluan/components/navigation-drawer.md +8 -8
- package/skills/eluan/components/navigation-menu.md +1 -1
- package/skills/eluan/components/row.md +2 -2
- package/skills/eluan/components/segmented-control.md +1 -1
- package/skills/eluan/components/separator.md +2 -2
- package/skills/eluan/components/skeleton.md +1 -1
- package/skills/eluan/components/slider.md +1 -1
- package/skills/eluan/components/stack.md +1 -1
- package/skills/eluan/components/stepper.md +3 -3
- package/skills/eluan/components/table.md +7 -7
- package/skills/eluan/components/tabs.md +1 -1
- package/skills/eluan/components/toast.md +2 -2
- package/skills/eluan/components/typography.md +12 -9
- package/skills/eluan/foundations/colour.md +99 -94
- package/skills/eluan/foundations/elevation.md +44 -15
- package/skills/eluan/foundations/iconography.md +4 -4
- package/skills/eluan/foundations/look.md +135 -0
- package/skills/eluan/foundations/radius.md +32 -20
- package/skills/eluan/foundations/spacing.md +19 -19
- package/skills/eluan/foundations/theming.md +48 -33
- package/skills/eluan/foundations/typography.md +49 -43
- package/skills/eluan/patterns/app-shell.md +222 -0
- package/skills/eluan/patterns/dashboard.md +249 -0
- package/skills/eluan/patterns/empty-states.md +20 -26
- package/skills/eluan/patterns/navigation.md +5 -4
- package/skills/eluan/patterns/page-layout.md +104 -20
- package/dist/badge-D1A0Tc79.cjs +0 -1
- package/dist/button--_WI-fM6.cjs +0 -1
- package/dist/card-BNdR5aDa.cjs +0 -1
- package/dist/card-BSgN7WSe.js +0 -70
- package/dist/command-D02vvta9.cjs +0 -9
- package/dist/command-sUMAxm8S.js +0 -132
- package/dist/context-menu-1WehRCpR.cjs +0 -1
- package/dist/decimal-input-Bg2BPKIr.js +0 -177
- package/dist/decimal-input-CkTEjo2J.cjs +0 -1
- package/dist/dialog-DRAoumvB.cjs +0 -1
- package/dist/dropdown-menu-_h_fqgvS.cjs +0 -1
- package/dist/dropdown-menu-p0NkOoTP.js +0 -115
- package/dist/fieldset-C3aAINhi.cjs +0 -1
- package/dist/file-input-D62FEnKg.cjs +0 -1
- package/dist/header-DzItWqW4.cjs +0 -1
- package/dist/hover-card-C_FCzE41.js +0 -21
- package/dist/input-BcjL2oxv.cjs +0 -1
- package/dist/input-otp-BhJ3ERrY.cjs +0 -1
- package/dist/input-otp-CTvJztkH.js +0 -95
- package/dist/menubar-CKWQEl7c.cjs +0 -1
- package/dist/multi-select-DBFINH3F.cjs +0 -1
- package/dist/navigation-drawer-BCBFtLEq.cjs +0 -1
- package/dist/navigation-drawer-BMyHXhhX.js +0 -198
- package/dist/number-input-Cm9YPBOX.js +0 -66
- package/dist/number-input-Dr9MbuRV.cjs +0 -1
- package/dist/popover-DPc4rRsR.js +0 -70
- package/dist/popover-Db6VOysz.cjs +0 -1
- package/dist/progress-BpdmBGaX.cjs +0 -1
- package/dist/select-Cdh991T-.cjs +0 -1
- package/dist/select-Dp5AJ6I-.js +0 -119
- package/dist/sheet-CkXjinUG.cjs +0 -1
- package/dist/slider-BQmbh0Nl.js +0 -16
- package/dist/slider-DK2yk-YK.cjs +0 -1
- package/dist/switch-C2OPCq5Z.cjs +0 -1
- package/dist/switch-CXBWUZcq.js +0 -9
- package/dist/table-DopzfXYj.js +0 -101
- package/dist/table-xNu_KUaU.cjs +0 -1
- package/dist/tabs-D8p6Tr5i.cjs +0 -1
- package/dist/textarea-BnpQmE74.cjs +0 -1
- package/dist/textarea-CJRmnazN.js +0 -8
- package/dist/time-input-A603mEFQ.js +0 -195
- package/dist/time-input-qxljhdEb.cjs +0 -1
- package/dist/toggle-Z3t4jPdv.cjs +0 -1
- package/dist/toggle-group-BZIW4wJp.cjs +0 -1
- package/dist/tree-view-DVQyRQDg.cjs +0 -1
|
@@ -6,27 +6,37 @@ name: radius
|
|
|
6
6
|
|
|
7
7
|
## Overview
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Two roles carry almost every corner:
|
|
10
|
+
|
|
11
|
+
- **Controls are capsules.** Buttons, inputs, selects, segmented controls, navigation items, chips and switches all take `--control-radius`, fully round, in every corner style. A control is recognised by its shape.
|
|
12
|
+
- **Surfaces take `--surface-radius`.** Cards, tables, dialogs and panels. This is what the `data-curves` axis sets: `sharp`, `slight` or `sweeping` (the default). It also steps down in compact density and up in wide, so a tight layout doesn't carry big soft corners.
|
|
13
|
+
|
|
14
|
+
The `--curves-*` scale is for the small parts inside those two: a checkbox corner, a menu item, a tag in a table cell, a focus outline. See [theming.md](./theming.md) for the axis and [look.md](./look.md) for the roles.
|
|
10
15
|
|
|
11
16
|
## Rules
|
|
12
17
|
|
|
13
|
-
1.
|
|
14
|
-
2.
|
|
15
|
-
3. Use `--
|
|
16
|
-
4.
|
|
17
|
-
5.
|
|
18
|
+
1. A control you build takes `--control-radius`; one that grows past a single line (a textarea, a tall dropzone) takes `--control-radius-multiline`, so it doesn't turn into an ellipse.
|
|
19
|
+
2. A surface you build takes `--surface-radius`.
|
|
20
|
+
3. Use `--curves-*` only for small inner parts. Never write a radius in px, rem or %.
|
|
21
|
+
4. To make surfaces rounder or sharper everywhere, change `defaultCurves` on `EluanProvider`. Never override `--surface-radius` or `--curves-*`, and never try to square off controls: the corner style doesn't touch them.
|
|
22
|
+
5. Nest smaller inside larger: an element inside a card uses `--curves-md` or smaller.
|
|
23
|
+
6. Use `--radius-radius-full` only for circles (avatars, status dots). For a pill-shaped control use `--control-radius`.
|
|
24
|
+
7. Don't restyle a component's corners. Components already use the right role.
|
|
18
25
|
|
|
19
26
|
## Tokens
|
|
20
27
|
|
|
21
28
|
<!-- tokens:start -->
|
|
22
29
|
| Token | Value (default theme) | Use for |
|
|
23
30
|
| --- | --- | --- |
|
|
24
|
-
| `--
|
|
25
|
-
| `--
|
|
26
|
-
| `--
|
|
27
|
-
| `--curves-
|
|
28
|
-
| `--curves-
|
|
29
|
-
| `--curves-
|
|
31
|
+
| `--control-radius` | `--radius-radius-full`: a capsule in every corner style | Every control: buttons, inputs, selects, chips, nav items |
|
|
32
|
+
| `--control-radius-multiline` | half of `--size-lg`: the capsule's corner at one line's height | A control taller than one line: textarea, dropzone |
|
|
33
|
+
| `--surface-radius` | 20px (sharp 6px, slight 12px; compact 16px, wide 24px) | Cards, tables, dialogs, panels |
|
|
34
|
+
| `--curves-xxs` | 2px (sharp 1px, slight 1px) | Corner radius |
|
|
35
|
+
| `--curves-xs` | 4px (sharp 2px, slight 2px) | Corner radius |
|
|
36
|
+
| `--curves-sm` | 8px (sharp 2px, slight 4px) | Corner radius |
|
|
37
|
+
| `--curves-md` | 12px (sharp 4px, slight 6px) | Corner radius |
|
|
38
|
+
| `--curves-lg` | 16px (sharp 6px, slight 10px) | Corner radius |
|
|
39
|
+
| `--curves-xl` | 24px (sharp 8px, slight 14px) | Corner radius |
|
|
30
40
|
| `--radius-radius-full` | 999px | Pills and circles only |
|
|
31
41
|
<!-- tokens:end -->
|
|
32
42
|
|
|
@@ -34,18 +44,20 @@ Corner radius comes from `--curves-*`, which the `data-curves` axis sets globall
|
|
|
34
44
|
|
|
35
45
|
| If you need… | Use |
|
|
36
46
|
| --- | --- |
|
|
37
|
-
| a card, panel or
|
|
38
|
-
| a
|
|
39
|
-
| a
|
|
40
|
-
| a
|
|
41
|
-
|
|
|
47
|
+
| a card, panel or table container you compose | `--surface-radius`, as Card and Dialog use |
|
|
48
|
+
| a button-like or input-like element | `--control-radius` |
|
|
49
|
+
| a multi-line field or a tall drop target | `--control-radius-multiline` |
|
|
50
|
+
| a menu item, or an image inside a card | `--curves-md` |
|
|
51
|
+
| a small inner element (tag, inline code, checkbox) | `--curves-sm` |
|
|
52
|
+
| a circle | `--radius-radius-full` |
|
|
53
|
+
| sharper surfaces everywhere | `defaultCurves="slight"` or `"sharp"` |
|
|
42
54
|
|
|
43
55
|
## Dos and don'ts
|
|
44
56
|
|
|
45
|
-
**Do:** use the
|
|
57
|
+
**Do:** use the role's token and nest down a step.
|
|
46
58
|
|
|
47
59
|
```tsx
|
|
48
|
-
<div style={{ borderRadius: "var(--
|
|
60
|
+
<div style={{ borderRadius: "var(--surface-radius)", padding: "var(--spacing-xl)" }}>
|
|
49
61
|
<img src="/cover.png" alt="" style={{ borderRadius: "var(--curves-md)", width: "100%" }} />
|
|
50
62
|
</div>
|
|
51
63
|
```
|
|
@@ -53,7 +65,7 @@ Corner radius comes from `--curves-*`, which the `data-curves` axis sets globall
|
|
|
53
65
|
**Don't:** hardcode a radius or override the axis.
|
|
54
66
|
|
|
55
67
|
```tsx
|
|
56
|
-
<div style={{ borderRadius: 12, "--
|
|
68
|
+
<div style={{ borderRadius: 12, "--surface-radius": "20px" } as React.CSSProperties} />
|
|
57
69
|
```
|
|
58
70
|
|
|
59
71
|
## Common agent mistakes
|
|
@@ -6,7 +6,7 @@ name: spacing
|
|
|
6
6
|
|
|
7
7
|
## Overview
|
|
8
8
|
|
|
9
|
-
Two density-aware scales control space and size. `--spacing-*` is for gaps, padding and margins. `--size-*` is for fixed dimensions: control heights, icon boxes, avatars. Both change with the `data-spacing` axis (`compact`, `standard`, `wide`), so a layout built on them re-densifies with one Provider setting. See [theming.md](./theming.md).
|
|
9
|
+
Two density-aware scales control space and size. `--spacing-*` is for gaps, padding and margins. `--size-*` is for fixed dimensions: control heights, icon boxes, avatars. Both change with the `data-spacing` axis (`compact`, `standard`, `wide`), so a layout built on them re-densifies with one Provider setting. Density moves space and control size only: text stays the same size in all three, so a dense table stays readable. A standard control is 28, 36 or 44px tall; the surface radius steps with density too (see [radius.md](./radius.md)). See [theming.md](./theming.md).
|
|
10
10
|
|
|
11
11
|
Steps run `xxs`, `xs`, `sm`, `md`, `lg`, `xl`, `2xl`, `3xl`, `4xl`.
|
|
12
12
|
|
|
@@ -17,7 +17,7 @@ Steps run `xxs`, `xs`, `sm`, `md`, `lg`, `xl`, `2xl`, `3xl`, `4xl`.
|
|
|
17
17
|
3. Never write px, rem or em for space or size.
|
|
18
18
|
4. Prefer `gap` on a parent over margins on children. [Stack](../components/stack.md), [Row](../components/row.md) and [Grid](../components/grid.md) take these steps by name: `gap="md"`, `pad="xl"`.
|
|
19
19
|
5. Never use `--spacing-xxs` for a border or line: it is 0 in compact density. Use a border token or the Separator component.
|
|
20
|
-
6. Never divide or multiply spacing tokens with `calc()` to invent a new step. Pick the nearest step.
|
|
20
|
+
6. Never divide or multiply spacing or size tokens with `calc()` to invent a new step. Pick the nearest step; for a height no step covers, such as a chart, use AspectRatio.
|
|
21
21
|
7. Don't pad inside components. Card, Dialog, Fieldset and Popover already pad their content.
|
|
22
22
|
|
|
23
23
|
## Tokens
|
|
@@ -29,20 +29,20 @@ Steps run `xxs`, `xs`, `sm`, `md`, `lg`, `xl`, `2xl`, `3xl`, `4xl`.
|
|
|
29
29
|
| `--spacing-xs` | 4px (compact 2px, wide 8px) | Gap, padding, margin |
|
|
30
30
|
| `--spacing-sm` | 6px (compact 4px, wide 12px) | Gap, padding, margin |
|
|
31
31
|
| `--spacing-md` | 10px (compact 8px, wide 16px) | Gap, padding, margin |
|
|
32
|
-
| `--spacing-lg` | 14px (compact
|
|
33
|
-
| `--spacing-xl` | 18px (compact
|
|
34
|
-
| `--spacing-2xl` | 20px (compact
|
|
35
|
-
| `--spacing-3xl` | 32px (compact 24px, wide
|
|
36
|
-
| `--spacing-4xl` | 64px (compact 32px, wide
|
|
37
|
-
| `--size-xxs` | 14px (compact 12px, wide
|
|
38
|
-
| `--size-xs` | 18px (compact 16px, wide
|
|
39
|
-
| `--size-sm` | 22px (compact
|
|
40
|
-
| `--size-md` | 28px (compact
|
|
41
|
-
| `--size-lg` | 36px (compact
|
|
42
|
-
| `--size-xl` | 44px (compact
|
|
43
|
-
| `--size-2xl` | 56px (compact
|
|
44
|
-
| `--size-3xl` | 80px (compact 64px, wide
|
|
45
|
-
| `--size-4xl` | 120px (compact 96px, wide
|
|
32
|
+
| `--spacing-lg` | 14px (compact 10px, wide 20px) | Gap, padding, margin |
|
|
33
|
+
| `--spacing-xl` | 18px (compact 14px, wide 24px) | Gap, padding, margin |
|
|
34
|
+
| `--spacing-2xl` | 20px (compact 16px, wide 32px) | Gap, padding, margin |
|
|
35
|
+
| `--spacing-3xl` | 32px (compact 24px, wide 40px) | Gap, padding, margin |
|
|
36
|
+
| `--spacing-4xl` | 64px (compact 32px, wide 80px) | Gap, padding, margin |
|
|
37
|
+
| `--size-xxs` | 14px (compact 12px, wide 16px) | Control height, icon size |
|
|
38
|
+
| `--size-xs` | 18px (compact 16px, wide 20px) | Control height, icon size |
|
|
39
|
+
| `--size-sm` | 22px (compact 18px, wide 28px) | Control height, icon size |
|
|
40
|
+
| `--size-md` | 28px (compact 22px, wide 36px) | Control height, icon size |
|
|
41
|
+
| `--size-lg` | 36px (compact 28px, wide 44px) | Control height, icon size |
|
|
42
|
+
| `--size-xl` | 44px (compact 36px, wide 56px) | Control height, icon size |
|
|
43
|
+
| `--size-2xl` | 56px (compact 44px, wide 64px) | Control height, icon size |
|
|
44
|
+
| `--size-3xl` | 80px (compact 64px, wide 96px) | Control height, icon size |
|
|
45
|
+
| `--size-4xl` | 120px (compact 96px, wide 160px) | Control height, icon size |
|
|
46
46
|
<!-- tokens:end -->
|
|
47
47
|
|
|
48
48
|
## Choosing a value
|
|
@@ -57,7 +57,7 @@ Component values come from the component source; page-level values are drafts.
|
|
|
57
57
|
| padding inside a dialog or sheet | Dialog and Sheet handle it (`--spacing-lg`) |
|
|
58
58
|
| space between inline items (icon and text, buttons in a row) | `--spacing-xs` to `--spacing-sm` |
|
|
59
59
|
| space between sections of a page | `--spacing-3xl` |
|
|
60
|
-
| page gutter | `--spacing-xl` |
|
|
60
|
+
| page gutter | `--spacing-xl`: `pad="xl"` on the page's `main`, as the Dashboard example in docs/layout.md does |
|
|
61
61
|
| an icon box inside a control | `--size-xxs` |
|
|
62
62
|
| a standard control height | the component sets it (`--size-lg` default, `--size-md` small, `--size-xl` large) |
|
|
63
63
|
|
|
@@ -66,10 +66,10 @@ Component values come from the component source; page-level values are drafts.
|
|
|
66
66
|
**Do:** space with gap and tokens.
|
|
67
67
|
|
|
68
68
|
```tsx
|
|
69
|
-
<
|
|
69
|
+
<Stack gap="lg">
|
|
70
70
|
<Input aria-label="Email" type="email" />
|
|
71
71
|
<Input aria-label="Password" type="password" />
|
|
72
|
-
</
|
|
72
|
+
</Stack>
|
|
73
73
|
```
|
|
74
74
|
|
|
75
75
|
**Don't:** use raw values or margins on each child.
|
|
@@ -10,48 +10,54 @@ Eluan's look comes from CSS custom properties in three layers: primitives (raw v
|
|
|
10
10
|
|
|
11
11
|
| Attribute | Values | Set with | Controls |
|
|
12
12
|
| --- | --- | --- | --- |
|
|
13
|
-
| `data-theme` | `
|
|
13
|
+
| `data-theme` | `eluan` or a custom theme name | `defaultTheme`, `setTheme` | the grey ramp, the accent, the status colours and the font families |
|
|
14
14
|
| `data-mode` | `light`, `dim`, `dark` | `defaultMode`, `setMode` | which mode aliases the theme resolves against |
|
|
15
|
-
| `data-spacing` | `compact`, `standard`, `wide` | `defaultSpacing`, `setSpacing` | every `--spacing-*` and `--size
|
|
16
|
-
| `data-curves` | `sharp`, `slight`, `sweeping` | `defaultCurves`, `setCurves` |
|
|
17
|
-
| `data-typeset` | `small`, `medium`, `large`, or absent | `defaultTypeset`, `setTypeset` | absent keeps type fluid;
|
|
15
|
+
| `data-spacing` | `compact`, `standard`, `wide` | `defaultSpacing`, `setSpacing` | every `--spacing-*` and `--size-*`: the room around text, never the text |
|
|
16
|
+
| `data-curves` | `sharp`, `slight`, `sweeping` (default) | `defaultCurves`, `setCurves` | `--surface-radius` and the `--curves-*` scale. Controls stay capsules |
|
|
17
|
+
| `data-typeset` | `app`, `small`, `medium`, `large`, or absent | `defaultTypeset`, `setTypeset` | absent keeps type fluid; `app` pins the whole-pixel scale for app screens; the others pin one column of the fluid scale |
|
|
18
18
|
|
|
19
|
-
`
|
|
19
|
+
`eluan` is the only built-in theme: concrete greys (a warm, faintly green grey) with blaze orange as the accent. A brand theme is a custom theme made with `createTheme()`, usually from `@eluan/theme-generator` output. It changes colour only. The look (what is flat, raised, lit and recessed; see [look.md](./look.md)) is the same in every theme.
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
A theme is two decisions: the grey and the accent.
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
- **The grey ramp**, `--color-neutral-0` to `--color-neutral-950`. Every mode builds its surfaces, text and borders from it: paper at 50, the hairline at 100, ink at 800, the dark ground at 950. The generator tints it toward a colour you name (`neutral`, a hex or `"none"`; the first accent if you name none) and by how much (`neutralTint`, 0 to 1).
|
|
24
|
+
- **The accent.** The primary action is the colour exactly as picked, in light, dim and dark, with white text on it. Switches, checks, sliders, progress and the focus ring take it from there.
|
|
25
|
+
|
|
26
|
+
The generator also derives status and chart colours and takes a minimum contrast ratio (default 4.5). Corner style, density and type scale are Provider axes, not generator output.
|
|
27
|
+
|
|
28
|
+
Contrast is checked when the theme is generated. The generator auto-corrects any foreground and background pair that falls below the minimum, moving the foreground the fewest steps along its own ramp that pass, and lists the corrections in its report. That's why you never override colour pairs by hand. One pair is held to 3:1 instead: white on the accent, which is part of the look (about 3.3:1 on the built-in orange). An accent too light for white gets dark text automatically; the report says when the primary button's text is under the configured minimum.
|
|
24
29
|
|
|
25
30
|
## Rules
|
|
26
31
|
|
|
27
32
|
1. Change the look through the theme or a Provider axis. Never restyle a single component.
|
|
28
33
|
2. Get brand colours from the theme generator. Never hand-pick hex values for semantic tokens.
|
|
29
34
|
3. Never override one token of a foreground and background pair. Regenerate the theme instead, so contrast stays checked.
|
|
30
|
-
4. Use `defaultCurves` for corner style and `defaultSpacing` for density. Don't override `--curves-*` or `--spacing-*` values.
|
|
35
|
+
4. Use `defaultCurves` for corner style and `defaultSpacing` for density. Don't override `--surface-radius`, `--curves-*` or `--spacing-*` values.
|
|
31
36
|
5. Let `EluanProvider` own the `data-*` attributes. Never set them in your own effects.
|
|
32
37
|
6. Use `useEluanTheme()` to read or change theme, mode, spacing, curves and typeset at runtime.
|
|
33
38
|
7. Never add a second built-in theme to the library. Custom themes live in the app.
|
|
34
|
-
8. Give custom themes a unique name that starts with a letter. `
|
|
39
|
+
8. Give custom themes a unique name that starts with a letter. `eluan` is taken.
|
|
40
|
+
9. A theme sets colour and fonts. Never use one to change the look: don't override `--control-*`, `--surface-*`, `--shell-*` or `--elevation-*` in a theme.
|
|
35
41
|
|
|
36
42
|
## Tokens
|
|
37
43
|
|
|
38
|
-
These are the
|
|
44
|
+
These are the tokens a custom theme sets: the grey ramp and the fonts, plus the accent (`--action-primary-*`) and the status colours listed in [colour.md](./colour.md).
|
|
39
45
|
|
|
40
46
|
<!-- tokens:start -->
|
|
41
47
|
| Token | Value (default theme) | Use for |
|
|
42
48
|
| --- | --- | --- |
|
|
43
|
-
| `--color-neutral-0` | `--color-
|
|
44
|
-
| `--color-neutral-50` | `--color-
|
|
45
|
-
| `--color-neutral-100` | `--color-
|
|
46
|
-
| `--color-neutral-200` | `--color-
|
|
47
|
-
| `--color-neutral-300` | `--color-
|
|
48
|
-
| `--color-neutral-400` | `--color-
|
|
49
|
-
| `--color-neutral-500` | `--color-
|
|
50
|
-
| `--color-neutral-600` | `--color-
|
|
51
|
-
| `--color-neutral-700` | `--color-
|
|
52
|
-
| `--color-neutral-800` | `--color-
|
|
53
|
-
| `--color-neutral-900` | `--color-
|
|
54
|
-
| `--color-neutral-950` | `--color-
|
|
49
|
+
| `--color-neutral-0` | `--color-concrete-0` → oklch(1.0000 0.0000 0.00) | Theme's neutral ramp; modes derive backgrounds and foregrounds from it |
|
|
50
|
+
| `--color-neutral-50` | `--color-concrete-50` → oklch(0.9868 0.0028 128.49) | Theme's neutral ramp; modes derive backgrounds and foregrounds from it |
|
|
51
|
+
| `--color-neutral-100` | `--color-concrete-100` → oklch(0.9522 0.0070 124.45) | Theme's neutral ramp; modes derive backgrounds and foregrounds from it |
|
|
52
|
+
| `--color-neutral-200` | `--color-concrete-200` → oklch(0.8827 0.0165 118.16) | Theme's neutral ramp; modes derive backgrounds and foregrounds from it |
|
|
53
|
+
| `--color-neutral-300` | `--color-concrete-300` → oklch(0.8111 0.0267 118.99) | Theme's neutral ramp; modes derive backgrounds and foregrounds from it |
|
|
54
|
+
| `--color-neutral-400` | `--color-concrete-400` → oklch(0.7378 0.0385 119.16) | Theme's neutral ramp; modes derive backgrounds and foregrounds from it |
|
|
55
|
+
| `--color-neutral-500` | `--color-concrete-500` → oklch(0.6639 0.0492 118.51) | Theme's neutral ramp; modes derive backgrounds and foregrounds from it |
|
|
56
|
+
| `--color-neutral-600` | `--color-concrete-600` → oklch(0.5744 0.0466 119.64) | Theme's neutral ramp; modes derive backgrounds and foregrounds from it |
|
|
57
|
+
| `--color-neutral-700` | `--color-concrete-700` → oklch(0.4767 0.0377 119.25) | Theme's neutral ramp; modes derive backgrounds and foregrounds from it |
|
|
58
|
+
| `--color-neutral-800` | `--color-concrete-800` → oklch(0.3738 0.0284 118.54) | Theme's neutral ramp; modes derive backgrounds and foregrounds from it |
|
|
59
|
+
| `--color-neutral-900` | `--color-concrete-900` → oklch(0.2982 0.0213 119.11) | Theme's neutral ramp; modes derive backgrounds and foregrounds from it |
|
|
60
|
+
| `--color-neutral-950` | `--color-concrete-950` → oklch(0.2257 0.0152 119.03) | Theme's neutral ramp; modes derive backgrounds and foregrounds from it |
|
|
55
61
|
| `--font-heading` | "Inter Variable" | Headings |
|
|
56
62
|
| `--font-body` | "Inter Variable" | Body text and UI |
|
|
57
63
|
| `--font-mono` | "Paper Mono" | Code and tabular figures |
|
|
@@ -62,7 +68,7 @@ These are the theme-level tokens a custom theme most often changes. The full sem
|
|
|
62
68
|
From the CLI (writes `custom-theme.css` and `create-theme.json` for applying the theme, plus `primitives.json`, `semantic.json`, `theme.css`, `preview.html` and `report.md`, to the output directory):
|
|
63
69
|
|
|
64
70
|
```bash
|
|
65
|
-
pnpm dlx @eluan/theme-generator generate --accent "#2F6F5E" --name forest --out ./src/theme
|
|
71
|
+
pnpm dlx @eluan/theme-generator generate --accent "#2F6F5E" --neutral "#7A8C82" --name forest --out ./src/theme
|
|
66
72
|
```
|
|
67
73
|
|
|
68
74
|
From code (pure colour maths, runs in Node and the browser):
|
|
@@ -77,12 +83,20 @@ const result = generateTheme({
|
|
|
77
83
|
neutralTintRatio: 0.04,
|
|
78
84
|
});
|
|
79
85
|
|
|
80
|
-
result.customTheme; // ready for EluanProvider's customThemes: light and dark, layered on
|
|
81
|
-
result.createThemeOptions; // { tokens, modes: { dark } } for createTheme()
|
|
86
|
+
result.customTheme; // ready for EluanProvider's customThemes: light, dim and dark, layered on eluan
|
|
87
|
+
result.createThemeOptions; // { tokens, modes: { dim, dark } } for createTheme()
|
|
82
88
|
result.report; // markdown: warnings and contrast corrections
|
|
83
89
|
```
|
|
84
90
|
|
|
85
|
-
|
|
91
|
+
The output is small on purpose: the grey ramp, the primary action and the status and chart colours. Surface, text and border tokens are not in it, because the base theme builds them from the ramp in every mode. Don't add them back by hand.
|
|
92
|
+
|
|
93
|
+
To tint the greys toward a colour other than the accent, pass `neutral` (and `neutralTint` for strength):
|
|
94
|
+
|
|
95
|
+
```ts
|
|
96
|
+
generateTheme({ accents: ["#FF5100"], neutral: "#909876", themeName: "brand", minContrast: 4.5, neutralTintRatio: 0.04 });
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Status and chart colours come out brighter in dark mode (`darkLift`, 0.08 by default) and quieter in dim (`dimChroma`, 0.8), with contrast still checked for every pair. The primary action is not adjusted: it is the picked colour in every mode. Don't brighten or tone colours by hand.
|
|
86
100
|
|
|
87
101
|
The accent hex is the one place a raw colour belongs: it's generator input, not a token value. Keep the generator call or its output in the app's source, next to the code that registers the theme.
|
|
88
102
|
|
|
@@ -97,7 +111,7 @@ const { customTheme: forest } = generateTheme({ accents: ["#2F6F5E"], themeName:
|
|
|
97
111
|
|
|
98
112
|
export function App({ children }: { children: React.ReactNode }) {
|
|
99
113
|
return (
|
|
100
|
-
<EluanProvider customThemes={[forest]} defaultTheme="forest"
|
|
114
|
+
<EluanProvider customThemes={[forest]} defaultTheme="forest">
|
|
101
115
|
{children}
|
|
102
116
|
</EluanProvider>
|
|
103
117
|
);
|
|
@@ -106,16 +120,16 @@ export function App({ children }: { children: React.ReactNode }) {
|
|
|
106
120
|
export function ThemeSwitch() {
|
|
107
121
|
const { theme, setTheme } = useEluanTheme();
|
|
108
122
|
return (
|
|
109
|
-
<button type="button" onClick={() => setTheme(theme === "forest" ? "
|
|
123
|
+
<button type="button" onClick={() => setTheme(theme === "forest" ? "eluan" : "forest")}>
|
|
110
124
|
Switch theme
|
|
111
125
|
</button>
|
|
112
126
|
);
|
|
113
127
|
}
|
|
114
128
|
```
|
|
115
129
|
|
|
116
|
-
The Provider sets `data-theme="
|
|
130
|
+
The Provider sets `data-theme="eluan"` plus `data-theme-custom="forest"`, injects the theme's CSS once, and applies its dim and dark values with `data-mode`.
|
|
117
131
|
|
|
118
|
-
To mix generated colours with tokens of your own (fonts, say), use `createTheme`, which extends `
|
|
132
|
+
To mix generated colours with tokens of your own (fonts, say), use `createTheme`, which extends `eluan` and takes per-mode overrides under `modes`:
|
|
119
133
|
|
|
120
134
|
```tsx
|
|
121
135
|
import { createTheme } from "@eluan/core";
|
|
@@ -130,7 +144,7 @@ export const forest = createTheme({
|
|
|
130
144
|
});
|
|
131
145
|
```
|
|
132
146
|
|
|
133
|
-
Don't apply `result.css.theme`
|
|
147
|
+
Don't apply `createThemeTokens` alone: it has no dim or dark values. `result.css.theme` is for pages without `EluanProvider`; it needs `data-theme` and `data-mode` on the same element.
|
|
134
148
|
|
|
135
149
|
Dark mode, density and corner style are separate axes:
|
|
136
150
|
|
|
@@ -152,7 +166,8 @@ To theme one region, point an `EluanProvider` at that element with `target`, and
|
|
|
152
166
|
| If you need… | Use |
|
|
153
167
|
| --- | --- |
|
|
154
168
|
| a brand colour | the theme generator's `customTheme`, registered with `customThemes` |
|
|
155
|
-
|
|
|
169
|
+
| sharper surfaces everywhere | `defaultCurves="slight"` or `"sharp"` |
|
|
170
|
+
| greys that lean toward a brand colour | the generator's `neutral` and `neutralTint` |
|
|
156
171
|
| a denser or roomier UI | `defaultSpacing="compact"` or `"wide"` |
|
|
157
172
|
| a dark mode toggle | a Switch that calls `setMode` from `useEluanTheme()` |
|
|
158
173
|
| a different font | override `--font-heading` and `--font-body` in `createTheme` |
|
|
@@ -166,7 +181,7 @@ To theme one region, point an `EluanProvider` at that element with `target`, and
|
|
|
166
181
|
```tsx
|
|
167
182
|
const { customTheme: brand } = generateTheme({ accents: ["#2F6F5E"], themeName: "brand", minContrast: 4.5, neutralTintRatio: 0.04 });
|
|
168
183
|
|
|
169
|
-
<EluanProvider customThemes={[brand]} defaultTheme="brand"
|
|
184
|
+
<EluanProvider customThemes={[brand]} defaultTheme="brand">
|
|
170
185
|
<App />
|
|
171
186
|
</EluanProvider>;
|
|
172
187
|
```
|
|
@@ -8,6 +8,8 @@ name: typography
|
|
|
8
8
|
|
|
9
9
|
Eluan's type scale is fluid: ten steps (`step-6` down to `step-neg3`) that interpolate with the viewport between 480px and 1024px, so text resizes with no media queries in app code. Each step has a size, a line height and a letter spacing, and they always travel together. `data-typeset` on any element pins the scale to its small, medium or large column; leave it off to stay fluid.
|
|
10
10
|
|
|
11
|
+
There is a second scale for app screens. `data-typeset="app"` (set it with `<EluanProvider defaultTypeset="app">`) pins every step to a whole-pixel size, 11, 12, 13, 14, 16, 20, 24, 28, 32 and 40, with line heights on a 4px grid, tracking set per size, and headings a weight heavier. Dashboards, tables and settings screens use it; marketing pages, docs and articles stay on the fluid scale. The token names are the same on both, so nothing else in your code changes.
|
|
12
|
+
|
|
11
13
|
The `Typography` component is the front door to the scale. Its `variant` picks a step, a family, a weight and a default element in one prop:
|
|
12
14
|
|
|
13
15
|
| Variant | Step | Family | Default element |
|
|
@@ -23,7 +25,7 @@ The `Typography` component is the front door to the scale. Its `variant` picks a
|
|
|
23
25
|
|
|
24
26
|
`tone` is `default`, `muted` (`--container-fg-alt`) or `inverse`; `positive` and `destructive` for status text; `interactive` and `interactive-muted` for text on a control you build; `inherit` for the parent's colour.
|
|
25
27
|
|
|
26
|
-
The `--font-size-xs` to `--font-size-5xl` aliases map onto steps
|
|
28
|
+
The `--font-size-xs` to `--font-size-5xl` aliases map onto steps, the same step in every density: `data-spacing` changes the room around text, never the text. To change text size, pin a typeset. Components use the aliases; app text should use `Typography`.
|
|
27
29
|
|
|
28
30
|
## Rules
|
|
29
31
|
|
|
@@ -32,8 +34,8 @@ The `--font-size-xs` to `--font-size-5xl` aliases map onto steps and shift one s
|
|
|
32
34
|
3. If you style text yourself, apply all three tokens of one step together, for example `--font-size-step-1`, `--line-height-step-1` and `--letter-spacing-step-1`.
|
|
33
35
|
4. Never write a font size, line height or letter spacing in px, rem or em.
|
|
34
36
|
5. Use `--font-heading`, `--font-body` and `--font-mono` for families. Change fonts only in the theme.
|
|
35
|
-
6. Use one `title` or `display` per page.
|
|
36
|
-
7. Don't pin `
|
|
37
|
+
6. Use one `title` or `display` per page. `display` and `lead` belong to content pages; on an app screen, set `title` and `heading` with `size` (see Choosing a value).
|
|
38
|
+
7. Pin `data-typeset="app"` for an app of app screens. Don't pin `small`, `medium` or `large` unless a region must not resize (for example a fixed-size canvas).
|
|
37
39
|
|
|
38
40
|
## Tokens
|
|
39
41
|
|
|
@@ -43,33 +45,33 @@ The `--font-size-xs` to `--font-size-5xl` aliases map onto steps and shift one s
|
|
|
43
45
|
| `--font-heading` | "Inter Variable" | Headings |
|
|
44
46
|
| `--font-body` | "Inter Variable" | Body text and UI |
|
|
45
47
|
| `--font-mono` | "Paper Mono" | Code and tabular figures |
|
|
46
|
-
| `--font-size-xs` | `--font-size-step-neg2`
|
|
47
|
-
| `--font-size-sm` | `--font-size-step-neg1`
|
|
48
|
-
| `--font-size-base` | `--font-size-step-0`
|
|
49
|
-
| `--font-size-lg` | `--font-size-step-1`
|
|
50
|
-
| `--font-size-xl` | `--font-size-step-2`
|
|
51
|
-
| `--font-size-2xl` | `--font-size-step-3`
|
|
52
|
-
| `--font-size-3xl` | `--font-size-step-4`
|
|
53
|
-
| `--font-size-4xl` | `--font-size-step-5`
|
|
54
|
-
| `--font-size-5xl` | `--font-size-step-6`
|
|
55
|
-
| `--line-height-xs` | `--line-height-step-neg2`
|
|
56
|
-
| `--line-height-sm` | `--line-height-step-neg1`
|
|
57
|
-
| `--line-height-base` | `--line-height-step-0`
|
|
58
|
-
| `--line-height-lg` | `--line-height-step-1`
|
|
59
|
-
| `--line-height-xl` | `--line-height-step-2`
|
|
60
|
-
| `--line-height-2xl` | `--line-height-step-3`
|
|
61
|
-
| `--line-height-3xl` | `--line-height-step-4`
|
|
62
|
-
| `--line-height-4xl` | `--line-height-step-5`
|
|
63
|
-
| `--line-height-5xl` | `--line-height-step-6`
|
|
64
|
-
| `--letter-spacing-xs` | `--letter-spacing-step-neg2`
|
|
65
|
-
| `--letter-spacing-sm` | `--letter-spacing-step-neg1`
|
|
66
|
-
| `--letter-spacing-base` | `--letter-spacing-step-0`
|
|
67
|
-
| `--letter-spacing-lg` | `--letter-spacing-step-1`
|
|
68
|
-
| `--letter-spacing-xl` | `--letter-spacing-step-2`
|
|
69
|
-
| `--letter-spacing-2xl` | `--letter-spacing-step-3`
|
|
70
|
-
| `--letter-spacing-3xl` | `--letter-spacing-step-4`
|
|
71
|
-
| `--letter-spacing-4xl` | `--letter-spacing-step-5`
|
|
72
|
-
| `--letter-spacing-5xl` | `--letter-spacing-step-6`
|
|
48
|
+
| `--font-size-xs` | `--font-size-step-neg2` | Type size alias components use; the same in every density |
|
|
49
|
+
| `--font-size-sm` | `--font-size-step-neg1` | Type size alias components use; the same in every density |
|
|
50
|
+
| `--font-size-base` | `--font-size-step-0` | Type size alias components use; the same in every density |
|
|
51
|
+
| `--font-size-lg` | `--font-size-step-1` | Type size alias components use; the same in every density |
|
|
52
|
+
| `--font-size-xl` | `--font-size-step-2` | Type size alias components use; the same in every density |
|
|
53
|
+
| `--font-size-2xl` | `--font-size-step-3` | Type size alias components use; the same in every density |
|
|
54
|
+
| `--font-size-3xl` | `--font-size-step-4` | Type size alias components use; the same in every density |
|
|
55
|
+
| `--font-size-4xl` | `--font-size-step-5` | Type size alias components use; the same in every density |
|
|
56
|
+
| `--font-size-5xl` | `--font-size-step-6` | Type size alias components use; the same in every density |
|
|
57
|
+
| `--line-height-xs` | `--line-height-step-neg2` | Line height for the same-named --font-size-* alias |
|
|
58
|
+
| `--line-height-sm` | `--line-height-step-neg1` | Line height for the same-named --font-size-* alias |
|
|
59
|
+
| `--line-height-base` | `--line-height-step-0` | Line height for the same-named --font-size-* alias |
|
|
60
|
+
| `--line-height-lg` | `--line-height-step-1` | Line height for the same-named --font-size-* alias |
|
|
61
|
+
| `--line-height-xl` | `--line-height-step-2` | Line height for the same-named --font-size-* alias |
|
|
62
|
+
| `--line-height-2xl` | `--line-height-step-3` | Line height for the same-named --font-size-* alias |
|
|
63
|
+
| `--line-height-3xl` | `--line-height-step-4` | Line height for the same-named --font-size-* alias |
|
|
64
|
+
| `--line-height-4xl` | `--line-height-step-5` | Line height for the same-named --font-size-* alias |
|
|
65
|
+
| `--line-height-5xl` | `--line-height-step-6` | Line height for the same-named --font-size-* alias |
|
|
66
|
+
| `--letter-spacing-xs` | `--letter-spacing-step-neg2` | Tracking for the same-named --font-size-* alias |
|
|
67
|
+
| `--letter-spacing-sm` | `--letter-spacing-step-neg1` | Tracking for the same-named --font-size-* alias |
|
|
68
|
+
| `--letter-spacing-base` | `--letter-spacing-step-0` | Tracking for the same-named --font-size-* alias |
|
|
69
|
+
| `--letter-spacing-lg` | `--letter-spacing-step-1` | Tracking for the same-named --font-size-* alias |
|
|
70
|
+
| `--letter-spacing-xl` | `--letter-spacing-step-2` | Tracking for the same-named --font-size-* alias |
|
|
71
|
+
| `--letter-spacing-2xl` | `--letter-spacing-step-3` | Tracking for the same-named --font-size-* alias |
|
|
72
|
+
| `--letter-spacing-3xl` | `--letter-spacing-step-4` | Tracking for the same-named --font-size-* alias |
|
|
73
|
+
| `--letter-spacing-4xl` | `--letter-spacing-step-5` | Tracking for the same-named --font-size-* alias |
|
|
74
|
+
| `--letter-spacing-5xl` | `--letter-spacing-step-6` | Tracking for the same-named --font-size-* alias |
|
|
73
75
|
| `--font-size-step-6` | 41.81px → 68.66px, fluid | Type step; apply with its line-height and letter-spacing |
|
|
74
76
|
| `--font-size-step-5` | 34.84px → 54.93px, fluid | Type step; apply with its line-height and letter-spacing |
|
|
75
77
|
| `--font-size-step-4` | 29.03px → 43.95px, fluid | Type step; apply with its line-height and letter-spacing |
|
|
@@ -104,16 +106,19 @@ The `--font-size-xs` to `--font-size-5xl` aliases map onto steps and shift one s
|
|
|
104
106
|
|
|
105
107
|
## Choosing a value
|
|
106
108
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
|
110
|
-
|
|
|
111
|
-
| a
|
|
112
|
-
|
|
|
113
|
-
|
|
|
114
|
-
|
|
|
115
|
-
|
|
|
116
|
-
|
|
|
109
|
+
First decide whether the page is a content page (read: marketing, docs, articles) or an app screen (work: dashboards, tables, settings, anything inside an app shell). [page-layout.md](../patterns/page-layout.md) explains the split. An app screen keeps the variant for the role and adds `size`, so headings sit on the same scale as the controls and tables beside them.
|
|
110
|
+
|
|
111
|
+
| If you need… | Content page | App screen |
|
|
112
|
+
| --- | --- | --- |
|
|
113
|
+
| a page title | `<Typography variant="title" as="h1">` | `<Typography variant="title" as="h1" size="xl">` |
|
|
114
|
+
| a line under the title | `<Typography variant="lead">` | `<Typography size="sm" tone="muted">` |
|
|
115
|
+
| a section heading | `<Typography variant="heading" as="h2">` | `<Typography variant="heading" as="h2" size="lg">` |
|
|
116
|
+
| a card or group heading | `<Typography variant="subheading" as="h3">`, or CardTitle inside a Card | `<Typography variant="subheading" as="h3" size="base">` |
|
|
117
|
+
| body copy | `<Typography variant="body">` | `<Typography size="sm">` |
|
|
118
|
+
| helper or meta text | `<Typography variant="caption" tone="muted">` | the same |
|
|
119
|
+
| a number in a column | `tabular` on either | `<Typography as="span" size="sm" tabular>` |
|
|
120
|
+
| a form label | Label (from `components/form-label.md`), not Typography | the same |
|
|
121
|
+
| code | CodeBlock or Kbd; `--font-mono` if composing | the same |
|
|
117
122
|
|
|
118
123
|
## Dos and don'ts
|
|
119
124
|
|
|
@@ -125,8 +130,8 @@ import { Typography } from "@eluan/core";
|
|
|
125
130
|
export function SettingsHeading() {
|
|
126
131
|
return (
|
|
127
132
|
<>
|
|
128
|
-
<Typography variant="title" as="h1">Account settings</Typography>
|
|
129
|
-
<Typography
|
|
133
|
+
<Typography variant="title" size="xl" as="h1">Account settings</Typography>
|
|
134
|
+
<Typography size="sm" tone="muted">Manage your profile, notifications and billing.</Typography>
|
|
130
135
|
</>
|
|
131
136
|
);
|
|
132
137
|
}
|
|
@@ -160,4 +165,5 @@ export function SettingsHeading() {
|
|
|
160
165
|
|
|
161
166
|
## Common agent mistakes
|
|
162
167
|
|
|
163
|
-
|
|
168
|
+
- Setting a dashboard's title, lead and section headings at content-page sizes, several steps above the controls and tables they introduce.
|
|
169
|
+
- Reaching for `step` to shrink a heading on an app screen. Use `size`: the aliases the controls beside it read.
|