opui-css 5.4.3 → 6.0.0-rc.1
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/CHANGELOG.md +1015 -373
- package/LICENSE +21 -21
- package/MIGRATING-legacy.md +159 -0
- package/MIGRATING.md +1362 -138
- package/README.md +238 -87
- package/astro/index.ts +175 -46
- package/bin/opui-css.mjs +68 -0
- package/components/Accordion/Accordion.astro +21 -48
- package/components/Accordion/Accordion.react.tsx +23 -0
- package/components/Accordion/Accordion.svelte +27 -0
- package/components/Accordion/Accordion.vue +21 -38
- package/components/Accordion/AccordionActions.astro +16 -0
- package/components/Accordion/AccordionActions.react.tsx +15 -0
- package/components/Accordion/AccordionActions.svelte +23 -0
- package/components/Accordion/AccordionActions.vue +18 -0
- package/components/Accordion/AccordionContent.astro +9 -0
- package/components/Accordion/AccordionContent.react.tsx +6 -0
- package/components/Accordion/AccordionContent.svelte +15 -0
- package/components/Accordion/AccordionContent.vue +12 -0
- package/components/Accordion/AccordionSummary.astro +19 -0
- package/components/Accordion/AccordionSummary.react.tsx +30 -0
- package/components/Accordion/AccordionSummary.svelte +24 -0
- package/components/Accordion/AccordionSummary.vue +27 -0
- package/components/Accordion/icons.ts +2 -0
- package/components/Accordion/types.astro.ts +13 -4
- package/components/Accordion/types.react.ts +14 -0
- package/components/Accordion/types.svelte.ts +15 -7
- package/components/Accordion/types.ts +16 -10
- package/components/Accordion/types.vue-props.ts +22 -0
- package/components/Anchor/Anchor.astro +37 -49
- package/components/Anchor/Anchor.react.tsx +38 -0
- package/components/Anchor/Anchor.svelte +47 -0
- package/components/Anchor/Anchor.vue +43 -41
- package/components/Anchor/AnchorContent.astro +17 -0
- package/components/Anchor/AnchorContent.react.tsx +18 -0
- package/components/Anchor/AnchorContent.svelte +23 -0
- package/components/Anchor/AnchorContent.vue +20 -0
- package/components/Anchor/context.astro.ts +4 -0
- package/components/Anchor/context.react.ts +8 -0
- package/components/Anchor/context.svelte.ts +7 -0
- package/components/Anchor/context.vue.ts +4 -0
- package/components/Anchor/root.ts +12 -0
- package/components/Anchor/types.astro.ts +7 -4
- package/components/Anchor/types.react.ts +7 -0
- package/components/Anchor/types.svelte.ts +7 -7
- package/components/Anchor/types.ts +18 -9
- package/components/Anchor/types.vue-props.ts +15 -0
- package/components/Avatar/Avatar.astro +33 -29
- package/components/Avatar/Avatar.react.tsx +34 -0
- package/components/Avatar/Avatar.svelte +39 -0
- package/components/Avatar/Avatar.vue +26 -24
- package/components/Avatar/AvatarGroup.astro +9 -0
- package/components/Avatar/AvatarGroup.react.tsx +12 -0
- package/components/Avatar/AvatarGroup.svelte +15 -0
- package/components/Avatar/AvatarGroup.vue +12 -0
- package/components/Avatar/types.astro.ts +11 -10
- package/components/Avatar/types.react.ts +11 -0
- package/components/Avatar/types.svelte.ts +11 -12
- package/components/Avatar/types.ts +32 -29
- package/components/Avatar/types.vue-props.ts +11 -0
- package/components/Badge/Badge.astro +56 -51
- package/components/Badge/Badge.react.tsx +50 -0
- package/components/Badge/Badge.svelte +48 -0
- package/components/Badge/Badge.vue +36 -40
- package/components/Badge/types.astro.ts +4 -4
- package/components/Badge/types.react.ts +6 -0
- package/components/Badge/types.svelte.ts +7 -4
- package/components/Badge/types.ts +12 -12
- package/components/Badge/types.vue-props.ts +7 -0
- package/components/Button/Button.astro +36 -36
- package/components/Button/Button.react.tsx +33 -0
- package/components/Button/Button.svelte +37 -0
- package/components/Button/Button.vue +27 -27
- package/components/Button/types.astro.ts +6 -6
- package/components/Button/types.react.ts +11 -0
- package/components/Button/types.svelte.ts +15 -6
- package/components/Button/types.ts +32 -16
- package/components/Button/types.vue-props.ts +6 -0
- package/components/ButtonGroup/ButtonGroup.astro +33 -29
- package/components/ButtonGroup/ButtonGroup.react.tsx +30 -0
- package/components/ButtonGroup/ButtonGroup.svelte +34 -0
- package/components/ButtonGroup/ButtonGroup.vue +25 -22
- package/components/ButtonGroup/types.astro.ts +4 -4
- package/components/ButtonGroup/types.react.ts +4 -0
- package/components/ButtonGroup/types.svelte.ts +4 -4
- package/components/ButtonGroup/types.ts +7 -7
- package/components/ButtonGroup/types.vue-props.ts +6 -0
- package/components/Callout/Callout.astro +24 -76
- package/components/Callout/Callout.react.tsx +26 -0
- package/components/Callout/Callout.svelte +32 -0
- package/components/Callout/Callout.vue +23 -63
- package/components/Callout/CalloutContent.astro +9 -0
- package/components/Callout/CalloutContent.react.tsx +6 -0
- package/components/Callout/CalloutContent.svelte +15 -0
- package/components/Callout/CalloutContent.vue +12 -0
- package/components/Callout/CalloutIcon.astro +25 -0
- package/components/Callout/CalloutIcon.react.tsx +26 -0
- package/components/Callout/CalloutIcon.svelte +24 -0
- package/components/Callout/CalloutIcon.vue +25 -0
- package/components/Callout/context.astro.ts +4 -0
- package/components/Callout/context.react.ts +8 -0
- package/components/Callout/context.svelte.ts +7 -0
- package/components/Callout/context.vue.ts +4 -0
- package/components/Callout/icons.ts +23 -0
- package/components/Callout/types.astro.ts +9 -4
- package/components/Callout/types.react.ts +9 -0
- package/components/Callout/types.svelte.ts +9 -7
- package/components/Callout/types.ts +10 -10
- package/components/Callout/types.vue-props.ts +14 -0
- package/components/Card/Card.astro +18 -34
- package/components/Card/Card.react.tsx +15 -0
- package/components/Card/Card.svelte +23 -0
- package/components/Card/Card.vue +18 -28
- package/components/Card/CardActions.astro +16 -0
- package/components/Card/CardActions.react.tsx +15 -0
- package/components/Card/CardActions.svelte +23 -0
- package/components/Card/CardActions.vue +18 -0
- package/components/Card/CardContent.astro +9 -0
- package/components/Card/CardContent.react.tsx +6 -0
- package/components/Card/CardContent.svelte +15 -0
- package/components/Card/CardContent.vue +12 -0
- package/components/Card/CardHeader.astro +9 -0
- package/components/Card/CardHeader.react.tsx +6 -0
- package/components/Card/CardHeader.svelte +15 -0
- package/components/Card/CardHeader.vue +12 -0
- package/components/Card/types.astro.ts +10 -4
- package/components/Card/types.react.ts +10 -0
- package/components/Card/types.svelte.ts +11 -7
- package/components/Card/types.ts +11 -11
- package/components/Card/types.vue-props.ts +17 -0
- package/components/Carousel/Carousel.astro +44 -0
- package/components/Carousel/Carousel.react.tsx +47 -0
- package/components/Carousel/Carousel.svelte +45 -0
- package/components/Carousel/Carousel.vue +44 -0
- package/components/Carousel/types.astro.ts +4 -0
- package/components/Carousel/types.react.ts +4 -0
- package/components/Carousel/types.svelte.ts +4 -0
- package/components/Carousel/types.ts +11 -0
- package/components/Carousel/types.vue-props.ts +6 -0
- package/components/Checkbox/Checkbox.astro +58 -46
- package/components/Checkbox/Checkbox.react.tsx +51 -0
- package/components/Checkbox/Checkbox.svelte +61 -0
- package/components/Checkbox/Checkbox.vue +64 -43
- package/components/Checkbox/CheckboxInput.astro +20 -16
- package/components/Checkbox/CheckboxInput.react.tsx +39 -0
- package/components/Checkbox/CheckboxInput.svelte +34 -0
- package/components/Checkbox/CheckboxInput.vue +50 -32
- package/components/Checkbox/types.astro.ts +7 -8
- package/components/Checkbox/types.react.ts +11 -0
- package/components/Checkbox/types.svelte.ts +16 -12
- package/components/Checkbox/types.ts +20 -16
- package/components/Checkbox/types.vue-props.ts +15 -0
- package/components/Chip/Chip.astro +47 -31
- package/components/Chip/Chip.react.tsx +45 -0
- package/components/Chip/Chip.svelte +45 -0
- package/components/Chip/Chip.vue +44 -37
- package/components/Chip/types.astro.ts +9 -9
- package/components/Chip/types.react.ts +15 -0
- package/components/Chip/types.svelte.ts +16 -14
- package/components/Chip/types.ts +30 -13
- package/components/Chip/types.vue-props.ts +11 -0
- package/components/DescriptionList/DescriptionList.astro +22 -18
- package/components/DescriptionList/DescriptionList.react.tsx +25 -0
- package/components/DescriptionList/DescriptionList.svelte +29 -0
- package/components/DescriptionList/DescriptionList.vue +22 -23
- package/components/DescriptionList/DescriptionListDescription.astro +9 -0
- package/components/DescriptionList/DescriptionListDescription.react.tsx +9 -0
- package/components/DescriptionList/DescriptionListDescription.svelte +15 -0
- package/components/DescriptionList/{Description.vue → DescriptionListDescription.vue} +15 -12
- package/components/DescriptionList/DescriptionListItem.astro +9 -0
- package/components/DescriptionList/DescriptionListItem.react.tsx +6 -0
- package/components/DescriptionList/DescriptionListItem.svelte +15 -0
- package/components/DescriptionList/{Item.vue → DescriptionListItem.vue} +15 -12
- package/components/DescriptionList/DescriptionListTerm.astro +9 -0
- package/components/DescriptionList/DescriptionListTerm.react.tsx +6 -0
- package/components/DescriptionList/DescriptionListTerm.svelte +15 -0
- package/components/DescriptionList/{Term.vue → DescriptionListTerm.vue} +15 -12
- package/components/DescriptionList/types.astro.ts +10 -10
- package/components/DescriptionList/types.react.ts +10 -0
- package/components/DescriptionList/types.svelte.ts +10 -4
- package/components/DescriptionList/types.ts +5 -3
- package/components/DescriptionList/types.vue-props.ts +12 -0
- package/components/Dialog/Dialog.astro +24 -38
- package/components/Dialog/Dialog.react.tsx +23 -0
- package/components/Dialog/Dialog.svelte +33 -0
- package/components/Dialog/Dialog.vue +25 -35
- package/components/Dialog/DialogContent.astro +9 -0
- package/components/Dialog/DialogContent.react.tsx +6 -0
- package/components/Dialog/DialogContent.svelte +15 -0
- package/components/Dialog/DialogContent.vue +12 -0
- package/components/Dialog/DialogFooter.astro +16 -0
- package/components/Dialog/DialogFooter.react.tsx +15 -0
- package/components/Dialog/DialogFooter.svelte +23 -0
- package/components/Dialog/DialogFooter.vue +18 -0
- package/components/Dialog/DialogHeader.astro +9 -0
- package/components/Dialog/DialogHeader.react.tsx +6 -0
- package/components/Dialog/DialogHeader.svelte +15 -0
- package/components/Dialog/DialogHeader.vue +12 -0
- package/components/Dialog/DialogTitle.astro +14 -0
- package/components/Dialog/DialogTitle.react.tsx +13 -0
- package/components/Dialog/DialogTitle.svelte +23 -0
- package/components/Dialog/DialogTitle.vue +18 -0
- package/components/Dialog/context.astro.ts +4 -0
- package/components/Dialog/context.react.ts +8 -0
- package/components/Dialog/context.svelte.ts +7 -0
- package/components/Dialog/context.vue.ts +4 -0
- package/components/Dialog/types.astro.ts +12 -4
- package/components/Dialog/types.react.ts +12 -0
- package/components/Dialog/types.svelte.ts +15 -7
- package/components/Dialog/types.ts +17 -10
- package/components/Dialog/types.vue-props.ts +24 -0
- package/components/Divider/Divider.astro +34 -12
- package/components/Divider/Divider.react.tsx +36 -0
- package/components/Divider/Divider.svelte +40 -0
- package/components/Divider/Divider.vue +30 -12
- package/components/Divider/types.astro.ts +4 -4
- package/components/Divider/types.react.ts +4 -0
- package/components/Divider/types.svelte.ts +4 -4
- package/components/Divider/types.ts +5 -3
- package/components/Divider/types.vue-props.ts +6 -0
- package/components/Drawer/Drawer.astro +42 -47
- package/components/Drawer/Drawer.react.tsx +40 -0
- package/components/Drawer/Drawer.svelte +50 -0
- package/components/Drawer/Drawer.vue +41 -46
- package/components/Drawer/DrawerContent.astro +9 -0
- package/components/Drawer/DrawerContent.react.tsx +6 -0
- package/components/Drawer/DrawerContent.svelte +15 -0
- package/components/Drawer/DrawerContent.vue +12 -0
- package/components/Drawer/DrawerFooter.astro +16 -11
- package/components/Drawer/DrawerFooter.react.tsx +15 -0
- package/components/Drawer/DrawerFooter.svelte +23 -0
- package/components/Drawer/DrawerFooter.vue +18 -16
- package/components/Drawer/DrawerHeader.astro +35 -27
- package/components/Drawer/DrawerHeader.react.tsx +41 -0
- package/components/Drawer/DrawerHeader.svelte +42 -0
- package/components/Drawer/DrawerHeader.vue +35 -36
- package/components/Drawer/DrawerTitle.astro +14 -0
- package/components/Drawer/DrawerTitle.react.tsx +13 -0
- package/components/Drawer/DrawerTitle.svelte +23 -0
- package/components/Drawer/DrawerTitle.vue +18 -0
- package/components/Drawer/context.astro.ts +4 -0
- package/components/Drawer/context.react.ts +8 -0
- package/components/Drawer/context.svelte.ts +7 -0
- package/components/Drawer/context.vue.ts +4 -0
- package/components/Drawer/icons.ts +2 -0
- package/components/Drawer/types.astro.ts +12 -8
- package/components/Drawer/types.react.ts +13 -0
- package/components/Drawer/types.svelte.ts +16 -15
- package/components/Drawer/types.ts +25 -20
- package/components/Drawer/types.vue-props.ts +24 -0
- package/components/FieldDescription/FieldDescription.astro +9 -9
- package/components/FieldDescription/FieldDescription.react.tsx +6 -0
- package/components/FieldDescription/FieldDescription.svelte +15 -0
- package/components/FieldDescription/FieldDescription.vue +12 -12
- package/components/FieldDescription/types.astro.ts +4 -4
- package/components/FieldDescription/types.react.ts +4 -0
- package/components/FieldDescription/types.svelte.ts +4 -4
- package/components/FieldDescription/types.ts +1 -1
- package/components/FieldDescription/types.vue-props.ts +6 -0
- package/components/FieldGroup/FieldGroup.astro +24 -24
- package/components/FieldGroup/FieldGroup.react.tsx +27 -0
- package/components/FieldGroup/FieldGroup.svelte +32 -0
- package/components/FieldGroup/FieldGroup.vue +23 -25
- package/components/FieldGroup/context.astro.ts +4 -0
- package/components/FieldGroup/context.react.ts +8 -0
- package/components/FieldGroup/context.svelte.ts +8 -0
- package/components/FieldGroup/context.vue.ts +4 -0
- package/components/FieldGroup/types.astro.ts +4 -4
- package/components/FieldGroup/types.react.ts +4 -0
- package/components/FieldGroup/types.svelte.ts +4 -4
- package/components/FieldGroup/types.ts +6 -4
- package/components/FieldGroup/types.vue-props.ts +6 -0
- package/components/FieldLegend/FieldLegend.astro +11 -11
- package/components/FieldLegend/FieldLegend.react.tsx +14 -0
- package/components/FieldLegend/FieldLegend.svelte +20 -0
- package/components/FieldLegend/FieldLegend.vue +20 -18
- package/components/FieldLegend/types.astro.ts +6 -6
- package/components/FieldLegend/types.react.ts +6 -0
- package/components/FieldLegend/types.svelte.ts +6 -6
- package/components/FieldLegend/types.ts +1 -1
- package/components/FieldLegend/types.vue-props.ts +9 -0
- package/components/{FieldSet/FieldSet.astro → Fieldset/Fieldset.astro} +15 -11
- package/components/Fieldset/Fieldset.react.tsx +15 -0
- package/components/Fieldset/Fieldset.svelte +21 -0
- package/components/Fieldset/Fieldset.vue +21 -0
- package/components/{FieldSet → Fieldset}/types.astro.ts +6 -6
- package/components/Fieldset/types.react.ts +6 -0
- package/components/Fieldset/types.svelte.ts +6 -0
- package/components/Fieldset/types.ts +1 -0
- package/components/Fieldset/types.vue-props.ts +9 -0
- package/components/Form/Form.astro +10 -10
- package/components/Form/Form.react.tsx +9 -0
- package/components/Form/Form.svelte +16 -0
- package/components/Form/Form.vue +16 -14
- package/components/Form/types.astro.ts +6 -6
- package/components/Form/types.react.ts +6 -0
- package/components/Form/types.svelte.ts +6 -7
- package/components/Form/types.ts +1 -1
- package/components/Form/types.vue-props.ts +9 -0
- package/components/List/List.astro +29 -29
- package/components/List/List.react.tsx +27 -0
- package/components/List/List.svelte +31 -0
- package/components/List/List.vue +23 -28
- package/components/List/types.astro.ts +4 -4
- package/components/List/types.react.ts +4 -0
- package/components/List/types.svelte.ts +4 -4
- package/components/List/types.ts +6 -7
- package/components/List/types.vue-props.ts +6 -0
- package/components/ListItem/ListItem.astro +115 -108
- package/components/ListItem/ListItem.react.tsx +65 -0
- package/components/ListItem/ListItem.svelte +80 -0
- package/components/ListItem/ListItem.vue +93 -98
- package/components/ListItem/types.astro.ts +9 -10
- package/components/ListItem/types.react.ts +17 -0
- package/components/ListItem/types.svelte.ts +17 -14
- package/components/ListItem/types.ts +35 -32
- package/components/ListItem/types.vue-props.ts +14 -0
- package/components/Menu/Menu.astro +86 -0
- package/components/Menu/Menu.react.tsx +87 -0
- package/components/Menu/Menu.svelte +71 -0
- package/components/Menu/Menu.vue +76 -0
- package/components/Menu/context.astro.ts +4 -0
- package/components/Menu/context.react.ts +8 -0
- package/components/Menu/context.svelte.ts +7 -0
- package/components/Menu/context.vue.ts +4 -0
- package/components/Menu/types.astro.ts +12 -0
- package/components/Menu/types.react.ts +12 -0
- package/components/Menu/types.svelte.ts +12 -0
- package/components/Menu/types.ts +23 -0
- package/components/Menu/types.vue-props.ts +16 -0
- package/components/Progress/Progress.astro +20 -31
- package/components/Progress/Progress.react.tsx +27 -0
- package/components/Progress/Progress.svelte +30 -0
- package/components/Progress/Progress.vue +30 -34
- package/components/Progress/types.astro.ts +5 -4
- package/components/Progress/types.react.ts +5 -0
- package/components/Progress/types.svelte.ts +5 -4
- package/components/Progress/types.ts +5 -10
- package/components/Progress/types.vue-props.ts +6 -0
- package/components/Radio/Radio.astro +58 -44
- package/components/Radio/Radio.react.tsx +51 -0
- package/components/Radio/Radio.svelte +59 -0
- package/components/Radio/Radio.vue +62 -41
- package/components/Radio/RadioInput.astro +10 -7
- package/components/Radio/RadioInput.react.tsx +10 -0
- package/components/Radio/RadioInput.svelte +27 -0
- package/components/Radio/RadioInput.vue +39 -14
- package/components/Radio/types.astro.ts +7 -6
- package/components/Radio/types.react.ts +11 -0
- package/components/Radio/types.svelte.ts +16 -12
- package/components/Radio/types.ts +17 -12
- package/components/Radio/types.vue-props.ts +15 -0
- package/components/Range/Range.astro +139 -128
- package/components/Range/Range.react.tsx +157 -0
- package/components/Range/Range.svelte +136 -0
- package/components/Range/Range.vue +169 -85
- package/components/Range/types.astro.ts +1 -3
- package/components/Range/types.react.ts +10 -0
- package/components/Range/types.svelte.ts +8 -3
- package/components/Range/types.ts +24 -25
- package/components/Range/types.vue-props.ts +16 -0
- package/components/Range/value.ts +27 -0
- package/components/Select/Select.astro +147 -108
- package/components/Select/Select.react.tsx +124 -0
- package/components/Select/Select.svelte +123 -0
- package/components/Select/Select.vue +157 -85
- package/components/Select/selection.ts +11 -0
- package/components/Select/types.react.ts +6 -0
- package/components/Select/types.svelte.ts +1 -1
- package/components/Select/types.ts +16 -13
- package/components/Select/types.vue-props.ts +20 -0
- package/components/Switch/Switch.astro +72 -76
- package/components/Switch/Switch.react.tsx +63 -0
- package/components/Switch/Switch.svelte +73 -0
- package/components/Switch/Switch.vue +81 -63
- package/components/Switch/SwitchInput.astro +10 -7
- package/components/Switch/SwitchInput.react.tsx +12 -0
- package/components/Switch/SwitchInput.svelte +30 -0
- package/components/Switch/SwitchInput.vue +36 -14
- package/components/Switch/types.astro.ts +7 -5
- package/components/Switch/types.react.ts +11 -0
- package/components/Switch/types.svelte.ts +16 -9
- package/components/Switch/types.ts +19 -16
- package/components/Switch/types.vue-props.ts +17 -0
- package/components/Table/Table.astro +27 -14
- package/components/Table/Table.react.tsx +24 -0
- package/components/Table/Table.svelte +28 -0
- package/components/Table/Table.vue +20 -19
- package/components/Table/TableBody.astro +9 -0
- package/components/Table/TableBody.react.tsx +5 -0
- package/components/Table/TableBody.svelte +9 -0
- package/components/Table/TableBody.vue +12 -0
- package/components/Table/TableCaption.astro +9 -0
- package/components/Table/TableCaption.react.tsx +5 -0
- package/components/Table/TableCaption.svelte +9 -0
- package/components/Table/TableCaption.vue +12 -0
- package/components/Table/TableCell.astro +9 -0
- package/components/Table/TableCell.react.tsx +6 -0
- package/components/Table/TableCell.svelte +16 -0
- package/components/Table/TableCell.vue +12 -0
- package/components/Table/TableColumn.astro +8 -0
- package/components/Table/TableColumn.react.tsx +7 -0
- package/components/Table/TableColumn.svelte +8 -0
- package/components/Table/TableColumn.vue +12 -0
- package/components/Table/TableColumnGroup.astro +9 -0
- package/components/Table/TableColumnGroup.react.tsx +5 -0
- package/components/Table/TableColumnGroup.svelte +9 -0
- package/components/Table/TableColumnGroup.vue +12 -0
- package/components/Table/TableFoot.astro +9 -0
- package/components/Table/TableFoot.react.tsx +5 -0
- package/components/Table/TableFoot.svelte +9 -0
- package/components/Table/TableFoot.vue +12 -0
- package/components/Table/TableHead.astro +9 -0
- package/components/Table/TableHead.react.tsx +5 -0
- package/components/Table/TableHead.svelte +9 -0
- package/components/Table/TableHead.vue +12 -0
- package/components/Table/TableHeaderCell.astro +9 -0
- package/components/Table/TableHeaderCell.react.tsx +10 -0
- package/components/Table/TableHeaderCell.svelte +16 -0
- package/components/Table/TableHeaderCell.vue +12 -0
- package/components/Table/TableRow.astro +9 -0
- package/components/Table/TableRow.react.tsx +5 -0
- package/components/Table/TableRow.svelte +9 -0
- package/components/Table/TableRow.vue +12 -0
- package/components/Table/types.astro.ts +22 -16
- package/components/Table/types.react.ts +22 -0
- package/components/Table/types.svelte.ts +23 -11
- package/components/Table/types.ts +14 -9
- package/components/Table/types.vue-props.ts +28 -0
- package/components/Tabs/Tabs.astro +34 -24
- package/components/Tabs/Tabs.react.tsx +43 -0
- package/components/Tabs/Tabs.svelte +43 -0
- package/components/Tabs/Tabs.vue +30 -20
- package/components/Tabs/TabsItem.astro +28 -40
- package/components/Tabs/TabsItem.react.tsx +47 -0
- package/components/Tabs/TabsItem.svelte +52 -0
- package/components/Tabs/TabsItem.vue +41 -39
- package/components/Tabs/TabsLabel.astro +16 -0
- package/components/Tabs/TabsLabel.react.tsx +17 -0
- package/components/Tabs/TabsLabel.svelte +19 -0
- package/components/Tabs/TabsLabel.vue +16 -0
- package/components/Tabs/TabsPanel.astro +9 -16
- package/components/Tabs/TabsPanel.react.tsx +6 -0
- package/components/Tabs/TabsPanel.svelte +15 -0
- package/components/Tabs/TabsPanel.vue +12 -31
- package/components/Tabs/context.astro.ts +4 -0
- package/components/Tabs/context.react.ts +8 -0
- package/components/Tabs/context.svelte.ts +7 -0
- package/components/Tabs/context.vue.ts +4 -0
- package/components/Tabs/types.astro.ts +13 -11
- package/components/Tabs/types.react.ts +12 -0
- package/components/Tabs/types.svelte.ts +10 -10
- package/components/Tabs/types.ts +21 -19
- package/components/Tabs/types.vue-props.ts +25 -0
- package/components/TextField/TextField.astro +108 -124
- package/components/TextField/TextField.react.tsx +70 -0
- package/components/TextField/TextField.svelte +84 -0
- package/components/TextField/TextField.vue +94 -74
- package/components/TextField/types.astro.ts +15 -17
- package/components/TextField/types.react.ts +12 -0
- package/components/TextField/types.svelte.ts +2 -4
- package/components/TextField/types.ts +11 -25
- package/components/TextField/types.vue-props.ts +21 -0
- package/components/Textarea/Textarea.astro +104 -118
- package/components/Textarea/Textarea.react.tsx +64 -0
- package/components/Textarea/Textarea.svelte +80 -0
- package/components/Textarea/Textarea.vue +88 -64
- package/components/Textarea/types.astro.ts +8 -10
- package/components/Textarea/types.react.ts +8 -0
- package/components/Textarea/types.svelte.ts +13 -21
- package/components/Textarea/types.ts +21 -33
- package/components/Textarea/types.vue-props.ts +20 -0
- package/components/ToggleButton/ToggleButton.astro +43 -43
- package/components/ToggleButton/ToggleButton.react.tsx +57 -0
- package/components/ToggleButton/ToggleButton.svelte +58 -0
- package/components/ToggleButton/ToggleButton.vue +65 -41
- package/components/ToggleButton/types.astro.ts +4 -4
- package/components/ToggleButton/types.react.ts +4 -0
- package/components/ToggleButton/types.svelte.ts +5 -7
- package/components/ToggleButton/types.ts +6 -10
- package/components/ToggleButton/types.vue-props.ts +11 -0
- package/components/ToggleGroup/ToggleGroup.astro +40 -42
- package/components/ToggleGroup/ToggleGroup.react.tsx +54 -0
- package/components/ToggleGroup/ToggleGroup.svelte +54 -0
- package/components/ToggleGroup/ToggleGroup.vue +45 -36
- package/components/ToggleGroup/context.astro.ts +5 -0
- package/components/ToggleGroup/context.react.ts +8 -0
- package/components/ToggleGroup/context.svelte.ts +8 -0
- package/components/ToggleGroup/context.vue.ts +4 -0
- package/components/ToggleGroup/selection.ts +12 -0
- package/components/ToggleGroup/types.astro.ts +4 -4
- package/components/ToggleGroup/types.react.ts +12 -0
- package/components/ToggleGroup/types.svelte.ts +6 -9
- package/components/ToggleGroup/types.ts +17 -15
- package/components/ToggleGroup/types.vue-props.ts +6 -0
- package/components/Tooltip/Tooltip.astro +22 -23
- package/components/Tooltip/Tooltip.react.tsx +24 -0
- package/components/Tooltip/Tooltip.svelte +29 -0
- package/components/Tooltip/Tooltip.vue +21 -22
- package/components/Tooltip/types.astro.ts +4 -4
- package/components/Tooltip/types.react.ts +4 -0
- package/components/Tooltip/types.svelte.ts +4 -7
- package/components/Tooltip/types.ts +5 -11
- package/components/Tooltip/types.vue-props.ts +6 -0
- package/components/content.svelte +9 -0
- package/components/context.astro.ts +15 -0
- package/components/cx.ts +12 -0
- package/components/dev.ts +63 -0
- package/components/group.ts +2 -0
- package/components/id.ts +9 -0
- package/components/style.ts +33 -0
- package/components/tag.ts +6 -0
- package/components/vue.ts +18 -0
- package/core/normalize.css +191 -214
- package/core/palette.css +131 -314
- package/core/utils.css +55 -68
- package/css/compat/avatar.css +7 -0
- package/css/compat/menu.css +20 -0
- package/css/compat.css +3 -0
- package/css/components/accordion.css +237 -173
- package/css/components/anchor.css +40 -27
- package/css/components/avatar.css +105 -65
- package/css/components/badge.css +146 -107
- package/css/components/button-group.css +170 -179
- package/css/components/button.css +422 -212
- package/css/components/callout.css +153 -112
- package/css/components/card.css +234 -116
- package/css/components/carousel.css +399 -0
- package/css/components/checkbox.css +90 -211
- package/css/components/chip.css +215 -92
- package/css/components/choice.css +291 -0
- package/css/components/description-list.css +91 -81
- package/css/components/dialog.css +154 -64
- package/css/components/divider.css +73 -20
- package/css/components/drawer.css +300 -170
- package/css/components/form.css +131 -146
- package/css/components/layout.css +92 -0
- package/css/components/link.css +53 -21
- package/css/components/list.css +460 -343
- package/css/components/menu.css +174 -0
- package/css/components/progress.css +107 -99
- package/css/components/radio.css +61 -170
- package/css/components/range.css +463 -320
- package/css/components/select.css +189 -170
- package/css/components/spinner.css +57 -38
- package/css/components/switch.css +197 -270
- package/css/components/table.css +214 -173
- package/css/components/tabs.css +278 -84
- package/css/components/text-field.css +559 -449
- package/css/components/textarea.css +20 -26
- package/css/components/toggle-button.css +131 -91
- package/css/components/toggle-group.css +86 -56
- package/css/components/tooltip.css +125 -68
- package/css/components/typography.css +801 -580
- package/css/components.css +48 -41
- package/css/imports.css +15 -17
- package/css/js/checkbox.d.ts +3 -0
- package/css/js/checkbox.js +31 -21
- package/css/js/range.d.ts +1 -0
- package/css/js/range.js +44 -0
- package/css/layers.css +2 -0
- package/css/theme.css +750 -124
- package/dist/op.css +16 -241
- package/dist/op.css.map +1 -1
- package/dist/opui.baseline-2023.css +9209 -0
- package/dist/opui.baseline-2023.css.map +1 -0
- package/dist/opui.baseline-2024.css +9209 -0
- package/dist/opui.baseline-2024.css.map +1 -0
- package/dist/opui.baseline-2025.css +9209 -0
- package/dist/opui.baseline-2025.css.map +1 -0
- package/dist/opui.baseline-2026.css +9209 -0
- package/dist/opui.baseline-2026.css.map +1 -0
- package/dist/opui.components.css +7346 -5140
- package/dist/opui.components.css.map +1 -1
- package/dist/opui.css +8489 -6128
- package/dist/opui.css.map +1 -1
- package/dist/opui.no-compat.css +9182 -0
- package/dist/opui.no-compat.css.map +1 -0
- package/env.d.ts +17 -14
- package/open-props.css +15 -6
- package/package.json +136 -90
- package/react/elements.ts +13 -0
- package/react/index.ts +176 -0
- package/skills/opui/SKILL.md +75 -0
- package/skills/opui/references/accordion.md +253 -0
- package/skills/opui/references/anchor.md +213 -0
- package/skills/opui/references/avatar.md +202 -0
- package/skills/opui/references/badge.md +199 -0
- package/skills/opui/references/button-group.md +239 -0
- package/skills/opui/references/button.md +242 -0
- package/skills/opui/references/callout.md +221 -0
- package/skills/opui/references/card.md +222 -0
- package/skills/opui/references/carousel.md +269 -0
- package/skills/opui/references/checkbox.md +241 -0
- package/skills/opui/references/chip.md +135 -0
- package/skills/opui/references/customizing.md +85 -0
- package/skills/opui/references/description-list.md +191 -0
- package/skills/opui/references/dialog.md +301 -0
- package/skills/opui/references/divider.md +112 -0
- package/skills/opui/references/drawer.md +802 -0
- package/skills/opui/references/form.md +260 -0
- package/skills/opui/references/getting-started.md +398 -0
- package/skills/opui/references/index.md +89 -0
- package/skills/opui/references/layout.md +161 -0
- package/skills/opui/references/list.md +216 -0
- package/skills/opui/references/menu.md +248 -0
- package/skills/opui/references/progress.md +114 -0
- package/skills/opui/references/radio.md +234 -0
- package/skills/opui/references/range.md +150 -0
- package/skills/opui/references/select.md +255 -0
- package/skills/opui/references/spinner.md +85 -0
- package/skills/opui/references/switch.md +223 -0
- package/skills/opui/references/table.md +480 -0
- package/skills/opui/references/tabs.md +257 -0
- package/skills/opui/references/text-field.md +167 -0
- package/skills/opui/references/textarea.md +169 -0
- package/skills/opui/references/theming.md +278 -0
- package/skills/opui/references/toggle.md +222 -0
- package/skills/opui/references/tooltip.md +167 -0
- package/skills/opui/references/typography.md +159 -0
- package/svelte/elements.ts +7 -0
- package/svelte/index.ts +177 -0
- package/themes/bootstrap.css +223 -0
- package/themes/brutalist.css +105 -0
- package/themes/m3.css +152 -0
- package/themes/shadcn.css +125 -0
- package/tokens.json +3729 -0
- package/vue/index.ts +175 -54
- package/components/AGENTS.md +0 -247
- package/components/Accordion/types.d.vue.ts +0 -15
- package/components/Accordion/types.solid.ts +0 -6
- package/components/Anchor/types.d.vue.ts +0 -10
- package/components/Anchor/types.solid.ts +0 -6
- package/components/Avatar/types.d.vue.ts +0 -12
- package/components/Avatar/types.solid.ts +0 -11
- package/components/Badge/types.d.vue.ts +0 -10
- package/components/Badge/types.solid.ts +0 -4
- package/components/Button/types.d.vue.ts +0 -10
- package/components/Button/types.solid.ts +0 -8
- package/components/ButtonGroup/types.d.vue.ts +0 -10
- package/components/ButtonGroup/types.solid.ts +0 -4
- package/components/Callout/types.d.vue.ts +0 -10
- package/components/Callout/types.solid.ts +0 -6
- package/components/Card/types.d.vue.ts +0 -10
- package/components/Card/types.solid.ts +0 -6
- package/components/Checkbox/types.d.vue.ts +0 -11
- package/components/Checkbox/types.solid.ts +0 -9
- package/components/Chip/types.d.vue.ts +0 -10
- package/components/Chip/types.solid.ts +0 -10
- package/components/ClassicSelect/ClassicSelect.astro +0 -60
- package/components/ClassicSelect/ClassicSelect.vue +0 -54
- package/components/ClassicSelect/types.astro.ts +0 -8
- package/components/ClassicSelect/types.d.vue.ts +0 -10
- package/components/ClassicSelect/types.solid.ts +0 -5
- package/components/ClassicSelect/types.svelte.ts +0 -5
- package/components/ClassicSelect/types.ts +0 -15
- package/components/DescriptionList/Description.astro +0 -9
- package/components/DescriptionList/Item.astro +0 -9
- package/components/DescriptionList/Term.astro +0 -9
- package/components/DescriptionList/index.ts +0 -12
- package/components/DescriptionList/types.d.vue.ts +0 -10
- package/components/DescriptionList/types.solid.ts +0 -4
- package/components/Dialog/types.d.vue.ts +0 -10
- package/components/Dialog/types.solid.ts +0 -8
- package/components/Divider/types.d.vue.ts +0 -6
- package/components/Divider/types.solid.ts +0 -4
- package/components/Drawer/types.d.vue.ts +0 -31
- package/components/Drawer/types.solid.ts +0 -12
- package/components/FieldDescription/types.d.vue.ts +0 -10
- package/components/FieldDescription/types.solid.ts +0 -5
- package/components/FieldGroup/types.d.vue.ts +0 -12
- package/components/FieldGroup/types.solid.ts +0 -5
- package/components/FieldLegend/types.d.vue.ts +0 -11
- package/components/FieldLegend/types.solid.ts +0 -5
- package/components/FieldSet/FieldSet.vue +0 -18
- package/components/FieldSet/types.d.vue.ts +0 -11
- package/components/FieldSet/types.solid.ts +0 -5
- package/components/FieldSet/types.svelte.ts +0 -8
- package/components/FieldSet/types.ts +0 -5
- package/components/Form/types.d.vue.ts +0 -11
- package/components/Form/types.solid.ts +0 -5
- package/components/IconButton/IconButton.astro +0 -24
- package/components/IconButton/IconButton.vue +0 -24
- package/components/IconButton/types.astro.ts +0 -6
- package/components/IconButton/types.d.vue.ts +0 -10
- package/components/IconButton/types.solid.ts +0 -8
- package/components/IconButton/types.svelte.ts +0 -6
- package/components/IconButton/types.ts +0 -16
- package/components/List/types.d.vue.ts +0 -10
- package/components/List/types.solid.ts +0 -4
- package/components/ListItem/types.d.vue.ts +0 -10
- package/components/ListItem/types.solid.ts +0 -12
- package/components/Progress/types.d.vue.ts +0 -10
- package/components/Progress/types.solid.ts +0 -4
- package/components/Radio/types.d.vue.ts +0 -11
- package/components/Radio/types.solid.ts +0 -9
- package/components/Range/types.d.vue.ts +0 -14
- package/components/Range/types.solid.ts +0 -6
- package/components/Select/types.d.vue.ts +0 -17
- package/components/Select/types.solid.ts +0 -6
- package/components/Switch/types.d.vue.ts +0 -13
- package/components/Switch/types.solid.ts +0 -9
- package/components/Table/Body.astro +0 -11
- package/components/Table/Body.vue +0 -5
- package/components/Table/Cell.astro +0 -11
- package/components/Table/Cell.vue +0 -5
- package/components/Table/Column.astro +0 -12
- package/components/Table/Column.vue +0 -19
- package/components/Table/ColumnGroup.astro +0 -11
- package/components/Table/ColumnGroup.vue +0 -5
- package/components/Table/Head.astro +0 -11
- package/components/Table/Head.vue +0 -5
- package/components/Table/HeaderCell.astro +0 -11
- package/components/Table/HeaderCell.vue +0 -5
- package/components/Table/Row.astro +0 -11
- package/components/Table/Row.vue +0 -5
- package/components/Table/index.ts +0 -20
- package/components/Table/types.d.vue.ts +0 -10
- package/components/Table/types.solid.ts +0 -8
- package/components/Tabs/TabsTab.astro +0 -15
- package/components/Tabs/TabsTab.vue +0 -24
- package/components/Tabs/index.ts +0 -14
- package/components/Tabs/types.d.vue.ts +0 -31
- package/components/Tabs/types.solid.ts +0 -12
- package/components/TextField/types.d.vue.ts +0 -20
- package/components/TextField/types.solid.ts +0 -22
- package/components/Textarea/types.d.vue.ts +0 -19
- package/components/Textarea/types.solid.ts +0 -6
- package/components/Toast/Toast.astro +0 -42
- package/components/Toast/Toast.vue +0 -48
- package/components/ToggleButton/types.d.vue.ts +0 -10
- package/components/ToggleButton/types.solid.ts +0 -7
- package/components/ToggleGroup/types.d.vue.ts +0 -15
- package/components/ToggleGroup/types.solid.ts +0 -4
- package/components/Tooltip/types.d.vue.ts +0 -10
- package/components/Tooltip/types.solid.ts +0 -6
- package/css/components/icon-button.css +0 -139
- package/css/components/text-input.css +0 -68
- package/css/components/toast.css +0 -157
- package/css/js/toast.js +0 -94
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
# Theming
|
|
2
|
+
|
|
3
|
+
The knobs and roles behind colors, density, spacing, corners, fonts, elevation, motion and contrast, and the classes that scope them.
|
|
4
|
+
|
|
5
|
+
A theme sets [knobs and roles](https://open-props-ui.netlify.app/html/guide/concepts.md#token-tiers), and every component reads the roles:
|
|
6
|
+
|
|
7
|
+
1. Knobs
|
|
8
|
+
|
|
9
|
+
`--ui-palette-hue` 145 `--ui-palette-chroma` 0.5
|
|
10
|
+
|
|
11
|
+
2. Palette `--ui-color-1` to `--ui-color-16`
|
|
12
|
+
|
|
13
|
+
3. Roles
|
|
14
|
+
|
|
15
|
+
- `--ui-primary` Filled buttons, links, focus ring
|
|
16
|
+
- `--ui-palette-tint` Tonal fills
|
|
17
|
+
- `--ui-palette-text` Tinted text
|
|
18
|
+
- `--ui-palette-border` Tinted borders
|
|
19
|
+
|
|
20
|
+
4. Components
|
|
21
|
+
|
|
22
|
+
[A link](#token-flow)
|
|
23
|
+
|
|
24
|
+
Drag a knob: the palette is derived again, the roles that read it follow, and so does every component. A theme sets the knobs once on `html`; this figure is a `.ui-palette` scope with its own.
|
|
25
|
+
|
|
26
|
+
Snippets on this page belong in `@layer theme.custom`, see [Your theme](https://open-props-ui.netlify.app/html/guide/customizing.md#your-theme). Every token and its default is on [Theme tokens](https://open-props-ui.netlify.app/html/guide/theme-tokens.md), and the [Theme builder](https://open-props-ui.netlify.app/theme-builder.md) writes a theme for you and checks its contrast.
|
|
27
|
+
|
|
28
|
+
## Palette
|
|
29
|
+
|
|
30
|
+
One hue and chroma in `theme.css` become a source color, `--ui-palette-source`, and `core/palette.css` derives the `--ui-color-1` to `--ui-color-16` steps from it.
|
|
31
|
+
|
|
32
|
+
```css
|
|
33
|
+
:where(html) {
|
|
34
|
+
--ui-palette-chroma: 0.5;
|
|
35
|
+
--ui-palette-hue: 145;
|
|
36
|
+
--ui-palette-hue-rotate-by: 0;
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
- `--ui-palette-chroma` scales the saturation, from `0` (gray) to `1`.
|
|
41
|
+
- `--ui-palette-hue` is a hue angle in degrees, `145` (green) by default.
|
|
42
|
+
- `--ui-palette-hue-rotate-by` turns the hue by this many degrees per step, so `1` spreads 15° across the palette. The severity scopes use `1` for livelier tints.
|
|
43
|
+
|
|
44
|
+
Or set `--ui-palette-source` to any color: the palette keeps its oklch hue, scales its chroma and sets the lightness per step. The palette is computed on `:root`, `.ui-palette`, `.ui-contrast-more`, the severity classes and the inline `del`, `ins`, `abbr` and `dfn` elements and their classes, so the knobs do nothing anywhere else. Each severity class takes its hue from its intent token, so setting `--ui-critical`, `--ui-info`, `--ui-neutral`, `--ui-success` or `--ui-warning` recolors the scope. `.ui-neutral` also keeps the chroma of `--ui-neutral`, which follows `--ui-gray-hue` and `--ui-gray-chroma` by default:
|
|
45
|
+
|
|
46
|
+
```css
|
|
47
|
+
:where(.ui-warning) {
|
|
48
|
+
--ui-palette-source: oklch(from var(--ui-warning) 0.58 0.21 h);
|
|
49
|
+
--ui-palette-hue-rotate-by: 1;
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Scopes
|
|
54
|
+
|
|
55
|
+
A scope class re-themes an element and everything inside it, so one page can carry several brands, a dark panel or one red for every critical component:
|
|
56
|
+
|
|
57
|
+
- `.ui-palette` re-derives the palette and every derived token (colors, control sizes, spacing, type roles and radii) from the knobs the element sets or inherits, `--ui-primary` and the intent colors included. `.ui-contrast-more` does the same with the contrast knobs tightened.
|
|
58
|
+
- `.ui-critical`, `.ui-info`, `.ui-neutral`, `.ui-success` and `.ui-warning` swap the palette steps for the intent color and leave `--ui-primary` and the text colors alone. [Concepts](https://open-props-ui.netlify.app/html/guide/concepts.md#palette-scopes) shows the steps of each one.
|
|
59
|
+
- `.ui-light` and `.ui-dark` force a color scheme. On an element they only pick the other side of `light-dark()`: the surface and text colors and `--ui-shadow-elevated` switch, while the shadow color and strength still come from the page.
|
|
60
|
+
|
|
61
|
+
## Surfaces
|
|
62
|
+
|
|
63
|
+
Five surfaces, two text colors and two border colors paint everything that isn't an accent:
|
|
64
|
+
|
|
65
|
+
- `--ui-surface` The page
|
|
66
|
+
- `--ui-surface-elevated` Elevated cards and accordions, dialogs, drawers, menus
|
|
67
|
+
- `--ui-surface-tonal` Tonal variants
|
|
68
|
+
- `--ui-surface-filled` Lists, tracks, table headers
|
|
69
|
+
- `--ui-surface-inverse` Tooltips
|
|
70
|
+
- `--ui-text-strong` Headings, labels, values
|
|
71
|
+
- `--ui-text` Body copy
|
|
72
|
+
- `--ui-border-color` Dividers, outlined variants
|
|
73
|
+
- `--ui-field-border-color` Fields
|
|
74
|
+
|
|
75
|
+
Each role with its current value, live with the theme.
|
|
76
|
+
|
|
77
|
+
A raised component (tonal and elevated `Card` and `Accordion`, `Dialog`, `Drawer`, `Menu` and a `Callout` without a severity) sets `--ui-border-color` to `--ui-border-color-on-raised` and `--ui-field-border-color` to `--ui-field-border-color-on-raised` on its root, so dividers and fields inside it stay visible on the raised fill. Both default to the plain border colors. Filled lists and table headers do the same with the `-on-filled` pair. A theme that wants another border on raised surfaces sets the `-on-raised` tokens.
|
|
78
|
+
|
|
79
|
+
The edge of the raised surface itself is `--ui-border-color-raised`, one word shorter. Every raised component reads it, the `Select` picker too, and each keeps its own edge until a theme sets it: cards, accordions and dialogs the page background, callouts their fill, drawers, menus and the picker `--ui-border-color-on-raised`. Set it to outline them all, or to `transparent` to drop their edges, like the m3 theme.
|
|
80
|
+
|
|
81
|
+
## Density
|
|
82
|
+
|
|
83
|
+
`--ui-density` scales the `--ui-control-size*` roles, so fields, buttons and list items grow or shrink together, and their padding shrinks down to the height of the text. Set it on `html`, or on a `.ui-palette` element to change one part of the page.
|
|
84
|
+
|
|
85
|
+
```css
|
|
86
|
+
:where(html) {
|
|
87
|
+
--ui-density: 0.875;
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Spacing
|
|
92
|
+
|
|
93
|
+
`--ui-space-1` to `--ui-space-8` pad and space containers, forms and rich text. Each is a fixed step (`0.25rem`, `0.5rem`, `1rem`, `1.25rem`, `1.5rem`, `1.75rem`, `2rem` and `3rem`) times `--ui-space-scale`, set on `html` or a `.ui-palette` element. Controls follow `--ui-density` instead, so a roomy form can keep compact fields.
|
|
94
|
+
|
|
95
|
+
```css
|
|
96
|
+
:where(html) {
|
|
97
|
+
--ui-space-scale: 1.25;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/* Or tie spacing to density */
|
|
101
|
+
:where(html) {
|
|
102
|
+
--ui-density: 0.875;
|
|
103
|
+
--ui-space-scale: var(--ui-density);
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Corners
|
|
108
|
+
|
|
109
|
+
`--ui-radius` rounds every component, and buttons and fields follow it until you set `--ui-button-radius` or `--ui-field-radius`. Small parts like `kbd`, tooltips and checkboxes never get rounder than it, so `0` squares everything. `--ui-radius-x-small`, `--ui-radius-small` and `--ui-radius-large` derive from it (capped at 2px and 5px, and times 1.5), and `--ui-radius-round` is the pill.
|
|
110
|
+
|
|
111
|
+
```css
|
|
112
|
+
:where(html) {
|
|
113
|
+
--ui-radius: 0;
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Fonts
|
|
118
|
+
|
|
119
|
+
`--ui-font-body` sets the text and controls, `--ui-font-code` code, `kbd` and `samp`, and `--ui-font-heading` the headings, which follow the body font until you set it.
|
|
120
|
+
|
|
121
|
+
```css
|
|
122
|
+
:where(html) {
|
|
123
|
+
--ui-font-body: "Inter", system-ui, sans-serif;
|
|
124
|
+
--ui-font-code: "JetBrains Mono", ui-monospace, monospace;
|
|
125
|
+
--ui-font-heading: "Fraunces", serif;
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
The type scale, `--ui-font-size-100` to `--ui-font-size-900` (12px to 56px), is a primitive. Components read the roles on top of it, like `--ui-font-size-caption`, `--ui-font-size-control` and `--ui-font-size-h1`. Pin a role, move a step and every role on it follows, or replace the scale:
|
|
130
|
+
|
|
131
|
+
```css
|
|
132
|
+
:where(html) {
|
|
133
|
+
/* Pin one role */
|
|
134
|
+
--ui-font-size-caption: 0.8125rem;
|
|
135
|
+
|
|
136
|
+
/* Or a modular scale: 1rem base, minor third */
|
|
137
|
+
--ui-font-size-100: calc(1rem * pow(1.2, -2));
|
|
138
|
+
--ui-font-size-200: calc(1rem * pow(1.2, -1));
|
|
139
|
+
--ui-font-size-300: 1rem;
|
|
140
|
+
--ui-font-size-400: calc(1rem * pow(1.2, 1));
|
|
141
|
+
--ui-font-size-500: calc(1rem * pow(1.2, 2));
|
|
142
|
+
--ui-font-size-600: calc(1rem * pow(1.2, 3));
|
|
143
|
+
--ui-font-size-700: calc(1rem * pow(1.2, 4));
|
|
144
|
+
--ui-font-size-800: calc(1rem * pow(1.2, 5));
|
|
145
|
+
--ui-font-size-900: calc(1rem * pow(1.2, 6));
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Fluid headings
|
|
150
|
+
|
|
151
|
+
`--ui-font-size-h1` to `--ui-font-size-h4` grow from one step to the next as the viewport widens, together, over one window: `--ui-fluid-min-inline-size` (20rem) to `--ui-fluid-max-inline-size` (48rem). `--ui-fluid-progress` is the position in that window, 0 to 1, from `progress()`, so a theme can ramp other values on the same window. Move the window, reuse the ramp, or pin a heading to a step:
|
|
152
|
+
|
|
153
|
+
```css
|
|
154
|
+
:where(html) {
|
|
155
|
+
/* Headings reach full size on wider screens */
|
|
156
|
+
--ui-fluid-min-inline-size: 24rem;
|
|
157
|
+
--ui-fluid-max-inline-size: 64rem;
|
|
158
|
+
|
|
159
|
+
/* Tighter spacing on narrow screens, on the same ramp */
|
|
160
|
+
--ui-space-scale: calc(0.875 + 0.125 * var(--ui-fluid-progress));
|
|
161
|
+
|
|
162
|
+
/* Or pin a heading */
|
|
163
|
+
--ui-font-size-h1: var(--ui-font-size-800);
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Browsers without `progress()` (before Firefox 155 and Safari 26) keep `clamp()` heading sizes and have no `--ui-fluid-progress`.
|
|
168
|
+
|
|
169
|
+
## Elevation
|
|
170
|
+
|
|
171
|
+
- `--ui-shadow-control`: buttons with a variant, chips, toggle buttons and fields. `none` until a theme sets it, and the optional `--ui-shadow-field` splits off the fields.
|
|
172
|
+
- `--ui-shadow-elevated`: elevated cards and accordions.
|
|
173
|
+
- `--ui-shadow-overlay`: dialogs, drawers, menus, `select` pickers and the carousel buttons.
|
|
174
|
+
- `--ui-shadow-scroll`: the edges of scrolled dialogs, drawers and sticky table headers.
|
|
175
|
+
- `--ui-shadow-surface`: tonal and outlined cards and accordions, and callouts. `none` by default.
|
|
176
|
+
- `--ui-shadow-selected`: the selected tab.
|
|
177
|
+
- `--ui-shadow-color`: the color and base opacity every default shadow is built from, a `light-dark()` pair, so shadows darken in dark mode, also in `.ui-dark` parts of the page. Each layer adds its own opacity on top.
|
|
178
|
+
|
|
179
|
+
```css
|
|
180
|
+
:where(html) {
|
|
181
|
+
--ui-shadow-color: light-dark(oklch(0.28 0.055 290 / 2%), oklch(0 0 0 / 30%));
|
|
182
|
+
--ui-shadow-elevated: none;
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Motion
|
|
187
|
+
|
|
188
|
+
`--ui-motion` multiplies every duration. It is `1`, or `0` under `prefers-reduced-motion: reduce`.
|
|
189
|
+
|
|
190
|
+
### Global classes
|
|
191
|
+
|
|
192
|
+
On `html`, these override the OS preference for every transition and animation. Smooth scrolling follows the system setting only, since `normalize.css` keys it on `prefers-reduced-motion`.
|
|
193
|
+
|
|
194
|
+
- `.ui-motion-off`: sets `--ui-motion: 0`.
|
|
195
|
+
- `.ui-motion-on`: sets `--ui-motion: 1`.
|
|
196
|
+
- `.ui-motion-debug`: sets `--ui-motion: 10` (slows down transitions 10x).
|
|
197
|
+
|
|
198
|
+
```html
|
|
199
|
+
<html lang="en" class="ui-motion-debug">
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Local overrides
|
|
203
|
+
|
|
204
|
+
Each component reads it through its own `--_motion`, so you can turn one off:
|
|
205
|
+
|
|
206
|
+
```html
|
|
207
|
+
<button class="ui-button" style="--_motion: 0" type="button">
|
|
208
|
+
Instant interaction
|
|
209
|
+
</button>
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
To follow it in your own CSS:
|
|
213
|
+
|
|
214
|
+
```css
|
|
215
|
+
transition: transform calc(var(--ui-duration) * var(--ui-motion)) var(--ui-ease);
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
## Contrast
|
|
219
|
+
|
|
220
|
+
`--ui-contrast` is `normal`, or `more` under `prefers-contrast: more`. More contrast changes no color directly. It tightens the knobs the roles are derived from, and every role follows: `--ui-text-strength-light` and `--ui-text-strength-dark` (how much of `--ui-text-strong` goes into `--ui-text`), `--ui-border-strength-light`, `--ui-border-strength-dark` and `--ui-field-border-strength` for the borders, `--ui-text-max-lightness`, `--ui-text-min-lightness` and `--ui-text-max-chroma` for the `-text` roles, `--ui-accent-fill-max-lightness` for intent fills, `--ui-primary-max-lightness` and `--ui-primary-min-lightness` for the primary, the `--ui-palette-*-lightness` limits for the palette roles, and `--ui-focus-ring-width`. Their values in both modes are on [Theme tokens](https://open-props-ui.netlify.app/html/guide/theme-tokens.md#contrast). Components with translucent fills or text have style queries of their own for the shape changes.
|
|
221
|
+
|
|
222
|
+
A theme that sets a knob or `--ui-primary-source` keeps working with more contrast. The example themes set their brand color that way and let `--ui-on-primary` and `--ui-primary-text` derive from it, so Bootstrap's blue darkens under more contrast and its text follows. A theme that pins a role directly, such as `--ui-border-color: oklch(0.95 0 0)`, owns that role in every contrast mode. Set the knob instead, or hand the role back to the library under more contrast with `revert-layer`, which drops the theme's value and keeps the library's formula, computed from the theme's own `--ui-text-strong` and `--ui-surface`:
|
|
223
|
+
|
|
224
|
+
```css
|
|
225
|
+
@layer theme.custom {
|
|
226
|
+
:where(html, .ui-palette, .ui-contrast-more) {
|
|
227
|
+
--ui-border-color: oklch(0.95 0 0);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
@media (prefers-contrast: more) {
|
|
231
|
+
:where(
|
|
232
|
+
html:not(.ui-contrast-normal),
|
|
233
|
+
html:not(.ui-contrast-normal) .ui-palette
|
|
234
|
+
) {
|
|
235
|
+
--ui-border-color: revert-layer;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
:where(.ui-contrast-more, .ui-contrast-more .ui-palette) {
|
|
240
|
+
--ui-border-color: revert-layer;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
The example themes do this for their borders, field borders, focus ring and subtle text, so they keep their originals' look at normal contrast and meet every contrast promise with more contrast. Hand back a role only where the library's value is stronger: a theme whose `--ui-text` already equals `--ui-text-strong` keeps it, and brutalist, whose borders are already black, draws them in `--ui-text` instead so they stay visible in dark mode. The Theme builder hands back the same roles when you set them.
|
|
246
|
+
|
|
247
|
+
### Classes
|
|
248
|
+
|
|
249
|
+
- `.ui-contrast-more`: sets `--ui-contrast: more` and the tightened knobs, on `html` or any element. On an element it is a scope like `.ui-palette`, so every role inside is derived again.
|
|
250
|
+
- `.ui-contrast-normal`: sets `--ui-contrast: normal`, on `html` to ignore the OS preference. It can't lower the contrast inside a `.ui-contrast-more` ancestor.
|
|
251
|
+
|
|
252
|
+
```html
|
|
253
|
+
<html lang="en" class="ui-contrast-more">
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### Custom values
|
|
257
|
+
|
|
258
|
+
To tune more contrast, set the knobs where the library sets them: on `html` under the media query, and on `.ui-contrast-more`.
|
|
259
|
+
|
|
260
|
+
```css
|
|
261
|
+
@layer theme.custom {
|
|
262
|
+
@media (prefers-contrast: more) {
|
|
263
|
+
:where(html:not(.ui-contrast-normal)) {
|
|
264
|
+
--ui-border-strength-light: 70%;
|
|
265
|
+
--ui-field-border-strength: 80%;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
:where(.ui-contrast-more) {
|
|
270
|
+
--ui-border-strength-light: 70%;
|
|
271
|
+
--ui-field-border-strength: 80%;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
### Forced colors
|
|
277
|
+
|
|
278
|
+
Under `forced-colors: active`, selected tabs, toggles and list items use `SelectedItem`, switches, ranges, progress bars and dividers `CanvasText`, and focused fields a `Highlight` outline. Nothing to configure.
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
# Toggle
|
|
2
|
+
|
|
3
|
+
Toggle buttons and toggle groups switch options on and off, alone or as a set.
|
|
4
|
+
|
|
5
|
+
- CSS: `opui-css/css/components/toggle-group.css` and `opui-css/css/components/toggle-button.css`.
|
|
6
|
+
- Full docs with every example: [HTML](https://open-props-ui.netlify.app/html/components/toggle.md), [Astro](https://open-props-ui.netlify.app/astro/components/toggle.md), [React](https://open-props-ui.netlify.app/react/components/toggle.md), [Svelte](https://open-props-ui.netlify.app/svelte/components/toggle.md), [Vue](https://open-props-ui.netlify.app/vue/components/toggle.md).
|
|
7
|
+
|
|
8
|
+
## ToggleGroup
|
|
9
|
+
|
|
10
|
+
### Parts
|
|
11
|
+
|
|
12
|
+
- `.ui-toggle-group` (root): Container element.
|
|
13
|
+
- `.ui-toggle-button` (`ToggleButton`): A toggle button.
|
|
14
|
+
|
|
15
|
+
### Props and modifiers
|
|
16
|
+
|
|
17
|
+
- `defaultValue` (React): `string | string[]`. The starting selection when `value` is omitted.
|
|
18
|
+
- `multiple`: `boolean`, `[role="group"]`. Lets several buttons be checked, with checkbox inputs. Without it, one button is checked at a time, with radio inputs in a `[role="radiogroup"]`.
|
|
19
|
+
- `name`: `string`. The name shared by the inputs. Generated when omitted.
|
|
20
|
+
- `onValueChange` (React): `(value: string | string[]) => void`. Called with the new selection when a button is toggled.
|
|
21
|
+
- `orientation`: `"horizontal"` (default), `"vertical"` (`.ui-vertical`). The orientation of the element.
|
|
22
|
+
- `overflow`: `"scroll"` (`.ui-overflow-scroll`), `"shrink"` (`.ui-overflow-shrink`), `"wrap"` (default). What the items do when they don't fit. `"wrap"` wraps them onto more rows, `"scroll"` keeps them on one row and scrolls it sideways, and `"shrink"` keeps them on one row and truncates labels with an ellipsis. Icon-only items keep their size.
|
|
23
|
+
- `size`: `"large"` (`.ui-large`), `"medium"` (default), `"small"` (`.ui-small`), `"x-small"` (`.ui-x-small`). The size of the buttons.
|
|
24
|
+
- `value` (React): `string | string[]`. The value of the checked button, or the values of the checked buttons with `multiple`.
|
|
25
|
+
|
|
26
|
+
### Slots
|
|
27
|
+
|
|
28
|
+
- `default`: The toggle buttons.
|
|
29
|
+
|
|
30
|
+
Model: `value` (`string | string[]`), the value of the checked button, or the values of the checked buttons with `multiple`. Astro and React `value`, Svelte `bind:value`, Vue `v-model`.
|
|
31
|
+
|
|
32
|
+
### Notes
|
|
33
|
+
|
|
34
|
+
- Astro: The selection lives in the inputs. Read it from the form, or listen for `change` in a script.
|
|
35
|
+
- React: Use `value` with `onValueChange`, or `defaultValue`. Without them the buttons keep their own state, and `onValueChange` still reports changes.
|
|
36
|
+
- Svelte: Bind `value` with a starting value to control the selection, `""` or `[]` for none. Without it, or bound to `undefined`, the buttons keep their own state.
|
|
37
|
+
- Vue: Bind `v-model` with a starting value to control the selection, `""` or `[]` for none. Without it, or bound to `undefined`, the buttons keep their own state.
|
|
38
|
+
|
|
39
|
+
## ToggleButton
|
|
40
|
+
|
|
41
|
+
### Parts
|
|
42
|
+
|
|
43
|
+
- `label.ui-toggle-button` (root): Container element.
|
|
44
|
+
- `<input>`: A visually hidden checkbox or radio input.
|
|
45
|
+
|
|
46
|
+
### Props and modifiers
|
|
47
|
+
|
|
48
|
+
- `checked`: `boolean`, `input[checked]`. Selects the button.
|
|
49
|
+
- `disabled`: `boolean`, `input[disabled]`. Disables the button.
|
|
50
|
+
- `id`: `string`. The id of the `<input>`.
|
|
51
|
+
- `label`: `string`. The button text when there is no child content.
|
|
52
|
+
- `name`: `string`. The name of the input. Set by the group.
|
|
53
|
+
- `required`: `boolean`. The form won't submit until it's checked. A `ToggleGroup` without `multiple` needs it on one button only.
|
|
54
|
+
- `size`: `"large"` (`.ui-large`), `"medium"` (default), `"small"` (`.ui-small`), `"x-small"` (`.ui-x-small`). The size of the element.
|
|
55
|
+
- `type`: `"checkbox"` (`input[type="checkbox"]`, default), `"radio"` (`input[type="radio"]`). The input type. `"radio"` allows one selection in a group. A `ToggleGroup` without `multiple` makes every button a radio.
|
|
56
|
+
- `value`: `string`. The value of the input.
|
|
57
|
+
|
|
58
|
+
### Slots
|
|
59
|
+
|
|
60
|
+
- `default`: The label and an optional icon.
|
|
61
|
+
|
|
62
|
+
Model: `checked` (`boolean`), the checked state of a standalone button. Astro and React `checked`, Svelte `bind:checked`, Vue `v-model`.
|
|
63
|
+
|
|
64
|
+
### Notes
|
|
65
|
+
|
|
66
|
+
- Astro: Attributes that aren't props go to the `<input>`, like `autofocus` and `form`, and `class` and `style` go to the root `<label>`.
|
|
67
|
+
- React: Attributes that aren't props go to the `<input>`, like `autofocus` and `form`, and `className` and `style` go to the root `<label>`. `defaultChecked` sets the starting state, and `checked` with `onChange` controls it, like on any input. In a `ToggleGroup` with a `value` or `defaultValue`, the group's value wins and a button's own `checked` and `defaultChecked` are ignored.
|
|
68
|
+
- Svelte: Attributes that aren't props go to the `<input>`, like `autofocus` and `form`, and `class` and `style` go to the root `<label>`. `bind:checked` binds a standalone checkbox button. A radio fires no `change` when another one takes the check, so for a choice of one, use a `ToggleGroup` with `bind:value`. In a `ToggleGroup`, `checked` only sets the starting state: the group's value wins once it has one.
|
|
69
|
+
- Vue: Attributes that aren't props go to the `<input>`, like `autofocus` and `form`, and `class` and `style` go to the root `<label>`. `v-model` binds a standalone checkbox button. A radio fires no `change` when another one takes the check, so for a choice of one, use a `ToggleGroup` with `v-model`. In a `ToggleGroup`, `checked` only sets the starting state: the group's value wins once it has one.
|
|
70
|
+
|
|
71
|
+
## Component properties
|
|
72
|
+
|
|
73
|
+
Set inputs on the component, inline or in your CSS. Outputs follow the variant and state, so never override them.
|
|
74
|
+
|
|
75
|
+
### toggle-group.css
|
|
76
|
+
|
|
77
|
+
- `--_bg-color`: Background of the group. Defaults to `--ui-surface`.
|
|
78
|
+
- `--_border-color`: Color of the outline around the group and the lines between buttons. Defaults to `--ui-control-border-color`, or `--ui-border-color` when the theme doesn't set it.
|
|
79
|
+
- `--_radius`: Corner radius of the group. Defaults to `--ui-button-radius`, or `--ui-radius` when the theme doesn't set it, capped at half a button height so a round radius doesn't clip the end items.
|
|
80
|
+
|
|
81
|
+
### toggle-button.css
|
|
82
|
+
|
|
83
|
+
- `--_ease`: Easing of the focus ring animation. Defaults to `--ui-ease`.
|
|
84
|
+
- `--_font-size`: The font size. Defaults to `--ui-font-size-control`. Set by the size classes on the button or its group.
|
|
85
|
+
- `--_icon-size`: Size of a direct child `svg`. Defaults to `--ui-icon-size`.
|
|
86
|
+
- `--_motion`: Motion multiplier for the focus ring animation. `0` turns it off.
|
|
87
|
+
- `--_selected-bg-color`: Background of the checked button. `--ui-selected` when the theme sets it, otherwise `--ui-primary`.
|
|
88
|
+
- `--_size`: Height and minimum width. Defaults to `--ui-button-size`, set by the size classes on the button or its group.
|
|
89
|
+
|
|
90
|
+
Outputs: `--_bg-color` and `--_duration`.
|
|
91
|
+
|
|
92
|
+
## Theme tokens
|
|
93
|
+
|
|
94
|
+
The stylesheets read `--ui-border-color`, `--ui-border-width`, `--ui-button-radius`, `--ui-button-size`, `--ui-button-size-large`, `--ui-button-size-small`, `--ui-button-size-x-small`, `--ui-control-border-color`, `--ui-control-border-color-filled`, `--ui-disabled-opacity`, `--ui-duration`, `--ui-ease`, `--ui-focus-ring-color`, `--ui-focus-ring-inset`, `--ui-focus-ring-style`, `--ui-focus-ring-width`, `--ui-font-size-caption`, `--ui-font-size-control`, `--ui-font-size-small`, `--ui-icon-size`, `--ui-motion`, `--ui-on-primary`, `--ui-on-selected`, `--ui-primary`, `--ui-radius`, `--ui-selected`, `--ui-shadow-control`, `--ui-space-2`, `--ui-space-3`, `--ui-state-hover-alpha-dark`, `--ui-state-hover-alpha-light`, `--ui-surface`, `--ui-text-disabled` and `--ui-text-strong`. `theming.md` and `tokens.json` describe them.
|
|
95
|
+
|
|
96
|
+
## HTML
|
|
97
|
+
|
|
98
|
+
### Example: Standalone
|
|
99
|
+
|
|
100
|
+
```html
|
|
101
|
+
<label class="ui-toggle-button">
|
|
102
|
+
<input type="checkbox" name="standalone-demo-1" />
|
|
103
|
+
Toggle me
|
|
104
|
+
</label>
|
|
105
|
+
<label class="ui-toggle-button">
|
|
106
|
+
<input type="checkbox" name="standalone-demo-2" />
|
|
107
|
+
<svg
|
|
108
|
+
aria-hidden="true"
|
|
109
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
110
|
+
width="24"
|
|
111
|
+
height="24"
|
|
112
|
+
viewBox="0 0 24 24"
|
|
113
|
+
fill="none"
|
|
114
|
+
stroke="currentColor"
|
|
115
|
+
stroke-width="2"
|
|
116
|
+
stroke-linecap="round"
|
|
117
|
+
stroke-linejoin="round"
|
|
118
|
+
>
|
|
119
|
+
<path d="M12 21a9 9 0 1 0-9-9 9 9 0 0 0 9 9Z"></path>
|
|
120
|
+
<path d="M12 8v4"></path>
|
|
121
|
+
<path d="M12 16h.01"></path>
|
|
122
|
+
</svg>
|
|
123
|
+
Toggle with icon
|
|
124
|
+
</label>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Astro
|
|
128
|
+
|
|
129
|
+
`import { ToggleButton, ToggleGroup } from "opui-css/astro"`
|
|
130
|
+
|
|
131
|
+
### Example: Standalone
|
|
132
|
+
|
|
133
|
+
```astro
|
|
134
|
+
---
|
|
135
|
+
import { ToggleButton } from "opui-css/astro"
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
<ToggleButton label="Toggle me" name="standalone-demo-1" />
|
|
139
|
+
<ToggleButton name="standalone-demo-2">
|
|
140
|
+
<svg
|
|
141
|
+
aria-hidden="true"
|
|
142
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
143
|
+
width="24"
|
|
144
|
+
height="24"
|
|
145
|
+
viewBox="0 0 24 24"
|
|
146
|
+
fill="none"
|
|
147
|
+
stroke="currentColor"
|
|
148
|
+
stroke-width="2"
|
|
149
|
+
stroke-linecap="round"
|
|
150
|
+
stroke-linejoin="round"
|
|
151
|
+
><path d="M12 21a9 9 0 1 0-9-9 9 9 0 0 0 9 9Z"></path><path d="M12 8v4"
|
|
152
|
+
></path><path d="M12 16h.01"></path></svg
|
|
153
|
+
>
|
|
154
|
+
Toggle with icon
|
|
155
|
+
</ToggleButton>
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## React
|
|
159
|
+
|
|
160
|
+
`import { ToggleButton, ToggleGroup } from "opui-css/react"`
|
|
161
|
+
|
|
162
|
+
- Client components (`"use client"`): `ToggleGroup` and `ToggleButton`.
|
|
163
|
+
|
|
164
|
+
### Example: Standalone
|
|
165
|
+
|
|
166
|
+
```tsx
|
|
167
|
+
import { ToggleButton } from "opui-css/react"
|
|
168
|
+
|
|
169
|
+
export default function Standalone() {
|
|
170
|
+
return (
|
|
171
|
+
<>
|
|
172
|
+
<ToggleButton label="Toggle me" name="standalone-demo-1" />
|
|
173
|
+
<ToggleButton name="standalone-demo-2">
|
|
174
|
+
<svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"></svg>
|
|
175
|
+
Toggle with icon
|
|
176
|
+
</ToggleButton>
|
|
177
|
+
</>
|
|
178
|
+
)
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Svelte
|
|
183
|
+
|
|
184
|
+
`import { ToggleButton, ToggleGroup } from "opui-css/svelte"`
|
|
185
|
+
|
|
186
|
+
- Hydration: `bind:value` on `ToggleGroup` and `bind:checked` on `ToggleButton`. The bound value only updates on the client. The native control still changes and submits with its form. Without hydration: Read the value from the form instead.
|
|
187
|
+
|
|
188
|
+
### Example: Standalone
|
|
189
|
+
|
|
190
|
+
```svelte
|
|
191
|
+
<script lang="ts">
|
|
192
|
+
import { ToggleButton } from "opui-css/svelte"
|
|
193
|
+
</script>
|
|
194
|
+
|
|
195
|
+
<ToggleButton label="Toggle me" name="standalone-demo-1" />
|
|
196
|
+
<ToggleButton name="standalone-demo-2">
|
|
197
|
+
<svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></svg>
|
|
198
|
+
Toggle with icon
|
|
199
|
+
</ToggleButton>
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## Vue
|
|
203
|
+
|
|
204
|
+
`import { ToggleButton, ToggleGroup } from "opui-css/vue"`
|
|
205
|
+
|
|
206
|
+
- Hydration: `v-model` on `ToggleGroup` and `ToggleButton`. The bound value only updates on the client. The native control still changes and submits with its form. Without hydration: Read the value from the form instead.
|
|
207
|
+
|
|
208
|
+
### Example: Standalone
|
|
209
|
+
|
|
210
|
+
```vue
|
|
211
|
+
<script setup lang="ts">
|
|
212
|
+
import { ToggleButton } from "opui-css/vue"
|
|
213
|
+
</script>
|
|
214
|
+
|
|
215
|
+
<template>
|
|
216
|
+
<ToggleButton label="Toggle me" name="standalone-demo-1" />
|
|
217
|
+
<ToggleButton name="standalone-demo-2">
|
|
218
|
+
<svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></svg>
|
|
219
|
+
Toggle with icon
|
|
220
|
+
</ToggleButton>
|
|
221
|
+
</template>
|
|
222
|
+
```
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# Tooltip
|
|
2
|
+
|
|
3
|
+
Built on top of Anchor.
|
|
4
|
+
|
|
5
|
+
- CSS: `opui-css/css/components/tooltip.css` and `opui-css/css/components/anchor.css`.
|
|
6
|
+
- Full docs with every example: [HTML](https://open-props-ui.netlify.app/html/components/tooltip.md), [Astro](https://open-props-ui.netlify.app/astro/components/tooltip.md), [React](https://open-props-ui.netlify.app/react/components/tooltip.md), [Svelte](https://open-props-ui.netlify.app/svelte/components/tooltip.md), [Vue](https://open-props-ui.netlify.app/vue/components/tooltip.md).
|
|
7
|
+
|
|
8
|
+
## Tooltip
|
|
9
|
+
|
|
10
|
+
### Parts
|
|
11
|
+
|
|
12
|
+
- `.ui-tooltip` (root): Container element.
|
|
13
|
+
- `& > :first-child`: The trigger that shows the tooltip on hover and focus.
|
|
14
|
+
- `.ui-floating` (`TooltipContent`): The tooltip, a `popover="hint"`.
|
|
15
|
+
|
|
16
|
+
### Props and modifiers
|
|
17
|
+
|
|
18
|
+
- `arrow`: `boolean`, `.ui-arrow`. Adds an arrow that points to the trigger.
|
|
19
|
+
- `id`: `string`. The id of the tooltip. Add `interestfor`, plus `commandfor` and `command="toggle-popover"` for touch, with the same id to the trigger. Required.
|
|
20
|
+
- `positionArea`: `string`, `--ui-anchor-position-area`, default `"self-block-start"`. Any valid `position-area` value. Controls where the tooltip is placed. The `self-` keywords follow the tooltip's own direction, so the placement mirrors in a right-to-left part of a left-to-right page.
|
|
21
|
+
|
|
22
|
+
### Slots
|
|
23
|
+
|
|
24
|
+
- `default`: The trigger, followed by `TooltipContent`.
|
|
25
|
+
|
|
26
|
+
### Notes
|
|
27
|
+
|
|
28
|
+
- HTML: Give `.ui-floating` `popover="hint"` and an id. Add `interestfor`, plus `commandfor` and `command="toggle-popover"` for touch, with that id to the trigger.
|
|
29
|
+
|
|
30
|
+
## Component properties
|
|
31
|
+
|
|
32
|
+
Set inputs on the component, inline or in your CSS. Outputs follow the variant and state, so never override them.
|
|
33
|
+
|
|
34
|
+
### tooltip.css
|
|
35
|
+
|
|
36
|
+
- `--_arrow-size`: Size of the arrow in `.ui-arrow`.
|
|
37
|
+
- `--_bg-color`: Background of the tooltip and its arrow. Defaults to `--ui-surface-inverse`.
|
|
38
|
+
- `--_ease`: Easing of the fade. Defaults to `--ui-ease-enter`.
|
|
39
|
+
- `--_max-inline-size`: The maximum width. Longer content wraps.
|
|
40
|
+
- `--_min-inline-size`: The minimum width, unless the content is narrower.
|
|
41
|
+
- `--_motion`: Motion multiplier for the fade. `0` turns it off.
|
|
42
|
+
- `--_offset`: Distance from the trigger. `.ui-arrow` computes it from `--_arrow-size`.
|
|
43
|
+
- `--_shift`: How far a shifted tooltip reaches past the center of the trigger.
|
|
44
|
+
- `--_text-color`: The text color. Defaults to `--ui-on-inverse`.
|
|
45
|
+
|
|
46
|
+
Outputs: `--_duration`.
|
|
47
|
+
|
|
48
|
+
### anchor.css
|
|
49
|
+
|
|
50
|
+
- `--_shift-x`: Horizontal shift of `.ui-floating`. Defaults to `0`.
|
|
51
|
+
- `--_shift-y`: Vertical shift of `.ui-floating`. Defaults to `0`.
|
|
52
|
+
|
|
53
|
+
## Theme tokens
|
|
54
|
+
|
|
55
|
+
The stylesheets read `--ui-border-width`, `--ui-duration`, `--ui-ease-enter`, `--ui-font-size-small`, `--ui-line-height-tight`, `--ui-motion`, `--ui-on-inverse`, `--ui-radius-small`, `--ui-space-1`, `--ui-space-2`, `--ui-space-4` and `--ui-surface-inverse`. `theming.md` and `tokens.json` describe them.
|
|
56
|
+
|
|
57
|
+
## HTML
|
|
58
|
+
|
|
59
|
+
### Example: Basics
|
|
60
|
+
|
|
61
|
+
```html
|
|
62
|
+
<span class="ui-tooltip">
|
|
63
|
+
<button
|
|
64
|
+
type="button"
|
|
65
|
+
class="ui-button"
|
|
66
|
+
interestfor="tooltip-basics-1"
|
|
67
|
+
commandfor="tooltip-basics-1"
|
|
68
|
+
command="toggle-popover"
|
|
69
|
+
>
|
|
70
|
+
Save
|
|
71
|
+
</button>
|
|
72
|
+
<span class="ui-floating" id="tooltip-basics-1" popover="hint"
|
|
73
|
+
>Save your changes</span
|
|
74
|
+
>
|
|
75
|
+
</span>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Astro
|
|
79
|
+
|
|
80
|
+
`import { Tooltip, TooltipContent } from "opui-css/astro"`
|
|
81
|
+
|
|
82
|
+
### Example: Basics
|
|
83
|
+
|
|
84
|
+
```astro
|
|
85
|
+
---
|
|
86
|
+
import { Button, Tooltip, TooltipContent } from "opui-css/astro"
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
<Tooltip id="tooltip-basics-1">
|
|
90
|
+
<Button
|
|
91
|
+
interestfor="tooltip-basics-1"
|
|
92
|
+
commandfor="tooltip-basics-1"
|
|
93
|
+
command="toggle-popover">Save</Button
|
|
94
|
+
>
|
|
95
|
+
<TooltipContent>Save your changes</TooltipContent>
|
|
96
|
+
</Tooltip>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## React
|
|
100
|
+
|
|
101
|
+
`import { Tooltip, TooltipContent } from "opui-css/react"`
|
|
102
|
+
|
|
103
|
+
### Example: Basics
|
|
104
|
+
|
|
105
|
+
```tsx
|
|
106
|
+
import { Button, Tooltip, TooltipContent } from "opui-css/react"
|
|
107
|
+
|
|
108
|
+
export default function Basics() {
|
|
109
|
+
return (
|
|
110
|
+
<Tooltip id="tooltip-basics-1">
|
|
111
|
+
<Button
|
|
112
|
+
interestfor="tooltip-basics-1"
|
|
113
|
+
commandfor="tooltip-basics-1"
|
|
114
|
+
command="toggle-popover"
|
|
115
|
+
>
|
|
116
|
+
Save
|
|
117
|
+
</Button>
|
|
118
|
+
<TooltipContent>Save your changes</TooltipContent>
|
|
119
|
+
</Tooltip>
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Svelte
|
|
125
|
+
|
|
126
|
+
`import { Tooltip, TooltipContent } from "opui-css/svelte"`
|
|
127
|
+
|
|
128
|
+
### Example: Basics
|
|
129
|
+
|
|
130
|
+
```svelte
|
|
131
|
+
<script lang="ts">
|
|
132
|
+
import { Button, Tooltip, TooltipContent } from "opui-css/svelte"
|
|
133
|
+
</script>
|
|
134
|
+
|
|
135
|
+
<Tooltip id="tooltip-basics-1">
|
|
136
|
+
<Button
|
|
137
|
+
interestfor="tooltip-basics-1"
|
|
138
|
+
commandfor="tooltip-basics-1"
|
|
139
|
+
command="toggle-popover">Save</Button
|
|
140
|
+
>
|
|
141
|
+
<TooltipContent>Save your changes</TooltipContent>
|
|
142
|
+
</Tooltip>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Vue
|
|
146
|
+
|
|
147
|
+
`import { Tooltip, TooltipContent } from "opui-css/vue"`
|
|
148
|
+
|
|
149
|
+
### Example: Basics
|
|
150
|
+
|
|
151
|
+
```vue
|
|
152
|
+
<script setup lang="ts">
|
|
153
|
+
import { Button, Tooltip, TooltipContent } from "opui-css/vue"
|
|
154
|
+
</script>
|
|
155
|
+
|
|
156
|
+
<template>
|
|
157
|
+
<Tooltip id="tooltip-basics-1">
|
|
158
|
+
<Button
|
|
159
|
+
interestfor="tooltip-basics-1"
|
|
160
|
+
commandfor="tooltip-basics-1"
|
|
161
|
+
command="toggle-popover"
|
|
162
|
+
>Save</Button
|
|
163
|
+
>
|
|
164
|
+
<TooltipContent>Save your changes</TooltipContent>
|
|
165
|
+
</Tooltip>
|
|
166
|
+
</template>
|
|
167
|
+
```
|