Warning
The following components have been introduced as a temporary solution until either Floating UI provides Svelte bindings, the upcoming native browser APIs become widely avialable, or another alternative is introduced (whichever comes first). Until that time, Skeleton will continue to maintain these components for production use. Maintenance will continue until the next major version of Skeleton if an alternative is introduced.
The following popover components are built using Zag.js primitives, and utilize Floating UI to control positioning and anchoring of each related element.
Z-Index
Neither Skeleton, Zag, or Floating UI take an opinionated stance regarding z-index stacking. This means elements may be occluded beneath other elements with a higher index. To adjust this value, set zIndex
with a raw CSS value, such as 10
, 20
, 999
- provided as a string. Note that this property does not accept utility classes.
<Popover ... zIndex="10"> <!-- ... --></Popover>
zIndex="z-50"
- This will NOT work.zIndex={99}
- This will NOT work.zIndex="99"
- This will work as expected.
Arrows
Both <Popover>
and <Tooltip>
allow for arrows. Skeleton follows Zag’s conventions for styling arrows. Add the arrow
prop to enable the arrow, then use the following to adjust each style. Note these properties do not accept utility classes.
Prop Name | CSS Custom Property | Demo |
---|---|---|
arrow | - | <Tooltip arrow> |
arrowBackground | --arrow-background | <Tooltip arrowBackground="var(--color-surface-50-950)"> |
arrowSize | --arrow-size | <Tooltip arrowSize="10px"> |
<Tooltip ... arrow arrowBackground="var(--color-surface-50-950)" arrowSize="15px"> ...</Tooltip>
Popover
Triggers an anchored popover when you click the trigger element. View API Reference.
Anatomy
<Popover>
trigger
positioner
arrow
content
API Reference
Popover
Property | Type | Description |
---|---|---|
zIndex | string | |
arrow | boolean | |
arrowBackground | string | |
arrowSize | string | |
base | string | |
classes | string | |
triggerBase | string | |
triggerBackground | string | |
triggerClasses | string | |
triggerAriaLabel | string | |
positionerBase | string | |
positionerClasses | string | |
contentBase | string | |
contentBackground | string | |
contentClasses | string | |
arrowBase | string | |
arrowClasses | string | |
trigger | Snippet<[]> | |
content | Snippet<[]> | |
onclick | MouseEventHandler<HTMLButtonElement> | |
ids | Partial<{ anchor: string; trigger: string; content: string; title: string; description: string; closeTrigger: string; positioner: string; arrow: string; }> | |
dir | "ltr" | "rtl" | |
getRootNode | () => ShadowRoot | Node | Document | |
autoFocus | boolean | |
onPointerDownOutside | (event: PointerDownOutsideEvent) => void | |
onFocusOutside | (event: FocusOutsideEvent) => void | |
onInteractOutside | (event: InteractOutsideEvent) => void | |
open | boolean | |
defaultOpen | boolean | |
positioning | PositioningOptions | |
onOpenChange | (details: OpenChangeDetails) => void | |
modal | boolean | |
initialFocusEl | () => HTMLElement | |
closeOnInteractOutside | boolean | |
closeOnEscape | boolean | |
onEscapeKeyDown | (event: KeyboardEvent) => void | |
persistentElements | (() => Element)[] | |
portalled | boolean | |
Tooltip
Triggers an anchored popover when you hover the trigger element. View API Reference.
Anatomy
<Tooltip>
trigger
positioner
arrow
content
API Reference
Tooltip
Property | Type | Description |
---|---|---|
zIndex | string | |
arrow | boolean | |
arrowBackground | string | |
arrowSize | string | |
base | string | |
classes | string | |
triggerBase | string | |
triggerBackground | string | |
triggerClasses | string | |
triggerAriaLabel | string | |
positionerBase | string | |
positionerClasses | string | |
contentBase | string | |
contentBackground | string | |
contentClasses | string | |
arrowBase | string | |
arrowClasses | string | |
trigger | Snippet<[]> | |
content | Snippet<[]> | |
onmouseover | MouseEventHandler<HTMLButtonElement> | |
onclick | MouseEventHandler<HTMLButtonElement> | |
ids | Partial<{ trigger: string; content: string; arrow: string; positioner: string; }> | |
disabled | boolean | |
dir | "ltr" | "rtl" | |
getRootNode | () => ShadowRoot | Node | Document | |
aria-label | string | |
open | boolean | |
defaultOpen | boolean | |
positioning | PositioningOptions | |
onOpenChange | (details: OpenChangeDetails) => void | |
closeOnEscape | boolean | |
openDelay | number | |
closeDelay | number | |
closeOnPointerDown | boolean | |
closeOnScroll | boolean | |
closeOnClick | boolean | |
interactive | boolean | |
Combobox
Triggers an anchored popover list when you tap the arrow. Includes auto-suggestion via typeahead. View API Reference.
Anatomy
<Combobox>
label
labelText
inputGroup
inputGroupInput
inputGroupButton
inputGroupArrow
positioner
content
option
API Reference
Combobox
Property | Type | Description |
---|---|---|
data | T[] | |
label | string | |
zIndex | string | |
base | string | |
width | string | |
classes | string | |
labelBase | string | |
labelText | string | |
labelClasses | string | |
inputGroupBase | string | |
inputGroupInput | string | |
inputGroupButton | string | |
inputGroupArrow | string | |
inputGroupClasses | string | |
positionerBase | string | |
positionerClasses | string | |
contentBase | string | |
contentBackground | string | |
contentSpaceY | string | |
contentClasses | string | |
optionBase | string | |
optionFocus | string | |
optionHover | string | |
optionActive | string | |
optionClasses | string | |
arrow | Snippet<[]> | |
item | Snippet<[T]> | |
onclick | (event: Event) => void | |
ids | Partial<{ root: string; label: string; control: string; input: string; content: string; trigger: string; clearTrigger: string; item(id: string, index?: number): string; positioner: string; itemGroup(id: string | number): string; itemGroupLabel(id: string | number): string; }> | |
multiple | boolean | |
value | string[] | |
defaultValue | string[] | |
disabled | boolean | |
onValueChange | (details: ValueChangeDetails<any>) => void | |
dir | "ltr" | "rtl" | |
getRootNode | () => ShadowRoot | Node | Document | |
name | string | |
translations | IntlTranslations | |
required | boolean | |
invalid | boolean | |
form | string | |
readOnly | boolean | |
autoFocus | boolean | |
loopFocus | boolean | |
composite | boolean | |
navigate | (details: NavigateDetails) => void | |
inputValue | string | |
defaultInputValue | string | |
onInputValueChange | (details: InputValueChangeDetails) => void | |
onHighlightChange | (details: HighlightChangeDetails<any>) => void | |
onPointerDownOutside | (event: PointerDownOutsideEvent) => void | |
onFocusOutside | (event: FocusOutsideEvent) => void | |
onInteractOutside | (event: InteractOutsideEvent) => void | |
open | boolean | |
defaultOpen | boolean | |
placeholder | string | |
defaultHighlightedValue | string | |
highlightedValue | string | |
inputBehavior | "autohighlight" | "autocomplete" | "none" | |
selectionBehavior | "clear" | "replace" | "preserve" | |
openOnClick | boolean | |
openOnChange | boolean | ((details: InputValueChangeDetails) => boolean) | |
allowCustomValue | boolean | |
positioning | PositioningOptions | |
onOpenChange | (details: OpenChangeDetails) => void | |
closeOnSelect | boolean | |
openOnKeyPress | boolean | |
scrollToIndexFn | (details: ScrollToIndexDetails) => void | |
disableLayer | boolean | |
Modal
Generate modals or dialogs that require a user’s immediate attention. View API Reference.
Anatomy
<Modal>
trigger
backdrop
positioner
content
API Reference
Modal
Property | Type | Description |
---|---|---|
base | string | |
classes | string | |
zIndex | string | |
triggerBase | string | |
triggerBackground | string | |
triggerClasses | string | |
triggerAriaLabel | string | |
backdropBase | string | |
backdropBackground | string | |
backdropClasses | string | |
positionerBase | string | |
positionerDisplay | string | |
positionerJustify | string | |
positionerAlign | string | |
positionerPadding | string | |
positionerClasses | string | |
contentBase | string | |
contentBackground | string | |
contentClasses | string | |
transitionsBackdropIn | FadeParams | |
transitionsBackdropOut | FadeParams | |
transitionsPositionerIn | FlyParams | |
transitionsPositionerOut | FlyParams | |
trigger | Snippet<[]> | |
content | Snippet<[]> | |
onclick | MouseEventHandler<HTMLButtonElement> | |
ids | Partial<{ trigger: string; positioner: string; backdrop: string; content: string; closeTrigger: string; title: string; description: string; }> | |
dir | "ltr" | "rtl" | |
getRootNode | () => ShadowRoot | Node | Document | |
aria-label | string | |
onPointerDownOutside | (event: PointerDownOutsideEvent) => void | |
onFocusOutside | (event: FocusOutsideEvent) => void | |
onInteractOutside | (event: InteractOutsideEvent) => void | |
open | boolean | |
defaultOpen | boolean | |
onOpenChange | (details: OpenChangeDetails) => void | |
trapFocus | boolean | |
preventScroll | boolean | |
modal | boolean | |
initialFocusEl | () => HTMLElement | |
finalFocusEl | () => HTMLElement | |
restoreFocus | boolean | |
closeOnInteractOutside | boolean | |
closeOnEscape | boolean | |
role | "dialog" | "alertdialog" | |
onEscapeKeyDown | (event: KeyboardEvent) => void | |
persistentElements | (() => Element)[] | |
Native Browser APIs
Skeleton will always favor native browser APIs over third-party libraries such as Floating UI Svelte. The following is a list of current and upcoming incoming APIs we will aim to support in the future, but are not quite standardized cross-browser yet.