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,260 @@
|
|
|
1
|
+
# Form
|
|
2
|
+
|
|
3
|
+
Spacing and grouping for form fields.
|
|
4
|
+
|
|
5
|
+
- CSS: `opui-css/css/components/form.css`.
|
|
6
|
+
- Full docs with every example: [HTML](https://open-props-ui.netlify.app/html/components/form.md), [Astro](https://open-props-ui.netlify.app/astro/components/form.md), [React](https://open-props-ui.netlify.app/react/components/form.md), [Svelte](https://open-props-ui.netlify.app/svelte/components/form.md), [Vue](https://open-props-ui.netlify.app/vue/components/form.md).
|
|
7
|
+
|
|
8
|
+
## Form
|
|
9
|
+
|
|
10
|
+
### Parts
|
|
11
|
+
|
|
12
|
+
- `.ui-form` (root): Container element. Spaces its fieldsets and fields.
|
|
13
|
+
|
|
14
|
+
### Props and modifiers
|
|
15
|
+
|
|
16
|
+
- `as`: `"div" | "form"`, default `"form"`. The element to render.
|
|
17
|
+
|
|
18
|
+
### Slots
|
|
19
|
+
|
|
20
|
+
- `default`: The fieldsets and fields.
|
|
21
|
+
|
|
22
|
+
## Fieldset
|
|
23
|
+
|
|
24
|
+
### Parts
|
|
25
|
+
|
|
26
|
+
- `.ui-fieldset` (root): Container element.
|
|
27
|
+
- `<legend>` (`FieldLegend`): The label of the fieldset.
|
|
28
|
+
- `.ui-fieldset > .ui-description` (`FieldDescription`): Supporting text displayed below the legend.
|
|
29
|
+
- `.ui-fieldset > .ui-end-text`: Supporting or error text for the whole group, after the fields.
|
|
30
|
+
|
|
31
|
+
### Props and modifiers
|
|
32
|
+
|
|
33
|
+
- `as`: `"div" | "fieldset"`, default `"fieldset"`. The element to render. Elements other than `fieldset` get `role="group"`. Point their `aria-labelledby` at the legend.
|
|
34
|
+
- `disabled`: `boolean`. Disables every field inside. Only on a `<fieldset>`.
|
|
35
|
+
- State (HTML): `disabled` (`[disabled]`), `invalid` (`:has([aria-invalid="true"], :user-invalid)`), `required` (`:has(:required)`). `disabled` disables every field inside, only on a `<fieldset>`. A field inside with `aria-invalid="true"`, or that is `:user-invalid`, colors the end text, and a required field adds a required mark after the legend.
|
|
36
|
+
|
|
37
|
+
### Slots
|
|
38
|
+
|
|
39
|
+
- `default`: The legend, description and fields.
|
|
40
|
+
|
|
41
|
+
## FieldLegend
|
|
42
|
+
|
|
43
|
+
### Parts
|
|
44
|
+
|
|
45
|
+
- `:is(legend, .ui-legend)` (root): The label of a fieldset.
|
|
46
|
+
|
|
47
|
+
### Props and modifiers
|
|
48
|
+
|
|
49
|
+
- `as`: `"legend" | "p"`, default `"legend"`. The element to render. Adds `.ui-legend` when not `"legend"`.
|
|
50
|
+
|
|
51
|
+
### Slots
|
|
52
|
+
|
|
53
|
+
- `default`: The label.
|
|
54
|
+
|
|
55
|
+
## FieldDescription
|
|
56
|
+
|
|
57
|
+
### Parts
|
|
58
|
+
|
|
59
|
+
- `.ui-description` (root): Supporting text for a fieldset.
|
|
60
|
+
|
|
61
|
+
### Slots
|
|
62
|
+
|
|
63
|
+
- `default`: The text.
|
|
64
|
+
|
|
65
|
+
## FieldGroup
|
|
66
|
+
|
|
67
|
+
### Parts
|
|
68
|
+
|
|
69
|
+
- `.ui-field-group` (root): Container element.
|
|
70
|
+
|
|
71
|
+
### Props and modifiers
|
|
72
|
+
|
|
73
|
+
- `name`: `string`. Sets `name` on the OPUI fields inside that don't set their own.
|
|
74
|
+
- `orientation`: `"auto"` (default), `"horizontal"` (`.ui-horizontal`), `"vertical"` (`.ui-vertical`). The orientation of the fields. With `auto`, fields stack and a group with only buttons lines up in a row.
|
|
75
|
+
|
|
76
|
+
### Slots
|
|
77
|
+
|
|
78
|
+
- `default`: The fields, such as checkboxes, radios or switches.
|
|
79
|
+
|
|
80
|
+
### Notes
|
|
81
|
+
|
|
82
|
+
- HTML: To label the group, wrap it in a `.ui-fieldset` with a `<legend>`.
|
|
83
|
+
|
|
84
|
+
## Theme tokens
|
|
85
|
+
|
|
86
|
+
The stylesheets read `--ui-disabled-opacity`, `--ui-field-helper-font-size`, `--ui-field-helper-line-height`, `--ui-field-helper-text-color`, `--ui-field-label-font-weight`, `--ui-field-label-text-color`, `--ui-field-required-text-color`, `--ui-font-size-small`, `--ui-invalid-text`, `--ui-line-height-control`, `--ui-space-1`, `--ui-space-2`, `--ui-space-3`, `--ui-space-4`, `--ui-space-5`, `--ui-space-8` and `--ui-text`. `theming.md` and `tokens.json` describe them.
|
|
87
|
+
|
|
88
|
+
## HTML
|
|
89
|
+
|
|
90
|
+
### Example: Basics
|
|
91
|
+
|
|
92
|
+
```html
|
|
93
|
+
<form class="ui-form">
|
|
94
|
+
<fieldset class="ui-fieldset">
|
|
95
|
+
<legend>Contact</legend>
|
|
96
|
+
<p class="ui-description">How can we reach you?</p>
|
|
97
|
+
<div class="ui-field-group">
|
|
98
|
+
<label class="ui-text-field">
|
|
99
|
+
<span class="ui-label">Name</span>
|
|
100
|
+
<span class="ui-field">
|
|
101
|
+
<input autocomplete="name" type="text" />
|
|
102
|
+
</span>
|
|
103
|
+
</label>
|
|
104
|
+
<label class="ui-text-field">
|
|
105
|
+
<span class="ui-label">Email</span>
|
|
106
|
+
<span class="ui-field">
|
|
107
|
+
<input autocomplete="email" type="email" />
|
|
108
|
+
</span>
|
|
109
|
+
</label>
|
|
110
|
+
</div>
|
|
111
|
+
</fieldset>
|
|
112
|
+
<div class="ui-field-group">
|
|
113
|
+
<button class="ui-button ui-filled" type="submit">Send</button>
|
|
114
|
+
</div>
|
|
115
|
+
</form>
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Astro
|
|
119
|
+
|
|
120
|
+
`import { FieldDescription, FieldGroup, FieldLegend, Fieldset, Form } from "opui-css/astro"`
|
|
121
|
+
|
|
122
|
+
### Example: Basics
|
|
123
|
+
|
|
124
|
+
```astro
|
|
125
|
+
---
|
|
126
|
+
import {
|
|
127
|
+
Button,
|
|
128
|
+
FieldDescription,
|
|
129
|
+
FieldGroup,
|
|
130
|
+
FieldLegend,
|
|
131
|
+
Fieldset,
|
|
132
|
+
Form,
|
|
133
|
+
TextField,
|
|
134
|
+
} from "opui-css/astro"
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
<Form>
|
|
138
|
+
<Fieldset>
|
|
139
|
+
<FieldLegend>Contact</FieldLegend>
|
|
140
|
+
<FieldDescription>How can we reach you?</FieldDescription>
|
|
141
|
+
<FieldGroup>
|
|
142
|
+
<TextField autocomplete="name" label="Name" />
|
|
143
|
+
<TextField autocomplete="email" label="Email" type="email" />
|
|
144
|
+
</FieldGroup>
|
|
145
|
+
</Fieldset>
|
|
146
|
+
<FieldGroup>
|
|
147
|
+
<Button type="submit" variant="filled">Send</Button>
|
|
148
|
+
</FieldGroup>
|
|
149
|
+
</Form>
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## React
|
|
153
|
+
|
|
154
|
+
`import { FieldDescription, FieldGroup, FieldLegend, Fieldset, Form } from "opui-css/react"`
|
|
155
|
+
|
|
156
|
+
- Client components (`"use client"`): `FieldGroup`.
|
|
157
|
+
|
|
158
|
+
### Example: Basics
|
|
159
|
+
|
|
160
|
+
```tsx
|
|
161
|
+
import {
|
|
162
|
+
Button,
|
|
163
|
+
FieldDescription,
|
|
164
|
+
FieldGroup,
|
|
165
|
+
FieldLegend,
|
|
166
|
+
Fieldset,
|
|
167
|
+
Form,
|
|
168
|
+
TextField,
|
|
169
|
+
} from "opui-css/react"
|
|
170
|
+
|
|
171
|
+
export default function Basics() {
|
|
172
|
+
return (
|
|
173
|
+
<Form>
|
|
174
|
+
<Fieldset>
|
|
175
|
+
<FieldLegend>Contact</FieldLegend>
|
|
176
|
+
<FieldDescription>How can we reach you?</FieldDescription>
|
|
177
|
+
<FieldGroup>
|
|
178
|
+
<TextField autoComplete="name" label="Name" />
|
|
179
|
+
<TextField autoComplete="email" label="Email" type="email" />
|
|
180
|
+
</FieldGroup>
|
|
181
|
+
</Fieldset>
|
|
182
|
+
<FieldGroup>
|
|
183
|
+
<Button type="submit" variant="filled">
|
|
184
|
+
Send
|
|
185
|
+
</Button>
|
|
186
|
+
</FieldGroup>
|
|
187
|
+
</Form>
|
|
188
|
+
)
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## Svelte
|
|
193
|
+
|
|
194
|
+
`import { FieldDescription, FieldGroup, FieldLegend, Fieldset, Form } from "opui-css/svelte"`
|
|
195
|
+
|
|
196
|
+
### Example: Basics
|
|
197
|
+
|
|
198
|
+
```svelte
|
|
199
|
+
<script lang="ts">
|
|
200
|
+
import {
|
|
201
|
+
Button,
|
|
202
|
+
FieldDescription,
|
|
203
|
+
FieldGroup,
|
|
204
|
+
FieldLegend,
|
|
205
|
+
Fieldset,
|
|
206
|
+
Form,
|
|
207
|
+
TextField,
|
|
208
|
+
} from "opui-css/svelte"
|
|
209
|
+
</script>
|
|
210
|
+
|
|
211
|
+
<Form>
|
|
212
|
+
<Fieldset>
|
|
213
|
+
<FieldLegend>Contact</FieldLegend>
|
|
214
|
+
<FieldDescription>How can we reach you?</FieldDescription>
|
|
215
|
+
<FieldGroup>
|
|
216
|
+
<TextField autocomplete="name" label="Name" />
|
|
217
|
+
<TextField autocomplete="email" label="Email" type="email" />
|
|
218
|
+
</FieldGroup>
|
|
219
|
+
</Fieldset>
|
|
220
|
+
<FieldGroup>
|
|
221
|
+
<Button type="submit" variant="filled">Send</Button>
|
|
222
|
+
</FieldGroup>
|
|
223
|
+
</Form>
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## Vue
|
|
227
|
+
|
|
228
|
+
`import { FieldDescription, FieldGroup, FieldLegend, Fieldset, Form } from "opui-css/vue"`
|
|
229
|
+
|
|
230
|
+
### Example: Basics
|
|
231
|
+
|
|
232
|
+
```vue
|
|
233
|
+
<script setup lang="ts">
|
|
234
|
+
import {
|
|
235
|
+
Button,
|
|
236
|
+
FieldDescription,
|
|
237
|
+
FieldGroup,
|
|
238
|
+
FieldLegend,
|
|
239
|
+
Fieldset,
|
|
240
|
+
Form,
|
|
241
|
+
TextField,
|
|
242
|
+
} from "opui-css/vue"
|
|
243
|
+
</script>
|
|
244
|
+
|
|
245
|
+
<template>
|
|
246
|
+
<Form>
|
|
247
|
+
<Fieldset>
|
|
248
|
+
<FieldLegend>Contact</FieldLegend>
|
|
249
|
+
<FieldDescription>How can we reach you?</FieldDescription>
|
|
250
|
+
<FieldGroup>
|
|
251
|
+
<TextField autocomplete="name" label="Name" />
|
|
252
|
+
<TextField autocomplete="email" label="Email" type="email" />
|
|
253
|
+
</FieldGroup>
|
|
254
|
+
</Fieldset>
|
|
255
|
+
<FieldGroup>
|
|
256
|
+
<Button type="submit" variant="filled">Send</Button>
|
|
257
|
+
</FieldGroup>
|
|
258
|
+
</Form>
|
|
259
|
+
</template>
|
|
260
|
+
```
|
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
# Getting started
|
|
2
|
+
|
|
3
|
+
Every framework needs the CSS. The HTML section covers the CDN file, the npm imports and the files to copy. The Astro, React, Svelte and Vue sections add their install, CSS import and component import steps.
|
|
4
|
+
|
|
5
|
+
## HTML
|
|
6
|
+
|
|
7
|
+
Add the CSS from the CDN, from npm or by copying the files, then write the class names.
|
|
8
|
+
|
|
9
|
+
Open Props UI is *just CSS*. You can copy any [component](https://open-props-ui.netlify.app/html/components.md) CSS straight from the docs - no install required. Each component page has its CSS under Installation, with the files it depends on and a button that copies them all. It reads tokens from `palette.css` and `theme.css`, so those need to be on the page too, after `layers.css` sets the layer order. `normalize.css` adds the focus ring and `utils.css` adds `.ui-sr-only` and the motion classes. The CDN link below has all of it in one file.
|
|
10
|
+
|
|
11
|
+
### Install via CDN
|
|
12
|
+
|
|
13
|
+
The quickest way to get going. One file with the theme, the reset, every component and the utility classes, in the right cascade layers, plus Open Props for your own CSS.
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/opui-css@6/dist/opui.css" />
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
It includes the [browser fallbacks](https://open-props-ui.netlify.app/html/guide/browser-support.md#compat). `dist/opui.no-compat.css` leaves them out, and `dist/opui.baseline-<year>.css` keeps only the ones that browsers of that Baseline year need.
|
|
20
|
+
|
|
21
|
+
`@6` loads the newest 6.x release, so a new major version never changes your site. Pin an exact version, such as `@6.0.0`, for full control.
|
|
22
|
+
|
|
23
|
+
6.0.0 isn't on npm yet, so the jsDelivr links on this page work once it is published. `opui-css@next` has the release candidate, 6.0.0-rc.1. Until then, build the package from [the repository](https://github.com/felix-bohlin/ui) (`pnpm install`, then `pnpm --filter opui-css build`) and use `packages/opui/dist/opui.css`, or load `opui-css@5` (5.4.3), the previous major: [Migrating](https://open-props-ui.netlify.app/html/guide/migrating.md) lists what changed since.
|
|
24
|
+
|
|
25
|
+
### Install via NPM
|
|
26
|
+
|
|
27
|
+
For when you have a bundler that resolves CSS `@import`s from `node_modules`, like Vite or webpack. No bundler? Use the CDN or install manually.
|
|
28
|
+
|
|
29
|
+
`pnpm`
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
pnpm add opui-css
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
`npm`
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
npm install opui-css
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
#### Import the CSS
|
|
42
|
+
|
|
43
|
+
Either import everything in your main CSS file:
|
|
44
|
+
|
|
45
|
+
```css
|
|
46
|
+
@import "opui-css/css/imports.css";
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Or pick and choose the parts you want to include:
|
|
50
|
+
|
|
51
|
+
```css
|
|
52
|
+
@import "opui-css/css/layers.css";
|
|
53
|
+
@import "opui-css/core/palette.css";
|
|
54
|
+
@import "opui-css/css/theme.css";
|
|
55
|
+
@import "opui-css/core/normalize.css";
|
|
56
|
+
@import "opui-css/css/components/button.css";
|
|
57
|
+
@import "opui-css/css/components/choice.css";
|
|
58
|
+
@import "opui-css/css/components/checkbox.css";
|
|
59
|
+
@import "opui-css/css/compat.css";
|
|
60
|
+
@import "opui-css/core/utils.css";
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Import `layers.css` first and `utils.css` last, it holds `.ui-sr-only` and the motion classes. Add `choice.css` with `checkbox.css`, `radio.css` or `switch.css`. Import `opui-css/css/components.css` instead of single component files to get every component. `compat.css` holds the [browser fallbacks](https://open-props-ui.netlify.app/html/guide/browser-support.md#compat), and you can leave it out.
|
|
64
|
+
|
|
65
|
+
### Install manually
|
|
66
|
+
|
|
67
|
+
The most flexible way to use OPUI, and it works without a build step. Download the package (`npm pack opui-css`, or browse it on [jsDelivr](https://cdn.jsdelivr.net/npm/opui-css@6/)) and drop these files into your project:
|
|
68
|
+
|
|
69
|
+
```text
|
|
70
|
+
opui
|
|
71
|
+
├─ core
|
|
72
|
+
│ ├─ normalize.css
|
|
73
|
+
│ ├─ palette.css
|
|
74
|
+
│ └─ utils.css
|
|
75
|
+
├─ css
|
|
76
|
+
│ ├─ compat
|
|
77
|
+
│ │ ├─ avatar.css
|
|
78
|
+
│ │ └─ ...
|
|
79
|
+
│ ├─ components
|
|
80
|
+
│ │ ├─ accordion.css
|
|
81
|
+
│ │ └─ ...
|
|
82
|
+
│ ├─ js
|
|
83
|
+
│ │ ├─ checkbox.js
|
|
84
|
+
│ │ └─ range.js
|
|
85
|
+
│ ├─ compat.css
|
|
86
|
+
│ ├─ components.css
|
|
87
|
+
│ ├─ imports.css
|
|
88
|
+
│ ├─ layers.css
|
|
89
|
+
│ └─ theme.css
|
|
90
|
+
├─ dist
|
|
91
|
+
│ ├─ op.css
|
|
92
|
+
│ ├─ opui.baseline-2023.css
|
|
93
|
+
│ ├─ ...
|
|
94
|
+
│ ├─ opui.components.css
|
|
95
|
+
│ ├─ opui.css
|
|
96
|
+
│ └─ opui.no-compat.css
|
|
97
|
+
├─ themes
|
|
98
|
+
│ ├─ bootstrap.css
|
|
99
|
+
│ ├─ brutalist.css
|
|
100
|
+
│ ├─ m3.css
|
|
101
|
+
│ └─ shadcn.css
|
|
102
|
+
├─ open-props.css
|
|
103
|
+
└─ tokens.json
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
`dist/op.css` is Open Props, pre-bundled in the `openprops` layer, and `open-props.css` imports it from `node_modules` for bundlers. The components don't read it, so both are optional and only there for your own CSS. `dist/opui.css` is the CDN file. `themes/` holds the [example themes](https://open-props-ui.netlify.app/html/guide/customizing.md#example-themes) and `tokens.json` the [design tokens](https://open-props-ui.netlify.app/html/guide/theme-tokens.md#tokens-json).
|
|
107
|
+
|
|
108
|
+
Then import the files in your main CSS, in this order:
|
|
109
|
+
|
|
110
|
+
```css
|
|
111
|
+
@import "./opui/css/layers.css";
|
|
112
|
+
|
|
113
|
+
@import "./opui/core/palette.css";
|
|
114
|
+
@import "./opui/css/theme.css";
|
|
115
|
+
@import "./opui/core/normalize.css";
|
|
116
|
+
@import "./opui/css/components.css";
|
|
117
|
+
@import "./opui/css/compat.css";
|
|
118
|
+
@import "./opui/core/utils.css";
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
If your own CSS reads Open Props, import `./opui/dist/op.css` right after `layers.css`. Leave out `compat.css` if you don't need the browser fallbacks.
|
|
122
|
+
|
|
123
|
+
### Your first component
|
|
124
|
+
|
|
125
|
+
With the CSS on the page, a component is a class on the right element. The modifiers are classes too.
|
|
126
|
+
|
|
127
|
+
Two things need a bit of JavaScript in plain HTML: indeterminate checkboxes (`css/js/checkbox.js`) and the Range value (`css/js/range.js`). Import them in a `<script type="module">`, from `https://cdn.jsdelivr.net/npm/opui-css@6/css/js/` without a bundler.
|
|
128
|
+
|
|
129
|
+
[Concepts](https://open-props-ui.netlify.app/html/guide/concepts.md#javascript) shows the imports and explains the class names, the cascade layers and what needs JavaScript. Then browse the [components](https://open-props-ui.netlify.app/html/components.md). [Theming](https://open-props-ui.netlify.app/html/guide/theming.md) covers colors, density, motion and contrast.
|
|
130
|
+
|
|
131
|
+
## Astro
|
|
132
|
+
|
|
133
|
+
OPUI ships first-class Astro components. Install the package, import what you need, and you're set.
|
|
134
|
+
|
|
135
|
+
### Install via NPM
|
|
136
|
+
|
|
137
|
+
The components ship as uncompiled `.astro` files, which Astro compiles as they are. They need Astro 7 or later.
|
|
138
|
+
|
|
139
|
+
### Import the CSS
|
|
140
|
+
|
|
141
|
+
Astro components ship markup only - the CSS still has to be imported once. The frontmatter of the layout every page uses is a good spot. Import everything:
|
|
142
|
+
|
|
143
|
+
```astro
|
|
144
|
+
---
|
|
145
|
+
import "opui-css/css/imports.css"
|
|
146
|
+
---
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Or pick and choose in a CSS file, and import that file in the layout instead:
|
|
150
|
+
|
|
151
|
+
Same code as in the HTML section.
|
|
152
|
+
|
|
153
|
+
Import `layers.css` first and `utils.css` last, it holds `.ui-sr-only` and the motion classes. Add `choice.css` with `checkbox.css`, `radio.css` or `switch.css`. Import `opui-css/css/components.css` instead of single component files to get every component. `compat.css` holds the [browser fallbacks](https://open-props-ui.netlify.app/astro/guide/browser-support.md#compat), and you can leave it out.
|
|
154
|
+
|
|
155
|
+
```astro
|
|
156
|
+
---
|
|
157
|
+
import "../styles/global.css"
|
|
158
|
+
---
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### How to use
|
|
162
|
+
|
|
163
|
+
```astro
|
|
164
|
+
---
|
|
165
|
+
import { Button } from "opui-css/astro"
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
<Button variant="filled">Click me</Button>
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Containers take parts, such as `CardHeader` and `DialogFooter`. Other components take named slots for rich content, such as `end-text` on a `TextField`.
|
|
172
|
+
|
|
173
|
+
[Concepts](https://open-props-ui.netlify.app/astro/guide/concepts.md) explains how props map to classes, the cascade layers and what needs JavaScript. Then browse the [components](https://open-props-ui.netlify.app/astro/components.md). [Theming](https://open-props-ui.netlify.app/astro/guide/theming.md) covers colors, density, motion and contrast.
|
|
174
|
+
|
|
175
|
+
### Server runtime
|
|
176
|
+
|
|
177
|
+
The components pass settings to their parts with `AsyncLocalStorage` from `node:async_hooks`, so they run on Node, Deno and Bun. On Cloudflare, enable the `nodejs_compat` compatibility flag.
|
|
178
|
+
|
|
179
|
+
#### Ids
|
|
180
|
+
|
|
181
|
+
Components that link elements with ids (form fields, Tabs, Drawer, Menu) read `Astro.locals.$id` when it exists and otherwise generate a random id per render. For stable, per-request ids, useful for snapshot tests, define it in a middleware:
|
|
182
|
+
|
|
183
|
+
```ts
|
|
184
|
+
import { defineMiddleware } from "astro:middleware"
|
|
185
|
+
|
|
186
|
+
export const onRequest = defineMiddleware((context, next) => {
|
|
187
|
+
const counts = new Map<string, number>()
|
|
188
|
+
context.locals.$id = (prefix) => {
|
|
189
|
+
const count = (counts.get(prefix) ?? 0) + 1
|
|
190
|
+
counts.set(prefix, count)
|
|
191
|
+
return `${prefix}-${count}`
|
|
192
|
+
}
|
|
193
|
+
return next()
|
|
194
|
+
})
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Add `/// <reference types="opui-css/env.d.ts" />` to your `env.d.ts` to type `$id` and the `interestfor` attribute on `a` and `button`.
|
|
198
|
+
|
|
199
|
+
## React
|
|
200
|
+
|
|
201
|
+
OPUI ships first-class React 19 components. Install the package, import what you need, and you're set.
|
|
202
|
+
|
|
203
|
+
### Install via NPM
|
|
204
|
+
|
|
205
|
+
The components ship as uncompiled TypeScript (`.tsx` and `.ts`), so your build has to compile them. They need React 19 or later, so add `react` and `react-dom` if they aren't installed yet. Vite with `@vitejs/plugin-react` and Astro with `@astrojs/react` compile them as they are. In Next.js, add `transpilePackages: ["opui-css"]` to `next.config`.
|
|
206
|
+
|
|
207
|
+
### Import the CSS
|
|
208
|
+
|
|
209
|
+
React components ship markup only - the CSS still has to be imported once, in your root layout or the entry file that renders your app. Import everything:
|
|
210
|
+
|
|
211
|
+
```tsx
|
|
212
|
+
import "opui-css/css/imports.css"
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Or pick and choose in a CSS file, and import that file in your entry instead:
|
|
216
|
+
|
|
217
|
+
Same code as in the HTML section.
|
|
218
|
+
|
|
219
|
+
Import `layers.css` first and `utils.css` last, it holds `.ui-sr-only` and the motion classes. Add `choice.css` with `checkbox.css`, `radio.css` or `switch.css`. Import `opui-css/css/components.css` instead of single component files to get every component. `compat.css` holds the [browser fallbacks](https://open-props-ui.netlify.app/react/guide/browser-support.md#compat), and you can leave it out.
|
|
220
|
+
|
|
221
|
+
```tsx
|
|
222
|
+
import "./styles/main.css"
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### How to use
|
|
226
|
+
|
|
227
|
+
```tsx
|
|
228
|
+
import { Button } from "opui-css/react"
|
|
229
|
+
|
|
230
|
+
export default function App() {
|
|
231
|
+
return <Button variant="filled">Click me</Button>
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
Containers take parts, such as `CardHeader` and `DialogFooter`. Other slots are props: the default slot is `children` and named slots are camelCased, such as `endText`. Form controls take the native `value` or `defaultValue`, `checked` or `defaultChecked`, and `onChange` props.
|
|
236
|
+
|
|
237
|
+
[Concepts](https://open-props-ui.netlify.app/react/guide/concepts.md) explains how props map to classes, the cascade layers and what needs JavaScript. Then browse the [components](https://open-props-ui.netlify.app/react/components.md). [Theming](https://open-props-ui.netlify.app/react/guide/theming.md) covers colors, density, motion and contrast.
|
|
238
|
+
|
|
239
|
+
### Server rendering
|
|
240
|
+
|
|
241
|
+
Components that need context, state or effects are marked `"use client"`: `Anchor`, `Callout`, `Dialog`, `Drawer`, `FieldGroup`, `Menu`, `Range`, `Select`, `Tabs`, `TextField`, `Textarea`, `ToggleButton` and `ToggleGroup`, and the `CheckboxInput`, `RadioInput` and `SwitchInput` parts. The rest also render as React Server Components. This list is read from the component sources.
|
|
242
|
+
|
|
243
|
+
Without hydration (Astro with `@astrojs/react` and no `client:*` directive, or `renderToString` on its own), every component renders complete HTML. The native controls work and submit with their form. A few things only update on the client:
|
|
244
|
+
|
|
245
|
+
- [Checkbox](https://open-props-ui.netlify.app/react/components/checkbox.md#indeterminate) `indeterminate`: it's a DOM property, so the box looks unchecked. Or call `activateIndeterminate()` from `opui-css/css/js/checkbox.js`.
|
|
246
|
+
- [Range](https://open-props-ui.netlify.app/react/components/range.md#value) value: the `<output>` doesn't follow the thumb. The track fill is CSS, so it's fine.
|
|
247
|
+
|
|
248
|
+
Hydrate those (`client:load` in Astro) or render them on the client. Component pages say what needs hydration next to the browser support chips, and the API tables mark each prop with a crossed-out server icon.
|
|
249
|
+
|
|
250
|
+
## Svelte
|
|
251
|
+
|
|
252
|
+
OPUI ships first-class Svelte 5 components. Install the package, import what you need, and you're set.
|
|
253
|
+
|
|
254
|
+
### Install via NPM
|
|
255
|
+
|
|
256
|
+
The components ship as uncompiled Svelte components (`.svelte` and `.ts`), so your build has to compile them. They need Svelte 5.57 or later, so add `svelte` if it isn't installed yet. Any setup with Svelte support works, for example SvelteKit, Vite with `@sveltejs/vite-plugin-svelte`, or Astro with `@astrojs/svelte`.
|
|
257
|
+
|
|
258
|
+
SvelteKit compiles the package for server rendering through its `svelte` field. In a Vite SSR setup of your own, add it to `ssr.noExternal`, since Node can't load `.svelte` files from `node_modules`:
|
|
259
|
+
|
|
260
|
+
```ts
|
|
261
|
+
import { svelte } from "@sveltejs/vite-plugin-svelte"
|
|
262
|
+
import { defineConfig } from "vite"
|
|
263
|
+
|
|
264
|
+
export default defineConfig({
|
|
265
|
+
plugins: [svelte()],
|
|
266
|
+
ssr: { noExternal: ["opui-css"] },
|
|
267
|
+
})
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### Import the CSS
|
|
271
|
+
|
|
272
|
+
Svelte components ship markup only - the CSS still has to be imported once, in your root layout or the entry file that mounts your app. Import everything:
|
|
273
|
+
|
|
274
|
+
```svelte
|
|
275
|
+
<script lang="ts">
|
|
276
|
+
import "opui-css/css/imports.css"
|
|
277
|
+
|
|
278
|
+
let { children } = $props()
|
|
279
|
+
</script>
|
|
280
|
+
|
|
281
|
+
{@render children()}
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
Or pick and choose in a CSS file, and import that file in your layout instead:
|
|
285
|
+
|
|
286
|
+
Same code as in the HTML section.
|
|
287
|
+
|
|
288
|
+
Import `layers.css` first and `utils.css` last, it holds `.ui-sr-only` and the motion classes. Add `choice.css` with `checkbox.css`, `radio.css` or `switch.css`. Import `opui-css/css/components.css` instead of single component files to get every component. `compat.css` holds the [browser fallbacks](https://open-props-ui.netlify.app/svelte/guide/browser-support.md#compat), and you can leave it out.
|
|
289
|
+
|
|
290
|
+
```svelte
|
|
291
|
+
<script lang="ts">
|
|
292
|
+
import "../styles/main.css"
|
|
293
|
+
|
|
294
|
+
let { children } = $props()
|
|
295
|
+
</script>
|
|
296
|
+
|
|
297
|
+
{@render children()}
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
### How to use
|
|
301
|
+
|
|
302
|
+
```svelte
|
|
303
|
+
<script lang="ts">
|
|
304
|
+
import { Button } from "opui-css/svelte"
|
|
305
|
+
</script>
|
|
306
|
+
|
|
307
|
+
<Button variant="filled">Click me</Button>
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
Containers take parts, such as `CardHeader` and `DialogFooter`. Other slots are snippets: the default slot is `children` and named slots are camelCased, such as `endText`. `TextField`, `Textarea`, `Select` and `Range` support `bind:value`. `Checkbox` and `Switch` support `bind:checked` and `bind:group`, and `Radio` supports `bind:group`.
|
|
311
|
+
|
|
312
|
+
[Concepts](https://open-props-ui.netlify.app/svelte/guide/concepts.md) explains how props map to classes, the cascade layers and what needs JavaScript. Then browse the [components](https://open-props-ui.netlify.app/svelte/components.md). [Theming](https://open-props-ui.netlify.app/svelte/guide/theming.md) covers colors, density, motion and contrast.
|
|
313
|
+
|
|
314
|
+
### Server rendering
|
|
315
|
+
|
|
316
|
+
Without hydration (SvelteKit with `csr = false`, or Astro with `@astrojs/svelte` and no `client:*` directive), every component renders complete HTML. The native controls work and submit with their form. A few things only update on the client:
|
|
317
|
+
|
|
318
|
+
- [Checkbox](https://open-props-ui.netlify.app/svelte/components/checkbox.md#indeterminate) `indeterminate`: it's a DOM property, so the box looks unchecked. Or call `activateIndeterminate()` from `opui-css/css/js/checkbox.js`.
|
|
319
|
+
- [Range](https://open-props-ui.netlify.app/svelte/components/range.md#value) value: the `<output>` doesn't follow the thumb. The track fill is CSS, so it's fine.
|
|
320
|
+
- `bind:` on [Checkbox](https://open-props-ui.netlify.app/svelte/components/checkbox.md), [Radio](https://open-props-ui.netlify.app/svelte/components/radio.md), [Range](https://open-props-ui.netlify.app/svelte/components/range.md), [Select](https://open-props-ui.netlify.app/svelte/components/select.md), [Switch](https://open-props-ui.netlify.app/svelte/components/switch.md), [Text field](https://open-props-ui.netlify.app/svelte/components/text-field.md) and [Textarea](https://open-props-ui.netlify.app/svelte/components/textarea.md): the bound state stays put. The native value still changes and submits.
|
|
321
|
+
|
|
322
|
+
Hydrate those (`client:load` in Astro) or keep client-side rendering on. Component pages say what needs hydration next to the browser support chips, and the API tables mark each prop with a crossed-out server icon.
|
|
323
|
+
|
|
324
|
+
## Vue
|
|
325
|
+
|
|
326
|
+
OPUI ships first-class Vue components. Install the package, import what you need, and you're set.
|
|
327
|
+
|
|
328
|
+
### Install via NPM
|
|
329
|
+
|
|
330
|
+
The components ship as uncompiled single-file components (`.vue` and `.ts`), so your build has to compile them. They need Vue 3.5 or later, so add `vue` if it isn't installed yet. Any setup with Vue SFC support works, for example Vite with `@vitejs/plugin-vue`, Nuxt, or Astro with `@astrojs/vue`.
|
|
331
|
+
|
|
332
|
+
For server rendering, the server build has to compile the package too, since Node can't load `.vue` files from `node_modules`. In Nuxt, add it to `build.transpile`:
|
|
333
|
+
|
|
334
|
+
```ts
|
|
335
|
+
export default defineNuxtConfig({
|
|
336
|
+
build: { transpile: ["opui-css"] },
|
|
337
|
+
})
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
In a Vite SSR setup of your own, add it to `ssr.noExternal`:
|
|
341
|
+
|
|
342
|
+
```ts
|
|
343
|
+
import vue from "@vitejs/plugin-vue"
|
|
344
|
+
import { defineConfig } from "vite"
|
|
345
|
+
|
|
346
|
+
export default defineConfig({
|
|
347
|
+
plugins: [vue()],
|
|
348
|
+
ssr: { noExternal: ["opui-css"] },
|
|
349
|
+
})
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
### Import the CSS
|
|
353
|
+
|
|
354
|
+
Vue components ship markup only - the CSS still has to be imported once, in the entry file that creates your app. Import everything:
|
|
355
|
+
|
|
356
|
+
```ts
|
|
357
|
+
import { createApp } from "vue"
|
|
358
|
+
import "opui-css/css/imports.css"
|
|
359
|
+
import App from "./App.vue"
|
|
360
|
+
|
|
361
|
+
createApp(App).mount("#app")
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
Or pick and choose in a CSS file, and import that file in `main.ts` instead:
|
|
365
|
+
|
|
366
|
+
Same code as in the HTML section.
|
|
367
|
+
|
|
368
|
+
Import `layers.css` first and `utils.css` last, it holds `.ui-sr-only` and the motion classes. Add `choice.css` with `checkbox.css`, `radio.css` or `switch.css`. Import `opui-css/css/components.css` instead of single component files to get every component. `compat.css` holds the [browser fallbacks](https://open-props-ui.netlify.app/vue/guide/browser-support.md#compat), and you can leave it out.
|
|
369
|
+
|
|
370
|
+
In Nuxt, add the file to `css` in `nuxt.config.ts` instead.
|
|
371
|
+
|
|
372
|
+
```ts
|
|
373
|
+
import "./styles/main.css"
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
### How to use
|
|
377
|
+
|
|
378
|
+
```vue
|
|
379
|
+
<script setup lang="ts">
|
|
380
|
+
import { Button } from "opui-css/vue"
|
|
381
|
+
</script>
|
|
382
|
+
|
|
383
|
+
<template>
|
|
384
|
+
<Button variant="filled">Click me</Button>
|
|
385
|
+
</template>
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
[Concepts](https://open-props-ui.netlify.app/vue/guide/concepts.md) explains how props map to classes, the cascade layers and what needs JavaScript. Then browse the [components](https://open-props-ui.netlify.app/vue/components.md). [Theming](https://open-props-ui.netlify.app/vue/guide/theming.md) covers colors, density, motion and contrast.
|
|
389
|
+
|
|
390
|
+
### Server rendering
|
|
391
|
+
|
|
392
|
+
Without hydration (Nuxt, or Astro with `@astrojs/vue` and no `client:*` directive), every component renders complete HTML. The native controls work and submit with their form. A few things only update on the client:
|
|
393
|
+
|
|
394
|
+
- [Checkbox](https://open-props-ui.netlify.app/vue/components/checkbox.md#indeterminate) `indeterminate`: it's a DOM property, so the box looks unchecked. Or call `activateIndeterminate()` from `opui-css/css/js/checkbox.js`.
|
|
395
|
+
- [Range](https://open-props-ui.netlify.app/vue/components/range.md#value) value: the `<output>` doesn't follow the thumb. The track fill is CSS, so it's fine.
|
|
396
|
+
- `v-model` on [Checkbox](https://open-props-ui.netlify.app/vue/components/checkbox.md), [Radio](https://open-props-ui.netlify.app/vue/components/radio.md), [Range](https://open-props-ui.netlify.app/vue/components/range.md), [Select](https://open-props-ui.netlify.app/vue/components/select.md), [Switch](https://open-props-ui.netlify.app/vue/components/switch.md), [Text field](https://open-props-ui.netlify.app/vue/components/text-field.md) and [Textarea](https://open-props-ui.netlify.app/vue/components/textarea.md): the ref stays put. The native value still changes and submits.
|
|
397
|
+
|
|
398
|
+
Hydrate those (`client:load` in Astro) or use them in a client-rendered Vue app. Component pages say what needs hydration next to the browser support chips, and the API tables mark each prop with a crossed-out server icon.
|