horizon-design 0.0.23 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +5 -0
- package/README.md +456 -2416
- package/dist/components/accordion/Accordion.svelte +22 -4
- package/dist/components/accordion/Accordion.svelte.d.ts +14 -1
- package/dist/components/accordion/AccordionItem.svelte +18 -6
- package/dist/components/accordion/AccordionItem.svelte.d.ts +9 -0
- package/dist/components/accordion/index.d.ts +4 -0
- package/dist/components/accordion/index.js +4 -0
- package/dist/components/action-bar/ActionBar.svelte +9 -2
- package/dist/components/action-bar/ActionBar.svelte.d.ts +4 -0
- package/dist/components/action-bar/ActionBarSeparator.svelte +9 -2
- package/dist/components/action-bar/ActionBarSeparator.svelte.d.ts +3 -0
- package/dist/components/action-bar/index.d.ts +4 -0
- package/dist/components/action-bar/index.js +4 -0
- package/dist/components/alert/Alert.svelte +32 -15
- package/dist/components/alert/Alert.svelte.d.ts +11 -0
- package/dist/components/alert/index.d.ts +4 -0
- package/dist/components/alert/index.js +4 -0
- package/dist/components/alert-dialog/AlertDialog.svelte +105 -65
- package/dist/components/alert-dialog/AlertDialog.svelte.d.ts +27 -3
- package/dist/components/alert-dialog/index.d.ts +4 -0
- package/dist/components/alert-dialog/index.js +4 -0
- package/dist/components/angle-slider/AngleSlider.svelte +70 -23
- package/dist/components/angle-slider/AngleSlider.svelte.d.ts +27 -0
- package/dist/components/angle-slider/index.d.ts +4 -0
- package/dist/components/angle-slider/index.js +4 -0
- package/dist/components/announcement/Announcement.svelte +9 -2
- package/dist/components/announcement/Announcement.svelte.d.ts +4 -0
- package/dist/components/announcement/index.d.ts +4 -0
- package/dist/components/announcement/index.js +4 -0
- package/dist/components/aspect-ratio/AspectRatio.svelte +9 -1
- package/dist/components/aspect-ratio/AspectRatio.svelte.d.ts +5 -0
- package/dist/components/aspect-ratio/index.d.ts +4 -0
- package/dist/components/aspect-ratio/index.js +4 -0
- package/dist/components/asset-card/AssetCard.svelte +103 -0
- package/dist/components/asset-card/AssetCard.svelte.d.ts +38 -0
- package/dist/components/asset-card/index.d.ts +5 -0
- package/dist/components/asset-card/index.js +5 -0
- package/dist/components/avatar/Avatar.svelte +48 -14
- package/dist/components/avatar/Avatar.svelte.d.ts +19 -5
- package/dist/components/avatar/index.d.ts +5 -1
- package/dist/components/avatar/index.js +5 -1
- package/dist/components/avatar/tone.d.ts +14 -0
- package/dist/components/avatar/tone.js +17 -0
- package/dist/components/avatar-stack/AvatarStack.svelte +89 -0
- package/dist/components/avatar-stack/AvatarStack.svelte.d.ts +37 -0
- package/dist/components/avatar-stack/index.d.ts +5 -0
- package/dist/components/avatar-stack/index.js +5 -0
- package/dist/components/badge/Badge.svelte +41 -23
- package/dist/components/badge/Badge.svelte.d.ts +14 -6
- package/dist/components/badge/index.d.ts +4 -0
- package/dist/components/badge/index.js +4 -0
- package/dist/components/bottom-navigation/BottomNavigation.svelte +24 -10
- package/dist/components/bottom-navigation/BottomNavigation.svelte.d.ts +13 -0
- package/dist/components/bottom-navigation/index.d.ts +4 -0
- package/dist/components/bottom-navigation/index.js +4 -0
- package/dist/components/breadcrumb/Breadcrumb.svelte +25 -14
- package/dist/components/breadcrumb/Breadcrumb.svelte.d.ts +8 -0
- package/dist/components/breadcrumb/index.d.ts +4 -0
- package/dist/components/breadcrumb/index.js +4 -0
- package/dist/components/button/Button.svelte +40 -76
- package/dist/components/button/Button.svelte.d.ts +27 -9
- package/dist/components/button/button-variants.d.ts +39 -22
- package/dist/components/button/button-variants.js +29 -26
- package/dist/components/button/index.d.ts +6 -1
- package/dist/components/button/index.js +5 -0
- package/dist/components/button-group/ButtonGroup.svelte +10 -1
- package/dist/components/button-group/ButtonGroup.svelte.d.ts +5 -0
- package/dist/components/button-group/index.d.ts +4 -0
- package/dist/components/button-group/index.js +4 -0
- package/dist/components/calendar/Calendar.svelte +49 -162
- package/dist/components/calendar/Calendar.svelte.d.ts +27 -2
- package/dist/components/calendar/CalendarViews.svelte +204 -0
- package/dist/components/calendar/CalendarViews.svelte.d.ts +24 -0
- package/dist/components/calendar/index.d.ts +4 -0
- package/dist/components/calendar/index.js +4 -0
- package/dist/components/calendar/trigger-ids.d.ts +14 -0
- package/dist/components/calendar/trigger-ids.js +7 -0
- package/dist/components/card/Card.svelte +23 -8
- package/dist/components/card/Card.svelte.d.ts +13 -0
- package/dist/components/card/index.d.ts +4 -0
- package/dist/components/card/index.js +4 -0
- package/dist/components/carousel/Carousel.svelte +96 -21
- package/dist/components/carousel/Carousel.svelte.d.ts +27 -2
- package/dist/components/carousel/index.d.ts +4 -0
- package/dist/components/carousel/index.js +4 -0
- package/dist/components/checkbox/Checkbox.svelte +30 -9
- package/dist/components/checkbox/Checkbox.svelte.d.ts +13 -1
- package/dist/components/checkbox/index.d.ts +4 -0
- package/dist/components/checkbox/index.js +4 -0
- package/dist/components/circular-progress/CircularProgress.svelte +38 -38
- package/dist/components/circular-progress/CircularProgress.svelte.d.ts +18 -2
- package/dist/components/circular-progress/index.d.ts +4 -0
- package/dist/components/circular-progress/index.js +4 -0
- package/dist/components/circular-slider/CircularSlider.svelte +69 -70
- package/dist/components/circular-slider/CircularSlider.svelte.d.ts +24 -2
- package/dist/components/circular-slider/index.d.ts +4 -0
- package/dist/components/circular-slider/index.js +4 -0
- package/dist/components/clipboard/Clipboard.svelte +45 -18
- package/dist/components/clipboard/Clipboard.svelte.d.ts +15 -1
- package/dist/components/clipboard/index.d.ts +4 -0
- package/dist/components/clipboard/index.js +4 -0
- package/dist/components/collapsible/Collapsible.svelte +28 -6
- package/dist/components/collapsible/Collapsible.svelte.d.ts +14 -1
- package/dist/components/collapsible/index.d.ts +4 -0
- package/dist/components/collapsible/index.js +4 -0
- package/dist/components/color-picker/ColorPicker.svelte +224 -64
- package/dist/components/color-picker/ColorPicker.svelte.d.ts +56 -1
- package/dist/components/color-picker/formats.d.ts +23 -0
- package/dist/components/color-picker/formats.js +52 -0
- package/dist/components/color-picker/index.d.ts +6 -0
- package/dist/components/color-picker/index.js +5 -0
- package/dist/components/combobox/Combobox.svelte +100 -23
- package/dist/components/combobox/Combobox.svelte.d.ts +36 -2
- package/dist/components/combobox/index.d.ts +4 -0
- package/dist/components/combobox/index.js +4 -0
- package/dist/components/command-palette/CommandPalette.svelte +85 -0
- package/dist/components/command-palette/CommandPalette.svelte.d.ts +30 -0
- package/dist/components/command-palette/PaletteSearch.svelte +137 -0
- package/dist/components/command-palette/PaletteSearch.svelte.d.ts +28 -0
- package/dist/components/command-palette/filter.d.ts +35 -0
- package/dist/components/command-palette/filter.js +62 -0
- package/dist/components/command-palette/index.d.ts +6 -0
- package/dist/components/command-palette/index.js +5 -0
- package/dist/components/context-menu/ContextMenu.svelte +69 -32
- package/dist/components/context-menu/ContextMenu.svelte.d.ts +29 -4
- package/dist/components/context-menu/index.d.ts +4 -0
- package/dist/components/context-menu/index.js +4 -0
- package/dist/components/data-list/DataList.svelte +13 -4
- package/dist/components/data-list/DataList.svelte.d.ts +6 -0
- package/dist/components/data-list/index.d.ts +4 -0
- package/dist/components/data-list/index.js +4 -0
- package/dist/components/date-picker/DatePicker.svelte +108 -145
- package/dist/components/date-picker/DatePicker.svelte.d.ts +39 -3
- package/dist/components/date-picker/index.d.ts +4 -0
- package/dist/components/date-picker/index.js +4 -0
- package/dist/components/dialog/Dialog.svelte +74 -31
- package/dist/components/dialog/Dialog.svelte.d.ts +25 -2
- package/dist/components/dialog/DialogClose.svelte +56 -30
- package/dist/components/dialog/DialogClose.svelte.d.ts +18 -2
- package/dist/components/dialog/context.d.ts +9 -0
- package/dist/components/dialog/context.js +16 -0
- package/dist/components/dialog/index.d.ts +4 -0
- package/dist/components/dialog/index.js +4 -0
- package/dist/components/drawer/Drawer.svelte +73 -30
- package/dist/components/drawer/Drawer.svelte.d.ts +26 -3
- package/dist/components/drawer/DrawerClose.svelte +6 -0
- package/dist/components/drawer/DrawerClose.svelte.d.ts +3 -0
- package/dist/components/drawer/index.d.ts +4 -0
- package/dist/components/drawer/index.js +4 -0
- package/dist/components/editable/Editable.svelte +35 -7
- package/dist/components/editable/Editable.svelte.d.ts +22 -1
- package/dist/components/editable/index.d.ts +4 -0
- package/dist/components/editable/index.js +4 -0
- package/dist/components/faceted-search/FacetedSearch.svelte +182 -0
- package/dist/components/faceted-search/FacetedSearch.svelte.d.ts +71 -0
- package/dist/components/faceted-search/index.d.ts +5 -0
- package/dist/components/faceted-search/index.js +5 -0
- package/dist/components/field/Field.svelte +14 -3
- package/dist/components/field/Field.svelte.d.ts +10 -0
- package/dist/components/field/index.d.ts +4 -0
- package/dist/components/field/index.js +4 -0
- package/dist/components/file-upload/FileUpload.svelte +29 -10
- package/dist/components/file-upload/FileUpload.svelte.d.ts +15 -0
- package/dist/components/file-upload/index.d.ts +4 -0
- package/dist/components/file-upload/index.js +4 -0
- package/dist/components/float/Float.svelte +20 -9
- package/dist/components/float/Float.svelte.d.ts +10 -1
- package/dist/components/float/index.d.ts +4 -0
- package/dist/components/float/index.js +4 -0
- package/dist/components/floating-panel/FloatingPanel.svelte +72 -23
- package/dist/components/floating-panel/FloatingPanel.svelte.d.ts +22 -3
- package/dist/components/floating-panel/index.d.ts +4 -0
- package/dist/components/floating-panel/index.js +4 -0
- package/dist/components/frame/Frame.svelte +21 -10
- package/dist/components/frame/Frame.svelte.d.ts +9 -0
- package/dist/components/frame/index.d.ts +4 -0
- package/dist/components/frame/index.js +4 -0
- package/dist/components/game-card/GameCard.svelte +133 -0
- package/dist/components/game-card/GameCard.svelte.d.ts +40 -0
- package/dist/components/game-card/index.d.ts +5 -0
- package/dist/components/game-card/index.js +5 -0
- package/dist/components/game-hero/GameHero.svelte +71 -0
- package/dist/components/game-hero/GameHero.svelte.d.ts +25 -0
- package/dist/components/game-hero/index.d.ts +5 -0
- package/dist/components/game-hero/index.js +5 -0
- package/dist/components/hint/Hint.svelte +10 -2
- package/dist/components/hint/Hint.svelte.d.ts +7 -0
- package/dist/components/hint/index.d.ts +4 -0
- package/dist/components/hint/index.js +4 -0
- package/dist/components/hover-card/HoverCard.svelte +16 -2
- package/dist/components/hover-card/HoverCard.svelte.d.ts +11 -0
- package/dist/components/hover-card/index.d.ts +4 -0
- package/dist/components/hover-card/index.js +4 -0
- package/dist/components/icon-button/IconButton.svelte +60 -0
- package/dist/components/icon-button/IconButton.svelte.d.ts +31 -0
- package/dist/components/icon-button/index.d.ts +5 -0
- package/dist/components/icon-button/index.js +5 -0
- package/dist/components/image-cropper/ImageCropper.svelte +27 -9
- package/dist/components/image-cropper/ImageCropper.svelte.d.ts +16 -1
- package/dist/components/image-cropper/index.d.ts +4 -0
- package/dist/components/image-cropper/index.js +4 -0
- package/dist/components/input/Input.svelte +49 -16
- package/dist/components/input/Input.svelte.d.ts +18 -1
- package/dist/components/input/index.d.ts +4 -0
- package/dist/components/input/index.js +4 -0
- package/dist/components/input-group/InputAddon.svelte +9 -2
- package/dist/components/input-group/InputAddon.svelte.d.ts +4 -0
- package/dist/components/input-group/InputGroup.svelte +11 -2
- package/dist/components/input-group/InputGroup.svelte.d.ts +7 -0
- package/dist/components/input-group/index.d.ts +4 -0
- package/dist/components/input-group/index.js +4 -0
- package/dist/components/item/Item.svelte +41 -11
- package/dist/components/item/Item.svelte.d.ts +13 -0
- package/dist/components/item/index.d.ts +4 -0
- package/dist/components/item/index.js +4 -0
- package/dist/components/kbd/Kbd.svelte +40 -3
- package/dist/components/kbd/Kbd.svelte.d.ts +18 -0
- package/dist/components/kbd/index.d.ts +4 -0
- package/dist/components/kbd/index.js +4 -0
- package/dist/components/link-overlay/LinkBox.svelte +21 -2
- package/dist/components/link-overlay/LinkBox.svelte.d.ts +7 -0
- package/dist/components/link-overlay/LinkOverlay.svelte +13 -3
- package/dist/components/link-overlay/LinkOverlay.svelte.d.ts +6 -1
- package/dist/components/link-overlay/index.d.ts +4 -0
- package/dist/components/link-overlay/index.js +4 -0
- package/dist/components/listbox/Listbox.svelte +42 -13
- package/dist/components/listbox/Listbox.svelte.d.ts +27 -10
- package/dist/components/listbox/index.d.ts +5 -1
- package/dist/components/listbox/index.js +4 -0
- package/dist/components/marquee/Marquee.svelte +47 -7
- package/dist/components/marquee/Marquee.svelte.d.ts +13 -0
- package/dist/components/marquee/MarqueeItem.svelte +15 -3
- package/dist/components/marquee/MarqueeItem.svelte.d.ts +4 -0
- package/dist/components/marquee/index.d.ts +4 -0
- package/dist/components/marquee/index.js +4 -0
- package/dist/components/menu/Menu.svelte +61 -9
- package/dist/components/menu/Menu.svelte.d.ts +23 -2
- package/dist/components/menu/MenuGroup.svelte +9 -4
- package/dist/components/menu/MenuGroup.svelte.d.ts +4 -1
- package/dist/components/menu/MenuGroupLabel.svelte +9 -2
- package/dist/components/menu/MenuGroupLabel.svelte.d.ts +4 -0
- package/dist/components/menu/MenuItem.svelte +10 -2
- package/dist/components/menu/MenuItem.svelte.d.ts +5 -0
- package/dist/components/menu/MenuSeparator.svelte +8 -2
- package/dist/components/menu/MenuSeparator.svelte.d.ts +3 -0
- package/dist/components/menu/index.d.ts +4 -0
- package/dist/components/menu/index.js +4 -0
- package/dist/components/native-select/NativeSelect.svelte +17 -3
- package/dist/components/native-select/NativeSelect.svelte.d.ts +11 -1
- package/dist/components/native-select/index.d.ts +4 -0
- package/dist/components/native-select/index.js +4 -0
- package/dist/components/notification-center/NotificationCenter.svelte +127 -0
- package/dist/components/notification-center/NotificationCenter.svelte.d.ts +46 -0
- package/dist/components/notification-center/index.d.ts +5 -0
- package/dist/components/notification-center/index.js +5 -0
- package/dist/components/number-input/NumberInput.svelte +78 -16
- package/dist/components/number-input/NumberInput.svelte.d.ts +25 -2
- package/dist/components/number-input/index.d.ts +4 -0
- package/dist/components/number-input/index.js +4 -0
- package/dist/components/pagination/Pagination.svelte +73 -33
- package/dist/components/pagination/Pagination.svelte.d.ts +26 -2
- package/dist/components/pagination/PaginationContext.svelte +4 -0
- package/dist/components/pagination/PaginationContext.svelte.d.ts +1 -0
- package/dist/components/pagination/PaginationEllipsis.svelte +10 -2
- package/dist/components/pagination/PaginationEllipsis.svelte.d.ts +5 -0
- package/dist/components/pagination/PaginationItem.svelte +10 -2
- package/dist/components/pagination/PaginationItem.svelte.d.ts +5 -0
- package/dist/components/pagination/PaginationNextTrigger.svelte +37 -11
- package/dist/components/pagination/PaginationNextTrigger.svelte.d.ts +12 -0
- package/dist/components/pagination/PaginationPrevTrigger.svelte +37 -11
- package/dist/components/pagination/PaginationPrevTrigger.svelte.d.ts +12 -0
- package/dist/components/pagination/index.d.ts +5 -0
- package/dist/components/pagination/index.js +5 -0
- package/dist/components/pin-input/PinInput.svelte +41 -10
- package/dist/components/pin-input/PinInput.svelte.d.ts +18 -2
- package/dist/components/pin-input/index.d.ts +4 -0
- package/dist/components/pin-input/index.js +4 -0
- package/dist/components/player-count/PlayerCount.svelte +62 -0
- package/dist/components/player-count/PlayerCount.svelte.d.ts +24 -0
- package/dist/components/player-count/index.d.ts +5 -0
- package/dist/components/player-count/index.js +5 -0
- package/dist/components/popover/Popover.svelte +72 -16
- package/dist/components/popover/Popover.svelte.d.ts +29 -2
- package/dist/components/popover/PopoverClose.svelte +33 -4
- package/dist/components/popover/PopoverClose.svelte.d.ts +11 -0
- package/dist/components/popover/index.d.ts +4 -0
- package/dist/components/popover/index.js +4 -0
- package/dist/components/progress/Progress.svelte +36 -7
- package/dist/components/progress/Progress.svelte.d.ts +14 -2
- package/dist/components/progress/index.d.ts +4 -0
- package/dist/components/progress/index.js +4 -0
- package/dist/components/prose/Prose.svelte +10 -2
- package/dist/components/prose/Prose.svelte.d.ts +7 -0
- package/dist/components/prose/index.d.ts +4 -0
- package/dist/components/prose/index.js +4 -0
- package/dist/components/qr-code/QrCode.svelte +18 -5
- package/dist/components/qr-code/QrCode.svelte.d.ts +11 -1
- package/dist/components/qr-code/index.d.ts +4 -0
- package/dist/components/qr-code/index.js +4 -0
- package/dist/components/radio-group/RadioGroup.svelte +66 -37
- package/dist/components/radio-group/RadioGroup.svelte.d.ts +18 -1
- package/dist/components/radio-group/index.d.ts +4 -0
- package/dist/components/radio-group/index.js +4 -0
- package/dist/components/rating-group/RatingGroup.svelte +51 -7
- package/dist/components/rating-group/RatingGroup.svelte.d.ts +22 -1
- package/dist/components/rating-group/index.d.ts +4 -0
- package/dist/components/rating-group/index.js +4 -0
- package/dist/components/ring/Ring.svelte +42 -0
- package/dist/components/ring/Ring.svelte.d.ts +16 -0
- package/dist/components/scroll-area/ScrollArea.svelte +40 -32
- package/dist/components/scroll-area/ScrollArea.svelte.d.ts +16 -0
- package/dist/components/scroll-area/index.d.ts +4 -0
- package/dist/components/scroll-area/index.js +4 -0
- package/dist/components/segment-group/SegmentGroup.svelte +56 -17
- package/dist/components/segment-group/SegmentGroup.svelte.d.ts +19 -1
- package/dist/components/segment-group/index.d.ts +4 -0
- package/dist/components/segment-group/index.js +4 -0
- package/dist/components/select/Select.svelte +38 -17
- package/dist/components/select/Select.svelte.d.ts +24 -7
- package/dist/components/select/index.d.ts +4 -0
- package/dist/components/select/index.js +4 -0
- package/dist/components/separator/Separator.svelte +11 -2
- package/dist/components/separator/Separator.svelte.d.ts +8 -0
- package/dist/components/separator/index.d.ts +4 -0
- package/dist/components/separator/index.js +4 -0
- package/dist/components/sheet/Sheet.svelte +103 -23
- package/dist/components/sheet/Sheet.svelte.d.ts +36 -2
- package/dist/components/sheet/index.d.ts +4 -0
- package/dist/components/sheet/index.js +4 -0
- package/dist/components/sidebar/Sidebar.svelte +38 -7
- package/dist/components/sidebar/Sidebar.svelte.d.ts +18 -0
- package/dist/components/sidebar/SidebarItem.svelte +75 -19
- package/dist/components/sidebar/SidebarItem.svelte.d.ts +16 -0
- package/dist/components/sidebar/SidebarSection.svelte +23 -3
- package/dist/components/sidebar/SidebarSection.svelte.d.ts +8 -0
- package/dist/components/sidebar/context.d.ts +9 -0
- package/dist/components/sidebar/context.js +15 -0
- package/dist/components/sidebar/index.d.ts +4 -0
- package/dist/components/sidebar/index.js +4 -0
- package/dist/components/signature-pad/SignaturePad.svelte +38 -12
- package/dist/components/signature-pad/SignaturePad.svelte.d.ts +15 -1
- package/dist/components/signature-pad/index.d.ts +4 -0
- package/dist/components/signature-pad/index.js +4 -0
- package/dist/components/skeleton/Skeleton.svelte +8 -2
- package/dist/components/skeleton/Skeleton.svelte.d.ts +3 -0
- package/dist/components/skeleton/index.d.ts +4 -0
- package/dist/components/skeleton/index.js +4 -0
- package/dist/components/skip-nav/SkipNav.svelte +12 -2
- package/dist/components/skip-nav/SkipNav.svelte.d.ts +5 -0
- package/dist/components/skip-nav/index.d.ts +4 -0
- package/dist/components/skip-nav/index.js +4 -0
- package/dist/components/slider/Slider.svelte +54 -20
- package/dist/components/slider/Slider.svelte.d.ts +16 -1
- package/dist/components/slider/index.d.ts +4 -0
- package/dist/components/slider/index.js +4 -0
- package/dist/components/spinner/Spinner.svelte +17 -5
- package/dist/components/spinner/Spinner.svelte.d.ts +13 -5
- package/dist/components/spinner/index.d.ts +4 -0
- package/dist/components/spinner/index.js +4 -0
- package/dist/components/splitter/Splitter.svelte +21 -14
- package/dist/components/splitter/Splitter.svelte.d.ts +10 -1
- package/dist/components/splitter/SplitterPanel.svelte +9 -1
- package/dist/components/splitter/SplitterPanel.svelte.d.ts +5 -0
- package/dist/components/splitter/SplitterResizeTrigger.svelte +13 -2
- package/dist/components/splitter/SplitterResizeTrigger.svelte.d.ts +6 -0
- package/dist/components/splitter/index.d.ts +4 -0
- package/dist/components/splitter/index.js +4 -0
- package/dist/components/status/Status.svelte +25 -11
- package/dist/components/status/Status.svelte.d.ts +13 -5
- package/dist/components/status/index.d.ts +4 -0
- package/dist/components/status/index.js +4 -0
- package/dist/components/steps/Steps.svelte +31 -14
- package/dist/components/steps/Steps.svelte.d.ts +18 -2
- package/dist/components/steps/index.d.ts +4 -0
- package/dist/components/steps/index.js +4 -0
- package/dist/components/swap/Swap.svelte +16 -3
- package/dist/components/swap/Swap.svelte.d.ts +8 -0
- package/dist/components/swap/index.d.ts +4 -0
- package/dist/components/swap/index.js +4 -0
- package/dist/components/switch/Switch.svelte +48 -52
- package/dist/components/switch/Switch.svelte.d.ts +10 -0
- package/dist/components/switch/index.d.ts +4 -0
- package/dist/components/switch/index.js +4 -0
- package/dist/components/table/Table.svelte +38 -27
- package/dist/components/table/Table.svelte.d.ts +43 -12
- package/dist/components/table/index.d.ts +5 -1
- package/dist/components/table/index.js +4 -0
- package/dist/components/tag-picker/TagPicker.svelte +78 -0
- package/dist/components/tag-picker/TagPicker.svelte.d.ts +32 -0
- package/dist/components/tag-picker/index.d.ts +5 -0
- package/dist/components/tag-picker/index.js +5 -0
- package/dist/components/textarea/Textarea.svelte +19 -2
- package/dist/components/textarea/Textarea.svelte.d.ts +12 -1
- package/dist/components/textarea/index.d.ts +4 -0
- package/dist/components/textarea/index.js +4 -0
- package/dist/components/theme-switch/ThemeSwitch.svelte +96 -105
- package/dist/components/theme-switch/ThemeSwitch.svelte.d.ts +24 -1
- package/dist/components/theme-switch/index.d.ts +5 -1
- package/dist/components/theme-switch/index.js +4 -0
- package/dist/components/thumb-card/ThumbCard.svelte +32 -8
- package/dist/components/thumb-card/ThumbCard.svelte.d.ts +13 -0
- package/dist/components/thumb-card/index.d.ts +4 -0
- package/dist/components/thumb-card/index.js +4 -0
- package/dist/components/timer/Timer.svelte +66 -22
- package/dist/components/timer/Timer.svelte.d.ts +24 -0
- package/dist/components/timer/index.d.ts +5 -1
- package/dist/components/timer/index.js +4 -0
- package/dist/components/toast/Toast.svelte +45 -15
- package/dist/components/toast/Toast.svelte.d.ts +14 -1
- package/dist/components/toast/Toaster.svelte +26 -3
- package/dist/components/toast/Toaster.svelte.d.ts +11 -0
- package/dist/components/toast/index.d.ts +4 -0
- package/dist/components/toast/index.js +4 -0
- package/dist/components/toggle/Toggle.svelte +19 -7
- package/dist/components/toggle/Toggle.svelte.d.ts +13 -1
- package/dist/components/toggle/index.d.ts +4 -0
- package/dist/components/toggle/index.js +4 -0
- package/dist/components/toggle-group/ToggleGroup.svelte +74 -12
- package/dist/components/toggle-group/ToggleGroup.svelte.d.ts +23 -1
- package/dist/components/toggle-group/index.d.ts +4 -0
- package/dist/components/toggle-group/index.js +4 -0
- package/dist/components/toggle-tooltip/ToggleTooltip.svelte +47 -24
- package/dist/components/toggle-tooltip/ToggleTooltip.svelte.d.ts +16 -2
- package/dist/components/toggle-tooltip/index.d.ts +4 -0
- package/dist/components/toggle-tooltip/index.js +4 -0
- package/dist/components/tooltip/Tooltip.svelte +61 -11
- package/dist/components/tooltip/Tooltip.svelte.d.ts +28 -1
- package/dist/components/tooltip/index.d.ts +4 -0
- package/dist/components/tooltip/index.js +4 -0
- package/dist/components/tour/Tour.svelte +61 -33
- package/dist/components/tour/Tour.svelte.d.ts +21 -4
- package/dist/components/tour/index.d.ts +4 -0
- package/dist/components/tour/index.js +4 -0
- package/dist/components/virtual-list/VirtualList.svelte +107 -0
- package/dist/components/virtual-list/VirtualList.svelte.d.ts +55 -0
- package/dist/components/virtual-list/index.d.ts +5 -0
- package/dist/components/virtual-list/index.js +5 -0
- package/dist/components/virtual-list/range.d.ts +24 -0
- package/dist/components/virtual-list/range.js +22 -0
- package/dist/components/virtual-tree/VirtualTree.svelte +304 -0
- package/dist/components/virtual-tree/VirtualTree.svelte.d.ts +104 -0
- package/dist/components/virtual-tree/index.d.ts +8 -0
- package/dist/components/virtual-tree/index.js +7 -0
- package/dist/components/vote-buttons/VoteButtons.svelte +87 -0
- package/dist/components/vote-buttons/VoteButtons.svelte.d.ts +36 -0
- package/dist/components/vote-buttons/index.d.ts +5 -0
- package/dist/components/vote-buttons/index.js +5 -0
- package/dist/editor/drag-preview.d.ts +8 -0
- package/dist/editor/drag-preview.js +28 -0
- package/dist/editor/file-tree/FileTree.svelte +122 -0
- package/dist/editor/file-tree/FileTree.svelte.d.ts +44 -0
- package/dist/{components → editor}/file-tree/index.d.ts +5 -0
- package/dist/editor/file-tree/index.js +7 -0
- package/dist/editor/hierarchy-view/HierarchyView.svelte +438 -0
- package/dist/editor/hierarchy-view/HierarchyView.svelte.d.ts +68 -0
- package/dist/editor/hierarchy-view/index.d.ts +18 -0
- package/dist/editor/hierarchy-view/index.js +5 -0
- package/dist/editor/horizon-layout/HorizonLayout.svelte +62 -0
- package/dist/editor/horizon-layout/HorizonLayout.svelte.d.ts +25 -0
- package/dist/{components → editor}/horizon-layout/horizon-layout.css +141 -64
- package/dist/{components → editor}/horizon-layout/index.d.ts +4 -0
- package/dist/{components → editor}/horizon-layout/index.js +4 -0
- package/dist/editor/index.d.ts +11 -0
- package/dist/editor/index.js +11 -0
- package/dist/editor/inspector-panel/InspectorPanel.svelte +326 -0
- package/dist/editor/inspector-panel/InspectorPanel.svelte.d.ts +57 -0
- package/dist/editor/inspector-panel/index.d.ts +5 -0
- package/dist/editor/inspector-panel/index.js +5 -0
- package/dist/editor/monaco-theme.d.ts +27 -0
- package/dist/editor/monaco-theme.js +104 -0
- package/dist/fonts/HorizonSans-latin-ext.woff2 +0 -0
- package/dist/fonts/HorizonSans-latin.woff2 +0 -0
- package/dist/fonts/OFL-EncodeSans.txt +93 -0
- package/dist/fonts/OFL-Lilex.txt +93 -0
- package/dist/generated/theme.css +295 -0
- package/dist/generated/tokens.d.ts +23 -0
- package/dist/generated/tokens.js +125 -0
- package/dist/horizon-design.css +14 -649
- package/dist/index.d.ts +88 -71
- package/dist/index.js +87 -73
- package/dist/motion/page-transition.d.ts +37 -0
- package/dist/motion/page-transition.js +83 -0
- package/dist/motion/sliding-indicator.d.ts +28 -0
- package/dist/motion/sliding-indicator.js +54 -0
- package/dist/platform.d.ts +21 -0
- package/dist/platform.js +19 -0
- package/dist/styles/base.css +86 -0
- package/dist/styles/fonts.css +70 -0
- package/dist/styles/frosted.css +9 -0
- package/dist/styles/motion.css +78 -0
- package/dist/styles/scale.css +210 -0
- package/dist/theme.svelte.d.ts +29 -8
- package/dist/theme.svelte.js +90 -44
- package/dist/utils.d.ts +12 -0
- package/dist/utils.js +29 -1
- package/package.json +102 -82
- package/dist/components/avatar/AvatarGroup.svelte +0 -18
- package/dist/components/avatar/AvatarGroup.svelte.d.ts +0 -9
- package/dist/components/circular-slider/circular-slider-context.d.ts +0 -9
- package/dist/components/circular-slider/circular-slider-context.js +0 -8
- package/dist/components/file-tree/FileTree.svelte +0 -214
- package/dist/components/file-tree/FileTree.svelte.d.ts +0 -28
- package/dist/components/file-tree/index.js +0 -2
- package/dist/components/hierarchy-view/HierarchyView.svelte +0 -763
- package/dist/components/hierarchy-view/HierarchyView.svelte.d.ts +0 -21
- package/dist/components/hierarchy-view/index.d.ts +0 -8
- package/dist/components/hierarchy-view/index.js +0 -1
- package/dist/components/horizon-layout/HorizonLayout.svelte +0 -78
- package/dist/components/horizon-layout/HorizonLayout.svelte.d.ts +0 -51
- package/dist/components/inspector-panel/InspectorPanel.svelte +0 -321
- package/dist/components/inspector-panel/InspectorPanel.svelte.d.ts +0 -18
- package/dist/components/inspector-panel/index.d.ts +0 -1
- package/dist/components/inspector-panel/index.js +0 -1
- package/dist/components/table/TableBody.svelte +0 -18
- package/dist/components/table/TableBody.svelte.d.ts +0 -9
- package/dist/components/table/TableCell.svelte +0 -25
- package/dist/components/table/TableCell.svelte.d.ts +0 -9
- package/dist/components/table/TableHead.svelte +0 -25
- package/dist/components/table/TableHead.svelte.d.ts +0 -9
- package/dist/components/table/TableHeader.svelte +0 -22
- package/dist/components/table/TableHeader.svelte.d.ts +0 -9
- package/dist/components/table/TableRow.svelte +0 -25
- package/dist/components/table/TableRow.svelte.d.ts +0 -9
- package/dist/components/tabs/Tabs.svelte +0 -111
- package/dist/components/tabs/Tabs.svelte.d.ts +0 -19
- package/dist/components/tabs/index.d.ts +0 -1
- package/dist/components/tabs/index.js +0 -1
- package/dist/fonts/EncodeSans-latin-ext.woff2 +0 -0
- package/dist/fonts/EncodeSans-latin.woff2 +0 -0
- package/dist/monaco-theme.d.ts +0 -12
- package/dist/monaco-theme.js +0 -153
package/README.md
CHANGED
|
@@ -1,2497 +1,537 @@
|
|
|
1
1
|
# horizon-design
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
<a href="https://www.npmjs.com/package/horizon-design">
|
|
8
|
-
<img src="https://img.shields.io/npm/l/horizon-design.svg" alt="npm license" />
|
|
9
|
-
</a>
|
|
10
|
-
</div>
|
|
3
|
+
Horizon's design system and Svelte 5 component library: one OKLCH palette and its tokens, the
|
|
4
|
+
theme and page-motion helpers, and the components of horizon, horizon-editor and the website,
|
|
5
|
+
built on [Ark UI](https://ark-ui.com) for behaviour and accessibility and
|
|
6
|
+
[Tailwind CSS 4](https://tailwindcss.com) for styling.
|
|
11
7
|
|
|
12
|
-
|
|
8
|
+
**Docs and live examples:** <https://play-horizon.github.io/horizon-design> (every component,
|
|
9
|
+
both themes). Each component's props are typed and documented in its source, so editors show
|
|
10
|
+
them.
|
|
13
11
|
|
|
14
|
-
|
|
12
|
+
## Entry points
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
Import the global design CSS in your root layout:
|
|
23
|
-
|
|
24
|
-
```svelte
|
|
25
|
-
<!-- src/routes/+layout.svelte -->
|
|
26
|
-
<script>
|
|
27
|
-
import 'horizon-design/horizon-design.css';
|
|
28
|
-
</script>
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
The dark theme is the default (`:root`). Add `.light` to `<html>` for the light variant.
|
|
32
|
-
|
|
33
|
-
---
|
|
34
|
-
|
|
35
|
-
## Developing
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
pnpm dev # start the showcase app
|
|
39
|
-
pnpm check # svelte-check type checking
|
|
40
|
-
pnpm build # build library → dist/
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
---
|
|
44
|
-
|
|
45
|
-
## Components
|
|
46
|
-
|
|
47
|
-
### Accordion
|
|
48
|
-
|
|
49
|
-
Collapsible sections. `trigger` accepts a string or Snippet for rich content.
|
|
50
|
-
|
|
51
|
-
```svelte
|
|
52
|
-
<script>
|
|
53
|
-
import { Accordion, AccordionItem } from 'horizon-design';
|
|
54
|
-
|
|
55
|
-
let openItems = $state([]);
|
|
56
|
-
</script>
|
|
57
|
-
|
|
58
|
-
<Accordion bind:value={openItems}>
|
|
59
|
-
<AccordionItem value="faq-1" trigger="Question?">Answer.</AccordionItem>
|
|
60
|
-
<AccordionItem value="faq-2" trigger="Another question?">Another answer.</AccordionItem>
|
|
61
|
-
</Accordion>
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
| Component | Prop | Type | Default |
|
|
65
|
-
| --------------- | --------------- | ----------------------- | ----------- |
|
|
66
|
-
| `Accordion` | `collapsible` | `boolean` | `true` |
|
|
67
|
-
| | `multiple` | `boolean` | `false` |
|
|
68
|
-
| | `lazyMount` | `boolean` | `true` |
|
|
69
|
-
| | `unmountOnExit` | `boolean` | `true` |
|
|
70
|
-
| | `value` | `string[]` | `undefined` |
|
|
71
|
-
| | `defaultValue` | `string[]` | — |
|
|
72
|
-
| `AccordionItem` | `value` | `string` **(required)** | — |
|
|
73
|
-
| | `trigger` | `string \| Snippet` | — |
|
|
74
|
-
| | `disabled` | `boolean` | — |
|
|
75
|
-
|
|
76
|
-
---
|
|
77
|
-
|
|
78
|
-
### ActionBar
|
|
79
|
-
|
|
80
|
-
Floating contextual action bar for compact page-level actions.
|
|
81
|
-
|
|
82
|
-
```svelte
|
|
83
|
-
<script>
|
|
84
|
-
import { ActionBar, ActionBarSeparator, Button } from 'horizon-design';
|
|
85
|
-
import MingcuteArchiveLine from '~icons/mingcute/archive-line';
|
|
86
|
-
import MingcuteCopy2Line from '~icons/mingcute/copy2-line';
|
|
87
|
-
import MingcuteDelete2Line from '~icons/mingcute/delete2-line';
|
|
88
|
-
</script>
|
|
89
|
-
|
|
90
|
-
<ActionBar>
|
|
91
|
-
<Button variant="ghost" size="icon-sm" aria-label="Archive">
|
|
92
|
-
<MingcuteArchiveLine class="size-4" />
|
|
93
|
-
</Button>
|
|
94
|
-
<Button variant="ghost" size="icon-sm" aria-label="Copy">
|
|
95
|
-
<MingcuteCopy2Line class="size-4" />
|
|
96
|
-
</Button>
|
|
97
|
-
<ActionBarSeparator />
|
|
98
|
-
<Button variant="ghost" size="icon-sm" aria-label="Delete">
|
|
99
|
-
<MingcuteDelete2Line class="size-4" />
|
|
100
|
-
</Button>
|
|
101
|
-
</ActionBar>
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
`ActionBar` is fixed to the bottom center by default. Use `ActionBarSeparator` to split action groups.
|
|
105
|
-
|
|
106
|
-
---
|
|
107
|
-
|
|
108
|
-
### Alert
|
|
109
|
-
|
|
110
|
-
Contextual feedback message with icon, title, and description.
|
|
111
|
-
|
|
112
|
-
```svelte
|
|
113
|
-
<script>
|
|
114
|
-
import { Alert } from 'horizon-design';
|
|
115
|
-
</script>
|
|
116
|
-
|
|
117
|
-
<Alert variant="success" title="Saved!" description="Your changes were saved successfully." />
|
|
118
|
-
<Alert variant="error" title="Error" description="Something went wrong." />
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
| Prop | Type | Default |
|
|
122
|
-
| ------------- | -------------------------------------------------------------- | ------------------------ |
|
|
123
|
-
| `variant` | `'info' \| 'success' \| 'warning' \| 'error' \| 'destructive'` | `'info'` |
|
|
124
|
-
| `title` | `string` | — |
|
|
125
|
-
| `description` | `string` | — |
|
|
126
|
-
| `icon` | `Snippet` | default icon per variant |
|
|
127
|
-
|
|
128
|
-
---
|
|
129
|
-
|
|
130
|
-
### AlertDialog
|
|
131
|
-
|
|
132
|
-
A confirmation dialog that prevents accidental actions.
|
|
133
|
-
|
|
134
|
-
```svelte
|
|
135
|
-
<script>
|
|
136
|
-
import { AlertDialog } from 'horizon-design';
|
|
137
|
-
import { buttonVariants } from 'horizon-design';
|
|
138
|
-
import MingcuteDelete2Line from '~icons/mingcute/delete2-line';
|
|
139
|
-
</script>
|
|
140
|
-
|
|
141
|
-
{#snippet trigger()}
|
|
142
|
-
<MingcuteDelete2Line class="size-4" />
|
|
143
|
-
Delete
|
|
144
|
-
{/snippet}
|
|
145
|
-
|
|
146
|
-
<AlertDialog
|
|
147
|
-
{trigger}
|
|
148
|
-
triggerClass={buttonVariants({ variant: 'destructive' })}
|
|
149
|
-
title="Are you absolutely sure?"
|
|
150
|
-
description="This action cannot be undone."
|
|
151
|
-
cancelLabel="Cancel"
|
|
152
|
-
actionLabel="Delete"
|
|
153
|
-
/>
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
| Prop | Type | Default |
|
|
157
|
-
| -------------- | --------- | ----------- |
|
|
158
|
-
| `trigger` | `Snippet` | — |
|
|
159
|
-
| `triggerClass` | `string` | `''` |
|
|
160
|
-
| `title` | `string` | — |
|
|
161
|
-
| `description` | `string` | — |
|
|
162
|
-
| `cancelLabel` | `string` | `'Cancel'` |
|
|
163
|
-
| `actionLabel` | `string` | `'Confirm'` |
|
|
164
|
-
| `cancelClass` | `string` | — |
|
|
165
|
-
| `actionClass` | `string` | — |
|
|
166
|
-
|
|
167
|
-
---
|
|
168
|
-
|
|
169
|
-
### AngleSlider
|
|
170
|
-
|
|
171
|
-
A circular drag-handle for picking an angle (0–360°).
|
|
172
|
-
|
|
173
|
-
```svelte
|
|
174
|
-
<script>
|
|
175
|
-
import { AngleSlider } from 'horizon-design';
|
|
176
|
-
|
|
177
|
-
let angle = $state(45);
|
|
178
|
-
</script>
|
|
179
|
-
|
|
180
|
-
<AngleSlider bind:value={angle} />
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
| Prop | Type | Default |
|
|
184
|
-
| -------------- | -------- | ------- |
|
|
185
|
-
| `value` | `number` | `0` |
|
|
186
|
-
| `defaultValue` | `number` | — |
|
|
187
|
-
| `size` | `number` | `120` |
|
|
188
|
-
|
|
189
|
-
---
|
|
190
|
-
|
|
191
|
-
### Announcement
|
|
192
|
-
|
|
193
|
-
A compact pill-shaped badge for highlighting news or updates.
|
|
194
|
-
|
|
195
|
-
```svelte
|
|
196
|
-
<script>
|
|
197
|
-
import { Announcement } from 'horizon-design';
|
|
198
|
-
import { MingcuteLightningLine } from '~icons/mingcute/lightning-line';
|
|
199
|
-
</script>
|
|
200
|
-
|
|
201
|
-
<Announcement>
|
|
202
|
-
<MingcuteLightningLine class="size-3.5" />
|
|
203
|
-
New: horizon-design
|
|
204
|
-
</Announcement>
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
---
|
|
208
|
-
|
|
209
|
-
### AspectRatio
|
|
210
|
-
|
|
211
|
-
Maintains a fixed aspect ratio for its children.
|
|
212
|
-
|
|
213
|
-
```svelte
|
|
214
|
-
<script>
|
|
215
|
-
import { AspectRatio } from 'horizon-design';
|
|
216
|
-
</script>
|
|
217
|
-
|
|
218
|
-
<AspectRatio ratio={16 / 9} class="overflow-hidden rounded-lg">
|
|
219
|
-
<img src="/photo.jpg" alt="Photo" class="h-full w-full object-cover" />
|
|
220
|
-
</AspectRatio>
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
| Prop | Type | Default |
|
|
224
|
-
| ------- | -------- | ------- |
|
|
225
|
-
| `ratio` | `number` | `1` |
|
|
226
|
-
|
|
227
|
-
---
|
|
228
|
-
|
|
229
|
-
### Avatar
|
|
230
|
-
|
|
231
|
-
User avatar with image and text fallback.
|
|
232
|
-
|
|
233
|
-
```svelte
|
|
234
|
-
<script>
|
|
235
|
-
import { Avatar, AvatarGroup } from 'horizon-design';
|
|
236
|
-
</script>
|
|
237
|
-
|
|
238
|
-
<Avatar src="/photo.jpg" alt="User" fallback="AB" size="md" />
|
|
239
|
-
|
|
240
|
-
<AvatarGroup>
|
|
241
|
-
<Avatar fallback="A" />
|
|
242
|
-
<Avatar fallback="B" />
|
|
243
|
-
<Avatar fallback="C" />
|
|
244
|
-
</AvatarGroup>
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
| Prop | Type | Default |
|
|
248
|
-
| ---------- | ------------------------------ | ------- |
|
|
249
|
-
| `src` | `string` | — |
|
|
250
|
-
| `alt` | `string` | — |
|
|
251
|
-
| `fallback` | `string` | — |
|
|
252
|
-
| `size` | `'sm' \| 'md' \| 'lg' \| 'xl'` | `'md'` |
|
|
253
|
-
|
|
254
|
-
`AvatarGroup` is a layout wrapper that overlaps its children with negative margins.
|
|
255
|
-
|
|
256
|
-
---
|
|
257
|
-
|
|
258
|
-
### Badge
|
|
259
|
-
|
|
260
|
-
Small status or label indicator.
|
|
261
|
-
|
|
262
|
-
```svelte
|
|
263
|
-
<script>
|
|
264
|
-
import { Badge } from 'horizon-design';
|
|
265
|
-
</script>
|
|
266
|
-
|
|
267
|
-
<Badge>New</Badge>
|
|
268
|
-
<Badge variant="success">Active</Badge>
|
|
269
|
-
<Badge variant="warning">Pending</Badge>
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
| Prop | Type | Default |
|
|
273
|
-
| --------- | -------------------------------------------------------------------------------------------- | ----------- |
|
|
274
|
-
| `variant` | `'default' \| 'secondary' \| 'outline' \| 'destructive' \| 'success' \| 'warning' \| 'info'` | `'default'` |
|
|
275
|
-
|
|
276
|
-
---
|
|
277
|
-
|
|
278
|
-
### BottomNavigation
|
|
279
|
-
|
|
280
|
-
Fixed bottom navigation bar for mobile interfaces. `icon` in each item is a Snippet.
|
|
281
|
-
|
|
282
|
-
```svelte
|
|
283
|
-
<script>
|
|
284
|
-
import { BottomNavigation } from 'horizon-design';
|
|
285
|
-
import MingcuteHomeLine from '~icons/mingcute/home-line';
|
|
286
|
-
import MingcuteSearchLine from '~icons/mingcute/search-line';
|
|
287
|
-
</script>
|
|
288
|
-
|
|
289
|
-
{#snippet iconHome()}<MingcuteHomeLine class="size-5" />{/snippet}
|
|
290
|
-
{#snippet iconSearch()}<MingcuteSearchLine class="size-5" />{/snippet}
|
|
291
|
-
|
|
292
|
-
<BottomNavigation
|
|
293
|
-
items={[
|
|
294
|
-
{ label: 'Home', href: '/', icon: iconHome, active: true },
|
|
295
|
-
{ label: 'Search', href: '/search', icon: iconSearch }
|
|
296
|
-
]}
|
|
297
|
-
/>
|
|
298
|
-
```
|
|
299
|
-
|
|
300
|
-
| Prop | Type | Default |
|
|
301
|
-
| ------- | -------------------------------------------------------------------------- | ------- |
|
|
302
|
-
| `items` | `Array<{ label: string; href: string; icon?: Snippet; active?: boolean }>` | `[]` |
|
|
303
|
-
|
|
304
|
-
---
|
|
305
|
-
|
|
306
|
-
### Breadcrumb
|
|
307
|
-
|
|
308
|
-
Navigation trail showing the current page location.
|
|
309
|
-
|
|
310
|
-
```svelte
|
|
311
|
-
<script>
|
|
312
|
-
import { Breadcrumb } from 'horizon-design';
|
|
313
|
-
</script>
|
|
314
|
-
|
|
315
|
-
<Breadcrumb
|
|
316
|
-
items={[
|
|
317
|
-
{ label: 'Home', href: '/' },
|
|
318
|
-
{ label: 'Components', href: '/components' },
|
|
319
|
-
{ label: 'Breadcrumb' }
|
|
320
|
-
]}
|
|
321
|
-
/>
|
|
322
|
-
```
|
|
323
|
-
|
|
324
|
-
| Prop | Type | Default |
|
|
325
|
-
| ------- | ----------------------------------------- | ------- |
|
|
326
|
-
| `items` | `Array<{ label: string; href?: string }>` | `[]` |
|
|
327
|
-
|
|
328
|
-
The last item (without `href`) is treated as the current page (`aria-current="page"`).
|
|
329
|
-
|
|
330
|
-
---
|
|
331
|
-
|
|
332
|
-
### Button
|
|
333
|
-
|
|
334
|
-
Primary interactive element.
|
|
335
|
-
|
|
336
|
-
```svelte
|
|
337
|
-
<script>
|
|
338
|
-
import { Button, buttonVariants } from 'horizon-design';
|
|
339
|
-
</script>
|
|
340
|
-
|
|
341
|
-
<Button>Click me</Button>
|
|
342
|
-
<Button variant="outline" size="lg">Outline</Button>
|
|
343
|
-
<Button isLoading>Saving…</Button>
|
|
344
|
-
```
|
|
345
|
-
|
|
346
|
-
| Prop | Type | Default |
|
|
347
|
-
| ------------- | ----------------------------------------------------------------------------------------------------------------- | ----------- |
|
|
348
|
-
| `variant` | `'default' \| 'outline' \| 'secondary' \| 'ghost' \| 'link' \| 'destructive' \| 'success' \| 'warning' \| 'info'` | `'default'` |
|
|
349
|
-
| `size` | `'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl' \| 'icon-xs' \| 'icon-sm' \| 'icon-md' \| 'icon-lg' \| 'icon-xl'` | `'md'` |
|
|
350
|
-
| `isLoading` | `boolean` | `false` |
|
|
351
|
-
| `clickEffect` | `boolean` | `true` |
|
|
352
|
-
| `pill` | `boolean` | `false` |
|
|
353
|
-
| `disabled` | `boolean` | `false` |
|
|
354
|
-
|
|
355
|
-
`buttonVariants({ variant, size })` returns the class string for use on non-button elements.
|
|
356
|
-
|
|
357
|
-
---
|
|
358
|
-
|
|
359
|
-
### ButtonGroup
|
|
360
|
-
|
|
361
|
-
Groups buttons into a visually connected row.
|
|
362
|
-
|
|
363
|
-
```svelte
|
|
364
|
-
<script>
|
|
365
|
-
import { ButtonGroup } from 'horizon-design';
|
|
366
|
-
import { Button } from 'horizon-design';
|
|
367
|
-
</script>
|
|
368
|
-
|
|
369
|
-
<ButtonGroup>
|
|
370
|
-
<Button variant="outline" size="sm">Cut</Button>
|
|
371
|
-
<Button variant="outline" size="sm">Copy</Button>
|
|
372
|
-
<Button variant="outline" size="sm">Paste</Button>
|
|
373
|
-
</ButtonGroup>
|
|
374
|
-
```
|
|
375
|
-
|
|
376
|
-
---
|
|
377
|
-
|
|
378
|
-
### Calendar
|
|
379
|
-
|
|
380
|
-
Standalone inline date picker (no popover). Built on the DatePicker primitive with `inline` mode.
|
|
381
|
-
|
|
382
|
-
```svelte
|
|
383
|
-
<script>
|
|
384
|
-
import { Calendar } from 'horizon-design';
|
|
385
|
-
</script>
|
|
386
|
-
|
|
387
|
-
<Calendar onValueChange={(d) => console.log(d.value)} />
|
|
388
|
-
```
|
|
389
|
-
|
|
390
|
-
Supports all DatePicker props: `value`, `defaultValue`, `min`, `max`, `selectionMode` (`'single' | 'range' | 'multiple'`), `onValueChange`.
|
|
391
|
-
|
|
392
|
-
---
|
|
393
|
-
|
|
394
|
-
### Card
|
|
395
|
-
|
|
396
|
-
Content container with optional header and footer.
|
|
397
|
-
|
|
398
|
-
```svelte
|
|
399
|
-
<script>
|
|
400
|
-
import { Card } from 'horizon-design';
|
|
401
|
-
import { Button } from 'horizon-design';
|
|
402
|
-
</script>
|
|
403
|
-
|
|
404
|
-
<Card title="Title" description="Subtitle">
|
|
405
|
-
Body content goes here.
|
|
406
|
-
{#snippet footer()}
|
|
407
|
-
<Button>Save</Button>
|
|
408
|
-
{/snippet}
|
|
409
|
-
</Card>
|
|
410
|
-
```
|
|
411
|
-
|
|
412
|
-
| Prop | Type | Default |
|
|
413
|
-
| ------------- | --------- | ------- |
|
|
414
|
-
| `title` | `string` | — |
|
|
415
|
-
| `description` | `string` | — |
|
|
416
|
-
| `footer` | `Snippet` | — |
|
|
417
|
-
| `class` | `string` | `''` |
|
|
418
|
-
|
|
419
|
-
---
|
|
420
|
-
|
|
421
|
-
### Carousel
|
|
422
|
-
|
|
423
|
-
Slideshow with prev/next controls and indicator dots. Each slide is a Snippet.
|
|
424
|
-
|
|
425
|
-
```svelte
|
|
426
|
-
<script>
|
|
427
|
-
import { Carousel } from 'horizon-design';
|
|
428
|
-
</script>
|
|
429
|
-
|
|
430
|
-
{#snippet slide1()}
|
|
431
|
-
<div class="flex h-40 items-center justify-center rounded-lg bg-blue-100">Slide 1</div>
|
|
432
|
-
{/snippet}
|
|
433
|
-
{#snippet slide2()}
|
|
434
|
-
<div class="flex h-40 items-center justify-center rounded-lg bg-green-100">Slide 2</div>
|
|
435
|
-
{/snippet}
|
|
436
|
-
|
|
437
|
-
<Carousel slides={[slide1, slide2]} />
|
|
438
|
-
```
|
|
439
|
-
|
|
440
|
-
| Prop | Type | Default |
|
|
441
|
-
| ---------------- | ----------- | ------- |
|
|
442
|
-
| `slides` | `Snippet[]` | `[]` |
|
|
443
|
-
| `showIndicators` | `boolean` | `true` |
|
|
444
|
-
| `showArrows` | `boolean` | `true` |
|
|
445
|
-
|
|
446
|
-
---
|
|
447
|
-
|
|
448
|
-
### Checkbox
|
|
449
|
-
|
|
450
|
-
Accessible checkbox with label.
|
|
451
|
-
|
|
452
|
-
```svelte
|
|
453
|
-
<script>
|
|
454
|
-
import { Checkbox } from 'horizon-design';
|
|
455
|
-
|
|
456
|
-
let accepted = $state(false);
|
|
457
|
-
</script>
|
|
458
|
-
|
|
459
|
-
<Checkbox label="Accept terms" bind:checked={accepted} />
|
|
460
|
-
<Checkbox label="Newsletter" defaultChecked />
|
|
461
|
-
```
|
|
462
|
-
|
|
463
|
-
| Prop | Type | Default |
|
|
464
|
-
| ---------------- | --------- | ------- |
|
|
465
|
-
| `label` | `string` | — |
|
|
466
|
-
| `checked` | `boolean` | — |
|
|
467
|
-
| `defaultChecked` | `boolean` | — |
|
|
468
|
-
| `disabled` | `boolean` | — |
|
|
469
|
-
|
|
470
|
-
---
|
|
471
|
-
|
|
472
|
-
### CircularProgress
|
|
473
|
-
|
|
474
|
-
SVG ring progress indicator with percentage label.
|
|
475
|
-
|
|
476
|
-
```svelte
|
|
477
|
-
<script>
|
|
478
|
-
import { CircularProgress } from 'horizon-design';
|
|
479
|
-
</script>
|
|
480
|
-
|
|
481
|
-
<CircularProgress value={72} showLabel />
|
|
482
|
-
<CircularProgress value={72} label="Complete" />
|
|
483
|
-
```
|
|
484
|
-
|
|
485
|
-
| Prop | Type | Default |
|
|
486
|
-
| ----------- | --------- | ------- |
|
|
487
|
-
| `value` | `number` | `0` |
|
|
488
|
-
| `max` | `number` | `100` |
|
|
489
|
-
| `showLabel` | `boolean` | `true` |
|
|
490
|
-
| `label` | `string` | — |
|
|
491
|
-
|
|
492
|
-
---
|
|
493
|
-
|
|
494
|
-
### CircularSlider
|
|
495
|
-
|
|
496
|
-
A circular angle-based slider rendered with SVG rings, with an optional value display.
|
|
497
|
-
|
|
498
|
-
```svelte
|
|
499
|
-
<script>
|
|
500
|
-
import { CircularSlider } from 'horizon-design';
|
|
501
|
-
|
|
502
|
-
let angle = $state(90);
|
|
503
|
-
</script>
|
|
504
|
-
|
|
505
|
-
<CircularSlider size={120} thickness={8} bind:value={angle} suffix="°" />
|
|
506
|
-
```
|
|
507
|
-
|
|
508
|
-
| Prop | Type | Default |
|
|
509
|
-
| ----------- | --------- | ------- |
|
|
510
|
-
| `size` | `number` | `100` |
|
|
511
|
-
| `thickness` | `number` | `6` |
|
|
512
|
-
| `step` | `number` | `1` |
|
|
513
|
-
| `showValue` | `boolean` | `true` |
|
|
514
|
-
| `prefix` | `string` | `''` |
|
|
515
|
-
| `suffix` | `string` | `''` |
|
|
516
|
-
| `value` | `number` | `0` |
|
|
517
|
-
|
|
518
|
-
---
|
|
519
|
-
|
|
520
|
-
### Clipboard
|
|
521
|
-
|
|
522
|
-
Copy-to-clipboard input with a toggle trigger icon.
|
|
523
|
-
|
|
524
|
-
```svelte
|
|
525
|
-
<script>
|
|
526
|
-
import { Clipboard } from 'horizon-design';
|
|
527
|
-
</script>
|
|
528
|
-
|
|
529
|
-
<Clipboard value="npm install horizon-design" label="Install command" />
|
|
530
|
-
```
|
|
531
|
-
|
|
532
|
-
| Prop | Type | Default |
|
|
533
|
-
| ------- | ----------------------- | ------- |
|
|
534
|
-
| `value` | `string` **(required)** | — |
|
|
535
|
-
| `label` | `string` | — |
|
|
536
|
-
|
|
537
|
-
---
|
|
538
|
-
|
|
539
|
-
### Collapsible
|
|
540
|
-
|
|
541
|
-
A section that can be toggled open or closed.
|
|
542
|
-
|
|
543
|
-
```svelte
|
|
544
|
-
<script>
|
|
545
|
-
import { Collapsible } from 'horizon-design';
|
|
546
|
-
|
|
547
|
-
let open = $state(false);
|
|
548
|
-
</script>
|
|
549
|
-
|
|
550
|
-
<Collapsible bind:open>
|
|
551
|
-
{#snippet trigger()}Toggle{/snippet}
|
|
552
|
-
Hidden content
|
|
553
|
-
</Collapsible>
|
|
554
|
-
```
|
|
555
|
-
|
|
556
|
-
| Prop | Type | Default |
|
|
557
|
-
| ------------- | --------- | ------- |
|
|
558
|
-
| `trigger` | `Snippet` | — |
|
|
559
|
-
| `open` | `boolean` | `false` |
|
|
560
|
-
| `defaultOpen` | `boolean` | — |
|
|
561
|
-
| `disabled` | `boolean` | — |
|
|
562
|
-
|
|
563
|
-
---
|
|
564
|
-
|
|
565
|
-
### ColorPicker
|
|
566
|
-
|
|
567
|
-
Full-featured HSLA color picker with hex input and swatches.
|
|
568
|
-
|
|
569
|
-
```svelte
|
|
570
|
-
<script>
|
|
571
|
-
import { ColorPicker, parseColor } from 'horizon-design';
|
|
572
|
-
|
|
573
|
-
let color = $state(parseColor('#737efa'));
|
|
574
|
-
</script>
|
|
575
|
-
|
|
576
|
-
<ColorPicker label="Brand color" bind:value={color} />
|
|
577
|
-
```
|
|
578
|
-
|
|
579
|
-
| Prop | Type | Default |
|
|
580
|
-
| ------- | -------- | ------- |
|
|
581
|
-
| `label` | `string` | — |
|
|
582
|
-
| `value` | `Color` | — |
|
|
583
|
-
|
|
584
|
-
`Color` is a type exported from `horizon-design` representing a parsed color object. `parseColor` accepts any of the following string formats:
|
|
585
|
-
|
|
586
|
-
- Hex: `#RGB`, `#RGBA`, `#RRGGBB`, `#RRGGBBAA`
|
|
587
|
-
- RGB: `rgb(r, g, b)`, `rgba(r, g, b, a)`
|
|
588
|
-
- HSL: `hsl(h, s%, l%)`, `hsla(h, s%, l%, a)`
|
|
589
|
-
- HSB: `hsb(h, s%, b%)`, `hsba(h, s%, b%, a)`
|
|
590
|
-
|
|
591
|
-
---
|
|
592
|
-
|
|
593
|
-
### Combobox
|
|
594
|
-
|
|
595
|
-
Searchable dropdown that filters a list of options.
|
|
596
|
-
|
|
597
|
-
```svelte
|
|
598
|
-
<script>
|
|
599
|
-
import { Combobox } from 'horizon-design';
|
|
600
|
-
|
|
601
|
-
const items = [
|
|
602
|
-
{ label: 'Svelte', value: 'svelte' },
|
|
603
|
-
{ label: 'React', value: 'react' }
|
|
604
|
-
];
|
|
605
|
-
</script>
|
|
606
|
-
|
|
607
|
-
<Combobox {items} label="Framework" placeholder="Search…" />
|
|
608
|
-
```
|
|
609
|
-
|
|
610
|
-
| Prop | Type | Default |
|
|
611
|
-
| ------------- | ----------------------------------------- | ----------- |
|
|
612
|
-
| `items` | `Array<{ label: string; value: string }>` | `[]` |
|
|
613
|
-
| `label` | `string` | — |
|
|
614
|
-
| `placeholder` | `string` | `'Search…'` |
|
|
615
|
-
|
|
616
|
-
---
|
|
617
|
-
|
|
618
|
-
### ContextMenu
|
|
619
|
-
|
|
620
|
-
Menu triggered on right-click. Pass the target area as `children`.
|
|
621
|
-
|
|
622
|
-
```svelte
|
|
623
|
-
<script>
|
|
624
|
-
import { ContextMenu } from 'horizon-design';
|
|
625
|
-
</script>
|
|
626
|
-
|
|
627
|
-
{#snippet area()}
|
|
628
|
-
<div class="rounded-lg border-2 border-dashed p-4">Right-click here</div>
|
|
629
|
-
{/snippet}
|
|
630
|
-
|
|
631
|
-
<ContextMenu
|
|
632
|
-
items={[
|
|
633
|
-
{ type: 'label', label: 'Actions' },
|
|
634
|
-
{ type: 'separator' },
|
|
635
|
-
{ value: 'edit', label: 'Edit' },
|
|
636
|
-
{ value: 'copy', label: 'Copy' },
|
|
637
|
-
{ type: 'separator' },
|
|
638
|
-
{ value: 'delete', label: 'Delete' }
|
|
639
|
-
]}
|
|
640
|
-
>
|
|
641
|
-
{@render area()}
|
|
642
|
-
</ContextMenu>
|
|
643
|
-
```
|
|
644
|
-
|
|
645
|
-
| Prop | Type | Default |
|
|
646
|
-
| ---------- | -------------------------------------------------------------------------------------------------------- | ------- |
|
|
647
|
-
| `items` | `Array<{ type?: 'item' \| 'separator' \| 'label'; value?: string; label?: string; disabled?: boolean }>` | `[]` |
|
|
648
|
-
| `children` | `Snippet` | — |
|
|
649
|
-
|
|
650
|
-
---
|
|
651
|
-
|
|
652
|
-
### DataList
|
|
653
|
-
|
|
654
|
-
Key–value pair list. Values can be strings or Snippets.
|
|
655
|
-
|
|
656
|
-
```svelte
|
|
657
|
-
<script>
|
|
658
|
-
import { DataList } from 'horizon-design';
|
|
659
|
-
</script>
|
|
660
|
-
|
|
661
|
-
{#snippet statusBadge()}
|
|
662
|
-
<Badge variant="success">Active</Badge>
|
|
663
|
-
{/snippet}
|
|
664
|
-
|
|
665
|
-
<DataList
|
|
666
|
-
items={[
|
|
667
|
-
{ label: 'Name', value: 'John Doe' },
|
|
668
|
-
{ label: 'Role', value: 'Admin' },
|
|
669
|
-
{ label: 'Status', value: statusBadge }
|
|
670
|
-
]}
|
|
671
|
-
/>
|
|
672
|
-
```
|
|
673
|
-
|
|
674
|
-
| Prop | Type | Default |
|
|
675
|
-
| ------- | ---------------------------------------------------- | ------- |
|
|
676
|
-
| `items` | `Array<{ label: string; value: string \| Snippet }>` | `[]` |
|
|
677
|
-
|
|
678
|
-
---
|
|
679
|
-
|
|
680
|
-
### DatePicker
|
|
681
|
-
|
|
682
|
-
Date picker with a calendar popover.
|
|
683
|
-
|
|
684
|
-
```svelte
|
|
685
|
-
<script>
|
|
686
|
-
import { DatePicker } from 'horizon-design';
|
|
687
|
-
|
|
688
|
-
let selectedDates = $state([]);
|
|
689
|
-
</script>
|
|
690
|
-
|
|
691
|
-
<DatePicker label="Event date" bind:value={selectedDates} placeholder="Pick a date" />
|
|
692
|
-
```
|
|
693
|
-
|
|
694
|
-
| Prop | Type | Default |
|
|
695
|
-
| -------------- | ------------- | ------- |
|
|
696
|
-
| `label` | `string` | — |
|
|
697
|
-
| `placeholder` | `string` | — |
|
|
698
|
-
| `value` | `DateValue[]` | — |
|
|
699
|
-
| `defaultValue` | `DateValue[]` | — |
|
|
700
|
-
|
|
701
|
-
---
|
|
702
|
-
|
|
703
|
-
### Dialog
|
|
704
|
-
|
|
705
|
-
Modal dialog with backdrop.
|
|
706
|
-
|
|
707
|
-
```svelte
|
|
708
|
-
<script>
|
|
709
|
-
import { Dialog } from 'horizon-design';
|
|
710
|
-
import { Button } from 'horizon-design';
|
|
711
|
-
|
|
712
|
-
let open = $state(false);
|
|
713
|
-
</script>
|
|
714
|
-
|
|
715
|
-
<Dialog title="Edit Profile" description="Update your information." bind:open>
|
|
716
|
-
{#snippet trigger()}
|
|
717
|
-
<Button variant="outline">Edit</Button>
|
|
718
|
-
{/snippet}
|
|
719
|
-
<p>Form fields go here.</p>
|
|
720
|
-
{#snippet footer()}
|
|
721
|
-
<Button variant="outline" onclick={() => (open = false)}>Cancel</Button>
|
|
722
|
-
<Button>Save</Button>
|
|
723
|
-
{/snippet}
|
|
724
|
-
</Dialog>
|
|
725
|
-
```
|
|
726
|
-
|
|
727
|
-
| Prop | Type | Default |
|
|
728
|
-
| -------------- | --------- | ------- |
|
|
729
|
-
| `trigger` | `Snippet` | — |
|
|
730
|
-
| `triggerClass` | `string` | `''` |
|
|
731
|
-
| `title` | `string` | — |
|
|
732
|
-
| `description` | `string` | — |
|
|
733
|
-
| `footer` | `Snippet` | — |
|
|
734
|
-
| `showClose` | `boolean` | `true` |
|
|
735
|
-
| `open` | `boolean` | `false` |
|
|
736
|
-
| `defaultOpen` | `boolean` | — |
|
|
737
|
-
| `modal` | `boolean` | `true` |
|
|
738
|
-
|
|
739
|
-
---
|
|
740
|
-
|
|
741
|
-
### Drawer
|
|
742
|
-
|
|
743
|
-
Slide-in panel from an edge of the viewport.
|
|
744
|
-
|
|
745
|
-
```svelte
|
|
746
|
-
<script>
|
|
747
|
-
import { Drawer } from 'horizon-design';
|
|
748
|
-
import { Button } from 'horizon-design';
|
|
749
|
-
|
|
750
|
-
let open = $state(false);
|
|
751
|
-
</script>
|
|
752
|
-
|
|
753
|
-
<Drawer title="Settings" side="right" bind:open>
|
|
754
|
-
{#snippet trigger()}
|
|
755
|
-
<Button variant="outline">Open</Button>
|
|
756
|
-
{/snippet}
|
|
757
|
-
<p>Drawer body.</p>
|
|
758
|
-
</Drawer>
|
|
759
|
-
```
|
|
760
|
-
|
|
761
|
-
| Prop | Type | Default |
|
|
762
|
-
| -------------- | ---------------------------------------- | --------- |
|
|
763
|
-
| `trigger` | `Snippet` | — |
|
|
764
|
-
| `triggerClass` | `string` | `''` |
|
|
765
|
-
| `title` | `string` | — |
|
|
766
|
-
| `description` | `string` | — |
|
|
767
|
-
| `footer` | `Snippet` | — |
|
|
768
|
-
| `side` | `'top' \| 'bottom' \| 'left' \| 'right'` | `'right'` |
|
|
769
|
-
| `showClose` | `boolean` | `true` |
|
|
770
|
-
| `open` | `boolean` | `false` |
|
|
771
|
-
| `defaultOpen` | `boolean` | — |
|
|
772
|
-
|
|
773
|
-
---
|
|
774
|
-
|
|
775
|
-
### Editable
|
|
776
|
-
|
|
777
|
-
Inline-editable text field that shows a preview until clicked.
|
|
778
|
-
|
|
779
|
-
```svelte
|
|
780
|
-
<script>
|
|
781
|
-
import { Editable } from 'horizon-design';
|
|
782
|
-
|
|
783
|
-
let name = $state('Click me to edit');
|
|
784
|
-
</script>
|
|
785
|
-
|
|
786
|
-
<Editable label="Display Name" bind:value={name} />
|
|
787
|
-
```
|
|
788
|
-
|
|
789
|
-
| Prop | Type | Default |
|
|
790
|
-
| -------------- | -------- | ------- |
|
|
791
|
-
| `label` | `string` | — |
|
|
792
|
-
| `defaultValue` | `string` | — |
|
|
793
|
-
| `value` | `string` | — |
|
|
794
|
-
| `placeholder` | `string` | — |
|
|
795
|
-
|
|
796
|
-
---
|
|
797
|
-
|
|
798
|
-
### Field
|
|
799
|
-
|
|
800
|
-
Wraps a form control with accessible label, helper text, and error text.
|
|
801
|
-
|
|
802
|
-
```svelte
|
|
803
|
-
<script>
|
|
804
|
-
import { Field } from 'horizon-design';
|
|
805
|
-
import { Input } from 'horizon-design';
|
|
806
|
-
</script>
|
|
807
|
-
|
|
808
|
-
<Field label="Email" helperText="We'll never share your email.">
|
|
809
|
-
<Input type="email" />
|
|
810
|
-
</Field>
|
|
811
|
-
|
|
812
|
-
<Field invalid label="Email" errorText="Invalid email address.">
|
|
813
|
-
<Input type="email" />
|
|
814
|
-
</Field>
|
|
815
|
-
```
|
|
816
|
-
|
|
817
|
-
`label`, `helperText`, and `errorText` accept a string or a `Snippet` for rich content.
|
|
818
|
-
|
|
819
|
-
| Prop | Type | Default |
|
|
820
|
-
| ------------ | ------------------- | ------- |
|
|
821
|
-
| `label` | `string \| Snippet` | — |
|
|
822
|
-
| `helperText` | `string \| Snippet` | — |
|
|
823
|
-
| `errorText` | `string \| Snippet` | — |
|
|
824
|
-
| `invalid` | `boolean` | — |
|
|
825
|
-
| `disabled` | `boolean` | — |
|
|
826
|
-
| `required` | `boolean` | — |
|
|
827
|
-
|
|
828
|
-
---
|
|
829
|
-
|
|
830
|
-
### FileUpload
|
|
831
|
-
|
|
832
|
-
Drag-and-drop file upload area with a hidden file input.
|
|
833
|
-
|
|
834
|
-
```svelte
|
|
835
|
-
<script>
|
|
836
|
-
import { FileUpload } from 'horizon-design';
|
|
837
|
-
</script>
|
|
838
|
-
|
|
839
|
-
<FileUpload label="Attachments" accept="image/*" maxFiles={3} />
|
|
840
|
-
```
|
|
841
|
-
|
|
842
|
-
| Prop | Type | Default |
|
|
843
|
-
| ------------- | -------- | ------- |
|
|
844
|
-
| `label` | `string` | — |
|
|
845
|
-
| `accept` | `string` | — |
|
|
846
|
-
| `maxFiles` | `number` | — |
|
|
847
|
-
| `maxFileSize` | `number` | — |
|
|
848
|
-
|
|
849
|
-
---
|
|
850
|
-
|
|
851
|
-
### Float
|
|
852
|
-
|
|
853
|
-
Positions its children as a floating overlay (e.g. FAB button).
|
|
854
|
-
|
|
855
|
-
```svelte
|
|
856
|
-
<script>
|
|
857
|
-
import { Float } from 'horizon-design';
|
|
858
|
-
import { Button } from 'horizon-design';
|
|
859
|
-
</script>
|
|
860
|
-
|
|
861
|
-
<Float position="bottom-right">
|
|
862
|
-
<Button size="icon-md" class="rounded-full shadow-lg">+</Button>
|
|
863
|
-
</Float>
|
|
864
|
-
```
|
|
865
|
-
|
|
866
|
-
| Prop | Type | Default |
|
|
867
|
-
| ---------- | -------------------------------------------------------------- | ---------------- |
|
|
868
|
-
| `position` | `'top-left' \| 'top-right' \| 'bottom-left' \| 'bottom-right'` | `'bottom-right'` |
|
|
869
|
-
|
|
870
|
-
---
|
|
871
|
-
|
|
872
|
-
### FloatingPanel
|
|
873
|
-
|
|
874
|
-
A draggable floating panel anchored to a trigger button. Drag the header to reposition.
|
|
875
|
-
|
|
876
|
-
```svelte
|
|
877
|
-
<script>
|
|
878
|
-
import { FloatingPanel } from 'horizon-design';
|
|
879
|
-
</script>
|
|
880
|
-
|
|
881
|
-
{#snippet panelTrigger()}Open Panel{/snippet}
|
|
882
|
-
{#snippet panelBody()}
|
|
883
|
-
<p class="text-muted-foreground text-sm">Drag the header to move this panel.</p>
|
|
884
|
-
{/snippet}
|
|
885
|
-
|
|
886
|
-
<FloatingPanel title="Settings" trigger={panelTrigger}>
|
|
887
|
-
{@render panelBody()}
|
|
888
|
-
</FloatingPanel>
|
|
889
|
-
```
|
|
890
|
-
|
|
891
|
-
| Prop | Type | Default |
|
|
892
|
-
| -------------- | --------- | ------- |
|
|
893
|
-
| `trigger` | `Snippet` | — |
|
|
894
|
-
| `triggerClass` | `string` | `''` |
|
|
895
|
-
| `title` | `string` | — |
|
|
896
|
-
| `children` | `Snippet` | — |
|
|
897
|
-
|
|
898
|
-
---
|
|
899
|
-
|
|
900
|
-
### Frame
|
|
901
|
-
|
|
902
|
-
A code-editor-style container with a title bar and traffic-light dots.
|
|
903
|
-
|
|
904
|
-
```svelte
|
|
905
|
-
<script>
|
|
906
|
-
import { Frame } from 'horizon-design';
|
|
907
|
-
</script>
|
|
908
|
-
|
|
909
|
-
<Frame title="app.svelte" class="h-32">
|
|
910
|
-
<div class="p-4 font-mono text-xs">let count = $state(0);</div>
|
|
911
|
-
</Frame>
|
|
912
|
-
```
|
|
913
|
-
|
|
914
|
-
| Prop | Type | Default |
|
|
915
|
-
| ------- | -------- | ------- |
|
|
916
|
-
| `title` | `string` | — |
|
|
917
|
-
|
|
918
|
-
---
|
|
919
|
-
|
|
920
|
-
### Hint
|
|
921
|
-
|
|
922
|
-
Small helper text below a form field.
|
|
923
|
-
|
|
924
|
-
```svelte
|
|
925
|
-
<script>
|
|
926
|
-
import { Hint } from 'horizon-design';
|
|
927
|
-
import { Input } from 'horizon-design';
|
|
928
|
-
</script>
|
|
929
|
-
|
|
930
|
-
<Input type="password" />
|
|
931
|
-
<Hint>Must be at least 8 characters.</Hint>
|
|
932
|
-
```
|
|
933
|
-
|
|
934
|
-
---
|
|
935
|
-
|
|
936
|
-
### HoverCard
|
|
937
|
-
|
|
938
|
-
Rich preview card revealed on hover.
|
|
939
|
-
|
|
940
|
-
```svelte
|
|
941
|
-
<script>
|
|
942
|
-
import { HoverCard } from 'horizon-design';
|
|
943
|
-
</script>
|
|
944
|
-
|
|
945
|
-
<HoverCard>
|
|
946
|
-
{#snippet trigger()}
|
|
947
|
-
<a href="#">@username</a>
|
|
948
|
-
{/snippet}
|
|
949
|
-
<p>User profile preview content.</p>
|
|
950
|
-
</HoverCard>
|
|
951
|
-
```
|
|
952
|
-
|
|
953
|
-
| Prop | Type | Default |
|
|
954
|
-
| -------------- | --------- | ------- |
|
|
955
|
-
| `trigger` | `Snippet` | — |
|
|
956
|
-
| `triggerClass` | `string` | `''` |
|
|
957
|
-
| `openDelay` | `number` | — |
|
|
958
|
-
| `closeDelay` | `number` | — |
|
|
959
|
-
|
|
960
|
-
---
|
|
961
|
-
|
|
962
|
-
### LinkOverlay
|
|
963
|
-
|
|
964
|
-
Clickable overlay link for making a full card area follow its primary link.
|
|
965
|
-
|
|
966
|
-
```svelte
|
|
967
|
-
<script>
|
|
968
|
-
import { LinkBox, LinkOverlay } from 'horizon-design';
|
|
969
|
-
</script>
|
|
970
|
-
|
|
971
|
-
<LinkBox class="rounded-xl border p-4">
|
|
972
|
-
<h3>
|
|
973
|
-
<LinkOverlay href="/projects/alpha">Project Alpha</LinkOverlay>
|
|
974
|
-
</h3>
|
|
975
|
-
<p>Open the project overview.</p>
|
|
976
|
-
</LinkBox>
|
|
977
|
-
```
|
|
978
|
-
|
|
979
|
-
Use `LinkBox` as the positioned wrapper and `LinkOverlay` for the main link.
|
|
980
|
-
|
|
981
|
-
---
|
|
982
|
-
|
|
983
|
-
### ImageCropper
|
|
984
|
-
|
|
985
|
-
Interactive image crop area with drag handles, grid lines, and resize handles.
|
|
986
|
-
|
|
987
|
-
```svelte
|
|
988
|
-
<script>
|
|
989
|
-
import { ImageCropper } from 'horizon-design';
|
|
990
|
-
</script>
|
|
991
|
-
|
|
992
|
-
<ImageCropper src="/photo.jpg" alt="Photo" axis="both" />
|
|
993
|
-
```
|
|
994
|
-
|
|
995
|
-
| Prop | Type | Default |
|
|
996
|
-
| ------ | -------------------------------------- | -------- |
|
|
997
|
-
| `src` | `string` **(required)** | — |
|
|
998
|
-
| `alt` | `string` | `''` |
|
|
999
|
-
| `axis` | `'horizontal' \| 'vertical' \| 'both'` | `'both'` |
|
|
1000
|
-
|
|
1001
|
-
---
|
|
1002
|
-
|
|
1003
|
-
### Input
|
|
1004
|
-
|
|
1005
|
-
Styled text input field.
|
|
1006
|
-
|
|
1007
|
-
```svelte
|
|
1008
|
-
<script>
|
|
1009
|
-
import { Input } from 'horizon-design';
|
|
1010
|
-
</script>
|
|
1011
|
-
|
|
1012
|
-
<Input placeholder="Enter text…" />
|
|
1013
|
-
<Input size="lg" type="email" />
|
|
1014
|
-
```
|
|
1015
|
-
|
|
1016
|
-
| Prop | Type | Default |
|
|
1017
|
-
| ------ | ---------------------- | ------- |
|
|
1018
|
-
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` |
|
|
1019
|
-
|
|
1020
|
-
Accepts all HTML `<input>` attributes.
|
|
1021
|
-
|
|
1022
|
-
---
|
|
1023
|
-
|
|
1024
|
-
### InputGroup
|
|
1025
|
-
|
|
1026
|
-
Connects an input with prefix/suffix addons.
|
|
1027
|
-
|
|
1028
|
-
```svelte
|
|
1029
|
-
<script>
|
|
1030
|
-
import { InputGroup, InputAddon } from 'horizon-design';
|
|
1031
|
-
import { Input } from 'horizon-design';
|
|
1032
|
-
</script>
|
|
1033
|
-
|
|
1034
|
-
<InputGroup>
|
|
1035
|
-
<InputAddon>https://</InputAddon>
|
|
1036
|
-
<Input placeholder="yoursite.com" />
|
|
1037
|
-
</InputGroup>
|
|
1038
|
-
```
|
|
1039
|
-
|
|
1040
|
-
---
|
|
1041
|
-
|
|
1042
|
-
### Item
|
|
1043
|
-
|
|
1044
|
-
A styled list row (label + icon/trailing slot).
|
|
1045
|
-
|
|
1046
|
-
```svelte
|
|
1047
|
-
<script>
|
|
1048
|
-
import { Item } from 'horizon-design';
|
|
1049
|
-
import MingcuteUserLine from '~icons/mingcute/user-line';
|
|
1050
|
-
</script>
|
|
1051
|
-
|
|
1052
|
-
<Item>
|
|
1053
|
-
<MingcuteUserLine class="text-muted-foreground size-4" />
|
|
1054
|
-
<span class="text-sm">Profile</span>
|
|
1055
|
-
</Item>
|
|
1056
|
-
```
|
|
1057
|
-
|
|
1058
|
-
---
|
|
1059
|
-
|
|
1060
|
-
### Kbd
|
|
1061
|
-
|
|
1062
|
-
Keyboard shortcut badge.
|
|
1063
|
-
|
|
1064
|
-
```svelte
|
|
1065
|
-
<script>
|
|
1066
|
-
import { Kbd } from 'horizon-design';
|
|
1067
|
-
</script>
|
|
1068
|
-
|
|
1069
|
-
<Kbd>⌘K</Kbd>
|
|
1070
|
-
<Kbd size="lg">Ctrl+S</Kbd>
|
|
1071
|
-
```
|
|
1072
|
-
|
|
1073
|
-
| Prop | Type | Default |
|
|
1074
|
-
| ------ | ---------------------- | ------- |
|
|
1075
|
-
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` |
|
|
1076
|
-
|
|
1077
|
-
---
|
|
1078
|
-
|
|
1079
|
-
### Listbox
|
|
1080
|
-
|
|
1081
|
-
A scrollable list that lets users select one or more items.
|
|
1082
|
-
|
|
1083
|
-
```svelte
|
|
1084
|
-
<script>
|
|
1085
|
-
import { Listbox } from 'horizon-design';
|
|
1086
|
-
|
|
1087
|
-
const items = [
|
|
1088
|
-
{ label: 'Svelte', value: 'svelte' },
|
|
1089
|
-
{ label: 'React', value: 'react' }
|
|
1090
|
-
];
|
|
1091
|
-
|
|
1092
|
-
let selected = $state([]);
|
|
1093
|
-
</script>
|
|
1094
|
-
|
|
1095
|
-
<Listbox {items} label="Choose a framework" bind:value={selected} />
|
|
1096
|
-
```
|
|
1097
|
-
|
|
1098
|
-
| Prop | Type | Default |
|
|
1099
|
-
| -------------- | ----------------------------------------- | ------- |
|
|
1100
|
-
| `items` | `Array<{ label: string; value: string }>` | `[]` |
|
|
1101
|
-
| `label` | `string` | — |
|
|
1102
|
-
| `multiple` | `boolean` | `false` |
|
|
1103
|
-
| `value` | `string[]` | `[]` |
|
|
1104
|
-
| `defaultValue` | `string[]` | — |
|
|
1105
|
-
|
|
1106
|
-
---
|
|
1107
|
-
|
|
1108
|
-
### Marquee
|
|
1109
|
-
|
|
1110
|
-
Horizontally scrolling ticker band.
|
|
1111
|
-
|
|
1112
|
-
```svelte
|
|
1113
|
-
<script>
|
|
1114
|
-
import { Marquee, MarqueeItem } from 'horizon-design';
|
|
1115
|
-
import { Badge } from 'horizon-design';
|
|
1116
|
-
</script>
|
|
1117
|
-
|
|
1118
|
-
<Marquee class="py-2">
|
|
1119
|
-
{#each ['Svelte', 'TypeScript', 'Tailwind'] as name (name)}
|
|
1120
|
-
<MarqueeItem class="px-3">
|
|
1121
|
-
<Badge variant="outline">{name}</Badge>
|
|
1122
|
-
</MarqueeItem>
|
|
1123
|
-
{/each}
|
|
1124
|
-
</Marquee>
|
|
1125
|
-
```
|
|
1126
|
-
|
|
1127
|
-
| Prop | Type | Default |
|
|
1128
|
-
| -------------- | --------- | ------- |
|
|
1129
|
-
| `speed` | `number` | — |
|
|
1130
|
-
| `pauseOnHover` | `boolean` | — |
|
|
1131
|
-
| `reverse` | `boolean` | — |
|
|
1132
|
-
|
|
1133
|
-
---
|
|
1134
|
-
|
|
1135
|
-
### Menu
|
|
1136
|
-
|
|
1137
|
-
Dropdown menu with items, separators, and groups.
|
|
1138
|
-
|
|
1139
|
-
```svelte
|
|
1140
|
-
<script>
|
|
1141
|
-
import { Menu, MenuItem, MenuSeparator, MenuGroup, MenuGroupLabel } from 'horizon-design';
|
|
1142
|
-
import { Button } from 'horizon-design';
|
|
1143
|
-
|
|
1144
|
-
let menuOpen = $state(false);
|
|
1145
|
-
</script>
|
|
1146
|
-
|
|
1147
|
-
<Menu bind:open={menuOpen}>
|
|
1148
|
-
{#snippet trigger()}
|
|
1149
|
-
<Button variant="outline">Options</Button>
|
|
1150
|
-
{/snippet}
|
|
1151
|
-
<MenuItem value="edit">Edit</MenuItem>
|
|
1152
|
-
<MenuItem value="delete">Delete</MenuItem>
|
|
1153
|
-
<MenuSeparator />
|
|
1154
|
-
<MenuItem value="help">Help</MenuItem>
|
|
1155
|
-
</Menu>
|
|
1156
|
-
```
|
|
1157
|
-
|
|
1158
|
-
| `Menu` Prop | Type | Default |
|
|
1159
|
-
| -------------- | --------- | ------- |
|
|
1160
|
-
| `trigger` | `Snippet` | — |
|
|
1161
|
-
| `triggerClass` | `string` | `''` |
|
|
1162
|
-
| `contentClass` | `string` | `''` |
|
|
1163
|
-
| `open` | `boolean` | `false` |
|
|
1164
|
-
|
|
1165
|
-
---
|
|
1166
|
-
|
|
1167
|
-
### NativeSelect
|
|
1168
|
-
|
|
1169
|
-
A styled native `<select>` element.
|
|
1170
|
-
|
|
1171
|
-
```svelte
|
|
1172
|
-
<script>
|
|
1173
|
-
import { NativeSelect } from 'horizon-design';
|
|
1174
|
-
</script>
|
|
1175
|
-
|
|
1176
|
-
<NativeSelect>
|
|
1177
|
-
<option value="">Choose…</option>
|
|
1178
|
-
<option value="svelte">Svelte</option>
|
|
1179
|
-
<option value="react">React</option>
|
|
1180
|
-
</NativeSelect>
|
|
1181
|
-
```
|
|
1182
|
-
|
|
1183
|
-
---
|
|
1184
|
-
|
|
1185
|
-
### NumberInput
|
|
1186
|
-
|
|
1187
|
-
Numeric input with increment/decrement buttons.
|
|
1188
|
-
|
|
1189
|
-
```svelte
|
|
1190
|
-
<script>
|
|
1191
|
-
import { NumberInput } from 'horizon-design';
|
|
1192
|
-
|
|
1193
|
-
let qty = $state('1');
|
|
1194
|
-
</script>
|
|
1195
|
-
|
|
1196
|
-
<NumberInput label="Quantity" min={0} max={100} bind:value={qty} />
|
|
1197
|
-
```
|
|
1198
|
-
|
|
1199
|
-
| Prop | Type | Default |
|
|
1200
|
-
| -------------- | --------- | ------- |
|
|
1201
|
-
| `label` | `string` | — |
|
|
1202
|
-
| `min` | `number` | — |
|
|
1203
|
-
| `max` | `number` | — |
|
|
1204
|
-
| `step` | `number` | `1` |
|
|
1205
|
-
| `defaultValue` | `string` | — |
|
|
1206
|
-
| `value` | `string` | `''` |
|
|
1207
|
-
| `disabled` | `boolean` | — |
|
|
1208
|
-
|
|
1209
|
-
---
|
|
1210
|
-
|
|
1211
|
-
### Pagination
|
|
1212
|
-
|
|
1213
|
-
Page navigation controls.
|
|
1214
|
-
|
|
1215
|
-
```svelte
|
|
1216
|
-
<script>
|
|
1217
|
-
import { Pagination } from 'horizon-design';
|
|
1218
|
-
|
|
1219
|
-
let currentPage = $state(1);
|
|
1220
|
-
</script>
|
|
1221
|
-
|
|
1222
|
-
<Pagination count={100} pageSize={10} bind:page={currentPage} />
|
|
1223
|
-
```
|
|
1224
|
-
|
|
1225
|
-
| Prop | Type | Default |
|
|
1226
|
-
| -------------- | ----------------------- | ------- |
|
|
1227
|
-
| `count` | `number` **(required)** | — |
|
|
1228
|
-
| `pageSize` | `number` | `10` |
|
|
1229
|
-
| `siblingCount` | `number` | `1` |
|
|
1230
|
-
| `page` | `number` | `1` |
|
|
1231
|
-
| `defaultPage` | `number` | — |
|
|
1232
|
-
|
|
1233
|
-
---
|
|
1234
|
-
|
|
1235
|
-
### PinInput
|
|
1236
|
-
|
|
1237
|
-
One-time code entry with individual digit boxes.
|
|
1238
|
-
|
|
1239
|
-
```svelte
|
|
1240
|
-
<script>
|
|
1241
|
-
import { PinInput } from 'horizon-design';
|
|
1242
|
-
|
|
1243
|
-
let code = $state([]);
|
|
1244
|
-
</script>
|
|
1245
|
-
|
|
1246
|
-
<PinInput label="Verification code" length={6} bind:value={code} />
|
|
1247
|
-
```
|
|
1248
|
-
|
|
1249
|
-
| Prop | Type | Default |
|
|
1250
|
-
| ----------------- | --------------------------------------------- | ----------- |
|
|
1251
|
-
| `label` | `string` | — |
|
|
1252
|
-
| `length` | `number` | `4` |
|
|
1253
|
-
| `placeholder` | `string` | `'○'` |
|
|
1254
|
-
| `type` | `'numeric' \| 'alphabetic' \| 'alphanumeric'` | `'numeric'` |
|
|
1255
|
-
| `value` | `string[]` | `[]` |
|
|
1256
|
-
| `onValueComplete` | `(details) => void` | — |
|
|
1257
|
-
|
|
1258
|
-
---
|
|
1259
|
-
|
|
1260
|
-
### Popover
|
|
1261
|
-
|
|
1262
|
-
Floating content panel anchored to a trigger.
|
|
1263
|
-
|
|
1264
|
-
```svelte
|
|
1265
|
-
<script>
|
|
1266
|
-
import { Popover } from 'horizon-design';
|
|
1267
|
-
import { Button } from 'horizon-design';
|
|
1268
|
-
|
|
1269
|
-
let open = $state(false);
|
|
1270
|
-
</script>
|
|
1271
|
-
|
|
1272
|
-
<Popover title="Info" bind:open>
|
|
1273
|
-
{#snippet trigger()}
|
|
1274
|
-
<Button variant="outline" size="icon-md">?</Button>
|
|
1275
|
-
{/snippet}
|
|
1276
|
-
<p>Helpful information here.</p>
|
|
1277
|
-
</Popover>
|
|
1278
|
-
```
|
|
1279
|
-
|
|
1280
|
-
| Prop | Type | Default |
|
|
1281
|
-
| -------------- | --------- | ------- |
|
|
1282
|
-
| `trigger` | `Snippet` | — |
|
|
1283
|
-
| `triggerClass` | `string` | `''` |
|
|
1284
|
-
| `title` | `string` | — |
|
|
1285
|
-
| `description` | `string` | — |
|
|
1286
|
-
| `footer` | `Snippet` | — |
|
|
1287
|
-
| `contentClass` | `string` | `''` |
|
|
1288
|
-
| `open` | `boolean` | `false` |
|
|
1289
|
-
| `defaultOpen` | `boolean` | — |
|
|
1290
|
-
|
|
1291
|
-
---
|
|
1292
|
-
|
|
1293
|
-
### Progress
|
|
1294
|
-
|
|
1295
|
-
Horizontal progress bar.
|
|
1296
|
-
|
|
1297
|
-
```svelte
|
|
1298
|
-
<script>
|
|
1299
|
-
import { Progress } from 'horizon-design';
|
|
1300
|
-
|
|
1301
|
-
let progress = $state(60);
|
|
1302
|
-
</script>
|
|
1303
|
-
|
|
1304
|
-
<Progress label="Loading" bind:value={progress} />
|
|
1305
|
-
<Progress value={null} /><!-- indeterminate -->
|
|
1306
|
-
```
|
|
1307
|
-
|
|
1308
|
-
| Prop | Type | Default |
|
|
1309
|
-
| ------- | ---------------- | ------- |
|
|
1310
|
-
| `label` | `string` | — |
|
|
1311
|
-
| `value` | `number \| null` | `0` |
|
|
1312
|
-
| `max` | `number` | `100` |
|
|
1313
|
-
|
|
1314
|
-
---
|
|
1315
|
-
|
|
1316
|
-
### Prose
|
|
1317
|
-
|
|
1318
|
-
Rich text typography wrapper for rendered Markdown, CMS content, or long-form copy.
|
|
1319
|
-
|
|
1320
|
-
```svelte
|
|
1321
|
-
<script>
|
|
1322
|
-
import { Prose } from 'horizon-design';
|
|
1323
|
-
</script>
|
|
1324
|
-
|
|
1325
|
-
<Prose>
|
|
1326
|
-
<h2>Release notes</h2>
|
|
1327
|
-
<p>Use Prose to style headings, paragraphs, lists, quotes, and inline code.</p>
|
|
1328
|
-
<ul>
|
|
1329
|
-
<li>Consistent spacing</li>
|
|
1330
|
-
<li>Design-system colours</li>
|
|
1331
|
-
</ul>
|
|
1332
|
-
</Prose>
|
|
1333
|
-
```
|
|
1334
|
-
|
|
1335
|
-
---
|
|
1336
|
-
|
|
1337
|
-
### QrCode
|
|
1338
|
-
|
|
1339
|
-
Renders a QR code SVG for a given string value.
|
|
1340
|
-
|
|
1341
|
-
```svelte
|
|
1342
|
-
<script>
|
|
1343
|
-
import { QrCode } from 'horizon-design';
|
|
1344
|
-
</script>
|
|
1345
|
-
|
|
1346
|
-
<QrCode value="https://github.com" size={120} />
|
|
1347
|
-
```
|
|
1348
|
-
|
|
1349
|
-
| Prop | Type | Default |
|
|
1350
|
-
| ------- | ----------------------- | ------- |
|
|
1351
|
-
| `value` | `string` **(required)** | — |
|
|
1352
|
-
| `size` | `number` | `200` |
|
|
1353
|
-
|
|
1354
|
-
---
|
|
1355
|
-
|
|
1356
|
-
### RadioGroup
|
|
1357
|
-
|
|
1358
|
-
A group of mutually exclusive radio buttons. Pass an `items` config array for a self-contained component, or use `children` for fully custom markup.
|
|
1359
|
-
|
|
1360
|
-
```svelte
|
|
1361
|
-
<script>
|
|
1362
|
-
import { RadioGroup } from 'horizon-design';
|
|
1363
|
-
|
|
1364
|
-
let plan = $state('pro');
|
|
1365
|
-
</script>
|
|
1366
|
-
|
|
1367
|
-
<RadioGroup
|
|
1368
|
-
label="Subscription plan"
|
|
1369
|
-
bind:value={plan}
|
|
1370
|
-
items={[
|
|
1371
|
-
{ value: 'free', label: 'Free' },
|
|
1372
|
-
{ value: 'pro', label: 'Pro' },
|
|
1373
|
-
{ value: 'enterprise', label: 'Enterprise', disabled: true }
|
|
1374
|
-
]}
|
|
1375
|
-
/>
|
|
1376
|
-
```
|
|
1377
|
-
|
|
1378
|
-
Items can also use a `Snippet` for rich labels:
|
|
1379
|
-
|
|
1380
|
-
```svelte
|
|
1381
|
-
{#snippet proLabel()}
|
|
1382
|
-
<span>Pro <Badge variant="info">Popular</Badge></span>
|
|
1383
|
-
{/snippet}
|
|
1384
|
-
|
|
1385
|
-
<RadioGroup items={[{ value: 'pro', label: proLabel }]} />
|
|
1386
|
-
```
|
|
1387
|
-
|
|
1388
|
-
| Prop | Type | Default |
|
|
1389
|
-
| -------------- | ------------------------------------------------------------------- | ------- |
|
|
1390
|
-
| `label` | `string` | — |
|
|
1391
|
-
| `items` | `{ value: string; label: string \| Snippet; disabled?: boolean }[]` | — |
|
|
1392
|
-
| `value` | `string` | `''` |
|
|
1393
|
-
| `defaultValue` | `string` | — |
|
|
1394
|
-
| `disabled` | `boolean` | — |
|
|
1395
|
-
| `children` | `Snippet` | — |
|
|
1396
|
-
|
|
1397
|
-
---
|
|
1398
|
-
|
|
1399
|
-
### RatingGroup
|
|
1400
|
-
|
|
1401
|
-
Star rating input.
|
|
1402
|
-
|
|
1403
|
-
```svelte
|
|
1404
|
-
<script>
|
|
1405
|
-
import { RatingGroup } from 'horizon-design';
|
|
1406
|
-
|
|
1407
|
-
let rating = $state(3);
|
|
1408
|
-
</script>
|
|
1409
|
-
|
|
1410
|
-
<RatingGroup label="Rate this" count={5} bind:value={rating} />
|
|
1411
|
-
```
|
|
1412
|
-
|
|
1413
|
-
| Prop | Type | Default |
|
|
1414
|
-
| -------------- | -------- | ------- |
|
|
1415
|
-
| `label` | `string` | — |
|
|
1416
|
-
| `count` | `number` | `5` |
|
|
1417
|
-
| `defaultValue` | `number` | — |
|
|
1418
|
-
| `value` | `number` | `0` |
|
|
1419
|
-
|
|
1420
|
-
---
|
|
1421
|
-
|
|
1422
|
-
### ScrollArea
|
|
1423
|
-
|
|
1424
|
-
Thin custom scrollbars in a fixed-height container.
|
|
1425
|
-
|
|
1426
|
-
```svelte
|
|
1427
|
-
<script>
|
|
1428
|
-
import { ScrollArea } from 'horizon-design';
|
|
1429
|
-
</script>
|
|
1430
|
-
|
|
1431
|
-
<ScrollArea class="h-64">
|
|
1432
|
-
<p>Long content…</p>
|
|
1433
|
-
</ScrollArea>
|
|
1434
|
-
```
|
|
1435
|
-
|
|
1436
|
-
---
|
|
1437
|
-
|
|
1438
|
-
### SegmentGroup
|
|
1439
|
-
|
|
1440
|
-
Segmented button group (radio-style). Labels can be strings or Snippets.
|
|
1441
|
-
|
|
1442
|
-
```svelte
|
|
1443
|
-
<script>
|
|
1444
|
-
import { SegmentGroup } from 'horizon-design';
|
|
1445
|
-
|
|
1446
|
-
let view = $state('week');
|
|
1447
|
-
</script>
|
|
1448
|
-
|
|
1449
|
-
<SegmentGroup
|
|
1450
|
-
items={[
|
|
1451
|
-
{ value: 'day', label: 'Day' },
|
|
1452
|
-
{ value: 'week', label: 'Week' },
|
|
1453
|
-
{ value: 'month', label: 'Month' }
|
|
1454
|
-
]}
|
|
1455
|
-
bind:value={view}
|
|
1456
|
-
/>
|
|
1457
|
-
```
|
|
1458
|
-
|
|
1459
|
-
The component uses `items-stretch` internally, so items always fill whatever height the root has. To control height, pass a height class: `class="h-9"` or `class="h-full"`.
|
|
1460
|
-
|
|
1461
|
-
| Prop | Type | Default |
|
|
1462
|
-
| -------------- | ---------------------------------------------------- | ------- |
|
|
1463
|
-
| `items` | `Array<{ value: string; label: string \| Snippet }>` | `[]` |
|
|
1464
|
-
| `value` | `string` | `''` |
|
|
1465
|
-
| `defaultValue` | `string` | — |
|
|
1466
|
-
|
|
1467
|
-
---
|
|
1468
|
-
|
|
1469
|
-
### Select
|
|
1470
|
-
|
|
1471
|
-
Styled accessible dropdown select.
|
|
1472
|
-
|
|
1473
|
-
```svelte
|
|
1474
|
-
<script>
|
|
1475
|
-
import { Select } from 'horizon-design';
|
|
1476
|
-
|
|
1477
|
-
const items = [
|
|
1478
|
-
{ label: 'Apple', value: 'apple' },
|
|
1479
|
-
{ label: 'Banana', value: 'banana' }
|
|
1480
|
-
];
|
|
1481
|
-
|
|
1482
|
-
let selected = $state([]);
|
|
1483
|
-
</script>
|
|
1484
|
-
|
|
1485
|
-
<Select {items} label="Fruit" bind:value={selected} placeholder="Pick a fruit…" />
|
|
1486
|
-
```
|
|
1487
|
-
|
|
1488
|
-
| Prop | Type | Default |
|
|
1489
|
-
| -------------- | ---------------------------------------------------------------------------- | -------------------- |
|
|
1490
|
-
| `items` | `Array<{ label: string; value: string; disabled?: boolean }>` **(required)** | `[]` |
|
|
1491
|
-
| `label` | `string` | — |
|
|
1492
|
-
| `placeholder` | `string` | `'Select an option'` |
|
|
1493
|
-
| `value` | `string[]` | `[]` |
|
|
1494
|
-
| `defaultValue` | `string[]` | — |
|
|
1495
|
-
| `multiple` | `boolean` | `false` |
|
|
1496
|
-
| `disabled` | `boolean` | — |
|
|
1497
|
-
|
|
1498
|
-
---
|
|
1499
|
-
|
|
1500
|
-
### Separator
|
|
1501
|
-
|
|
1502
|
-
Horizontal or vertical dividing line.
|
|
1503
|
-
|
|
1504
|
-
```svelte
|
|
1505
|
-
<script>
|
|
1506
|
-
import { Separator } from 'horizon-design';
|
|
1507
|
-
</script>
|
|
1508
|
-
|
|
1509
|
-
<Separator />
|
|
1510
|
-
<Separator orientation="vertical" class="h-6" />
|
|
1511
|
-
```
|
|
1512
|
-
|
|
1513
|
-
| Prop | Type | Default |
|
|
1514
|
-
| ------------- | ---------------------------- | -------------- |
|
|
1515
|
-
| `orientation` | `'horizontal' \| 'vertical'` | `'horizontal'` |
|
|
1516
|
-
| `decorative` | `boolean` | `true` |
|
|
1517
|
-
|
|
1518
|
-
---
|
|
1519
|
-
|
|
1520
|
-
### Sheet
|
|
1521
|
-
|
|
1522
|
-
Slide-in panel (alias of Drawer with configurable side).
|
|
1523
|
-
|
|
1524
|
-
```svelte
|
|
1525
|
-
<script>
|
|
1526
|
-
import { Sheet } from 'horizon-design';
|
|
1527
|
-
import { Button } from 'horizon-design';
|
|
1528
|
-
</script>
|
|
1529
|
-
|
|
1530
|
-
<Sheet title="Filters" side="right">
|
|
1531
|
-
{#snippet trigger()}
|
|
1532
|
-
<Button variant="outline">Open Filters</Button>
|
|
1533
|
-
{/snippet}
|
|
1534
|
-
<p>Filter content here.</p>
|
|
1535
|
-
</Sheet>
|
|
1536
|
-
```
|
|
1537
|
-
|
|
1538
|
-
| Prop | Type | Default |
|
|
1539
|
-
| -------------- | ---------------------------------------- | --------- |
|
|
1540
|
-
| `trigger` | `Snippet` | — |
|
|
1541
|
-
| `triggerClass` | `string` | `''` |
|
|
1542
|
-
| `title` | `string` | — |
|
|
1543
|
-
| `description` | `string` | — |
|
|
1544
|
-
| `footer` | `Snippet` | — |
|
|
1545
|
-
| `side` | `'top' \| 'bottom' \| 'left' \| 'right'` | `'right'` |
|
|
1546
|
-
| `showClose` | `boolean` | `true` |
|
|
1547
|
-
| `open` | `boolean` | `false` |
|
|
1548
|
-
| `defaultOpen` | `boolean` | — |
|
|
1549
|
-
|
|
1550
|
-
---
|
|
1551
|
-
|
|
1552
|
-
### Sidebar
|
|
1553
|
-
|
|
1554
|
-
Vertical navigation layout with header, grouped content, items, and footer.
|
|
1555
|
-
|
|
1556
|
-
```svelte
|
|
1557
|
-
<script>
|
|
1558
|
-
import { Sidebar, SidebarSection, SidebarItem } from 'horizon-design';
|
|
1559
|
-
</script>
|
|
1560
|
-
|
|
1561
|
-
<Sidebar>
|
|
1562
|
-
{#snippet header()}Workspace{/snippet}
|
|
1563
|
-
{#snippet footer()}<p>Signed in as Rayan</p>{/snippet}
|
|
1564
|
-
<SidebarSection label="General">
|
|
1565
|
-
<SidebarItem href="/" active>Overview</SidebarItem>
|
|
1566
|
-
<SidebarItem href="/settings">Settings</SidebarItem>
|
|
1567
|
-
</SidebarSection>
|
|
1568
|
-
</Sidebar>
|
|
1569
|
-
```
|
|
1570
|
-
|
|
1571
|
-
| `Sidebar` Prop | Type | Default |
|
|
1572
|
-
| -------------- | --------- | ------- |
|
|
1573
|
-
| `collapsed` | `boolean` | `false` |
|
|
1574
|
-
| `header` | `Snippet` | — |
|
|
1575
|
-
| `footer` | `Snippet` | — |
|
|
1576
|
-
|
|
1577
|
-
| `SidebarSection` Prop | Type | Default |
|
|
1578
|
-
| --------------------- | -------- | ------- |
|
|
1579
|
-
| `label` | `string` | `''` |
|
|
1580
|
-
|
|
1581
|
-
| `SidebarItem` Prop | Type | Default |
|
|
1582
|
-
| ------------------ | --------- | ------- |
|
|
1583
|
-
| `href` | `string` | `''` |
|
|
1584
|
-
| `active` | `boolean` | `false` |
|
|
1585
|
-
|
|
1586
|
-
---
|
|
1587
|
-
|
|
1588
|
-
### SignaturePad
|
|
1589
|
-
|
|
1590
|
-
Freehand drawing canvas for signatures.
|
|
1591
|
-
|
|
1592
|
-
```svelte
|
|
1593
|
-
<script>
|
|
1594
|
-
import { SignaturePad } from 'horizon-design';
|
|
1595
|
-
</script>
|
|
1596
|
-
|
|
1597
|
-
<SignaturePad label="Draw your signature" onDrawEnd={(d) => console.log(d.paths)} />
|
|
1598
|
-
```
|
|
1599
|
-
|
|
1600
|
-
| Prop | Type | Default |
|
|
1601
|
-
| ----------- | ------------------- | ------- |
|
|
1602
|
-
| `label` | `string` | — |
|
|
1603
|
-
| `onDrawEnd` | `(details) => void` | — |
|
|
1604
|
-
|
|
1605
|
-
---
|
|
1606
|
-
|
|
1607
|
-
### Skeleton
|
|
1608
|
-
|
|
1609
|
-
Animated loading placeholder.
|
|
1610
|
-
|
|
1611
|
-
```svelte
|
|
1612
|
-
<script>
|
|
1613
|
-
import { Skeleton } from 'horizon-design';
|
|
1614
|
-
</script>
|
|
1615
|
-
|
|
1616
|
-
<Skeleton class="h-4 w-48" />
|
|
1617
|
-
<Skeleton class="h-12 w-12 rounded-full" />
|
|
1618
|
-
```
|
|
1619
|
-
|
|
1620
|
-
---
|
|
1621
|
-
|
|
1622
|
-
### SkipNav
|
|
1623
|
-
|
|
1624
|
-
Keyboard-only skip link for jumping directly to main page content.
|
|
1625
|
-
|
|
1626
|
-
```svelte
|
|
1627
|
-
<script>
|
|
1628
|
-
import { SkipNav } from 'horizon-design';
|
|
1629
|
-
</script>
|
|
1630
|
-
|
|
1631
|
-
<SkipNav href="#main-content">Skip to content</SkipNav>
|
|
1632
|
-
```
|
|
1633
|
-
|
|
1634
|
-
| Prop | Type | Default |
|
|
1635
|
-
| ------ | -------- | ----------------- |
|
|
1636
|
-
| `href` | `string` | `'#main-content'` |
|
|
1637
|
-
|
|
1638
|
-
---
|
|
1639
|
-
|
|
1640
|
-
### Slider
|
|
1641
|
-
|
|
1642
|
-
Range input with draggable thumb.
|
|
1643
|
-
|
|
1644
|
-
```svelte
|
|
1645
|
-
<script>
|
|
1646
|
-
import { Slider } from 'horizon-design';
|
|
1647
|
-
|
|
1648
|
-
let volume = $state([50]);
|
|
1649
|
-
</script>
|
|
1650
|
-
|
|
1651
|
-
<Slider label="Volume" showValue min={0} max={100} bind:value={volume} />
|
|
1652
|
-
```
|
|
1653
|
-
|
|
1654
|
-
| Prop | Type | Default |
|
|
1655
|
-
| -------------- | ---------------------------- | -------------- |
|
|
1656
|
-
| `label` | `string` | — |
|
|
1657
|
-
| `showValue` | `boolean` | `false` |
|
|
1658
|
-
| `min` | `number` | `0` |
|
|
1659
|
-
| `max` | `number` | `100` |
|
|
1660
|
-
| `step` | `number` | `1` |
|
|
1661
|
-
| `value` | `number[]` | `[0]` |
|
|
1662
|
-
| `defaultValue` | `number[]` | — |
|
|
1663
|
-
| `orientation` | `'horizontal' \| 'vertical'` | `'horizontal'` |
|
|
1664
|
-
| `disabled` | `boolean` | — |
|
|
1665
|
-
|
|
1666
|
-
---
|
|
1667
|
-
|
|
1668
|
-
### Spinner
|
|
1669
|
-
|
|
1670
|
-
Animated loading indicator.
|
|
1671
|
-
|
|
1672
|
-
```svelte
|
|
1673
|
-
<script>
|
|
1674
|
-
import { Spinner } from 'horizon-design';
|
|
1675
|
-
</script>
|
|
1676
|
-
|
|
1677
|
-
<Spinner />
|
|
1678
|
-
<Spinner class="size-8" aria-label="Uploading" />
|
|
1679
|
-
```
|
|
1680
|
-
|
|
1681
|
-
---
|
|
1682
|
-
|
|
1683
|
-
### Splitter
|
|
1684
|
-
|
|
1685
|
-
Resizable split pane layout.
|
|
1686
|
-
|
|
1687
|
-
```svelte
|
|
1688
|
-
<script>
|
|
1689
|
-
import { Splitter, SplitterPanel, SplitterResizeTrigger } from 'horizon-design';
|
|
1690
|
-
|
|
1691
|
-
const panels = [{ id: 'a' }, { id: 'b' }];
|
|
1692
|
-
</script>
|
|
1693
|
-
|
|
1694
|
-
<Splitter {panels} class="h-40 rounded-lg border">
|
|
1695
|
-
<SplitterPanel id="a">Panel A</SplitterPanel>
|
|
1696
|
-
<SplitterResizeTrigger id="a:b" />
|
|
1697
|
-
<SplitterPanel id="b">Panel B</SplitterPanel>
|
|
1698
|
-
</Splitter>
|
|
1699
|
-
```
|
|
1700
|
-
|
|
1701
|
-
| `Splitter` Prop | Type | Default |
|
|
1702
|
-
| --------------- | -------------------------------------- | -------------- |
|
|
1703
|
-
| `panels` | `Array<{ id: string }>` **(required)** | — |
|
|
1704
|
-
| `orientation` | `'horizontal' \| 'vertical'` | `'horizontal'` |
|
|
1705
|
-
|
|
1706
|
-
---
|
|
1707
|
-
|
|
1708
|
-
### Status
|
|
1709
|
-
|
|
1710
|
-
Colour-coded presence dot.
|
|
1711
|
-
|
|
1712
|
-
```svelte
|
|
1713
|
-
<script>
|
|
1714
|
-
import { Status } from 'horizon-design';
|
|
1715
|
-
</script>
|
|
1716
|
-
|
|
1717
|
-
<Status variant="online" />
|
|
1718
|
-
<Status variant="away" />
|
|
1719
|
-
```
|
|
1720
|
-
|
|
1721
|
-
| Prop | Type | Default |
|
|
1722
|
-
| --------- | ------------------------------------------- | ---------- |
|
|
1723
|
-
| `variant` | `'online' \| 'offline' \| 'away' \| 'busy'` | `'online'` |
|
|
1724
|
-
|
|
1725
|
-
---
|
|
1726
|
-
|
|
1727
|
-
### Steps
|
|
1728
|
-
|
|
1729
|
-
Multi-step wizard with progress indicators.
|
|
1730
|
-
|
|
1731
|
-
```svelte
|
|
1732
|
-
<script>
|
|
1733
|
-
import { Steps } from 'horizon-design';
|
|
1734
|
-
</script>
|
|
1735
|
-
|
|
1736
|
-
{#snippet step1()}
|
|
1737
|
-
<p>Fill in your profile details.</p>
|
|
1738
|
-
{/snippet}
|
|
1739
|
-
{#snippet step2()}
|
|
1740
|
-
<p>Configure your preferences.</p>
|
|
1741
|
-
{/snippet}
|
|
1742
|
-
{#snippet done()}
|
|
1743
|
-
<p>All done! 🎉</p>
|
|
1744
|
-
{/snippet}
|
|
1745
|
-
|
|
1746
|
-
<Steps
|
|
1747
|
-
steps={[
|
|
1748
|
-
{ title: 'Profile', content: step1 },
|
|
1749
|
-
{ title: 'Preferences', content: step2 }
|
|
1750
|
-
]}
|
|
1751
|
-
completedContent={done}
|
|
1752
|
-
/>
|
|
1753
|
-
```
|
|
1754
|
-
|
|
1755
|
-
| Prop | Type | Default |
|
|
1756
|
-
| ------------------ | -------------------------------------------- | -------- |
|
|
1757
|
-
| `steps` | `Array<{ title: string; content: Snippet }>` | `[]` |
|
|
1758
|
-
| `step` | `number` (bindable) | — |
|
|
1759
|
-
| `completedContent` | `Snippet` | — |
|
|
1760
|
-
| `prevLabel` | `string` | `'Back'` |
|
|
1761
|
-
| `nextLabel` | `string` | `'Next'` |
|
|
1762
|
-
|
|
1763
|
-
---
|
|
1764
|
-
|
|
1765
|
-
### Swap
|
|
1766
|
-
|
|
1767
|
-
Toggle between two rendered states with an animated transition. Both `on` and `off` are Snippets.
|
|
1768
|
-
|
|
1769
|
-
```svelte
|
|
1770
|
-
<script>
|
|
1771
|
-
import { Swap } from 'horizon-design';
|
|
1772
|
-
import MingcuteSunLine from '~icons/mingcute/sun-line';
|
|
1773
|
-
import MingcuteMoonLine from '~icons/mingcute/moon-line';
|
|
1774
|
-
</script>
|
|
1775
|
-
|
|
1776
|
-
{#snippet sunIcon()}<MingcuteSunLine class="size-6" />{/snippet}
|
|
1777
|
-
{#snippet moonIcon()}<MingcuteMoonLine class="size-6" />{/snippet}
|
|
1778
|
-
|
|
1779
|
-
<button onclick={() => (dark = !dark)}>
|
|
1780
|
-
<Swap swap={dark} on={sunIcon} off={moonIcon} />
|
|
1781
|
-
</button>
|
|
1782
|
-
```
|
|
1783
|
-
|
|
1784
|
-
| Prop | Type | Default |
|
|
1785
|
-
| --------------- | --------- | ------- |
|
|
1786
|
-
| `swap` | `boolean` | `false` |
|
|
1787
|
-
| `on` | `Snippet` | — |
|
|
1788
|
-
| `off` | `Snippet` | — |
|
|
1789
|
-
| `lazyMount` | `boolean` | `true` |
|
|
1790
|
-
| `unmountOnExit` | `boolean` | `true` |
|
|
1791
|
-
|
|
1792
|
-
---
|
|
1793
|
-
|
|
1794
|
-
### Switch
|
|
1795
|
-
|
|
1796
|
-
Toggle switch.
|
|
1797
|
-
|
|
1798
|
-
```svelte
|
|
1799
|
-
<script>
|
|
1800
|
-
import { Switch } from 'horizon-design';
|
|
1801
|
-
|
|
1802
|
-
let notifications = $state(false);
|
|
1803
|
-
</script>
|
|
1804
|
-
|
|
1805
|
-
<Switch label="Dark mode" />
|
|
1806
|
-
<Switch label="Notifications" bind:checked={notifications} />
|
|
1807
|
-
<Switch label="With content">
|
|
1808
|
-
{#snippet checkedContent()}<MyCheckIcon />{/snippet}
|
|
1809
|
-
{#snippet uncheckedContent()}<MyCloseIcon />{/snippet}
|
|
1810
|
-
</Switch>
|
|
1811
|
-
```
|
|
1812
|
-
|
|
1813
|
-
| Prop | Type | Default |
|
|
1814
|
-
| ------------------ | ------------------------------ | ----------- |
|
|
1815
|
-
| `size` | `'sm' \| 'md' \| 'lg' \| 'xl'` | `'md'` |
|
|
1816
|
-
| `variant` | `'default' \| 'secondary'` | `'default'` |
|
|
1817
|
-
| `label` | `string` | — |
|
|
1818
|
-
| `checked` | `boolean` | — |
|
|
1819
|
-
| `defaultChecked` | `boolean` | — |
|
|
1820
|
-
| `disabled` | `boolean` | — |
|
|
1821
|
-
| `checkedContent` | `Snippet` | — |
|
|
1822
|
-
| `uncheckedContent` | `Snippet` | — |
|
|
14
|
+
| Import | What it holds |
|
|
15
|
+
| ----------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
16
|
+
| `horizon-design` | The general kit: every component below but the Editor's, `theme` and `THEME_STORAGE_KEY`, `slidePage` and `prefersReducedMotion`, `cn`, `isApplePlatform`, and Ark's `createTreeCollection` for `VirtualTree`. |
|
|
17
|
+
| `horizon-design/editor` | The Editor window's components: `HierarchyView`, `InspectorPanel`, `FileTree` (with Ark's `createTreeCollection` and `createFileTreeCollection`), `HorizonLayout` (with everything horizon-layout exports), `createMonacoTheme`. |
|
|
18
|
+
| `horizon-design/tokens` | `tokenValues`: every colour token of each theme as OKLCH and as sRGB hex, plain TypeScript with no Svelte. |
|
|
19
|
+
| `horizon-design/horizon-design.css` | The stylesheet: fonts, theme tokens, the Tailwind theme, base styles, page motion. |
|
|
1823
20
|
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
### Table
|
|
1827
|
-
|
|
1828
|
-
Data table from column config and row data. Row values can be strings or Snippets.
|
|
1829
|
-
|
|
1830
|
-
```svelte
|
|
1831
|
-
<script>
|
|
1832
|
-
import { Table } from 'horizon-design';
|
|
1833
|
-
</script>
|
|
21
|
+
## Setup
|
|
1834
22
|
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
{ key: 'name', label: 'Name' },
|
|
1838
|
-
{ key: 'role', label: 'Role' },
|
|
1839
|
-
{ key: 'joined', label: 'Joined' }
|
|
1840
|
-
]}
|
|
1841
|
-
rows={[
|
|
1842
|
-
{ name: 'Alice', role: 'Admin', joined: 'Jan 2024' },
|
|
1843
|
-
{ name: 'Bob', role: 'Developer', joined: 'Mar 2024' }
|
|
1844
|
-
]}
|
|
1845
|
-
/>
|
|
23
|
+
```sh
|
|
24
|
+
pnpm add horizon-design
|
|
1846
25
|
```
|
|
1847
26
|
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
| `rows` | `Array<Record<string, string \| Snippet>>` | `[]` |
|
|
27
|
+
The components import their icons from [Mingcute](https://www.mingcute.com) through
|
|
28
|
+
[unplugin-icons](https://github.com/unplugin/unplugin-icons), which compiles each icon into a
|
|
29
|
+
Svelte component when the app is built, so the app sets up the same (see [Icons](#icons)).
|
|
1852
30
|
|
|
1853
|
-
|
|
31
|
+
An app that server-renders or prerenders the Editor's components bundles the drag-and-drop
|
|
32
|
+
library into its server build, since its packages have no `exports` map that Node's ESM loader
|
|
33
|
+
would accept (`vite.config.ts`):
|
|
1854
34
|
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
let activeTab = $state('overview');
|
|
1864
|
-
</script>
|
|
1865
|
-
|
|
1866
|
-
{#snippet overview()}<p>Overview content.</p>{/snippet}
|
|
1867
|
-
{#snippet settings()}<p>Settings content.</p>{/snippet}
|
|
1868
|
-
|
|
1869
|
-
<Tabs
|
|
1870
|
-
tabs={[
|
|
1871
|
-
{ value: 'overview', label: 'Overview', content: overview },
|
|
1872
|
-
{ value: 'settings', label: 'Settings', content: settings }
|
|
1873
|
-
]}
|
|
1874
|
-
bind:value={activeTab}
|
|
1875
|
-
defaultValue="overview"
|
|
1876
|
-
/>
|
|
35
|
+
```ts
|
|
36
|
+
export default defineConfig({
|
|
37
|
+
plugins: [tailwindcss(), sveltekit(), Icons({ compiler: 'svelte' })],
|
|
38
|
+
ssr: {
|
|
39
|
+
noExternal: ['@atlaskit/pragmatic-drag-and-drop', '@atlaskit/pragmatic-drag-and-drop-hitbox']
|
|
40
|
+
}
|
|
41
|
+
});
|
|
1877
42
|
```
|
|
1878
43
|
|
|
1879
|
-
|
|
44
|
+
Import the stylesheet after Tailwind, in the app's root CSS:
|
|
1880
45
|
|
|
1881
|
-
```
|
|
1882
|
-
|
|
46
|
+
```css
|
|
47
|
+
@import 'tailwindcss';
|
|
48
|
+
@import 'horizon-design/horizon-design.css';
|
|
1883
49
|
```
|
|
1884
50
|
|
|
1885
|
-
|
|
1886
|
-
| -------------- | ---------------------------------------------------------------------- | ----------- |
|
|
1887
|
-
| `tabs` | `Array<{ value: string; label: string \| Snippet; content: Snippet }>` | `[]` |
|
|
1888
|
-
| `variant` | `'default' \| 'underline'` | `'default'` |
|
|
1889
|
-
| `value` | `string` | — |
|
|
1890
|
-
| `defaultValue` | `string` | — |
|
|
51
|
+
The stylesheet tells Tailwind to scan the library's components itself.
|
|
1891
52
|
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
### Textarea
|
|
1895
|
-
|
|
1896
|
-
Multi-line text input.
|
|
53
|
+
Then initialize the theme once, in the root layout (`theme.initialize` returns the function that removes
|
|
54
|
+
its listeners, which `onMount` calls when the layout unmounts):
|
|
1897
55
|
|
|
1898
56
|
```svelte
|
|
1899
|
-
<script>
|
|
1900
|
-
import {
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
<Textarea placeholder="Write something…" rows={4} />
|
|
1904
|
-
```
|
|
1905
|
-
|
|
1906
|
-
Accepts all HTML `<textarea>` attributes.
|
|
1907
|
-
|
|
1908
|
-
---
|
|
1909
|
-
|
|
1910
|
-
### ThemeSwitch
|
|
1911
|
-
|
|
1912
|
-
A three-position toggle (System / Dark / Light) with animated sliding thumb.
|
|
57
|
+
<script lang="ts">
|
|
58
|
+
import { onMount } from 'svelte';
|
|
59
|
+
import { theme } from 'horizon-design';
|
|
1913
60
|
|
|
1914
|
-
|
|
1915
|
-
<script>
|
|
1916
|
-
import { ThemeSwitch } from 'horizon-design';
|
|
61
|
+
onMount(() => theme.initialize());
|
|
1917
62
|
</script>
|
|
1918
|
-
|
|
1919
|
-
<ThemeSwitch />
|
|
1920
|
-
<ThemeSwitch size="lg" />
|
|
1921
63
|
```
|
|
1922
64
|
|
|
1923
|
-
|
|
65
|
+
and set it before the first paint, so the page never flashes the other theme (an inline script in
|
|
66
|
+
`app.html`, or the same lines in a preload script under a strict CSP). The script reads the mode
|
|
67
|
+
saved under `THEME_STORAGE_KEY` (`horizon-theme`) and, when storage is disabled, follows the OS as
|
|
68
|
+
the theme controller does:
|
|
1924
69
|
|
|
1925
70
|
```html
|
|
1926
|
-
<!-- app.html, inside <head> -->
|
|
1927
71
|
<script>
|
|
1928
72
|
(function () {
|
|
1929
|
-
var
|
|
73
|
+
var mode = null;
|
|
74
|
+
try {
|
|
75
|
+
mode = localStorage.getItem('horizon-theme');
|
|
76
|
+
} catch {
|
|
77
|
+
// Storage disabled: follow the OS, as the theme controller does.
|
|
78
|
+
}
|
|
1930
79
|
var dark =
|
|
1931
|
-
|
|
1932
|
-
|
|
80
|
+
mode === 'dark' ||
|
|
81
|
+
(mode !== 'light' && window.matchMedia('(prefers-color-scheme: dark)').matches);
|
|
82
|
+
document.documentElement.dataset.theme = dark ? 'dark' : 'light';
|
|
1933
83
|
})();
|
|
1934
84
|
</script>
|
|
1935
85
|
```
|
|
1936
86
|
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
|
1949
|
-
|
|
|
1950
|
-
| `
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
<Timer autoStart={true} />
|
|
1985
|
-
```
|
|
1986
|
-
|
|
1987
|
-
| Prop | Type | Default |
|
|
1988
|
-
| ----------- | --------- | ------- |
|
|
1989
|
-
| `autoStart` | `boolean` | `false` |
|
|
1990
|
-
|
|
1991
|
-
---
|
|
1992
|
-
|
|
1993
|
-
### Toast
|
|
1994
|
-
|
|
1995
|
-
Transient notification messages.
|
|
1996
|
-
|
|
1997
|
-
```svelte
|
|
1998
|
-
<script>
|
|
1999
|
-
import { Toaster, createToaster } from 'horizon-design';
|
|
2000
|
-
|
|
2001
|
-
const toaster = createToaster({ placement: 'bottom-end' });
|
|
2002
|
-
|
|
2003
|
-
function notify() {
|
|
2004
|
-
toaster.create({ title: 'Saved!', description: 'Changes were saved.', type: 'success' });
|
|
2005
|
-
}
|
|
2006
|
-
</script>
|
|
2007
|
-
|
|
2008
|
-
<button onclick={notify}>Save</button>
|
|
2009
|
-
<Toaster {toaster} />
|
|
2010
|
-
```
|
|
2011
|
-
|
|
2012
|
-
`createToaster` options: `placement`, `max`, `duration`, `removeDelay`.
|
|
2013
|
-
|
|
2014
|
-
---
|
|
2015
|
-
|
|
2016
|
-
### Toggle
|
|
2017
|
-
|
|
2018
|
-
A pressable on/off button.
|
|
2019
|
-
|
|
2020
|
-
```svelte
|
|
2021
|
-
<script>
|
|
2022
|
-
import { Toggle } from 'horizon-design';
|
|
2023
|
-
|
|
2024
|
-
let bold = $state(false);
|
|
2025
|
-
</script>
|
|
2026
|
-
|
|
2027
|
-
<Toggle bind:pressed={bold}>Bold</Toggle>
|
|
2028
|
-
<Toggle variant="outline" size="sm">Italic</Toggle>
|
|
2029
|
-
```
|
|
2030
|
-
|
|
2031
|
-
| Prop | Type | Default |
|
|
2032
|
-
| ---------------- | ------------------------ | ----------- |
|
|
2033
|
-
| `variant` | `'default' \| 'outline'` | `'default'` |
|
|
2034
|
-
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` |
|
|
2035
|
-
| `pressed` | `boolean` | `false` |
|
|
2036
|
-
| `defaultPressed` | `boolean` | — |
|
|
2037
|
-
|
|
2038
|
-
---
|
|
2039
|
-
|
|
2040
|
-
### ToggleGroup
|
|
2041
|
-
|
|
2042
|
-
A group of toggle buttons (multi-select or single-select). Each item content is a Snippet.
|
|
2043
|
-
|
|
2044
|
-
```svelte
|
|
2045
|
-
<script>
|
|
2046
|
-
import { ToggleGroup } from 'horizon-design';
|
|
2047
|
-
import MingcuteBoldLine from '~icons/mingcute/bold-line';
|
|
2048
|
-
import MingcuteItalicLine from '~icons/mingcute/italic-line';
|
|
2049
|
-
|
|
2050
|
-
let formatting = $state([]);
|
|
2051
|
-
</script>
|
|
2052
|
-
|
|
2053
|
-
{#snippet boldIcon()}<MingcuteBoldLine class="size-4" />{/snippet}
|
|
2054
|
-
{#snippet italicIcon()}<MingcuteItalicLine class="size-4" />{/snippet}
|
|
2055
|
-
|
|
2056
|
-
<ToggleGroup
|
|
2057
|
-
items={[
|
|
2058
|
-
{ value: 'bold', content: boldIcon },
|
|
2059
|
-
{ value: 'italic', content: italicIcon }
|
|
2060
|
-
]}
|
|
2061
|
-
bind:value={formatting}
|
|
2062
|
-
/>
|
|
2063
|
-
```
|
|
2064
|
-
|
|
2065
|
-
| Prop | Type | Default |
|
|
2066
|
-
| -------------- | -------------------------------------------- | ------------ |
|
|
2067
|
-
| `items` | `Array<{ value: string; content: Snippet }>` | `[]` |
|
|
2068
|
-
| `type` | `'single' \| 'multiple'` | `'multiple'` |
|
|
2069
|
-
| `value` | `string[]` | `[]` |
|
|
2070
|
-
| `defaultValue` | `string[]` | — |
|
|
2071
|
-
|
|
2072
|
-
---
|
|
2073
|
-
|
|
2074
|
-
### ToggleTooltip
|
|
2075
|
-
|
|
2076
|
-
A toggle button with an attached tooltip label.
|
|
2077
|
-
|
|
2078
|
-
```svelte
|
|
2079
|
-
<script>
|
|
2080
|
-
import { ToggleTooltip } from 'horizon-design';
|
|
2081
|
-
import MingcuteBoldLine from '~icons/mingcute/bold-line';
|
|
2082
|
-
</script>
|
|
2083
|
-
|
|
2084
|
-
<ToggleTooltip label="Bold">
|
|
2085
|
-
<MingcuteBoldLine class="size-4" />
|
|
2086
|
-
</ToggleTooltip>
|
|
2087
|
-
```
|
|
2088
|
-
|
|
2089
|
-
| Prop | Type | Default |
|
|
2090
|
-
| ------- | ----------------------- | ------- |
|
|
2091
|
-
| `label` | `string` **(required)** | — |
|
|
2092
|
-
|
|
2093
|
-
---
|
|
2094
|
-
|
|
2095
|
-
### Tooltip
|
|
87
|
+
## Tokens
|
|
88
|
+
|
|
89
|
+
One OKLCH palette (a navy ramp, a blue ramp and the status hues) is mapped, per theme, onto
|
|
90
|
+
semantic tokens. Components use only the semantic tokens, so both themes stay consistent; apps do
|
|
91
|
+
the same, and never write a colour literal.
|
|
92
|
+
|
|
93
|
+
| Group | Tokens (Tailwind: `bg-*`, `text-*`, `border-*`…) |
|
|
94
|
+
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
95
|
+
| Surfaces | `background` (the page), `sunken` (sidebars, fields, tracks), `surface` (cards, panels), `raised` (popovers, dialogs), `hover`, `active` |
|
|
96
|
+
| Lines | `border`, `border-strong` |
|
|
97
|
+
| Text | `fg`, `fg-2`, `muted`, `faint` |
|
|
98
|
+
| Actions and status | `primary`, `primary-hover`, `on-primary`, `danger`, `on-danger`, `success`, `warning`, `info`, `accent`, each with `-subtle` (a tinted fill) and `-border` |
|
|
99
|
+
| Editor | `server`, `local` (the two object modes), `grid-line`, the code colours `code-keyword`, `code-function`, `code-string`, `code-number`, `code-type`, `code-comment`, `code-attribute`, `code-line` |
|
|
100
|
+
| Fixed in both themes | `paper` (switch and slider thumbs, QR codes), `on-art`, `art-scrim` and `art-scrim-hover` (text and pills over game art), `avatar-1` to `avatar-5` |
|
|
101
|
+
| Overlays | `scrim` |
|
|
102
|
+
|
|
103
|
+
- **Theme:** dark is the default; `data-theme="light"` on `<html>` (or on any element, for a
|
|
104
|
+
light island) switches to light. `color-scheme` follows.
|
|
105
|
+
- **Type scale:** `text-2xs` (10.5 px) to `text-4xl` (34 px) for apps, 13 px body; `text-display-sm`,
|
|
106
|
+
`text-display` and `text-display-lg` for marketing headlines. Horizon Sans (semi-expanded; see
|
|
107
|
+
[Fonts](#fonts)) and Lilex for code.
|
|
108
|
+
- **Radius:** `rounded-xs` 2 px, `sm` 4 px, `md` 6 px, `lg` 10 px, `xl` 14 px.
|
|
109
|
+
- **Control heights:** `h-control-xs` 22 px, `sm` 26 px, `md` 30 px, `lg` 40 px.
|
|
110
|
+
- **Elevation:** `shadow-sm`, `shadow-md`, `shadow-lg`, and `inset-shadow-highlight`, the light
|
|
111
|
+
edge on raised surfaces; each theme has its own.
|
|
112
|
+
- **Motion:** `ease-standard`, `ease-emphasized`; `--duration-fast` (0.15 s), `--duration-base`
|
|
113
|
+
(0.2 s), `--duration-page` (0.32 s).
|
|
114
|
+
- **No blur by default.** Overlays (`Dialog`, `AlertDialog`, `Sheet`, `Drawer`, `Popover`, `Menu`,
|
|
115
|
+
`ContextMenu`, `HoverCard`, `FloatingPanel`, `CommandPalette`) take `frosted` for a translucent,
|
|
116
|
+
blurred surface; the `frosted` utility is for overlays only.
|
|
117
|
+
- Tailwind's default palette and shadows are removed: only these tokens produce colour utilities.
|
|
118
|
+
|
|
119
|
+
The tokens have one source, `scripts/tokens/tokens.ts`. When the library is built,
|
|
120
|
+
`scripts/tokens/generate.ts` writes the theme CSS (`src/lib/generated/theme.css`) and the
|
|
121
|
+
exported values (`src/lib/generated/tokens.ts`), converting each OKLCH value to sRGB hex. Every
|
|
122
|
+
OKLCH colour of the library lies inside sRGB (the generator refuses one that doesn't, and a test
|
|
123
|
+
checks every colour of the token source and every `oklch()` written in `src/`), so the CSS and its
|
|
124
|
+
hex show the same colour on every display.
|
|
125
|
+
|
|
126
|
+
### Token values as data
|
|
127
|
+
|
|
128
|
+
`horizon-design/tokens` gives every colour token of each theme in both forms, generated when the
|
|
129
|
+
library is built: `tokenValues[theme][token]` is `{ oklch, hex }`, where `oklch` is the value the
|
|
130
|
+
theme CSS uses (`oklch(0.202 0.029 268.7)`) and `hex` the same colour as lowercase sRGB hex
|
|
131
|
+
(`#111624`, or `#rrggbbaa` for translucent tokens), converted with CSS Color 4's conversion (colorjs.io, at build time). It is
|
|
132
|
+
for the colours needed before any CSS loads, which take no CSS variable and, for Electron, no
|
|
133
|
+
OKLCH:
|
|
2096
134
|
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
```svelte
|
|
2100
|
-
<script>
|
|
2101
|
-
import { Tooltip } from 'horizon-design';
|
|
2102
|
-
import { Button } from 'horizon-design';
|
|
2103
|
-
</script>
|
|
135
|
+
```ts
|
|
136
|
+
import { tokenValues } from 'horizon-design/tokens';
|
|
2104
137
|
|
|
2105
|
-
|
|
2106
|
-
<Button variant="ghost" size="icon-md">?</Button>
|
|
2107
|
-
</Tooltip>
|
|
138
|
+
new BrowserWindow({ backgroundColor: tokenValues[theme].background.hex });
|
|
2108
139
|
```
|
|
2109
140
|
|
|
2110
|
-
|
|
2111
|
-
| ------------- | ---------------------------------- | ---------------------- |
|
|
2112
|
-
| `content` | `string \| Snippet` **(required)** | — |
|
|
2113
|
-
| `openDelay` | `number` | `200` |
|
|
2114
|
-
| `closeDelay` | `number` | `100` |
|
|
2115
|
-
| `positioning` | `PositioningOptions` | `{ placement: 'top' }` |
|
|
2116
|
-
|
|
2117
|
-
---
|
|
2118
|
-
|
|
2119
|
-
### Tour
|
|
2120
|
-
|
|
2121
|
-
Guided multi-step product tour with spotlight and step navigation.
|
|
141
|
+
## Theme and motion
|
|
2122
142
|
|
|
2123
|
-
```
|
|
2124
|
-
|
|
2125
|
-
import { Tour } from 'horizon-design';
|
|
2126
|
-
import { Button } from 'horizon-design';
|
|
2127
|
-
</script>
|
|
143
|
+
```ts
|
|
144
|
+
import { theme, slidePage } from 'horizon-design';
|
|
2128
145
|
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
<Tour
|
|
2134
|
-
trigger={tourTrigger}
|
|
2135
|
-
steps={[
|
|
2136
|
-
{
|
|
2137
|
-
id: 'step-1',
|
|
2138
|
-
type: 'dialog',
|
|
2139
|
-
title: 'Welcome',
|
|
2140
|
-
description: 'This is the first step.',
|
|
2141
|
-
actions: [{ label: 'Next', action: 'next' }]
|
|
2142
|
-
},
|
|
2143
|
-
{
|
|
2144
|
-
id: 'step-2',
|
|
2145
|
-
type: 'dialog',
|
|
2146
|
-
title: 'Done!',
|
|
2147
|
-
description: 'You finished the tour.',
|
|
2148
|
-
actions: [{ label: 'Finish', action: 'dismiss' }]
|
|
2149
|
-
}
|
|
2150
|
-
]}
|
|
2151
|
-
/>
|
|
146
|
+
theme.mode; // 'system' | 'dark' | 'light': the choice (reactive, read-only: change it with theme.set)
|
|
147
|
+
theme.resolved; // 'dark' | 'light': the theme in effect, following the OS while the mode is system (reactive)
|
|
148
|
+
theme.set('light'); // saves the mode and crossfades the whole page into it; resolves once the crossfade ends
|
|
149
|
+
theme.initialize({ blockContextMenu: true }); // applies the theme, follows the OS, blocks the browser's context menu only when asked; returns the function that stops it
|
|
2152
150
|
```
|
|
2153
151
|
|
|
2154
|
-
The
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
| `steps` | `TourStepDetails[]` | `[]` |
|
|
2159
|
-
| `trigger` | `Snippet<[() => void]>` | — |
|
|
2160
|
-
| `showProgress` | `boolean` | `true` |
|
|
2161
|
-
| `showClose` | `boolean` | `true` |
|
|
2162
|
-
|
|
2163
|
-
---
|
|
2164
|
-
|
|
2165
|
-
### FileTree
|
|
152
|
+
The mode is saved in `localStorage` under `THEME_STORAGE_KEY`. Without storage (disabled, or
|
|
153
|
+
server rendering) the mode starts as system, and a choice lasts until the page is closed; on the
|
|
154
|
+
server, where there is no OS theme, `resolved` is dark. Calling `theme.initialize` again replaces the
|
|
155
|
+
listeners of the previous call.
|
|
2166
156
|
|
|
2167
|
-
|
|
157
|
+
Switching themes crossfades the whole page, and navigating slides the screen in the direction of
|
|
158
|
+
travel, both with the View Transitions API in 0.32 s, and neither when the browser has no View
|
|
159
|
+
Transitions or the system asks for reduced motion (`prefersReducedMotion()` says whether it does).
|
|
160
|
+
Mark the element that slides with `data-slide-region` and start the slide from SvelteKit's
|
|
161
|
+
`onNavigate`, with the app's own order of screens:
|
|
2168
162
|
|
|
2169
|
-
```
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
name: '',
|
|
2179
|
-
children: [
|
|
2180
|
-
{
|
|
2181
|
-
id: 'src',
|
|
2182
|
-
name: 'src',
|
|
2183
|
-
children: [
|
|
2184
|
-
{ id: 'app', name: 'app.ts' },
|
|
2185
|
-
{ id: 'index', name: 'index.ts' }
|
|
2186
|
-
]
|
|
2187
|
-
},
|
|
2188
|
-
{ id: 'package', name: 'package.json' }
|
|
2189
|
-
]
|
|
2190
|
-
}
|
|
163
|
+
```ts
|
|
164
|
+
onNavigate((navigation) => {
|
|
165
|
+
const direction = order(navigation.to) > order(navigation.from) ? 'forward' : 'backward';
|
|
166
|
+
return new Promise((resolve) => {
|
|
167
|
+
slidePage(direction, async () => {
|
|
168
|
+
resolve();
|
|
169
|
+
// A failed or cancelled navigation is SvelteKit's to report; the slide just ends.
|
|
170
|
+
await navigation.complete.catch(() => {});
|
|
171
|
+
});
|
|
2191
172
|
});
|
|
2192
|
-
|
|
2193
|
-
let selectedValue = $state([]);
|
|
2194
|
-
let expandedValue = $state([]);
|
|
2195
|
-
</script>
|
|
2196
|
-
|
|
2197
|
-
<FileTree {collection} bind:selectedValue bind:expandedValue />
|
|
2198
|
-
```
|
|
2199
|
-
|
|
2200
|
-
| Prop | Type | Default |
|
|
2201
|
-
| ------------------- | ----------------------------------------- | -------------------------- |
|
|
2202
|
-
| `collection` | `TreeCollection<TreeNode>` **(required)** | — |
|
|
2203
|
-
| `icon` | `Snippet<[node]>` | folder/file mingcute icons |
|
|
2204
|
-
| `selectedValue` | `string[]` (bindable) | `[]` |
|
|
2205
|
-
| `expandedValue` | `string[]` (bindable) | `[]` |
|
|
2206
|
-
| `focusedValue` | `string` (bindable) | — |
|
|
2207
|
-
| `onSelectionChange` | `(details) => void` | — |
|
|
2208
|
-
| `onExpandedChange` | `(details) => void` | — |
|
|
2209
|
-
| `onFocusChange` | `(details) => void` | — |
|
|
2210
|
-
|
|
2211
|
-
**Custom icons**
|
|
2212
|
-
|
|
2213
|
-
The `icon` snippet receives the current node:
|
|
2214
|
-
|
|
2215
|
-
```svelte
|
|
2216
|
-
{#snippet icon(node)}
|
|
2217
|
-
{#if node.children}
|
|
2218
|
-
<FolderIcon class="size-4" />
|
|
2219
|
-
{:else}
|
|
2220
|
-
<FileIcon class="size-4" />
|
|
2221
|
-
{/if}
|
|
2222
|
-
{/snippet}
|
|
2223
|
-
|
|
2224
|
-
<FileTree {collection} {icon} />
|
|
2225
|
-
```
|
|
2226
|
-
|
|
2227
|
-
Folder branches default to `mingcute:folder-2-line` / `mingcute:folder-open-line` (open/closed) and files to `mingcute:file-line`.
|
|
2228
|
-
|
|
2229
|
-
The following are re-exported from `horizon-design` for convenience: `createTreeCollection`, `createFileTreeCollection`, `TreeCollection`, `TreeNode`, `TreeCollectionOptions`, `FilePathTreeNode`.
|
|
2230
|
-
|
|
2231
|
-
---
|
|
2232
|
-
|
|
2233
|
-
### HierarchyView
|
|
2234
|
-
|
|
2235
|
-
Unity-style hierarchy panel. Accepts a plain nested object tree — no collection wrapper needed. Both branches and leaves are fully selectable. Clicking a row selects it; only the chevron button toggles expand/collapse. Supports multi-select (Shift-click), inline rename (double-click or F2), long-press drag-and-drop reordering, and keyboard-driven node movement. `onDataChange` fires whenever the tree is mutated by any interaction.
|
|
2236
|
-
|
|
2237
|
-
```svelte
|
|
2238
|
-
<script>
|
|
2239
|
-
import { HierarchyView } from 'horizon-design';
|
|
2240
|
-
|
|
2241
|
-
const data = [
|
|
2242
|
-
{
|
|
2243
|
-
id: 'scene',
|
|
2244
|
-
name: 'Scene',
|
|
2245
|
-
children: [
|
|
2246
|
-
{
|
|
2247
|
-
id: 'player',
|
|
2248
|
-
name: 'Player',
|
|
2249
|
-
children: [
|
|
2250
|
-
{ id: 'camera', name: 'Camera' },
|
|
2251
|
-
{ id: 'mesh', name: 'Mesh' }
|
|
2252
|
-
]
|
|
2253
|
-
},
|
|
2254
|
-
{ id: 'light', name: 'Directional Light' },
|
|
2255
|
-
{
|
|
2256
|
-
id: 'ui',
|
|
2257
|
-
name: 'UI Canvas',
|
|
2258
|
-
children: [{ id: 'hud', name: 'HUD' }]
|
|
2259
|
-
}
|
|
2260
|
-
]
|
|
2261
|
-
}
|
|
2262
|
-
];
|
|
2263
|
-
|
|
2264
|
-
let selectedValue = $state([]);
|
|
2265
|
-
let expandedValue = $state([]);
|
|
2266
|
-
</script>
|
|
2267
|
-
|
|
2268
|
-
<HierarchyView {data} bind:selectedValue bind:expandedValue />
|
|
173
|
+
});
|
|
2269
174
|
```
|
|
2270
175
|
|
|
2271
|
-
|
|
2272
|
-
| ------------------- | ------------------------------------------------ | ---------------------------------- |
|
|
2273
|
-
| `data` | `AnyNode[]` **(required)** | — |
|
|
2274
|
-
| `nodeToValue` | `(node: AnyNode) => string` | uses `node.id` then `node.name` |
|
|
2275
|
-
| `nodeToString` | `(node: AnyNode) => string` | uses `node.name` then `node.label` |
|
|
2276
|
-
| `icon` | `Snippet<[node]>` | `mingcute:file-line` |
|
|
2277
|
-
| `selectedValue` | `string[]` (bindable) | `[]` |
|
|
2278
|
-
| `expandedValue` | `string[]` (bindable) | `[]` |
|
|
2279
|
-
| `onSelectionChange` | `(details: { selectedValue: string[] }) => void` | — |
|
|
2280
|
-
| `onExpandedChange` | `(details: { expandedValue: string[] }) => void` | — |
|
|
2281
|
-
| `onDataChange` | `(data: AnyNode[]) => void` | — |
|
|
2282
|
-
|
|
2283
|
-
`AnyNode` is a flexible shape: `{ id?, name?, label?, children?, [key: string]: unknown }`. Pass the top-level nodes directly — no root wrapper needed.
|
|
2284
|
-
|
|
2285
|
-
**Keyboard shortcuts**
|
|
2286
|
-
|
|
2287
|
-
| Key | Action |
|
|
2288
|
-
| ---------------------- | ----------------------------------------------- |
|
|
2289
|
-
| `↑` / `↓` | Move cursor |
|
|
2290
|
-
| `→` | Expand branch / move cursor into first child |
|
|
2291
|
-
| `←` | Collapse branch / move cursor to parent |
|
|
2292
|
-
| `Shift+↑` / `Shift+↓` | Move focused node up / down within its siblings |
|
|
2293
|
-
| `Shift+→` / `Shift+←` | Indent / outdent focused node |
|
|
2294
|
-
| `Enter` / `Space` | Toggle selection |
|
|
2295
|
-
| `F2` | Rename focused node |
|
|
2296
|
-
| `Delete` / `Backspace` | Delete focused node and its subtree |
|
|
2297
|
-
| `Home` / `End` | Jump to first / last visible node |
|
|
2298
|
-
| `Escape` | Clear selection |
|
|
2299
|
-
|
|
2300
|
-
All nodes default to `mingcute:file-line`. Supply an `icon` snippet to differentiate node types by shape.
|
|
2301
|
-
|
|
2302
|
-
---
|
|
176
|
+
Switching documents or views inside one window is not a navigation: it switches at once.
|
|
2303
177
|
|
|
2304
|
-
|
|
178
|
+
## Text
|
|
2305
179
|
|
|
2306
|
-
|
|
180
|
+
Components hold no interface text of their own: every label, placeholder and accessible name is a
|
|
181
|
+
prop (`closeLabel`, `labels`, `emptyText`…) or a snippet, so apps pass their i18n messages; the
|
|
182
|
+
texts a component can't do without are required props. Numbers and dates arrive formatted
|
|
183
|
+
(`PlayerCount`'s `count`, `CircularProgress`'s `valueText`, a notification's `time`).
|
|
2307
184
|
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
{#snippet content(card)}
|
|
2323
|
-
<p>Content for {card.title}</p>
|
|
2324
|
-
{/snippet}
|
|
2325
|
-
</InspectorPanel>
|
|
2326
|
-
```
|
|
2327
|
-
|
|
2328
|
-
| Prop | Type | Default | Description |
|
|
2329
|
-
| ------------------ | ---------------------------------- | ------- | ------------------------------------------ |
|
|
2330
|
-
| `cards` | `InspectorCard[]` | `[]` | List of cards (bindable) |
|
|
2331
|
-
| `expandedIds` | `string[]` | `[]` | IDs of currently expanded cards (bindable) |
|
|
2332
|
-
| `content` | `Snippet<[InspectorCard]>` | — | Snippet rendered inside each card body |
|
|
2333
|
-
| `onCardsChange` | `(cards: InspectorCard[]) => void` | — | Fired when card order changes |
|
|
2334
|
-
| `onExpandedChange` | `(ids: string[]) => void` | — | Fired when expanded state changes |
|
|
2335
|
-
| `class` | `string` | `''` | Extra classes on the root element |
|
|
185
|
+
Ark UI components whose parts Ark names in English take Ark's `translations` prop, so the app
|
|
186
|
+
gives those names translated. It is required by `Calendar`, `Carousel`, `Clipboard`, `Combobox`,
|
|
187
|
+
`DatePicker`, `Editable`, `ImageCropper`, `NumberInput` (`incrementLabel`, `decrementLabel`,
|
|
188
|
+
`roleDescription`), `Pagination` (`rootLabel`, `prevTriggerLabel`, `nextTriggerLabel`,
|
|
189
|
+
`itemLabel`), `PinInput` (`inputLabel`) and `RatingGroup` (`ratingValueText`, `roleDescription`),
|
|
190
|
+
each with the keys it shows; `Calendar`, `Carousel` and `DatePicker` add the roles their parts are
|
|
191
|
+
announced as (`tableRoleDescription`; `roleDescription` and `slideRoleDescription`;
|
|
192
|
+
`contentRoleDescription` and `tableRoleDescription`). The other Ark components take props of their own instead: `Tour`'s
|
|
193
|
+
`closeLabel` and `progressText`, `Marquee`'s `label` and `roleDescription`, `SignaturePad`'s
|
|
194
|
+
`label`, `roleDescription` and `clearLabel`, `FileUpload`'s `prompt` and `hint`, `VirtualTree`'s `label` and `rename.label`, `FileTree`'s `label`, `HierarchyView`'s `label` and `renameLabel` and the
|
|
195
|
+
`closeLabel` of `Toaster`, `ToastItem` and `FloatingPanel` replace the names Ark gives in English,
|
|
196
|
+
and `ColorPicker`'s `labels` (each control, the area's role and the values its area and sliders
|
|
197
|
+
announce) and `Timer`'s `labels` (its buttons) name the controls Ark leaves unnamed.
|
|
198
|
+
`AngleSlider`'s and `CircularSlider`'s `valueText` format the values they show and announce.
|
|
2336
199
|
|
|
2337
|
-
`
|
|
200
|
+
`HorizonLayout` takes horizon-layout's `translations` (`resizePane`, `floatingPanel`, `tabList`)
|
|
201
|
+
required and complete, where horizon-layout itself would fill in English for a key left out.
|
|
2338
202
|
|
|
2339
|
-
|
|
203
|
+
## Text selection
|
|
2340
204
|
|
|
2341
|
-
|
|
205
|
+
Like a desktop app's, interface text isn't selectable: the base styles set `user-select: none` on
|
|
206
|
+
`<body>`. The base styles turn selection back on in what the user types (`<input>`, `<textarea>`,
|
|
207
|
+
editable `contenteditable` elements, so `Input`, `Textarea`, `Editable`, `PinInput`,
|
|
208
|
+
`NumberInput` and the other fields), and the components that show text to read or to copy turn it
|
|
209
|
+
on with `select-text`: `Prose`, the value of `Clipboard` and `ColorPicker`'s list of values.
|
|
2342
210
|
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
211
|
+
Anywhere else that needs it, opt in with Tailwind's `select-text` class on the element:
|
|
212
|
+
documentation and other reading text, code (a Monaco editor's host element, a code block), and
|
|
213
|
+
values a user copies (an id, a link to share). Elements a pointer drags (`Slider`, `ScrollArea`'s
|
|
214
|
+
scroll bar, the `Splitter` handles, the `ImageCropper` image, the layout's tabs) keep
|
|
215
|
+
`select-none`, so a drag never selects text even inside a selectable region.
|
|
2346
216
|
|
|
2347
217
|
```svelte
|
|
2348
|
-
<
|
|
2349
|
-
import HorizonLayout from '$lib/components/horizon-layout/HorizonLayout.svelte';
|
|
2350
|
-
import type { LayoutConfig, Id, View } from 'horizon-layout';
|
|
2351
|
-
import { SvelteMap } from 'svelte/reactivity';
|
|
2352
|
-
|
|
2353
|
-
let config: LayoutConfig = $state({
|
|
2354
|
-
root: {/* ... */}
|
|
2355
|
-
});
|
|
2356
|
-
|
|
2357
|
-
const views = new SvelteMap<Id, View>([['panel-a', { title: 'Panel A', snippet: mySnippetA }]]);
|
|
2358
|
-
</script>
|
|
2359
|
-
|
|
2360
|
-
<HorizonLayout bind:config {views} />
|
|
218
|
+
<pre class="select-text"><code>{source}</code></pre>
|
|
2361
219
|
```
|
|
2362
220
|
|
|
2363
|
-
|
|
2364
|
-
| ------------------ | ---------------------------------------- | ------- |
|
|
2365
|
-
| `config` | `LayoutConfig` (bindable) **(required)** | — |
|
|
2366
|
-
| `views` | `SvelteMap<Id, View>` **(required)** | — |
|
|
2367
|
-
| `tabgroupControls` | `View[]` | — |
|
|
2368
|
-
| `showSplitRatio` | `boolean` | `false` |
|
|
2369
|
-
|
|
2370
|
-
---
|
|
221
|
+
## Icons
|
|
2371
222
|
|
|
2372
|
-
|
|
223
|
+
Icons are the [Mingcute](https://www.mingcute.com) set, through
|
|
224
|
+
[unplugin-icons](https://github.com/unplugin/unplugin-icons), and nothing else: no inline `<svg>`
|
|
225
|
+
markup in a component. Any other graphic (a logo, an illustration, example art) is a file (an
|
|
226
|
+
`.svg` or an image) referenced by its path. The library's components follow the same rule, and
|
|
227
|
+
import their icons as `~icons/mingcute/<name>`, which the app's build resolves. An app sets it up
|
|
228
|
+
once:
|
|
2373
229
|
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
The global theme store. Import it to read or change the active theme:
|
|
2377
|
-
|
|
2378
|
-
```ts
|
|
2379
|
-
import { theme } from 'horizon-design';
|
|
2380
|
-
|
|
2381
|
-
theme.mode; // 'system' | 'dark' | 'light' — the stored preference
|
|
2382
|
-
theme.resolved; // 'dark' | 'light' — the effective theme (resolves 'system' against OS preference)
|
|
2383
|
-
theme.set('dark');
|
|
230
|
+
```sh
|
|
231
|
+
pnpm add -D unplugin-icons @iconify-json/mingcute
|
|
2384
232
|
```
|
|
2385
233
|
|
|
2386
|
-
`theme.onChange(callback)` fires whenever the effective theme changes — either because `theme.set()` was called or because the OS preference changed while mode is `'system'`. Returns an unsubscribe function.
|
|
2387
|
-
|
|
2388
234
|
```ts
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
235
|
+
// vite.config.ts
|
|
236
|
+
import { sveltekit } from '@sveltejs/kit/vite';
|
|
237
|
+
import tailwindcss from '@tailwindcss/vite';
|
|
238
|
+
import Icons from 'unplugin-icons/vite';
|
|
239
|
+
import { defineConfig } from 'vite';
|
|
240
|
+
|
|
241
|
+
export default defineConfig({
|
|
242
|
+
plugins: [tailwindcss(), sveltekit(), Icons({ compiler: 'svelte' })]
|
|
2392
243
|
});
|
|
2393
|
-
|
|
2394
|
-
// later:
|
|
2395
|
-
off();
|
|
2396
244
|
```
|
|
2397
245
|
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
---
|
|
2407
|
-
|
|
2408
|
-
### `cn(...inputs)`
|
|
2409
|
-
|
|
2410
|
-
Merges Tailwind class names (clsx + tailwind-merge).
|
|
2411
|
-
|
|
2412
|
-
```ts
|
|
2413
|
-
import { cn } from 'horizon-design';
|
|
2414
|
-
|
|
2415
|
-
const cls = cn('px-4 py-2', { 'bg-primary': isActive });
|
|
246
|
+
```jsonc
|
|
247
|
+
// tsconfig.json: the types of the `~icons/*` imports. A SvelteKit app keeps `$app/types`, which
|
|
248
|
+
// its `$app/tsconfig` sets and `types` replaces.
|
|
249
|
+
{
|
|
250
|
+
"extends": "$app/tsconfig",
|
|
251
|
+
"compilerOptions": { "types": ["$app/types", "unplugin-icons/types/svelte"] }
|
|
252
|
+
}
|
|
2416
253
|
```
|
|
2417
254
|
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
### `createMonacoTheme()`
|
|
255
|
+
Then import an icon as a component; it takes the `class` of its size and colour and inherits
|
|
256
|
+
`currentColor`:
|
|
2421
257
|
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
import * as monaco from 'monaco-editor';
|
|
258
|
+
```svelte
|
|
259
|
+
<script lang="ts">
|
|
260
|
+
import SearchIcon from '~icons/mingcute/search-line';
|
|
261
|
+
</script>
|
|
2427
262
|
|
|
2428
|
-
|
|
2429
|
-
monaco.editor.setTheme('horizon');
|
|
263
|
+
<SearchIcon class="size-4 text-muted" aria-hidden="true" />
|
|
2430
264
|
```
|
|
2431
265
|
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
```ts
|
|
2435
|
-
import { theme, createMonacoTheme } from 'horizon-design';
|
|
2436
|
-
import * as monaco from 'monaco-editor';
|
|
266
|
+
Browse the set's names on [mingcute.com](https://www.mingcute.com) (`-line` and `-fill`
|
|
267
|
+
variants).
|
|
2437
268
|
|
|
2438
|
-
|
|
2439
|
-
void theme.mode;
|
|
2440
|
-
monaco.editor.defineTheme('horizon', createMonacoTheme());
|
|
2441
|
-
monaco.editor.setTheme('horizon');
|
|
2442
|
-
});
|
|
2443
|
-
```
|
|
269
|
+
## Components
|
|
2444
270
|
|
|
2445
|
-
|
|
271
|
+
### Actions
|
|
272
|
+
|
|
273
|
+
| Component | What it is |
|
|
274
|
+
| ------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
275
|
+
| [`ActionBar`](https://play-horizon.github.io/horizon-design/action-bar) | A floating bar of actions at the bottom of the window, for the current selection; `ActionBarSeparator` divides its groups. |
|
|
276
|
+
| [`Button`](https://play-horizon.github.io/horizon-design/button) | A button: `variant` sets its look (`art` for an action over game art, such as a game page's Back) and `size` its height (`icon-*` for a square icon-only button, which needs an `aria-label`; `IconButton` adds the tooltip); `loading` shows a spinner and disables it. `buttonVariants` gives its classes to other elements, such as an overlay's trigger. |
|
|
277
|
+
| [`ButtonGroup`](https://play-horizon.github.io/horizon-design/button-group) | Groups buttons into one connected row or column (`orientation`). |
|
|
278
|
+
| [`Clipboard`](https://play-horizon.github.io/horizon-design/clipboard) | Copies `value` to the clipboard, showing it, selectable, with a copy button that confirms the copy (Ark Clipboard); Ark `translations` (`triggerLabel`), required, name the button, as its accessible name and its tooltip. |
|
|
279
|
+
| [`IconButton`](https://play-horizon.github.io/horizon-design/icon-button) | An icon-only button with a tooltip that names it: `label`, required, is both the tooltip's text and the button's accessible name; `variant` as `Button`'s, `size` its square size. Every icon-only button should be one (or carry a `Tooltip` with the same name). |
|
|
280
|
+
| [`SegmentGroup`](https://play-horizon.github.io/horizon-design/segment-group) | A segmented control (Ark SegmentGroup): the `default` variant raises the chosen segment on a sunken track, such as a view switch; `underline` draws a bar under the chosen label, for the views of a page (the app renders the view of `value`). The segment or bar slides to the choice; `value` binds it, an item can be `disabled`, and an `aria-label` names the group. |
|
|
281
|
+
| [`Swap`](https://play-horizon.github.io/horizon-design/swap) | Swaps between two contents with an animation, such as a play and a pause icon (Ark Swap): `on` while `swap` is true, `off` while it is false. |
|
|
282
|
+
| [`Toggle`](https://play-horizon.github.io/horizon-design/toggle) | A button that stays pressed or not (Ark Toggle); `pressed` binds its state. An icon-only toggle takes an `aria-label` and a `Tooltip` with the same text, or is a `ToggleTooltip`. |
|
|
283
|
+
| [`ToggleGroup`](https://play-horizon.github.io/horizon-design/toggle-group) | A row of toggles of which one or several stay pressed (Ark ToggleGroup): with one choice, a raised highlight slides to the pressed item; with `multiple`, each pressed item is raised. `value` binds the pressed items, an `aria-label` names the group, and an icon-only item takes a `label`, also its tooltip. |
|
|
284
|
+
| [`ToggleTooltip`](https://play-horizon.github.io/horizon-design/toggle-tooltip) | An icon toggle, such as a toolbar's Bold, with a tooltip that names it: `label`, required, is both the tooltip's text and the toggle's accessible name, and `pressed` binds its state. A press shrinks it for a moment, and the pressed state is tinted primary, unlike a hover. |
|
|
285
|
+
| [`VoteButtons`](https://play-horizon.github.io/horizon-design/vote-buttons) | Up and down votes, side by side on a segmented track, each with its count (`upCount`, `downCount`, formatted); `vote` binds the account's vote, and `labels` names the group and the buttons. |
|
|
286
|
+
|
|
287
|
+
### Forms
|
|
288
|
+
|
|
289
|
+
| Component | What it is |
|
|
290
|
+
| --------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
291
|
+
| [`AngleSlider`](https://play-horizon.github.io/horizon-design/angle-slider) | A circular control that picks an angle in degrees from 0 to 359, 0 at the top and clockwise (Ark AngleSlider); `label`, required, is its accessible name, `valueText`, required, formats the angle shown and announced (such as `45°`), and `value` binds the angle. |
|
|
292
|
+
| [`Calendar`](https://play-horizon.github.io/horizon-design/calendar) | A month calendar to pick a date or a range, inline (Ark DatePicker without its field); Ark `translations`, required, name its days and controls (the arrows show theirs in a tooltip) and the roles of its tables. The day view always shows six weeks, and the month and year views keep its size. |
|
|
293
|
+
| [`Checkbox`](https://play-horizon.github.io/horizon-design/checkbox) | A checkbox with its label (`label` or `children`, Ark Checkbox); `checked` binds true, false or indeterminate (a bar as thick as the check). |
|
|
294
|
+
| [`CircularSlider`](https://play-horizon.github.io/horizon-design/circular-slider) | A circular control that picks a value from 0 to 359 along a ring that fills clockwise from the top, with a round start, up to its thumb (Ark AngleSlider), with the value in its centre; `label`, required, is its accessible name, `valueText`, required, formats the value shown and announced (such as `120°`), and `value` binds the value. |
|
|
295
|
+
| [`ColorPicker`](https://play-horizon.github.io/horizon-design/color-picker) | Picks a colour: a hex field and a swatch trigger opening an area, hue and alpha sliders and fields (Ark ColorPicker). The hex fields show 8 digits (`FF` alpha when opaque) and take 3, 4, 6 or 8; `formats` (`hexa`, `rgba`, `hsla`, `hsba`; the first three by default) writes the colour under the controls; `swatches`, preset colours on one line, none by default. `value` binds the colour (from `parseColor`), and `labels`, required, names every control (the trigger also in its tooltip), the list of formats, the area's role and the values the area and sliders announce. |
|
|
296
|
+
| [`Combobox`](https://play-horizon.github.io/horizon-design/combobox) | A text field that filters a list of options to choose from (Ark Combobox); `label`, required, names the field, `emptyText`, required, shows when none matches, and Ark `translations` (`triggerLabel`), required, name its open button (also its tooltip); `openOnClick` opens the options as soon as the field is pressed, ready for typing; Ark announces the options found to screen readers only when `translations` gives the messages (`resultsCount`, `noResults`, `loading`). |
|
|
297
|
+
| [`DatePicker`](https://play-horizon.github.io/horizon-design/date-picker) | A date field with a calendar popover (Ark DatePicker); `label`, required, names the field, `value` binds the chosen dates, `placeholder` shows while none is chosen, and Ark `translations`, required, name its controls (the icon buttons show theirs in a tooltip) and the roles of its popover and tables; its calendar is `Calendar`'s, and `openOnClick` opens it as soon as the field is pressed. |
|
|
298
|
+
| [`Editable`](https://play-horizon.github.io/horizon-design/editable) | Text that turns into a field when edited, then back (Ark Editable); `value` binds the text, and Ark `translations` (`input`, `edit`), required, name the field (when there is no `label`, which names it otherwise) and the text. |
|
|
299
|
+
| [`FacetedSearch`](https://play-horizon.github.io/horizon-design/faceted-search) | Search with facets, for Discover and the store: a search field and an optional sort at the top, the facets in a column at the side (each a group of checkboxes, with optional counts), and the results, which the app renders in `children`. `query`, `selected` and `sort` bind, `onChange` reports each change, and `searchLabel`, `sortLabel` and `clearLabel` are required. |
|
|
300
|
+
| [`Field`](https://play-horizon.github.io/horizon-design/field) | A form field: its label, the control, a help text and an error message (`label`, `helperText`, `errorText`), wired together for assistive technology (Ark Field). |
|
|
301
|
+
| [`FileUpload`](https://play-horizon.github.io/horizon-design/file-upload) | A dropzone that takes files by drop or by browsing (Ark FileUpload); `prompt`, required, is its text and `hint` a second line, which together name it; a `disabled` dropzone is dimmed. |
|
|
302
|
+
| [`Hint`](https://play-horizon.github.io/horizon-design/hint) | A short help text under a field, which the field's `aria-describedby` points at through the hint's `id`; inside a `Field`, its `helperText` takes its place. |
|
|
303
|
+
| [`ImageCropper`](https://play-horizon.github.io/horizon-design/image-cropper) | Crops an image (`src`) to a frame that can be moved and resized (Ark ImageCropper), for avatars and thumbnails; Ark `translations`, all required, name and describe it for assistive technology. |
|
|
304
|
+
| [`Input`](https://play-horizon.github.io/horizon-design/input) | A text input on a sunken field, with optional icons or controls at its start and end (`start`, `end`); `value` binds its text and `invalid` marks it invalid. Inside a `Field`, it takes the field's label, description and error. |
|
|
305
|
+
| [`InputGroup`](https://play-horizon.github.io/horizon-design/input-group) | An `Input` with `InputAddon`s (text or an icon, such as `https://`) attached to its sides, joined into one field. |
|
|
306
|
+
| [`Listbox`](https://play-horizon.github.io/horizon-design/listbox) | A list of options to choose one or several from (Ark Listbox); `label`, required, names it, and `value` binds the chosen options. An option with `disabled` can't be chosen, and Ark's horizontal `orientation` lays the options out in a row. |
|
|
307
|
+
| [`NativeSelect`](https://play-horizon.github.io/horizon-design/native-select) | The browser's own select, styled like the other fields; `value` binds the chosen option, a `<label for>` or an `aria-label` names it, and `aria-invalid` turns its border danger. |
|
|
308
|
+
| [`NumberInput`](https://play-horizon.github.io/horizon-design/number-input) | A number field with increment and decrement buttons (Ark NumberInput); `value` binds the field's text, and `translations` (`incrementLabel`, `decrementLabel`, `roleDescription`), required, name the buttons, shown as their tooltips too, and the field's role. Ark's `invalid` turns the border danger. |
|
|
309
|
+
| [`PinInput`](https://play-horizon.github.io/horizon-design/pin-input) | A row of `count` one-character fields for a code, such as the sign-up code (Ark PinInput); `value` binds the characters, Ark `translations.inputLabel` names each field, and Ark's `invalid` turns the borders danger. |
|
|
310
|
+
| [`RadioGroup`](https://play-horizon.github.io/horizon-design/radio-group) | A group of radio buttons to choose one option (Ark RadioGroup), from `items` or Ark's `RadioGroup.Item` parts; `value` binds the chosen option, and `label` or an `aria-label` names the group. Ark's `orientation="horizontal"` lays the options out in a row, and `invalid` turns the circles danger. |
|
|
311
|
+
| [`RatingGroup`](https://play-horizon.github.io/horizon-design/rating-group) | A row of `count` stars to give a rating (Ark RatingGroup); `value` binds the rating, `label`, required, names the group, and `translations` (`ratingValueText`, `roleDescription`), required, name each star and its role. With Ark's `allowHalf`, a half rating fills half a star. |
|
|
312
|
+
| [`Select`](https://play-horizon.github.io/horizon-design/select) | A select field with a dropdown list of options (Ark Select); `value` binds the chosen values, `label`, required, names the field, and `placeholder` shows while none is chosen. Ark's `invalid` turns its border danger. |
|
|
313
|
+
| [`SignaturePad`](https://play-horizon.github.io/horizon-design/signature-pad) | A pad to draw a signature or a sketch (Ark SignaturePad), with a clear button once something is drawn; `label`, `roleDescription` and `clearLabel`, required, name the pad, its role and the button. |
|
|
314
|
+
| [`Slider`](https://play-horizon.github.io/horizon-design/slider) | A slider to pick a value, or a range with one thumb per value (Ark Slider); `value` binds the values, `label` (or Ark's `aria-label`) names the thumbs, and Ark's `orientation="vertical"` stands it up. |
|
|
315
|
+
| [`Switch`](https://play-horizon.github.io/horizon-design/switch) | An on/off switch with its label (`label` or `children`, Ark Switch); `checked` binds its state. `checkedContent` and `uncheckedContent` put an icon on the thumb, sized and centred by the switch; the thumb travels with the same gap at both ends at every `size`. |
|
|
316
|
+
| [`TagPicker`](https://play-horizon.github.io/horizon-design/tag-picker) | Chooses tags from a fixed list (the platform's tag lists are never free text): every tag is a toggle chip, the chosen ones shown by their colour only. `value` binds the chosen ids, in the order chosen, `max` caps how many, and `label`, required, names the group. |
|
|
317
|
+
| [`Textarea`](https://play-horizon.github.io/horizon-design/textarea) | A multi-line text field on a sunken field; `value` binds its text, and `invalid` (or an invalid `Field`) turns it danger. Inside a `Field`, it takes the field's label, description and error. |
|
|
318
|
+
|
|
319
|
+
### Display
|
|
320
|
+
|
|
321
|
+
| Component | What it is |
|
|
322
|
+
| ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
323
|
+
| [`Announcement`](https://play-horizon.github.io/horizon-design/announcement) | A small pill that announces something new, with an optional icon and a tag. |
|
|
324
|
+
| [`AspectRatio`](https://play-horizon.github.io/horizon-design/aspect-ratio) | Keeps its content at a fixed width-to-height ratio (`ratio`, such as `16 / 9`). |
|
|
325
|
+
| [`AssetCard`](https://play-horizon.github.io/horizon-design/asset-card) | An asset in a list (a store listing, an entry of My assets or of a game's assets): its square thumbnail, its `name`, its `kind`, a `meta` line (votes, the rig profile) and `actions` (Add to my assets). It is a link with `href`, a button with `onclick`, a toggle pressed while `selected` with `selectable` (for pickers), and a plain display with none of them. `name` and `kind`, translated, are required. |
|
|
326
|
+
| [`Avatar`](https://play-horizon.github.io/horizon-design/avatar) | A person's avatar: their image, or their initials (`fallback`) on a coloured disc while it loads or when there is none, the same size either way. `alt`, the person's name, names it; without it, it is decorative. |
|
|
327
|
+
| [`AvatarStack`](https://play-horizon.github.io/horizon-design/avatar-stack) | A row of overlapping avatars, such as who is editing a game now: up to `max` people, then a chip whose text `overflowText` gives; `label`, required, names the group. |
|
|
328
|
+
| [`Badge`](https://play-horizon.github.io/horizon-design/badge) | A small label: a status, a count, a tag or a restriction badge; `variant` sets its colour and `size` its height. |
|
|
329
|
+
| [`Card`](https://play-horizon.github.io/horizon-design/card) | A surface that groups related content: an optional title and description, the content, and an optional footer. The title is a heading of `headingLevel` (3 by default, 2 right under the page's title). |
|
|
330
|
+
| [`Carousel`](https://play-horizon.github.io/horizon-design/carousel) | A horizontal slideshow of `slides` with previous and next controls and indicators (Ark Carousel); `label`, required, names it, and Ark `translations`, required, name the slides and the controls and the roles of the carousel and its slides. The arrows and dots show their names in tooltips. |
|
|
331
|
+
| [`DataList`](https://play-horizon.github.io/horizon-design/data-list) | A list of label and value pairs (`items`), such as the details of a game. |
|
|
332
|
+
| [`Frame`](https://play-horizon.github.io/horizon-design/frame) | A window-like frame around content, such as a code sample or a screenshot; with a `title`, a title bar shows it, with three window controls at its end. |
|
|
333
|
+
| [`GameCard`](https://play-horizon.github.io/horizon-design/game-card) | A game in a list: its 16:9 thumbnail and its name, the card's link (`href`) or button (`onclick`); the `feature` variant is the larger Continue playing card, with the icon and an `action` (Play). |
|
|
334
|
+
| [`GameHero`](https://play-horizon.github.io/horizon-design/game-hero) | The top of a game page: the game's 16:9 thumbnail as a banner that fades into the page, with the square icon, the name, a `byline` (the creator) and the game's `tags` over its bottom, and a `top` slot at its top left (Back, a `Button` of the `art` variant). |
|
|
335
|
+
| [`Item`](https://play-horizon.github.io/horizon-design/item) | A row of a list, laying out what it is given (media, a title, a description, actions) in a line: a link with `href`, a button with `onclick` (its content then holds no other control), a plain row with neither. |
|
|
336
|
+
| [`Kbd`](https://play-horizon.github.io/horizon-design/kbd) | A keyboard key or shortcut, such as `Ctrl K`, drawn as a raised key. With `command` (its names, translated), the platform's command key: ⌘ on Apple's platforms, Ctrl elsewhere, from the user agent once mounted, without changing size. `isApplePlatform` tells the app which key its shortcuts use. |
|
|
337
|
+
| [`Marquee`](https://play-horizon.github.io/horizon-design/marquee) | Content (`MarqueeItem`s) that scrolls continuously, pausing while hovered or focused and still under reduced motion (Ark Marquee); `label` and `roleDescription`, required, name the region and its role. |
|
|
338
|
+
| [`PlayerCount`](https://play-horizon.github.io/horizon-design/player-count) | How many people are playing a game now: a live dot and the count. `count` (formatted) and `label` (`playing now`) are required; `variant` is `inline` or an `overlay` pill on game art. |
|
|
339
|
+
| [`Prose`](https://play-horizon.github.io/horizon-design/prose) | Typography for long-form text, such as rendered Markdown; its text is selectable. |
|
|
340
|
+
| [`QrCode`](https://play-horizon.github.io/horizon-design/qr-code) | A QR code of `value` on the fixed `paper` background, so scanners read it in both themes (Ark QrCode); `label`, required, names the image. |
|
|
341
|
+
| [`ScrollArea`](https://play-horizon.github.io/horizon-design/scroll-area) | A scrolling region with a thin, themed vertical scrollbar, shown only while the content overflows and kept 8 px from the region's top and bottom (Ark ScrollArea); the region needs a height and a `label`, required, which names it, and takes the keyboard focus while it scrolls, so the arrow keys scroll it. |
|
|
342
|
+
| [`Separator`](https://play-horizon.github.io/horizon-design/separator) | A horizontal or vertical divider, hidden from assistive technology unless `decorative` is false. |
|
|
343
|
+
| [`Status`](https://play-horizon.github.io/horizon-design/status) | A small dot that shows a status: online (or running), away, busy (or failing) or offline, with a soft ring in its colour; `label` names it, and without it the dot is decorative. |
|
|
344
|
+
| [`Table`](https://play-horizon.github.io/horizon-design/table) | A data table from `columns` and `rows`: a column shows each row's field named by its `key`, or renders its `cell` snippet with the row; `rowKey`, required, gives each row's stable key. |
|
|
345
|
+
| [`ThemeSwitch`](https://play-horizon.github.io/horizon-design/theme-switch) | The theme switch: three icon buttons (system, dark, light) on a sunken pill, which call `theme.set`, with a raised highlight that slides to the chosen one; `labels`, required, names the group and each mode, also in each button's tooltip (`tooltipSide` places them). |
|
|
346
|
+
| [`ThumbCard`](https://play-horizon.github.io/horizon-design/thumb-card) | A card showing a preview (its content) with a `label` under it: a link with `href`, a button with `onclick`, either covering the whole card; a plain display with neither. |
|
|
347
|
+
| [`Timer`](https://play-horizon.github.io/horizon-design/timer) | A countdown or a stopwatch (Ark Timer), with the days before the hours from one day on (`01:02:00:00`), and start, pause, resume and reset buttons that `labels`, required, names (also in their tooltips). It starts paused unless `autoStart`. |
|
|
348
|
+
|
|
349
|
+
### Feedback
|
|
350
|
+
|
|
351
|
+
| Component | What it is |
|
|
352
|
+
| ----------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
353
|
+
| [`Alert`](https://play-horizon.github.io/horizon-design/alert) | An inline message (a banner): a neutral, info, success, warning or error tint, an icon, a title and a description. |
|
|
354
|
+
| [`CircularProgress`](https://play-horizon.github.io/horizon-design/circular-progress) | A ring that fills with progress (`value` out of `max`), with round ends and an optional value in its centre; `label`, required, names the progress bar, and `valueText` (formatted, such as `72%`) is shown and announced. |
|
|
355
|
+
| [`NotificationCenter`](https://play-horizon.github.io/horizon-design/notification-center) | The notification centre: a heading with "Mark all as read", then the account's notifications, newest first, each with its image (a game's icon), its text, its time and, while unread, a dot. `heading`, `emptyText`, `markAllLabel` and `unreadLabel` are required, and `actions` renders a notification's buttons. |
|
|
356
|
+
| [`Progress`](https://play-horizon.github.io/horizon-design/progress) | A horizontal progress bar of `value`, required, with an optional label and value (Ark Progress); `label` names the bar. |
|
|
357
|
+
| [`Skeleton`](https://play-horizon.github.io/horizon-design/skeleton) | A placeholder block that pulses while content loads (pages show skeletons, not spinners). |
|
|
358
|
+
| [`Spinner`](https://play-horizon.github.io/horizon-design/spinner) | A spinning loading indicator, for an action in progress inside a control (a button); `label` shows beside it and is announced, an `aria-label` is only announced, and with neither it is decorative. |
|
|
359
|
+
| [`Toaster`](https://play-horizon.github.io/horizon-design/toast) | Shows the toasts of a toaster made with `createToaster`, stacked at the window's edge, in a live region; `label` and `closeLabel`, required, name the region and each toast's close button, whose tooltip says the same. |
|
|
360
|
+
| [`ToastItem`](https://play-horizon.github.io/horizon-design/toast) | One toast message: an info, success, warning or error tint (or, while loading, a neutral one with a spinner), a title, a description and a close button named by `closeLabel`, required, which is also its tooltip. |
|
|
361
|
+
|
|
362
|
+
### Navigation
|
|
363
|
+
|
|
364
|
+
| Component | What it is |
|
|
365
|
+
| ------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
366
|
+
| [`Accordion`](https://play-horizon.github.io/horizon-design/accordion) | A vertical stack of collapsible sections (Ark Accordion); `AccordionItem` is one section, with its `value` and its `trigger`, and `value` binds the open sections. |
|
|
367
|
+
| [`BottomNavigation`](https://play-horizon.github.io/horizon-design/bottom-navigation) | A bar of navigation `items` fixed to the bottom of a narrow screen; `label`, required, names it among the page's landmarks. |
|
|
368
|
+
| [`Breadcrumb`](https://play-horizon.github.io/horizon-design/breadcrumb) | The trail of pages leading to the current one, each a link but the last; `label`, required, names the trail. |
|
|
369
|
+
| [`Collapsible`](https://play-horizon.github.io/horizon-design/collapsible) | Content that a trigger shows and hides (Ark Collapsible); `open` binds whether it shows, and `disabled` turns the trigger off. |
|
|
370
|
+
| [`CommandPalette`](https://play-horizon.github.io/horizon-design/command-palette) | The command palette: a dialog at the top of the window with a search field and every command that matches what is typed (each word whole, ignoring case and accents, through Ark's `useFilter`), ranked by [fuzzysort](https://github.com/farzher/fuzzysort), label matches first, each with its shortcut. The field and the virtualised list are an Ark combobox: Up, Down, Home and End move through the commands that can run, Enter runs one, Escape closes. `open` binds, `onRun` runs the chosen command once the palette has finished closing, so the command can move the focus, and `label` and `emptyText` are required. |
|
|
371
|
+
| [`LinkOverlay`](https://play-horizon.github.io/horizon-design/link-overlay) | The link of a `LinkBox`, stretched over the whole box so a click anywhere follows it, while the box's other links and controls stay usable. |
|
|
372
|
+
| [`Pagination`](https://play-horizon.github.io/horizon-design/pagination) | Page links with previous and next for `count` items, required (Ark Pagination); `page` binds the current page, and Ark `translations` name its controls; the built-in arrows show their names as tooltips. `children` replaces the built-in controls with the parts `PaginationPrevTrigger` and `PaginationNextTrigger` (an icon-only one takes a `label`, its tooltip), `PaginationItem`, `PaginationEllipsis` and `PaginationContext`, which reads its state. |
|
|
373
|
+
| [`Sidebar`](https://play-horizon.github.io/horizon-design/sidebar) | An app's navigation sidebar: a sunken column with an optional header (the brand), the navigation itself (`SidebarSection` and `SidebarItem`, named by `label`) and an optional footer (the account); `collapsed` narrows it to its icons, and each item then shows its text as a tooltip. |
|
|
374
|
+
| [`SkipNav`](https://play-horizon.github.io/horizon-design/skip-nav) | A link, shown on keyboard focus, that skips to the page's main content. |
|
|
375
|
+
| [`Steps`](https://play-horizon.github.io/horizon-design/steps) | A multi-step flow (Ark Steps): the `steps` (each an `id`, a `title` and its `content`), the current step's content, and back and next buttons named by `prevLabel` and `nextLabel`, required; `step` binds the current step. |
|
|
376
|
+
|
|
377
|
+
### Overlays
|
|
378
|
+
|
|
379
|
+
| Component | What it is |
|
|
380
|
+
| ------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
381
|
+
| [`AlertDialog`](https://play-horizon.github.io/horizon-design/alert-dialog) | A confirmation dialog for a destructive or irreversible action: a title, a description, Cancel and the confirming action, named by `cancelLabel` and `actionLabel`, required. Cancel takes the focus; the confirming button calls `onAction`, required, and closes it; `open` binds. |
|
|
382
|
+
| [`ContextMenu`](https://play-horizon.github.io/horizon-design/context-menu) | A menu opened by a right click or a long press on its content (Ark Menu): its `groups` (each with an `id`, an optional title that names it, and its `items` to choose, each with an `id`), a line between groups, and Ark's `onSelect` reports the chosen item's `id`; `frosted` for a translucent surface. |
|
|
383
|
+
| [`Dialog`](https://play-horizon.github.io/horizon-design/dialog) | A modal dialog (Ark Dialog): a title, a description, the content and a footer, on the raised surface over a scrim; `closeLabel`, required, names its close button and is its tooltip, `open` binds, and `DialogClose` closes it from inside (without children, a close icon whose `label`, required, is its name and tooltip); `frosted` for a translucent surface. |
|
|
384
|
+
| [`Drawer`](https://play-horizon.github.io/horizon-design/drawer) | A panel that slides in from the end edge of the window and is swiped back toward it to dismiss it (Ark Drawer), with a title, content and footer; `title`, required, names it, `closeLabel`, required, names its close button and is its tooltip, `open` binds, and `DrawerClose` closes it from inside. |
|
|
385
|
+
| [`FloatingPanel`](https://play-horizon.github.io/horizon-design/floating-panel) | A panel that floats over the window, dragged by its header and resized by its edges and corners (Ark FloatingPanel); `title`, required, names it, `closeLabel`, required, names its close button and is its tooltip, and `open` binds. |
|
|
386
|
+
| [`HoverCard`](https://play-horizon.github.io/horizon-design/hover-card) | A card that shows on hover or focus of its trigger (Ark HoverCard), such as the docs card of a function; `frosted` for a translucent surface. |
|
|
387
|
+
| [`Menu`](https://play-horizon.github.io/horizon-design/menu) | A dropdown menu opened by its trigger (Ark Menu): `MenuItem`s (each a `value`, which Ark's `onSelect` reports), `MenuGroup`s named by a `MenuGroupLabel`, and `MenuSeparator`s; `open` binds, a trigger that shows only an icon takes a `triggerLabel` (its accessible name and tooltip), and `frosted` gives a translucent surface. |
|
|
388
|
+
| [`Popover`](https://play-horizon.github.io/horizon-design/popover) | A non-modal panel anchored to its trigger (Ark Popover), with a title, content and footer; `open` binds, a trigger that shows only an icon takes a `triggerLabel` (its accessible name and tooltip), and `PopoverClose`, named by its required `label`, closes it from inside (`iconOnly` shows the label as a tooltip); `frosted` for a translucent surface. |
|
|
389
|
+
| [`Sheet`](https://play-horizon.github.io/horizon-design/sheet) | A modal panel that slides in from one `side` of the window (Ark Dialog); `closeLabel`, required, names its close button and is its tooltip, a trigger that shows only an icon takes a `triggerLabel` (its accessible name and tooltip), and `open` binds; `frosted` for a translucent surface. |
|
|
390
|
+
| [`Tooltip`](https://play-horizon.github.io/horizon-design/tooltip) | A short label (`content`) shown on hover or keyboard focus of its trigger (Ark Tooltip), above every other layer: a button holding `children`, or the app's own element through `trigger`, which receives no `data-scope`, `data-part` or `data-state`; when that element is another component's trigger, `triggerId` is the id that component gives it (through its Ark `ids`). It describes the trigger, so an icon-only trigger still needs an `aria-label`. |
|
|
391
|
+
| [`Tour`](https://play-horizon.github.io/horizon-design/tour) | A guided tour of the interface, step by step, with the step's target spotlit (Ark Tour); the app passes the `steps` and their action labels translated, and `closeLabel` (the close button's name and tooltip) and `progressText`, required. |
|
|
392
|
+
|
|
393
|
+
### Layout
|
|
394
|
+
|
|
395
|
+
| Component | What it is |
|
|
396
|
+
| --------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
397
|
+
| [`Float`](https://play-horizon.github.io/horizon-design/float) | Pins its content at a corner or the bottom centre of the window (`position`), over the page, such as floating action buttons; several children stack in a column. |
|
|
398
|
+
| [`Splitter`](https://play-horizon.github.io/horizon-design/splitter) | Resizable panels (Ark Splitter), in a row or, with `orientation="vertical"`, a column: `SplitterPanel`s, each with its `id` from `panels`, and a `SplitterResizeTrigger` between each two, named by its `label`, required. |
|
|
399
|
+
| [`VirtualList`](https://play-horizon.github.io/horizon-design/virtual-list) | A scrolling list that renders only the rows in view (plus `overscan` rows on each side), so a list of any length costs the same as one screenful; `items`, `itemHeight`, `key` and `row` are required, and `scrollToIndex` brings a row into view, and `keepIndex` keeps a row (such as the active one) rendered while it is out of view. |
|
|
400
|
+
| [`VirtualTree`](https://play-horizon.github.io/horizon-design/virtual-tree) | A virtualised tree (WAI-ARIA tree view, on Ark TreeView): only the rows in view are rendered, so a hierarchy of any size stays fast, with Ark's keyboard, multiple selection and renaming, and its own type-to-find, which takes names with spaces. `collection` (from `createTreeCollection`), `label` and `row` are required; `expandedValue`, `selectedValue` and `focusedValue` bind, `rename` enables F2 renaming, and `focus`, `visibleValues` and `startRenaming` bring a row into view and focus it, list the rows on screen, and open the rename field. |
|
|
401
|
+
|
|
402
|
+
### Editor
|
|
403
|
+
|
|
404
|
+
| Component | What it is |
|
|
405
|
+
| --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
406
|
+
| [`FileTree`](https://play-horizon.github.io/horizon-design/file-tree) | A tree of files and folders on `VirtualTree` (only the rows in view are rendered) from a `collection`, with expandable folders and custom icons; only files are selected. `label`, required, names it, and `selectedValue`, `expandedValue` and `focusedValue` bind. |
|
|
407
|
+
| [`HierarchyView`](https://play-horizon.github.io/horizon-design/hierarchy-view) | The Editor's hierarchy of a scene's objects, on `VirtualTree`: keyboard navigation, multiple selection, renaming, deletion, and drag and drop ([pragmatic-drag-and-drop](#drag-and-drop)) to reparent and reorder, which reports each change of `data` through `onDataChange`. `label`, `renameLabel` and `dragLabel` are required; `nodeWithName` writes a renamed node when `nodeToString` reads a field other than `name`, and `selectedValue` and `expandedValue` bind. |
|
|
408
|
+
| [`HorizonLayout`](https://play-horizon.github.io/horizon-design/horizon-layout) | The Editor window's docking layout: horizon-layout 2.0.2 styled with horizon-design, taking every prop of its `HorizonLayout`, with docked panes that meet on a single line, floating panels raised over them, and a button that restores a maximised view; `config` binds, `views` holds the views, horizon-layout's `translations`, required and complete, name the split handles, the tab lists and the floating panels, and `restoreLabel`, required, names the restore button and is its tooltip. |
|
|
409
|
+
| [`InspectorPanel`](https://play-horizon.github.io/horizon-design/inspector-panel) | The Editor's inspector: a column of collapsible cards (a component each) that can be reordered by drag ([pragmatic-drag-and-drop](#drag-and-drop)) or keyboard; `cards` and `expandedIds` bind, and `onRemove` with `removeLabel` adds a remove button (with its tooltip) to each card not marked `removable: false`. |
|
|
410
|
+
|
|
411
|
+
## Drag and drop
|
|
412
|
+
|
|
413
|
+
The Editor's drag and drop (`HierarchyView`, `InspectorPanel`) uses Atlassian's
|
|
414
|
+
[pragmatic-drag-and-drop](https://atlassian.design/components/pragmatic-drag-and-drop) (Apache-2.0).
|
|
415
|
+
It is framework-agnostic with a small core, maintained by Atlassian for Jira, Trello and
|
|
416
|
+
Confluence, and built on native HTML5 drag and drop, which Electron's Chromium supports. Its hitbox
|
|
417
|
+
package computes exactly the instructions a hierarchy needs (reorder above or below, make child,
|
|
418
|
+
reparent by indent level) and a list's closest edge. `@dnd-kit/svelte` was the alternative; its
|
|
419
|
+
Svelte port is younger and less proven. The keyboard does the same moves (Shift+arrows).
|
|
420
|
+
|
|
421
|
+
## Upgrading from 1.0.0
|
|
422
|
+
|
|
423
|
+
2.0.0 changes what code written for 1.0.0 may rely on:
|
|
424
|
+
|
|
425
|
+
- **`Tabs` is removed.** Use `SegmentGroup` with `variant="underline"`, and render the view of its
|
|
426
|
+
`value` below it: `<SegmentGroup variant="underline" items={…} bind:value />` then
|
|
427
|
+
`{#if value === 'overview'}…{/if}`. Its items are `{ value, label, disabled? }` (a tab's
|
|
428
|
+
`content` snippet has no counterpart), and it is a radio group for assistive technology, not a tab
|
|
429
|
+
list.
|
|
430
|
+
- **Names are spelled out**: `theme.init()` is `theme.initialize()`, and its options type
|
|
431
|
+
`ThemeInitOptions` is `ThemeInitializeOptions`.
|
|
432
|
+
- **`AssetCard`, `Item` and `ThumbCard` are interactive only with an action.** Without `href` or
|
|
433
|
+
`onclick` they are plain displays: no hover, no pointer, no focus. An `AssetCard` with `onclick`
|
|
434
|
+
is a button; it is a toggle (with `aria-pressed` and the chosen look of `selected`) only with
|
|
435
|
+
the new `selectable` prop, so a picker adds `selectable`. An `Item` with `onclick` is now a
|
|
436
|
+
`<button>` (and with `href` an `<a>`): its content must hold no other control.
|
|
437
|
+
- **`ColorPicker`**: `labels.formats`, required, names the list of the colour's values now shown
|
|
438
|
+
under the controls (`formats={[]}` hides it). The hex fields show 8 digits (`#RRGGBBAA`).
|
|
439
|
+
- **`Calendar` and `DatePicker`** always show six weeks. The view switch's name is now the visible
|
|
440
|
+
month, year or decade, then `translations.viewTrigger`'s text (`"March 2026, show the month
|
|
441
|
+
view"`): write that text to follow the date.
|
|
442
|
+
- **`ThemeSwitch`** names each mode in a `Tooltip` instead of a `title` attribute.
|
|
443
|
+
- **`DatePicker`'s** calendar has `Calendar`'s 36 px cells (they were 32 px). `Calendar`'s size
|
|
444
|
+
follows `--cell-size`, set through its `class` as in 1.0; a `w-full` class no longer stretches it.
|
|
445
|
+
- **`ScrollArea`** requires `label`, which names its viewport, a region: the viewport takes the
|
|
446
|
+
keyboard focus while its content overflows (so the keyboard can scroll it), and a test that tabs
|
|
447
|
+
across a scrolling region meets one more stop.
|
|
448
|
+
- **Every icon-only button of the kit** shows its accessible name in a tooltip (the close buttons of
|
|
449
|
+
`Dialog`, `Drawer`, `Sheet`, `FloatingPanel`, `Toast` and `Tour`, the arrows and dots of
|
|
450
|
+
`Carousel` and the arrows of `Calendar`, `DatePicker` and `Pagination`, the buttons of `Timer`,
|
|
451
|
+
`NumberInput`, `Clipboard`, `Combobox`, `ColorPicker`, `ThemeSwitch`, a collapsed `Sidebar`'s
|
|
452
|
+
items, `ToggleGroup`'s icon items and `HorizonLayout`'s restore button): a test that counts the
|
|
453
|
+
elements of role `tooltip` finds them.
|
|
454
|
+
- **`Table`**: a column renders its `cell` snippet with the row (`cell: Snippet<[Row]>`), in place
|
|
455
|
+
of the per-row snippet cells, and `columns` and `rows` are required; `Table` is generic over the row type, and `TableColumn<Row>` types a column.
|
|
456
|
+
- **`DialogClose`** without children (the close icon) requires its `label`, which is also its
|
|
457
|
+
tooltip.
|
|
458
|
+
- **`Tooltip`**: the props its `trigger` snippet receives no longer carry `data-scope`, `data-part`
|
|
459
|
+
and `data-state`; give `triggerId` when the element is another component's trigger (with the same
|
|
460
|
+
id in that component's `ids`). Its content now sits above every layer (dialogs, toasts, the tour).
|
|
461
|
+
- **`FileUpload`**: the dropzone is named by `prompt` and `hint` together, and the file input is no
|
|
462
|
+
longer inside it: a test that finds the dropzone by `prompt` alone, or the input inside the
|
|
463
|
+
dropzone, needs updating.
|
|
464
|
+
- **Tokens**: the light theme's `warning` is a gold (`oklch(0.51 0.104 84)`, it was
|
|
465
|
+
`oklch(0.54 0.116 70)`) and its `warning-subtle` and `warning-border` follow; the five avatar
|
|
466
|
+
tones are darker (white initials keep 4.5:1); `art-scrim-hover` is new. Code that copied a hex
|
|
467
|
+
from `horizon-design/tokens` gets the new values.
|
|
2446
468
|
|
|
2447
|
-
##
|
|
469
|
+
## Developing
|
|
2448
470
|
|
|
2449
|
-
|
|
471
|
+
Requirements: Node 26 and pnpm 12 (`.node-version`, `packageManager`).
|
|
2450
472
|
|
|
2451
|
-
```
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
473
|
+
```sh
|
|
474
|
+
pnpm install
|
|
475
|
+
pnpm dev # the docs site on http://localhost:5173
|
|
476
|
+
pnpm lint # Prettier and ESLint
|
|
477
|
+
pnpm check # svelte-check
|
|
478
|
+
pnpm test # vitest: the token pipeline and component tests (jsdom)
|
|
479
|
+
pnpm build # the docs site (build/) and the package (dist/)
|
|
2456
480
|
```
|
|
2457
481
|
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
| `--muted-foreground` | `#7888a6` | `#64748b` |
|
|
2468
|
-
| `--accent` | `#1e2944` | `#e2e8f0` |
|
|
2469
|
-
| `--card` | `#141a2b` | `#ffffff` |
|
|
2470
|
-
| `--popover` | `#171e32` | `#ffffff` |
|
|
2471
|
-
| `--border` | `#212c47` | `oklch(0.9288 0.0126 255.5)` |
|
|
2472
|
-
| `--input` | `#151c2e` | `#ffffff` |
|
|
2473
|
-
| `--ring` | `#2d65f2` | same |
|
|
2474
|
-
| `--destructive` | `#ef4444` | same |
|
|
2475
|
-
| `--success` | `#10b981` | same |
|
|
2476
|
-
| `--warning` | `#f59e0b` | same |
|
|
2477
|
-
| `--info` | `#38bdf8` | `#3b82f6` |
|
|
2478
|
-
| `--radius` | `0.375rem` | same |
|
|
2479
|
-
|
|
2480
|
-
---
|
|
2481
|
-
|
|
2482
|
-
## Fonts
|
|
482
|
+
- `src/lib/components/<name>/`: one directory per general component, with its `index.ts`, its
|
|
483
|
+
tests (`*.test.ts`) and any helper module.
|
|
484
|
+
- `src/lib/editor/`: the Editor's components, exported as `horizon-design/editor`.
|
|
485
|
+
- `src/lib/styles/`: the stylesheet's parts (fonts, scale, base, motion, frosted), imported by
|
|
486
|
+
`src/lib/horizon-design.css`; `src/lib/generated/` holds the generated token files (gitignored).
|
|
487
|
+
- `src/lib/theme.svelte.ts` and `src/lib/motion/`: the theme controller and page motion.
|
|
488
|
+
- `scripts/tokens/`: the token source and the generator, which converts OKLCH to hex with [colorjs.io](https://colorjs.io) when the library is built.
|
|
489
|
+
- `src/routes/`: the docs site, one page per component (`sections/<Name>.svelte`), listed in
|
|
490
|
+
`src/routes/navigation.ts`.
|
|
2483
491
|
|
|
2484
|
-
|
|
492
|
+
Every new component gets a docs page with live examples and component tests. Publishing: a push
|
|
493
|
+
to `main` that bumps the version publishes to npm and deploys the docs site.
|
|
2485
494
|
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
495
|
+
Upgrading horizon-layout: `src/lib/editor/horizon-layout/horizon-layout.css` is a copy of the
|
|
496
|
+
library's default theme with horizon-design's differences, listed in its header. Diff the
|
|
497
|
+
library's default theme (`src/lib/horizon-layout.css` in horizon-layout) between the version
|
|
498
|
+
pinned in `package.json` and the new one, apply that diff to the copy, keeping the listed
|
|
499
|
+
differences, and update the version the header names.
|
|
2490
500
|
|
|
2491
|
-
|
|
501
|
+
## Fonts
|
|
2492
502
|
|
|
2493
|
-
|
|
2494
|
-
:
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
503
|
+
Two variable fonts are self-hosted and bundled with the stylesheet (`src/lib/fonts`, published in
|
|
504
|
+
`dist/fonts`), each split into a Latin and an extended subset:
|
|
505
|
+
|
|
506
|
+
- **Horizon Sans** (`--font-sans`, variable weight and width) is a subset of
|
|
507
|
+
[Encode Sans](https://github.com/thundernixon/Encode-Sans), Copyright 2020 The Encode Project
|
|
508
|
+
Authors, renamed as its licence requires: the SIL Open Font License reserves the name
|
|
509
|
+
"Encode Sans" for the unmodified font, and a subset is a modified version.
|
|
510
|
+
- **Lilex** (`--font-mono`, variable weight), Copyright 2019 The Lilex Project Authors
|
|
511
|
+
([Lilex](https://github.com/mishamyrt/Lilex)), is subset under its own name: its licence reserves
|
|
512
|
+
no name.
|
|
513
|
+
|
|
514
|
+
Both are under the SIL Open Font License 1.1, shipped next to them: `OFL-EncodeSans.txt` and
|
|
515
|
+
`OFL-Lilex.txt`.
|
|
516
|
+
|
|
517
|
+
The Horizon Sans files are the Encode Sans subsets of commit `12ca3cd` with their names changed by
|
|
518
|
+
`scripts/fonts/rename-horizon-sans.py` (family, full name, PostScript name, unique ID and
|
|
519
|
+
typographic family; nothing else). fontTools runs once, outside the project's dependencies, here in
|
|
520
|
+
a throwaway container; the same input gives the same files:
|
|
521
|
+
|
|
522
|
+
```sh
|
|
523
|
+
mkdir -p /tmp/horizon-sans
|
|
524
|
+
for subset in latin latin-ext; do
|
|
525
|
+
git show 12ca3cd:src/lib/fonts/EncodeSans-$subset.woff2 > /tmp/horizon-sans/EncodeSans-$subset.woff2
|
|
526
|
+
done
|
|
527
|
+
docker run --rm -v /tmp/horizon-sans:/fonts -v "$PWD/scripts/fonts:/scripts:ro" -w /fonts \
|
|
528
|
+
python:3.13-slim sh -c 'pip install fonttools==4.68.0 brotli==1.2.1 && for subset in latin latin-ext; do
|
|
529
|
+
python -I /scripts/rename-horizon-sans.py EncodeSans-$subset.woff2 HorizonSans-$subset.woff2
|
|
530
|
+
done'
|
|
531
|
+
cp /tmp/horizon-sans/HorizonSans-*.woff2 src/lib/fonts/
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
## Licence
|
|
535
|
+
|
|
536
|
+
MIT, except the fonts in `src/lib/fonts` (`dist/fonts` in the package), which are under the SIL
|
|
537
|
+
Open Font License 1.1 (see [Fonts](#fonts)).
|