@kovojs/ui
Generated from 44 public subpaths — 424 exports, 424 documented. Do not edit by hand.
@kovojs/ui/accordion#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/accordion.tsx
Values#
Accordion#
Renders the styled accordion primitive.
Copyable example
import { Accordion } from "@kovojs/ui/accordion";
const component = Accordion;Signature
const Accordion = component({
render(props: AccordionProps) {
const attrs = accordionRootAttributes(accordionState(props));
const styleAttrs = style.attrs(accordionStyles.root, props.styles?.root);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-orientation={attrs['data-orientation']}
id={props.id}
>
{props.children}
</div>
);
},
});AccordionItem#
Renders the styled accordion item primitive.
Copyable example
import { AccordionItem } from "@kovojs/ui/accordion";
const component = AccordionItem;Signature
const AccordionItem = component({
render(props: AccordionItemProps) {
const attrs = accordionItemAttributes(accordionItemState(props));
const styleAttrs = style.attrs(accordionStyles.item, props.styles?.item);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
open={attrs.open}
>
{props.children}
</div>
);
},
});AccordionHeader#
Renders the styled accordion header primitive.
Copyable example
import { AccordionHeader } from "@kovojs/ui/accordion";
const component = AccordionHeader;Signature
const AccordionHeader = component({
render(props: AccordionHeaderProps) {
const attrs = accordionHeaderAttributes({
...accordionItemState(props),
...(props.level === undefined ? {} : { level: props.level }),
});
const styleAttrs = style.attrs(accordionStyles.header, props.styles?.header);
return (
<h3
{...styleAttrs}
{...passThroughProps(props)}
aria-level={attrs['aria-level']}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
role={attrs.role}
>
{props.children}
</h3>
);
},
});AccordionTrigger#
Renders the styled accordion trigger primitive.
Copyable example
import { AccordionTrigger } from "@kovojs/ui/accordion";
const component = AccordionTrigger;Signature
const AccordionTrigger = component({
render(props: AccordionTriggerProps) {
const attrs = accordionTriggerAttributes({
...accordionItemState(props),
...(props.contentId === undefined ? {} : { contentId: props.contentId }),
...(props.triggerId === undefined ? {} : { triggerId: props.triggerId }),
});
const styleAttrs = style.attrs(accordionStyles.trigger, props.styles?.trigger);
return (
<button
{...styleAttrs}
{...passThroughProps(props)}
aria-controls={attrs['aria-controls']}
aria-expanded={attrs['aria-expanded']}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
disabled={attrs.disabled}
id={attrs.id}
type={attrs.type}
>
{props.children}
</button>
);
},
});AccordionContent#
Renders the styled accordion content primitive.
Copyable example
import { AccordionContent } from "@kovojs/ui/accordion";
const component = AccordionContent;Signature
const AccordionContent = component({
render(props: AccordionContentProps) {
const attrs = accordionContentAttributes({
...accordionItemState(props),
...(props.contentId === undefined ? {} : { contentId: props.contentId }),
...(props.triggerId === undefined ? {} : { triggerId: props.triggerId }),
});
const styleAttrs = style.attrs(accordionStyles.content, props.styles?.content);
const innerStyleAttrs = style.attrs(accordionStyles.contentInner);
return (
// Outer div is the grid wrapper that animates height; it keeps the id/role/
// aria-labelledby/data-state/hidden contract and forwards the reactive
// data-bind stamps via passThroughProps. The inner div carries the padded
// content and mirrors data-state so its padding collapses with the row.
// `hidden` stays on this element for a11y + the gallery contract: the closed
// panel is correctly removed from the accessibility tree. The StyleX
// `display:grid` (author rule) overrides the UA `[hidden]{display:none}`, so
// the grid-rows 0fr<->1fr transition still fires while `hidden` stays true.
<div
{...styleAttrs}
{...passThroughProps(props)}
aria-labelledby={attrs['aria-labelledby']}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
hidden={attrs.hidden}
id={attrs.id}
role={attrs.role}
>
<div
{...innerStyleAttrs}
{...bindingProps(props, ['data-state'])}
data-state={attrs['data-state']}
>
{props.children}
</div>
</div>
);
},
});Supporting types#
AccordionStyleOverrides#
Style override slots accepted by the accordion components.
Copyable example
import type { AccordionStyleOverrides } from "@kovojs/ui/accordion";
const styles: AccordionStyleOverrides = {};Signature
interface AccordionStyleOverrides {
content?: style.StyleInput;
header?: style.StyleInput;
item?: style.StyleInput;
root?: style.StyleInput;
trigger?: style.StyleInput;
}AccordionStateProps#
Shared state props for the accordion component family.
Copyable example
import type { AccordionStateProps } from "@kovojs/ui/accordion";
const state: AccordionStateProps = {};Signature
interface AccordionStateProps {
collapsible?: boolean;
disabled?: boolean;
orientation?: CollectionOrientation;
type?: AccordionType;
value?: AccordionValue;
}AccordionProps#
Props for the accordion component.
Copyable example
import type { AccordionProps } from "@kovojs/ui/accordion";
const props: AccordionProps = { children: 'Content' };Signature
interface AccordionProps extends AccordionStateProps {
children?: ComponentChild;
id?: string;
styles?: AccordionStyleOverrides;
}AccordionItemProps#
Props for the accordion item component.
Copyable example
import type { AccordionItemProps } from "@kovojs/ui/accordion";
const props: AccordionItemProps = { itemValue: 'item', children: 'Content' };Signature
interface AccordionItemProps extends AccordionStateProps {
children?: ComponentChild;
itemDisabled?: boolean;
itemValue: string;
styles?: AccordionStyleOverrides;
}AccordionHeaderProps#
Props for the accordion header component.
Copyable example
import type { AccordionHeaderProps } from "@kovojs/ui/accordion";
const props: AccordionHeaderProps = { itemValue: 'item', children: 'Content' };Signature
interface AccordionHeaderProps extends AccordionItemProps {
level?: number;
}AccordionTriggerProps#
Props for the accordion trigger component.
Copyable example
import type { AccordionTriggerProps } from "@kovojs/ui/accordion";
const props: AccordionTriggerProps = { itemValue: 'item', children: 'Content' };Signature
interface AccordionTriggerProps extends AccordionItemProps {
contentId?: string;
triggerId?: string;
}AccordionContentProps#
Props for the accordion content component.
Copyable example
import type { AccordionContentProps } from "@kovojs/ui/accordion";
const props: AccordionContentProps = { itemValue: 'item', children: 'Content' };Signature
interface AccordionContentProps extends AccordionItemProps {
contentId?: string;
triggerId?: string;
}@kovojs/ui/alert#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/alert.tsx
Values#
Alert#
Renders the styled alert primitive.
Copyable example
import { Alert } from "@kovojs/ui/alert";
const component = Alert;Signature
const Alert = component({
render(props: AlertProps) {
const attrs = style.attrs(base.root, variants[props.variant ?? 'info'], props.style);
const titleAttrs = style.attrs(base.title);
const descriptionAttrs = style.attrs(base.description);
return (
<div {...attrs} role={props.role ?? 'status'}>
{props.title === undefined ? '' : <strong {...titleAttrs}>{props.title}</strong>}
<div {...descriptionAttrs}>{props.children}</div>
</div>
);
},
});Supporting types#
AlertVariant#
Supported alert variant values.
Copyable example
import type { AlertVariant } from "@kovojs/ui/alert";
const value: AlertVariant = 'info';Signature
type AlertVariant = 'info' | 'success' | 'warning' | 'danger';AlertProps#
Props for the alert component.
Copyable example
import type { AlertProps } from "@kovojs/ui/alert";
const props: AlertProps = { children: 'Content' };Signature
interface AlertProps {
children?: ComponentChild;
role?: 'alert' | 'status';
style?: style.StyleInput;
title?: string;
variant?: AlertVariant;
}@kovojs/ui/alert-dialog#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/alert-dialog.tsx
Values#
AlertDialog#
Renders the styled alert dialog primitive.
Copyable example
import { AlertDialog } from "@kovojs/ui/alert-dialog";
const component = AlertDialog;Signature
const AlertDialog = component({
render(props: AlertDialogProps) {
const attrs = alertDialogRootAttributes(alertDialogState(props));
const styleAttrs = style.attrs(alertDialogStyles.root, props.styles?.root);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
id={props.id}
>
{props.children}
</div>
);
},
});AlertDialogTrigger#
Renders the styled alert dialog trigger primitive.
Copyable example
import { AlertDialogTrigger } from "@kovojs/ui/alert-dialog";
const component = AlertDialogTrigger;Signature
const AlertDialogTrigger = component({
render(props: AlertDialogTriggerProps) {
const attrs = alertDialogTriggerAttributes({
...alertDialogState(props),
...(props.contentId === undefined ? {} : { contentId: props.contentId }),
});
const styleAttrs = style.attrs(alertDialogStyles.trigger, props.styles?.trigger);
return (
<button
{...styleAttrs}
{...passThroughProps(props)}
aria-controls={attrs['aria-controls']}
aria-expanded={attrs['aria-expanded']}
aria-haspopup={attrs['aria-haspopup']}
command={attrs.command}
commandfor={attrs.commandfor}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
disabled={attrs.disabled}
id={props.id}
type={attrs.type}
>
{props.children}
</button>
);
},
});AlertDialogContent#
Renders the styled alert dialog content primitive.
Copyable example
import { AlertDialogContent } from "@kovojs/ui/alert-dialog";
const component = AlertDialogContent;Signature
const AlertDialogContent = component({
render(props: AlertDialogContentProps) {
const attrs = alertDialogContentAttributes({
...alertDialogState(props),
...(props.contentId === undefined ? {} : { contentId: props.contentId }),
...(props.descriptionId === undefined ? {} : { descriptionId: props.descriptionId }),
...(props.titleId === undefined ? {} : { titleId: props.titleId }),
});
const styleAttrs = style.attrs(alertDialogStyles.content, props.styles?.content);
// Top-right "X" affordance. It closes through the native invoker exactly like
// AlertDialogCancel (command='request-close'/commandfor=contentId); reusing the
// cancel attributes keeps that wiring in one place. An accessible name is
// required (rules/accessibility-conformance.md). Backdrop light-dismiss is
// enabled via `closedby="any"` on the dialog below — it fires a `cancel` event
// the call site already syncs (same path as Escape); the explicit X / Cancel /
// Action affordances remain the primary choices.
const closeAttrs = alertDialogCancelAttributes({
...alertDialogState(props),
...(props.contentId === undefined ? {} : { contentId: props.contentId }),
});
const closeStyleAttrs = style.attrs(alertDialogStyles.close, props.styles?.close);
return (
<dialog
{...styleAttrs}
{...passThroughProps(props)}
aria-describedby={attrs['aria-describedby']}
aria-labelledby={attrs['aria-labelledby']}
aria-modal={attrs['aria-modal']}
closedby="any"
data-state={attrs['data-state']}
id={attrs.id}
open={attrs.open}
role={attrs.role}
>
<button
{...closeStyleAttrs}
aria-label="Close"
command={closeAttrs.command}
commandfor={closeAttrs.commandfor}
data-disabled={closeAttrs['data-disabled']}
data-state={closeAttrs['data-state']}
disabled={closeAttrs.disabled}
type={closeAttrs.type}
>
<X aria-hidden="true" />
</button>
{props.children}
</dialog>
);
},
});AlertDialogCancel#
Renders the styled alert dialog cancel primitive.
Copyable example
import { AlertDialogCancel } from "@kovojs/ui/alert-dialog";
const component = AlertDialogCancel;Signature
const AlertDialogCancel = component({
render(props: AlertDialogCancelProps) {
const attrs = alertDialogCancelAttributes({
...alertDialogState(props),
...(props.autoFocus === undefined ? {} : { autoFocus: props.autoFocus }),
...(props.contentId === undefined ? {} : { contentId: props.contentId }),
});
const styleAttrs = style.attrs(alertDialogStyles.cancel, props.styles?.cancel);
return (
<button
{...styleAttrs}
{...passThroughProps(props)}
autofocus={attrs.autofocus}
command={attrs.command}
commandfor={attrs.commandfor}
data-disabled={attrs['data-disabled']}
data-intent={attrs['data-intent']}
data-state={attrs['data-state']}
disabled={attrs.disabled}
id={props.id}
type={attrs.type}
>
{props.children ?? 'Cancel'}
</button>
);
},
});AlertDialogAction#
Renders the styled alert dialog action primitive.
Copyable example
import { AlertDialogAction } from "@kovojs/ui/alert-dialog";
const component = AlertDialogAction;Signature
const AlertDialogAction = component({
render(props: AlertDialogActionProps) {
const attrs = alertDialogActionAttributes({
...alertDialogState(props),
...(props.contentId === undefined ? {} : { contentId: props.contentId }),
...(props.intent === undefined ? {} : { intent: props.intent }),
});
const styleAttrs = style.attrs(alertDialogStyles.action, props.styles?.action);
return (
<button
{...styleAttrs}
{...passThroughProps(props)}
command={attrs.command}
commandfor={attrs.commandfor}
data-disabled={attrs['data-disabled']}
data-intent={attrs['data-intent']}
data-state={attrs['data-state']}
disabled={attrs.disabled}
id={props.id}
type={attrs.type}
>
{props.children}
</button>
);
},
});AlertDialogHeader#
Renders the styled alert dialog header primitive.
Copyable example
import { AlertDialogHeader } from "@kovojs/ui/alert-dialog";
const component = AlertDialogHeader;Signature
const AlertDialogHeader = component({
render(props: AlertDialogPartProps) {
const styleAttrs = style.attrs(alertDialogStyles.header, props.styles?.header);
return (
<div {...styleAttrs} {...passThroughProps(props)} id={props.id}>
{props.children}
</div>
);
},
});AlertDialogTitle#
Renders the styled alert dialog title primitive.
Copyable example
import { AlertDialogTitle } from "@kovojs/ui/alert-dialog";
const component = AlertDialogTitle;Signature
const AlertDialogTitle = component({
render(props: AlertDialogPartProps) {
const styleAttrs = style.attrs(alertDialogStyles.title, props.styles?.title);
return (
<h2 {...styleAttrs} {...passThroughProps(props)} id={props.id}>
{props.children}
</h2>
);
},
});AlertDialogDescription#
Renders the styled alert dialog description primitive.
Copyable example
import { AlertDialogDescription } from "@kovojs/ui/alert-dialog";
const component = AlertDialogDescription;Signature
const AlertDialogDescription = component({
render(props: AlertDialogPartProps) {
const styleAttrs = style.attrs(alertDialogStyles.description, props.styles?.description);
return (
<p {...styleAttrs} {...passThroughProps(props)} id={props.id}>
{props.children}
</p>
);
},
});AlertDialogFooter#
Renders the styled alert dialog footer primitive.
Copyable example
import { AlertDialogFooter } from "@kovojs/ui/alert-dialog";
const component = AlertDialogFooter;Signature
const AlertDialogFooter = component({
render(props: AlertDialogPartProps) {
const styleAttrs = style.attrs(alertDialogStyles.footer, props.styles?.footer);
return (
<div {...styleAttrs} {...passThroughProps(props)} id={props.id}>
{props.children}
</div>
);
},
});Supporting types#
AlertDialogStyleOverrides#
Style override slots accepted by the alert dialog components.
Copyable example
import type { AlertDialogStyleOverrides } from "@kovojs/ui/alert-dialog";
const styles: AlertDialogStyleOverrides = {};Signature
interface AlertDialogStyleOverrides {
action?: style.StyleInput;
cancel?: style.StyleInput;
close?: style.StyleInput;
content?: style.StyleInput;
description?: style.StyleInput;
footer?: style.StyleInput;
header?: style.StyleInput;
root?: style.StyleInput;
title?: style.StyleInput;
trigger?: style.StyleInput;
}AlertDialogStateProps#
Shared state props for the alert dialog component family.
Copyable example
import type { AlertDialogStateProps } from "@kovojs/ui/alert-dialog";
const state: AlertDialogStateProps = {};Signature
interface AlertDialogStateProps {
disabled?: boolean;
open?: boolean;
}AlertDialogProps#
Props for the alert dialog component.
Copyable example
import type { AlertDialogProps } from "@kovojs/ui/alert-dialog";
const props: AlertDialogProps = { children: 'Content' };Signature
interface AlertDialogProps extends AlertDialogStateProps {
children?: ComponentChild;
id?: string;
styles?: AlertDialogStyleOverrides;
}AlertDialogTriggerProps#
Props for the alert dialog trigger component.
Copyable example
import type { AlertDialogTriggerProps } from "@kovojs/ui/alert-dialog";
const props: AlertDialogTriggerProps = { children: 'Content' };Signature
interface AlertDialogTriggerProps extends AlertDialogStateProps {
children?: ComponentChild;
contentId?: string;
id?: string;
styles?: AlertDialogStyleOverrides;
}AlertDialogContentProps#
Props for the alert dialog content component.
Copyable example
import type { AlertDialogContentProps } from "@kovojs/ui/alert-dialog";
const props: AlertDialogContentProps = { children: 'Content' };Signature
interface AlertDialogContentProps extends AlertDialogStateProps {
children?: ComponentChild;
contentId?: string;
descriptionId?: string;
styles?: AlertDialogStyleOverrides;
titleId?: string;
}AlertDialogCancelProps#
Props for the alert dialog cancel component.
Copyable example
import type { AlertDialogCancelProps } from "@kovojs/ui/alert-dialog";
const props: AlertDialogCancelProps = { children: 'Content' };Signature
interface AlertDialogCancelProps extends AlertDialogStateProps {
autoFocus?: boolean;
children?: ComponentChild;
contentId?: string;
id?: string;
styles?: AlertDialogStyleOverrides;
}AlertDialogActionProps#
Props for the alert dialog action component.
Copyable example
import type { AlertDialogActionProps } from "@kovojs/ui/alert-dialog";
const props: AlertDialogActionProps = { children: 'Content' };Signature
interface AlertDialogActionProps extends AlertDialogStateProps {
children?: ComponentChild;
contentId?: string;
id?: string;
intent?: AlertDialogActionIntent;
styles?: AlertDialogStyleOverrides;
}AlertDialogPartProps#
Props for the alert dialog part component.
Copyable example
import type { AlertDialogPartProps } from "@kovojs/ui/alert-dialog";
const props: AlertDialogPartProps = { children: 'Content' };Signature
interface AlertDialogPartProps {
children?: ComponentChild;
id?: string;
styles?: AlertDialogStyleOverrides;
}@kovojs/ui/autocomplete#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/autocomplete.tsx
Values#
Autocomplete#
Renders the styled autocomplete primitive.
Copyable example
import { Autocomplete } from "@kovojs/ui/autocomplete";
const component = Autocomplete;Signature
const Autocomplete = component({
render(props: AutocompleteProps) {
const attrs = autocompleteRootAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.form === undefined ? {} : { form: props.form }),
...(props.highlightedValue === undefined ? {} : { highlightedValue: props.highlightedValue }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.inputValue === undefined ? {} : { inputValue: props.inputValue }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.items === undefined ? {} : { items: props.items }),
...(props.listId === undefined ? {} : { listId: props.listId }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.open === undefined ? {} : { open: props.open }),
...(props.placeholder === undefined ? {} : { placeholder: props.placeholder }),
...(props.required === undefined ? {} : { required: props.required }),
...(props.value === undefined ? {} : { value: props.value }),
});
const styleAttrs = style.attrs(autocompleteStyles.root, props.styles?.root);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-invalid={attrs['data-invalid']}
data-placeholder={attrs['data-placeholder']}
data-required={attrs['data-required']}
data-state={attrs['data-state']}
id={attrs.id}
>
{props.children}
</div>
);
},
});AutocompleteInput#
Renders the styled autocomplete input primitive.
Copyable example
import { AutocompleteInput } from "@kovojs/ui/autocomplete";
const component = AutocompleteInput;Signature
const AutocompleteInput = component({
render(props: AutocompleteInputProps) {
const attrs = autocompleteInputAttributes({
...(props.autocomplete === undefined ? {} : { autocomplete: props.autocomplete }),
...(props.descriptionId === undefined ? {} : { descriptionId: props.descriptionId }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.errorId === undefined ? {} : { errorId: props.errorId }),
...(props.form === undefined ? {} : { form: props.form }),
...(props.highlightedValue === undefined ? {} : { highlightedValue: props.highlightedValue }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.inputValue === undefined ? {} : { inputValue: props.inputValue }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.items === undefined ? {} : { items: props.items }),
...(props.labelledBy === undefined ? {} : { labelledBy: props.labelledBy }),
...(props.listId === undefined ? {} : { listId: props.listId }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.open === undefined ? {} : { open: props.open }),
...(props.placeholder === undefined ? {} : { placeholder: props.placeholder }),
...(props.required === undefined ? {} : { required: props.required }),
...(props.value === undefined ? {} : { value: props.value }),
});
const styleAttrs = style.attrs(autocompleteStyles.input, props.styles?.input);
return (
<input
{...styleAttrs}
{...passThroughProps(props)}
aria-activedescendant={attrs['aria-activedescendant']}
aria-autocomplete={attrs['aria-autocomplete']}
aria-controls={attrs['aria-controls']}
aria-describedby={attrs['aria-describedby']}
aria-expanded={attrs['aria-expanded']}
aria-invalid={attrs['aria-invalid']}
aria-labelledby={attrs['aria-labelledby']}
autocomplete={attrs.autocomplete}
data-disabled={attrs['data-disabled']}
data-invalid={attrs['data-invalid']}
data-placeholder={attrs['data-placeholder']}
data-required={attrs['data-required']}
data-state={attrs['data-state']}
disabled={attrs.disabled}
form={attrs.form}
id={attrs.id}
list={attrs.list}
name={attrs.name}
placeholder={attrs.placeholder}
required={attrs.required}
role={attrs.role}
type={attrs.type}
value={attrs.value}
/>
);
},
});AutocompleteList#
Renders the styled autocomplete list primitive.
Copyable example
import { AutocompleteList } from "@kovojs/ui/autocomplete";
const component = AutocompleteList;Signature
const AutocompleteList = component({
render(props: AutocompleteListProps) {
const attrs = autocompleteListAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.form === undefined ? {} : { form: props.form }),
...(props.highlightedValue === undefined ? {} : { highlightedValue: props.highlightedValue }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.inputValue === undefined ? {} : { inputValue: props.inputValue }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.items === undefined ? {} : { items: props.items }),
...(props.labelledBy === undefined ? {} : { labelledBy: props.labelledBy }),
...(props.listId === undefined ? {} : { listId: props.listId }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.open === undefined ? {} : { open: props.open }),
...(props.placeholder === undefined ? {} : { placeholder: props.placeholder }),
...(props.required === undefined ? {} : { required: props.required }),
...(props.value === undefined ? {} : { value: props.value }),
});
const styleAttrs = style.attrs(autocompleteStyles.list, props.styles?.list);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
aria-labelledby={attrs['aria-labelledby']}
data-disabled={attrs['data-disabled']}
data-invalid={attrs['data-invalid']}
data-placeholder={attrs['data-placeholder']}
data-required={attrs['data-required']}
data-state={attrs['data-state']}
hidden={attrs.hidden}
id={attrs.id}
role={attrs.role}
>
{props.children}
</div>
);
},
});AutocompleteOption#
Renders the styled autocomplete option primitive.
Copyable example
import { AutocompleteOption } from "@kovojs/ui/autocomplete";
const component = AutocompleteOption;Signature
const AutocompleteOption = component({
render(props: AutocompleteOptionProps) {
const attrs = autocompleteOptionAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.form === undefined ? {} : { form: props.form }),
...(props.highlightedValue === undefined ? {} : { highlightedValue: props.highlightedValue }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.inputValue === undefined ? {} : { inputValue: props.inputValue }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.itemDisabled === undefined ? {} : { itemDisabled: props.itemDisabled }),
...(props.itemLabel === undefined ? {} : { itemLabel: props.itemLabel }),
...(props.items === undefined ? {} : { items: props.items }),
itemValue: props.itemValue,
...(props.listId === undefined ? {} : { listId: props.listId }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.open === undefined ? {} : { open: props.open }),
...(props.placeholder === undefined ? {} : { placeholder: props.placeholder }),
...(props.required === undefined ? {} : { required: props.required }),
...(props.value === undefined ? {} : { value: props.value }),
});
const styleAttrs = style.attrs(autocompleteStyles.option, props.styles?.option);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
aria-disabled={attrs['aria-disabled']}
aria-selected={attrs['aria-selected']}
data-disabled={attrs['data-disabled']}
data-highlighted={attrs['data-highlighted']}
data-state={attrs['data-state']}
id={attrs.id}
label={attrs.label}
role={attrs.role}
value={attrs.value}
>
{props.children ?? props.itemLabel ?? props.itemValue ?? ''}
</div>
);
},
});AutocompleteValue#
Renders the styled autocomplete value primitive.
Copyable example
import { AutocompleteValue } from "@kovojs/ui/autocomplete";
const component = AutocompleteValue;Signature
const AutocompleteValue = component({
render(props: AutocompleteValueProps) {
const attrs = autocompleteValueAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.form === undefined ? {} : { form: props.form }),
...(props.highlightedValue === undefined ? {} : { highlightedValue: props.highlightedValue }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.inputValue === undefined ? {} : { inputValue: props.inputValue }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.items === undefined ? {} : { items: props.items }),
...(props.listId === undefined ? {} : { listId: props.listId }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.open === undefined ? {} : { open: props.open }),
...(props.placeholder === undefined ? {} : { placeholder: props.placeholder }),
...(props.required === undefined ? {} : { required: props.required }),
...(props.value === undefined ? {} : { value: props.value }),
});
const styleAttrs = style.attrs(autocompleteStyles.value, props.styles?.value);
return (
<span
{...styleAttrs}
{...passThroughProps(props)}
data-placeholder={attrs['data-placeholder']}
id={attrs.id}
>
{autocompleteValueText(props)}
</span>
);
},
});Supporting types#
AutocompleteStyleOverrides#
Style override slots accepted by the autocomplete components.
Copyable example
import type { AutocompleteStyleOverrides } from "@kovojs/ui/autocomplete";
const styles: AutocompleteStyleOverrides = {};Signature
interface AutocompleteStyleOverrides {
input?: style.StyleInput;
list?: style.StyleInput;
option?: style.StyleInput;
root?: style.StyleInput;
value?: style.StyleInput;
}AutocompleteStateProps#
Shared state props for the autocomplete component family.
Copyable example
import type { AutocompleteStateProps } from "@kovojs/ui/autocomplete";
const state: AutocompleteStateProps = {};Signature
interface AutocompleteStateProps {
disabled?: boolean;
form?: string;
highlightedValue?: string;
inputValue?: string;
invalid?: boolean;
items?: readonly HeadlessAutocompleteItem[];
listId?: string;
name?: string;
open?: boolean;
placeholder?: string;
required?: boolean;
value?: string;
}AutocompleteProps#
Props for the autocomplete component.
Copyable example
import type { AutocompleteProps } from "@kovojs/ui/autocomplete";
const props: AutocompleteProps = { children: 'Content' };Signature
interface AutocompleteProps extends AutocompleteStateProps {
children?: ComponentChild;
id?: string;
styles?: AutocompleteStyleOverrides;
}AutocompleteInputProps#
Props for the autocomplete input component.
Copyable example
import type { AutocompleteInputProps } from "@kovojs/ui/autocomplete";
const props: AutocompleteInputProps = {};Signature
interface AutocompleteInputProps extends AutocompleteStateProps {
autocomplete?: string;
descriptionId?: string;
errorId?: string;
id?: string;
labelledBy?: string;
styles?: AutocompleteStyleOverrides;
}AutocompleteListProps#
Props for the autocomplete list component.
Copyable example
import type { AutocompleteListProps } from "@kovojs/ui/autocomplete";
const props: AutocompleteListProps = { children: 'Content' };Signature
interface AutocompleteListProps extends AutocompleteStateProps {
children?: ComponentChild;
id?: string;
labelledBy?: string;
styles?: AutocompleteStyleOverrides;
}AutocompleteOptionProps#
Props for the autocomplete option component.
Copyable example
import type { AutocompleteOptionProps } from "@kovojs/ui/autocomplete";
const props: AutocompleteOptionProps = { itemValue: 'item', children: 'Content' };Signature
interface AutocompleteOptionProps extends AutocompleteStateProps {
children?: ComponentChild;
id?: string;
itemDisabled?: boolean;
itemLabel?: string;
itemValue: string;
styles?: AutocompleteStyleOverrides;
}AutocompleteValueProps#
Props for the autocomplete value component.
Copyable example
import type { AutocompleteValueProps } from "@kovojs/ui/autocomplete";
const props: AutocompleteValueProps = {};Signature
interface AutocompleteValueProps extends AutocompleteStateProps {
id?: string;
styles?: AutocompleteStyleOverrides;
}@kovojs/ui/avatar#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/avatar.tsx
Values#
Avatar#
Renders the styled avatar primitive.
Copyable example
import { Avatar } from "@kovojs/ui/avatar";
const component = Avatar;Signature
const Avatar = component({
render(props: AvatarProps) {
const attrs = avatarRootAttributes({
...(props.label === undefined ? {} : { label: props.label }),
...(props.src === undefined ? {} : { src: props.src }),
...(props.status === undefined ? {} : { status: props.status }),
});
const styleAttrs = style.attrs(avatarStyles.root, props.styles?.root);
return (
<span
{...styleAttrs}
{...passThroughProps(props)}
aria-label={attrs['aria-label']}
data-state={attrs['data-state']}
id={props.id}
role={attrs.role}
>
{props.children}
</span>
);
},
});AvatarImage#
Renders the styled avatar image primitive.
Copyable example
import { AvatarImage } from "@kovojs/ui/avatar";
const component = AvatarImage;Signature
const AvatarImage = component({
render(props: AvatarImageProps) {
const attrs = avatarImageAttributes({
alt: props.alt,
...(props.decoding === undefined ? {} : { decoding: props.decoding }),
...(props.loading === undefined ? {} : { loading: props.loading }),
referrerPolicy: 'no-referrer',
...(props.sizes === undefined ? {} : { sizes: props.sizes }),
src: props.src,
...(props.status === undefined ? {} : { status: props.status }),
});
return (
<img
{...styleAttributes(avatarStyles.image, props.styles?.image)}
alt={attrs.alt}
data-state={attrs['data-state']}
decoding={attrs.decoding}
hidden={attrs.hidden}
loading={attrs.loading}
referrerpolicy="no-referrer"
sizes={attrs.sizes}
src={trustedUrl(props.src, {
reason: 'caller-selected avatar image',
source: '@kovojs/ui/avatar',
})}
/>
);
},
});AvatarFallback#
Renders the styled avatar fallback primitive.
Copyable example
import { AvatarFallback } from "@kovojs/ui/avatar";
const component = AvatarFallback;Signature
const AvatarFallback = component({
render(props: AvatarFallbackProps) {
const attrs = avatarFallbackAttributes({
...(props.delayMs === undefined ? {} : { delayMs: props.delayMs }),
...(props.src === undefined ? {} : { src: props.src }),
...(props.status === undefined ? {} : { status: props.status }),
});
const styleAttrs = style.attrs(avatarStyles.fallback, props.styles?.fallback);
return (
<span
{...styleAttrs}
{...passThroughProps(props)}
data-delay={attrs['data-delay']}
data-state={attrs['data-state']}
hidden={attrs.hidden}
>
{props.children}
</span>
);
},
});Supporting types#
AvatarStyleOverrides#
Style override slots accepted by the avatar components.
Copyable example
import type { AvatarStyleOverrides } from "@kovojs/ui/avatar";
const styles: AvatarStyleOverrides = {};Signature
interface AvatarStyleOverrides {
fallback?: style.StyleInput;
image?: style.StyleInput;
root?: style.StyleInput;
}AvatarStateProps#
Shared state props for the avatar component family.
Copyable example
import type { AvatarStateProps } from "@kovojs/ui/avatar";
const state: AvatarStateProps = {};Signature
interface AvatarStateProps {
src?: string;
status?: AvatarImageStatus;
}AvatarProps#
Props for the avatar component.
Copyable example
import type { AvatarProps } from "@kovojs/ui/avatar";
const props: AvatarProps = { children: 'Content' };Signature
interface AvatarProps extends AvatarStateProps {
children?: ComponentChild;
id?: string;
label?: string;
styles?: AvatarStyleOverrides;
}AvatarImageProps#
Props for the avatar image component.
Copyable example
import type { AvatarImageProps } from "@kovojs/ui/avatar";
const props: AvatarImageProps = { alt: 'Profile photo', src: '/avatar.png' };Signature
interface AvatarImageProps extends AvatarStateProps {
alt: string;
decoding?: 'async' | 'auto' | 'sync';
loading?: 'eager' | 'lazy';
sizes?: string;
src: string;
styles?: AvatarStyleOverrides;
}AvatarFallbackProps#
Props for the avatar fallback component.
Copyable example
import type { AvatarFallbackProps } from "@kovojs/ui/avatar";
const props: AvatarFallbackProps = { children: 'Content' };Signature
interface AvatarFallbackProps extends AvatarStateProps {
children?: ComponentChild;
delayMs?: number;
styles?: AvatarStyleOverrides;
}@kovojs/ui/badge#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/badge.tsx
Values#
Badge#
Renders the styled badge primitive.
Copyable example
import { Badge } from "@kovojs/ui/badge";
const component = Badge;Signature
const Badge = component({
render(props: BadgeProps) {
const attrs = style.attrs(base.root, variants[props.variant ?? 'neutral'], props.style);
// SPEC.md §4.5/§5.2: the @kovojs/server JSX runtime escapes scalar text
// children exactly once, so pass the raw value — pre-escaping here would
// double-escape (`AT&T` → `AT&amp;T`).
return <span {...attrs}>{props.children ?? ''}</span>;
},
});Supporting types#
BadgeVariant#
Supported badge variant values.
Copyable example
import type { BadgeVariant } from "@kovojs/ui/badge";
const value: BadgeVariant = 'neutral';Signature
type BadgeVariant = 'neutral' | 'success' | 'warning' | 'destructive' | 'outline';BadgeProps#
Props for the badge component.
Copyable example
import type { BadgeProps } from "@kovojs/ui/badge";
const props: BadgeProps = { children: 'Content' };Signature
interface BadgeProps {
children?: ComponentChild;
style?: style.StyleInput;
variant?: BadgeVariant;
}@kovojs/ui/breadcrumb#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/breadcrumb.tsx
Values#
Breadcrumb#
Renders the styled breadcrumb primitive.
Copyable example
import { Breadcrumb } from "@kovojs/ui/breadcrumb";
const component = Breadcrumb;Signature
const Breadcrumb = component({
render(props: BreadcrumbProps) {
const rootAttrs = style.attrs(breadcrumbStyles.root, props.styles?.root);
const listAttrs = style.attrs(breadcrumbStyles.list, props.styles?.list);
return (
<nav {...rootAttrs} aria-label={props.label ?? 'Breadcrumb'}>
<ol {...listAttrs}>{props.children}</ol>
</nav>
);
},
});BreadcrumbItem#
Renders the styled breadcrumb item primitive.
Copyable example
import { BreadcrumbItem } from "@kovojs/ui/breadcrumb";
const component = BreadcrumbItem;Signature
const BreadcrumbItem = component({
render(props: BreadcrumbPartProps) {
const attrs = style.attrs(breadcrumbStyles.item, props.styles?.item);
return <li {...attrs}>{props.children}</li>;
},
});BreadcrumbLink#
Renders the styled breadcrumb link primitive.
Copyable example
import { BreadcrumbLink } from "@kovojs/ui/breadcrumb";
const component = BreadcrumbLink;Signature
const BreadcrumbLink = component({
render(props: BreadcrumbLinkProps) {
const current = props.current === true;
return (
<a
{...styleAttributes(
current ? breadcrumbStyles.current : breadcrumbStyles.link,
current ? props.styles?.current : props.styles?.link,
)}
{...passThroughProps(props)}
aria-current={current ? 'page' : undefined}
// SECURITY_FINDINGS.md H3: route the caller href through safeUrl so a
// `javascript:`/`data:` scheme is neutralized; keep the existing
// undefined semantics (omit href entirely when there is none / current).
href={current || props.href === undefined ? undefined : safeUrl(props.href)}
>
{props.children}
</a>
);
},
});BreadcrumbSeparator#
Renders the styled breadcrumb separator primitive.
Copyable example
import { BreadcrumbSeparator } from "@kovojs/ui/breadcrumb";
const component = BreadcrumbSeparator;Signature
const BreadcrumbSeparator = component({
render(props: BreadcrumbPartProps) {
const attrs = separatorRootAttributes();
const hasText = props.children !== undefined;
const styleAttrs = style.attrs(
breadcrumbStyles.separator,
hasText ? breadcrumbStyles.separatorText : undefined,
props.styles?.separator,
);
return (
<li
{...styleAttrs}
{...passThroughProps(props)}
aria-hidden="true"
data-orientation={attrs['data-orientation']}
role={attrs.role}
>
{props.children}
</li>
);
},
});Supporting types#
BreadcrumbStyleOverrides#
Style override slots accepted by the breadcrumb components.
Copyable example
import type { BreadcrumbStyleOverrides } from "@kovojs/ui/breadcrumb";
const styles: BreadcrumbStyleOverrides = {};Signature
interface BreadcrumbStyleOverrides {
current?: style.StyleInput;
item?: style.StyleInput;
link?: style.StyleInput;
list?: style.StyleInput;
root?: style.StyleInput;
separator?: style.StyleInput;
}BreadcrumbProps#
Props for the breadcrumb component.
Copyable example
import type { BreadcrumbProps } from "@kovojs/ui/breadcrumb";
const props: BreadcrumbProps = { children: 'Content' };Signature
interface BreadcrumbProps {
children?: ComponentChild;
label?: string;
styles?: BreadcrumbStyleOverrides;
}BreadcrumbPartProps#
Props for the breadcrumb part component.
Copyable example
import type { BreadcrumbPartProps } from "@kovojs/ui/breadcrumb";
const props: BreadcrumbPartProps = { children: 'Content' };Signature
interface BreadcrumbPartProps {
children?: ComponentChild;
styles?: BreadcrumbStyleOverrides;
}BreadcrumbLinkProps#
Props for the breadcrumb link component.
Copyable example
import type { BreadcrumbLinkProps } from "@kovojs/ui/breadcrumb";
const props: BreadcrumbLinkProps = { children: 'Content' };Signature
interface BreadcrumbLinkProps extends BreadcrumbPartProps {
current?: boolean;
href?: string | TrustedUrl;
}@kovojs/ui/button#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/button.tsx
Values#
Button#
Renders the styled button primitive.
Copyable example
import { Button } from "@kovojs/ui/button";
const component = Button;Signature
const Button = component({
render(props: ButtonProps) {
const attrs = style.attrs(
base.root,
sizes[props.size ?? 'md'],
variants[props.variant ?? 'primary'],
props.style,
);
return (
<button
{...attrs}
{...passThroughProps(props)}
disabled={props.disabled}
form={props.form}
name={props.name}
type={props.type ?? 'button'}
value={props.value}
>
{props.children}
</button>
);
},
});Supporting types#
ButtonVariant#
Supported button variant values.
Copyable example
import type { ButtonVariant } from "@kovojs/ui/button";
const value: ButtonVariant = 'primary';Signature
type ButtonVariant = 'primary' | 'secondary' | 'ghost' | 'destructive' | 'outline';ButtonSize#
Supported button size values.
Copyable example
import type { ButtonSize } from "@kovojs/ui/button";
const value: ButtonSize = 'md';Signature
type ButtonSize = 'sm' | 'md';ButtonProps#
Props for the button component.
Copyable example
import type { ButtonProps } from "@kovojs/ui/button";
const props: ButtonProps = { children: 'Content' };Signature
interface ButtonProps {
children?: ComponentChild;
disabled?: boolean;
form?: string;
name?: string;
size?: ButtonSize;
style?: style.StyleInput;
type?: 'button' | 'submit' | 'reset';
value?: string;
variant?: ButtonVariant;
}@kovojs/ui/card#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/card.tsx
Values#
Card#
Renders the styled card primitive.
Copyable example
import { Card } from "@kovojs/ui/card";
const component = Card;Signature
const Card = component({
render(props: CardProps) {
const attrs = style.attrs(cardStyles.root, props.style);
return <section {...attrs}>{props.children}</section>;
},
});CardHeader#
Groups a card title and description.
Copyable example
import { CardHeader } from "@kovojs/ui/card";
const component = CardHeader;Signature
const CardHeader = component({
render(props: CardHeaderProps) {
return <div {...style.attrs(cardStyles.header, props.style)}>{props.children}</div>;
},
});CardTitle#
Renders the card's heading.
Copyable example
import { CardTitle } from "@kovojs/ui/card";
const component = CardTitle;Signature
const CardTitle = component({
render(props: CardTitleProps) {
return <h3 {...style.attrs(cardStyles.title, props.style)}>{props.children}</h3>;
},
});CardDescription#
Renders supporting text for the card title.
Copyable example
import { CardDescription } from "@kovojs/ui/card";
const component = CardDescription;Signature
const CardDescription = component({
render(props: CardDescriptionProps) {
return <p {...style.attrs(cardStyles.description, props.style)}>{props.children}</p>;
},
});CardContent#
Renders the card's primary content region.
Copyable example
import { CardContent } from "@kovojs/ui/card";
const component = CardContent;Signature
const CardContent = component({
render(props: CardContentProps) {
return <div {...style.attrs(cardStyles.content, props.style)}>{props.children}</div>;
},
});CardFooter#
Renders trailing card actions or metadata.
Copyable example
import { CardFooter } from "@kovojs/ui/card";
const component = CardFooter;Signature
const CardFooter = component({
render(props: CardFooterProps) {
return <footer {...style.attrs(cardStyles.footer, props.style)}>{props.children}</footer>;
},
});Supporting types#
CardProps#
Props for the card component.
Copyable example
import type { CardProps } from "@kovojs/ui/card";
const props: CardProps = { children: 'Content' };Signature
interface CardProps {
children?: ComponentChild;
style?: style.StyleInput;
}CardHeaderProps#
Props for the structural header region of a {@link Card}.
Signature
interface CardHeaderProps extends CardProps {}CardTitleProps#
Props for the heading rendered inside a {@link CardHeader}.
Signature
interface CardTitleProps extends CardProps {}CardDescriptionProps#
Props for supporting copy rendered inside a {@link CardHeader}.
Signature
interface CardDescriptionProps extends CardProps {}CardContentProps#
Props for the primary content region of a {@link Card}.
Signature
interface CardContentProps extends CardProps {}CardFooterProps#
Props for the trailing actions or metadata region of a {@link Card}.
Signature
interface CardFooterProps extends CardProps {}@kovojs/ui/checkbox#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/checkbox.tsx
Values#
Checkbox#
Renders the styled checkbox primitive.
Copyable example
import { Checkbox } from "@kovojs/ui/checkbox";
const component = Checkbox;Signature
const Checkbox = component({
render(props: CheckboxProps) {
const attrs = checkboxRootAttributes({
checked: props.checked ?? false,
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.required === undefined ? {} : { required: props.required }),
...(props.value === undefined ? {} : { value: props.value }),
});
const rootStyleAttrs = style.attrs(checkboxStyles.root, props.styles?.root);
const inputStyleAttrs = style.attrs(checkboxStyles.input, props.styles?.input);
const boxStyleAttrs = style.attrs(checkboxStyles.box, props.styles?.box);
return (
<label
{...rootStyleAttrs}
{...passThroughProps(props, { events: false, bindings: false })}
{...bindingProps(props, ['data-state'])}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
>
<span
{...boxStyleAttrs}
{...bindingProps(props, ['data-state'])}
data-state={attrs['data-state']}
>
<input
{...inputStyleAttrs}
{...passThroughProps(props, { island: false })}
aria-checked={attrs['aria-checked']}
aria-describedby={props.describedBy}
aria-labelledby={props.labelledBy}
checked={attrs.checked}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
disabled={attrs.disabled}
form={props.form}
id={props.id}
name={attrs.name}
required={attrs.required}
type={attrs.type}
value={attrs.value}
/>
</span>
{props.children}
</label>
);
},
});Supporting types#
CheckboxStyleOverrides#
Style override slots accepted by the checkbox components.
Copyable example
import type { CheckboxStyleOverrides } from "@kovojs/ui/checkbox";
const styles: CheckboxStyleOverrides = {};Signature
interface CheckboxStyleOverrides {
box?: style.StyleInput;
input?: style.StyleInput;
root?: style.StyleInput;
}CheckboxProps#
Props for the checkbox component.
Copyable example
import type { CheckboxProps } from "@kovojs/ui/checkbox";
const props: CheckboxProps = { children: 'Content' };Signature
interface CheckboxProps {
describedBy?: string;
checked?: CheckboxCheckedState;
children?: ComponentChild;
disabled?: boolean;
form?: string;
id?: string;
labelledBy?: string;
name?: string;
required?: boolean;
styles?: CheckboxStyleOverrides;
value?: string;
}@kovojs/ui/checkbox-group#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/checkbox-group.tsx
Values#
CheckboxGroup#
Renders the styled checkbox group primitive.
Copyable example
import { CheckboxGroup } from "@kovojs/ui/checkbox-group";
const component = CheckboxGroup;Signature
const CheckboxGroup = component({
render(props: CheckboxGroupProps) {
const attrs = checkboxGroupRootAttributes({
...(props.activeValue === undefined ? {} : { activeValue: props.activeValue }),
...(props.descriptionId === undefined ? {} : { descriptionId: props.descriptionId }),
...(props.dir === undefined ? {} : { dir: props.dir }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.errorId === undefined ? {} : { errorId: props.errorId }),
...(props.form === undefined ? {} : { form: props.form }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.items === undefined ? {} : { items: props.items }),
...(props.labelledBy === undefined ? {} : { labelledBy: props.labelledBy }),
...(props.loop === undefined ? {} : { loop: props.loop }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.orientation === undefined ? {} : { orientation: props.orientation }),
...(props.required === undefined ? {} : { required: props.required }),
...(props.value === undefined ? {} : { value: props.value }),
});
const styleAttrs = style.attrs(checkboxGroupStyles.root, props.styles?.root);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
aria-describedby={attrs['aria-describedby']}
aria-disabled={attrs['aria-disabled']}
aria-invalid={attrs['aria-invalid']}
aria-labelledby={attrs['aria-labelledby']}
aria-required={attrs['aria-required']}
data-disabled={attrs['data-disabled']}
data-invalid={attrs['data-invalid']}
data-orientation={attrs['data-orientation']}
data-required={attrs['data-required']}
id={attrs.id}
role={attrs.role}
>
{props.children}
</div>
);
},
});CheckboxGroupItem#
Renders the styled checkbox group item primitive.
Copyable example
import { CheckboxGroupItem } from "@kovojs/ui/checkbox-group";
const component = CheckboxGroupItem;Signature
const CheckboxGroupItem = component({
render(props: CheckboxGroupItemProps) {
const attrs = checkboxGroupItemAttributes({
...(props.activeValue === undefined ? {} : { activeValue: props.activeValue }),
...(props.dir === undefined ? {} : { dir: props.dir }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.form === undefined ? {} : { form: props.form }),
...(props.itemDisabled === undefined ? {} : { itemDisabled: props.itemDisabled }),
...(props.items === undefined ? {} : { items: props.items }),
itemValue: props.itemValue,
...(props.loop === undefined ? {} : { loop: props.loop }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.orientation === undefined ? {} : { orientation: props.orientation }),
...(props.required === undefined ? {} : { required: props.required }),
...(props.value === undefined ? {} : { value: props.value }),
});
const styleAttrs = style.attrs(checkboxGroupStyles.item, props.styles?.item);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
id={attrs.id}
>
{props.children}
</div>
);
},
});CheckboxGroupControl#
Renders the styled checkbox group control primitive.
Copyable example
import { CheckboxGroupControl } from "@kovojs/ui/checkbox-group";
const component = CheckboxGroupControl;Signature
const CheckboxGroupControl = component({
render(props: CheckboxGroupControlProps) {
const attrs = checkboxGroupControlAttributes({
...(props.activeValue === undefined ? {} : { activeValue: props.activeValue }),
...(props.dir === undefined ? {} : { dir: props.dir }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.form === undefined ? {} : { form: props.form }),
...(props.itemDisabled === undefined ? {} : { itemDisabled: props.itemDisabled }),
...(props.items === undefined ? {} : { items: props.items }),
itemValue: props.itemValue,
...(props.loop === undefined ? {} : { loop: props.loop }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.orientation === undefined ? {} : { orientation: props.orientation }),
...(props.required === undefined ? {} : { required: props.required }),
...(props.value === undefined ? {} : { value: props.value }),
...(props.controlId === undefined ? {} : { controlId: props.controlId }),
});
const boxStyleAttrs = style.attrs(checkboxGroupStyles.control, props.styles?.control);
const inputStyleAttrs = style.attrs(checkboxGroupStyles.controlInput);
// Custom box matching the standalone Checkbox (checkbox.tsx): a decorative
// `span` paints the teal fill + check glyph driven by data-state, wrapping a
// visually-hidden native input that remains the real checkbox — semantics,
// form state, events, island ownership, and the single click/focus/tab
// target. bindingProps forwards only the data-state binding stamp so the box
// re-renders its fill client-side without becoming a second tab stop or
// splitting the island scope (SPEC.md §4.6).
return (
<span
{...boxStyleAttrs}
{...bindingProps(props, ['data-state'])}
data-state={attrs['data-state']}
>
<input
{...inputStyleAttrs}
{...passThroughProps(props)}
aria-checked={attrs['aria-checked']}
checked={attrs.checked}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
disabled={attrs.disabled}
form={attrs.form}
id={attrs.id}
name={attrs.name}
required={attrs.required}
tabIndex={attrs.tabIndex}
type={attrs.type}
value={attrs.value}
/>
</span>
);
},
});CheckboxGroupLabel#
Renders the styled checkbox group label primitive.
Copyable example
import { CheckboxGroupLabel } from "@kovojs/ui/checkbox-group";
const component = CheckboxGroupLabel;Signature
const CheckboxGroupLabel = component({
render(props: CheckboxGroupLabelProps) {
const attrs = checkboxGroupLabelAttributes({
...(props.activeValue === undefined ? {} : { activeValue: props.activeValue }),
...(props.dir === undefined ? {} : { dir: props.dir }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.form === undefined ? {} : { form: props.form }),
...(props.itemDisabled === undefined ? {} : { itemDisabled: props.itemDisabled }),
...(props.items === undefined ? {} : { items: props.items }),
itemValue: props.itemValue,
...(props.loop === undefined ? {} : { loop: props.loop }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.orientation === undefined ? {} : { orientation: props.orientation }),
...(props.required === undefined ? {} : { required: props.required }),
...(props.value === undefined ? {} : { value: props.value }),
...(props.controlId === undefined ? {} : { controlId: props.controlId }),
});
const styleAttrs = style.attrs(checkboxGroupStyles.label, props.styles?.label);
return (
<label
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
for={attrs.for}
id={attrs.id}
>
{props.children}
</label>
);
},
});Supporting types#
CheckboxGroupStyleOverrides#
Style override slots accepted by the checkbox group components.
Copyable example
import type { CheckboxGroupStyleOverrides } from "@kovojs/ui/checkbox-group";
const styles: CheckboxGroupStyleOverrides = {};Signature
interface CheckboxGroupStyleOverrides {
control?: style.StyleInput;
item?: style.StyleInput;
label?: style.StyleInput;
root?: style.StyleInput;
}CheckboxGroupStateProps#
Shared state props for the checkbox group component family.
Copyable example
import type { CheckboxGroupStateProps } from "@kovojs/ui/checkbox-group";
const state: CheckboxGroupStateProps = {};Signature
interface CheckboxGroupStateProps {
activeValue?: string;
descriptionId?: string;
dir?: TextDirection;
disabled?: boolean;
errorId?: string;
form?: string;
invalid?: boolean;
items?: readonly HeadlessCheckboxGroupItem[];
loop?: boolean;
name?: string;
orientation?: CollectionOrientation;
required?: boolean;
value?: readonly string[];
}CheckboxGroupProps#
Props for the checkbox group component.
Copyable example
import type { CheckboxGroupProps } from "@kovojs/ui/checkbox-group";
const props: CheckboxGroupProps = { children: 'Content' };Signature
interface CheckboxGroupProps extends CheckboxGroupStateProps {
children?: ComponentChild;
id?: string;
labelledBy?: string;
styles?: CheckboxGroupStyleOverrides;
}CheckboxGroupItemProps#
Props for the checkbox group item component.
Copyable example
import type { CheckboxGroupItemProps } from "@kovojs/ui/checkbox-group";
const props: CheckboxGroupItemProps = { itemValue: 'item', children: 'Content' };Signature
interface CheckboxGroupItemProps extends CheckboxGroupStateProps {
children?: ComponentChild;
id?: string;
itemDisabled?: boolean;
itemValue: string;
styles?: CheckboxGroupStyleOverrides;
}CheckboxGroupControlProps#
Props for the checkbox group control component.
Copyable example
import type { CheckboxGroupControlProps } from "@kovojs/ui/checkbox-group";
const props: CheckboxGroupControlProps = { itemValue: 'item' };Signature
interface CheckboxGroupControlProps extends CheckboxGroupStateProps {
controlId?: string;
itemDisabled?: boolean;
itemValue: string;
styles?: CheckboxGroupStyleOverrides;
}CheckboxGroupLabelProps#
Props for the checkbox group label component.
Copyable example
import type { CheckboxGroupLabelProps } from "@kovojs/ui/checkbox-group";
const props: CheckboxGroupLabelProps = { itemValue: 'item', children: 'Content' };Signature
interface CheckboxGroupLabelProps extends CheckboxGroupStateProps {
children?: ComponentChild;
controlId?: string;
id?: string;
itemDisabled?: boolean;
itemValue: string;
styles?: CheckboxGroupStyleOverrides;
}@kovojs/ui/collapsible#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/collapsible.tsx
Values#
Collapsible#
Renders the styled collapsible primitive.
Copyable example
import { Collapsible } from "@kovojs/ui/collapsible";
const component = Collapsible;Signature
const Collapsible = component({
render(props: CollapsibleProps) {
const attrs = collapsibleRootAttributes(collapsibleState(props));
const styleAttrs = style.attrs(collapsibleStyles.root, props.styles?.root);
return (
<details
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
id={props.id}
open={attrs.open}
>
{props.children}
</details>
);
},
});CollapsibleTrigger#
Renders the styled collapsible trigger primitive.
Copyable example
import { CollapsibleTrigger } from "@kovojs/ui/collapsible";
const component = CollapsibleTrigger;Signature
const CollapsibleTrigger = component({
render(props: CollapsibleTriggerProps) {
const attrs = collapsibleTriggerAttributes({
...collapsibleState(props),
...(props.contentId === undefined ? {} : { contentId: props.contentId }),
});
const styleAttrs = style.attrs(collapsibleStyles.trigger, props.styles?.trigger);
return (
<summary
aria-controls={attrs['aria-controls']}
aria-expanded={attrs['aria-expanded']}
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
id={props.id}
>
{props.children}
</summary>
);
},
});CollapsibleContent#
Renders the styled collapsible content primitive.
Copyable example
import { CollapsibleContent } from "@kovojs/ui/collapsible";
const component = CollapsibleContent;Signature
const CollapsibleContent = component({
render(props: CollapsibleContentProps) {
const attrs = collapsibleContentAttributes({
...collapsibleState(props),
...(props.contentId === undefined ? {} : { contentId: props.contentId }),
});
const styleAttrs = style.attrs(collapsibleStyles.content, props.styles?.content);
const innerStyleAttrs = style.attrs(collapsibleStyles.contentInner);
return (
// passThroughProps forwards the compiler-emitted data-bind:* reactive stamps
// (e.g. data-bind:data-state) so the panel re-renders open/closed client-side;
// without it the SSR value stays frozen and the content never reveals.
// Outer div is the animatable grid wrapper; the inner div holds the padded
// content and mirrors data-state so its padding collapses with the row.
<div
{...styleAttrs}
{...passThroughProps(props)}
data-state={attrs['data-state']}
id={attrs.id}
>
<div {...innerStyleAttrs} data-state={attrs['data-state']}>
{props.children}
</div>
</div>
);
},
});Supporting types#
CollapsibleStateProps#
Shared state props for the collapsible component family.
Copyable example
import type { CollapsibleStateProps } from "@kovojs/ui/collapsible";
const state: CollapsibleStateProps = {};Signature
interface CollapsibleStateProps {
disabled?: boolean;
open?: boolean;
}CollapsibleStyleOverrides#
Style override slots accepted by the collapsible components.
Copyable example
import type { CollapsibleStyleOverrides } from "@kovojs/ui/collapsible";
const styles: CollapsibleStyleOverrides = {};Signature
interface CollapsibleStyleOverrides {
content?: style.StyleInput;
root?: style.StyleInput;
trigger?: style.StyleInput;
}CollapsibleProps#
Props for the collapsible component.
Copyable example
import type { CollapsibleProps } from "@kovojs/ui/collapsible";
const props: CollapsibleProps = { children: 'Content' };Signature
interface CollapsibleProps extends CollapsibleStateProps {
children?: ComponentChild;
id?: string;
styles?: CollapsibleStyleOverrides;
}CollapsibleTriggerProps#
Props for the collapsible trigger component.
Copyable example
import type { CollapsibleTriggerProps } from "@kovojs/ui/collapsible";
const props: CollapsibleTriggerProps = { children: 'Content' };Signature
interface CollapsibleTriggerProps extends CollapsibleStateProps {
children?: ComponentChild;
contentId?: string;
id?: string;
styles?: CollapsibleStyleOverrides;
}CollapsibleContentProps#
Props for the collapsible content component.
Copyable example
import type { CollapsibleContentProps } from "@kovojs/ui/collapsible";
const props: CollapsibleContentProps = { children: 'Content' };Signature
interface CollapsibleContentProps extends CollapsibleStateProps {
children?: ComponentChild;
contentId?: string;
styles?: CollapsibleStyleOverrides;
}@kovojs/ui/combobox#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/combobox.tsx
Values#
Combobox#
Renders the styled combobox primitive.
Copyable example
import { Combobox } from "@kovojs/ui/combobox";
const component = Combobox;Signature
const Combobox = component({
render(props: ComboboxProps) {
const attrs = comboboxRootAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.form === undefined ? {} : { form: props.form }),
...(props.highlightedValue === undefined ? {} : { highlightedValue: props.highlightedValue }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.items === undefined ? {} : { items: props.items }),
...(props.listboxId === undefined ? {} : { listboxId: props.listboxId }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.open === undefined ? {} : { open: props.open }),
...(props.placeholder === undefined ? {} : { placeholder: props.placeholder }),
...(props.required === undefined ? {} : { required: props.required }),
...(props.value === undefined ? {} : { value: props.value }),
});
const styleAttrs = style.attrs(comboboxStyles.root, props.styles?.root);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-invalid={attrs['data-invalid']}
data-placeholder={attrs['data-placeholder']}
data-required={attrs['data-required']}
data-state={attrs['data-state']}
id={attrs.id}
>
{props.children}
</div>
);
},
});ComboboxInput#
Renders the styled combobox input primitive.
Copyable example
import { ComboboxInput } from "@kovojs/ui/combobox";
const component = ComboboxInput;Signature
const ComboboxInput = component({
render(props: ComboboxInputProps) {
const attrs = comboboxInputAttributes({
...(props.descriptionId === undefined ? {} : { descriptionId: props.descriptionId }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.errorId === undefined ? {} : { errorId: props.errorId }),
...(props.form === undefined ? {} : { form: props.form }),
...(props.highlightedValue === undefined ? {} : { highlightedValue: props.highlightedValue }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.items === undefined ? {} : { items: props.items }),
...(props.labelledBy === undefined ? {} : { labelledBy: props.labelledBy }),
...(props.listboxId === undefined ? {} : { listboxId: props.listboxId }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.open === undefined ? {} : { open: props.open }),
...(props.placeholder === undefined ? {} : { placeholder: props.placeholder }),
...(props.required === undefined ? {} : { required: props.required }),
...(props.value === undefined ? {} : { value: props.value }),
});
const styleAttrs = style.attrs(comboboxStyles.input, props.styles?.input);
return (
<input
{...styleAttrs}
{...passThroughProps(props)}
aria-activedescendant={attrs['aria-activedescendant']}
aria-autocomplete={attrs['aria-autocomplete']}
aria-controls={attrs['aria-controls']}
aria-describedby={attrs['aria-describedby']}
aria-expanded={attrs['aria-expanded']}
aria-invalid={attrs['aria-invalid']}
aria-labelledby={attrs['aria-labelledby']}
data-disabled={attrs['data-disabled']}
data-invalid={attrs['data-invalid']}
data-placeholder={attrs['data-placeholder']}
data-required={attrs['data-required']}
data-state={attrs['data-state']}
disabled={attrs.disabled}
form={attrs.form}
id={attrs.id}
list={attrs.list}
name={attrs.name}
placeholder={attrs.placeholder}
required={attrs.required}
role={attrs.role}
type={attrs.type}
value={attrs.value}
/>
);
},
});ComboboxListbox#
Renders the styled combobox listbox primitive.
Copyable example
import { ComboboxListbox } from "@kovojs/ui/combobox";
const component = ComboboxListbox;Signature
const ComboboxListbox = component({
render(props: ComboboxListboxProps) {
const attrs = comboboxListboxAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.form === undefined ? {} : { form: props.form }),
...(props.highlightedValue === undefined ? {} : { highlightedValue: props.highlightedValue }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.items === undefined ? {} : { items: props.items }),
...(props.labelledBy === undefined ? {} : { labelledBy: props.labelledBy }),
...(props.listboxId === undefined ? {} : { listboxId: props.listboxId }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.open === undefined ? {} : { open: props.open }),
...(props.placeholder === undefined ? {} : { placeholder: props.placeholder }),
...(props.required === undefined ? {} : { required: props.required }),
...(props.value === undefined ? {} : { value: props.value }),
});
const styleAttrs = style.attrs(comboboxStyles.listbox, props.styles?.listbox);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
aria-labelledby={attrs['aria-labelledby']}
data-disabled={attrs['data-disabled']}
data-invalid={attrs['data-invalid']}
data-placeholder={attrs['data-placeholder']}
data-required={attrs['data-required']}
data-state={attrs['data-state']}
hidden={attrs.hidden}
id={attrs.id}
role={attrs.role}
>
{props.children}
</div>
);
},
});ComboboxOption#
Renders the styled combobox option primitive.
Copyable example
import { ComboboxOption } from "@kovojs/ui/combobox";
const component = ComboboxOption;Signature
const ComboboxOption = component({
render(props: ComboboxOptionProps) {
const attrs = comboboxOptionAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.form === undefined ? {} : { form: props.form }),
...(props.highlightedValue === undefined ? {} : { highlightedValue: props.highlightedValue }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.itemDisabled === undefined ? {} : { itemDisabled: props.itemDisabled }),
...(props.itemLabel === undefined ? {} : { itemLabel: props.itemLabel }),
...(props.items === undefined ? {} : { items: props.items }),
itemValue: props.itemValue,
...(props.listboxId === undefined ? {} : { listboxId: props.listboxId }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.open === undefined ? {} : { open: props.open }),
...(props.placeholder === undefined ? {} : { placeholder: props.placeholder }),
...(props.required === undefined ? {} : { required: props.required }),
...(props.value === undefined ? {} : { value: props.value }),
});
const styleAttrs = style.attrs(comboboxStyles.option, props.styles?.option);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
aria-disabled={attrs['aria-disabled']}
aria-selected={attrs['aria-selected']}
data-disabled={attrs['data-disabled']}
data-highlighted={attrs['data-highlighted']}
data-state={attrs['data-state']}
id={attrs.id}
role={attrs.role}
value={attrs.value}
>
{props.children ?? props.itemLabel ?? props.itemValue ?? ''}
</div>
);
},
});ComboboxValue#
Renders the styled combobox value primitive.
Copyable example
import { ComboboxValue } from "@kovojs/ui/combobox";
const component = ComboboxValue;Signature
const ComboboxValue = component({
render(props: ComboboxValueProps) {
const attrs = comboboxValueAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.form === undefined ? {} : { form: props.form }),
...(props.highlightedValue === undefined ? {} : { highlightedValue: props.highlightedValue }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.items === undefined ? {} : { items: props.items }),
...(props.listboxId === undefined ? {} : { listboxId: props.listboxId }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.open === undefined ? {} : { open: props.open }),
...(props.placeholder === undefined ? {} : { placeholder: props.placeholder }),
...(props.required === undefined ? {} : { required: props.required }),
...(props.value === undefined ? {} : { value: props.value }),
});
const styleAttrs = style.attrs(comboboxStyles.value, props.styles?.value);
return (
<span
{...styleAttrs}
{...passThroughProps(props)}
data-placeholder={attrs['data-placeholder']}
id={attrs.id}
>
{comboboxValueText(props)}
</span>
);
},
});Supporting types#
ComboboxStyleOverrides#
Style override slots accepted by the combobox components.
Copyable example
import type { ComboboxStyleOverrides } from "@kovojs/ui/combobox";
const styles: ComboboxStyleOverrides = {};Signature
interface ComboboxStyleOverrides {
input?: style.StyleInput;
listbox?: style.StyleInput;
option?: style.StyleInput;
root?: style.StyleInput;
value?: style.StyleInput;
}ComboboxStateProps#
Shared state props for the combobox component family.
Copyable example
import type { ComboboxStateProps } from "@kovojs/ui/combobox";
const state: ComboboxStateProps = {};Signature
interface ComboboxStateProps {
disabled?: boolean;
form?: string;
highlightedValue?: string;
invalid?: boolean;
items?: readonly HeadlessComboboxItem[];
listboxId?: string;
name?: string;
open?: boolean;
placeholder?: string;
required?: boolean;
value?: string;
}ComboboxProps#
Props for the combobox component.
Copyable example
import type { ComboboxProps } from "@kovojs/ui/combobox";
const props: ComboboxProps = { children: 'Content' };Signature
interface ComboboxProps extends ComboboxStateProps {
children?: ComponentChild;
id?: string;
styles?: ComboboxStyleOverrides;
}ComboboxInputProps#
Props for the combobox input component.
Copyable example
import type { ComboboxInputProps } from "@kovojs/ui/combobox";
const props: ComboboxInputProps = {};Signature
interface ComboboxInputProps extends ComboboxStateProps {
descriptionId?: string;
errorId?: string;
id?: string;
labelledBy?: string;
styles?: ComboboxStyleOverrides;
}ComboboxListboxProps#
Props for the combobox listbox component.
Copyable example
import type { ComboboxListboxProps } from "@kovojs/ui/combobox";
const props: ComboboxListboxProps = { children: 'Content' };Signature
interface ComboboxListboxProps extends ComboboxStateProps {
children?: ComponentChild;
id?: string;
labelledBy?: string;
styles?: ComboboxStyleOverrides;
}ComboboxOptionProps#
Props for the combobox option component.
Copyable example
import type { ComboboxOptionProps } from "@kovojs/ui/combobox";
const props: ComboboxOptionProps = { itemValue: 'item', children: 'Content' };Signature
interface ComboboxOptionProps extends ComboboxStateProps {
children?: ComponentChild;
id?: string;
itemDisabled?: boolean;
itemLabel?: string;
itemValue: string;
styles?: ComboboxStyleOverrides;
}ComboboxValueProps#
Props for the combobox value component.
Copyable example
import type { ComboboxValueProps } from "@kovojs/ui/combobox";
const props: ComboboxValueProps = {};Signature
interface ComboboxValueProps extends ComboboxStateProps {
id?: string;
styles?: ComboboxStyleOverrides;
}@kovojs/ui/command#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/command.tsx
Values#
Command#
Renders the styled command primitive.
Copyable example
import { Command } from "@kovojs/ui/command";
const component = Command;Signature
const Command = component({
render(props: CommandProps) {
const attrs = commandRootAttributes(toCommandState(props));
const styleAttrs = style.attrs(commandStyles.root, props.styles?.root);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-invalid={attrs['data-invalid']}
data-required={attrs['data-required']}
data-state={attrs['data-state']}
id={attrs.id}
>
{props.children}
</div>
);
},
});CommandTrigger#
Renders the styled command trigger primitive.
Copyable example
import { CommandTrigger } from "@kovojs/ui/command";
const component = CommandTrigger;Signature
const CommandTrigger = component({
render(props: CommandTriggerProps) {
const attrs = commandTriggerAttributes({
...toCommandState(props),
...(props.contentId === undefined ? {} : { contentId: props.contentId }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.labelledBy === undefined ? {} : { labelledBy: props.labelledBy }),
});
const styleAttrs = style.attrs(commandStyles.trigger, props.styles?.trigger);
return (
<button
{...styleAttrs}
{...passThroughProps(props)}
aria-controls={attrs['aria-controls']}
aria-expanded={attrs['aria-expanded']}
aria-haspopup={attrs['aria-haspopup']}
aria-labelledby={attrs['aria-labelledby']}
command={attrs.command}
commandfor={attrs.commandfor}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
disabled={attrs.disabled}
id={attrs.id}
type={attrs.type}
>
{props.children}
</button>
);
},
});CommandDialog#
Renders the styled command dialog primitive.
Copyable example
import { CommandDialog } from "@kovojs/ui/command";
const component = CommandDialog;Signature
const CommandDialog = component({
render(props: CommandDialogProps) {
const attrs = commandDialogAttributes({
...toCommandState(props),
...(props.contentId === undefined ? {} : { contentId: props.contentId }),
...(props.descriptionId === undefined ? {} : { descriptionId: props.descriptionId }),
...(props.titleId === undefined ? {} : { titleId: props.titleId }),
});
const styleAttrs = style.attrs(commandStyles.dialog, props.styles?.dialog);
return (
<dialog
{...styleAttrs}
{...passThroughProps(props)}
aria-describedby={attrs['aria-describedby']}
aria-labelledby={attrs['aria-labelledby']}
aria-modal={attrs['aria-modal']}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
id={attrs.id}
open={attrs.open}
>
{props.children}
</dialog>
);
},
});CommandInput#
Renders the styled command input primitive.
Copyable example
import { CommandInput } from "@kovojs/ui/command";
const component = CommandInput;Signature
const CommandInput = component({
render(props: CommandInputProps) {
const attrs = commandInputAttributes({
...(props.autocomplete === undefined ? {} : { autocomplete: props.autocomplete }),
...toCommandState(props),
...(props.descriptionId === undefined ? {} : { descriptionId: props.descriptionId }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.labelledBy === undefined ? {} : { labelledBy: props.labelledBy }),
...(props.listboxId === undefined ? {} : { listboxId: props.listboxId }),
});
const styleAttrs = style.attrs(commandStyles.input, props.styles?.input);
const wrapperAttrs = style.attrs(commandStyles.inputWrapper);
return (
<div {...wrapperAttrs}>
<Search style={commandStyles.inputIcon} />
<input
{...styleAttrs}
{...passThroughProps(props)}
aria-activedescendant={attrs['aria-activedescendant']}
aria-autocomplete={attrs['aria-autocomplete']}
aria-controls={attrs['aria-controls']}
aria-describedby={attrs['aria-describedby']}
aria-expanded={attrs['aria-expanded']}
aria-invalid={attrs['aria-invalid']}
aria-labelledby={attrs['aria-labelledby']}
autocomplete={attrs.autocomplete}
data-disabled={attrs['data-disabled']}
data-invalid={attrs['data-invalid']}
data-required={attrs['data-required']}
data-state={attrs['data-state']}
disabled={attrs.disabled}
form={attrs.form}
id={attrs.id}
name={attrs.name}
placeholder={attrs.placeholder}
required={attrs.required}
role={attrs.role}
type={attrs.type}
value={attrs.value}
/>
</div>
);
},
});CommandListbox#
Renders the styled command listbox primitive.
Copyable example
import { CommandListbox } from "@kovojs/ui/command";
const component = CommandListbox;Signature
const CommandListbox = component({
render(props: CommandListboxProps) {
const attrs = commandListboxAttributes({
...toCommandState(props),
...(props.id === undefined ? {} : { id: props.id }),
...(props.labelledBy === undefined ? {} : { labelledBy: props.labelledBy }),
});
const styleAttrs = style.attrs(commandStyles.listbox, props.styles?.listbox);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
aria-labelledby={attrs['aria-labelledby']}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
hidden={attrs.hidden}
id={attrs.id}
role={attrs.role}
>
{props.children}
</div>
);
},
});CommandItem#
Renders the styled command item primitive.
Copyable example
import { CommandItem } from "@kovojs/ui/command";
const component = CommandItem;Signature
const CommandItem = component({
render(props: CommandItemProps) {
const attrs = commandItemAttributes({
...toCommandState(props),
...(props.id === undefined ? {} : { id: props.id }),
...(props.itemDisabled === undefined ? {} : { itemDisabled: props.itemDisabled }),
...(props.itemLabel === undefined ? {} : { itemLabel: props.itemLabel }),
...(props.listboxId === undefined ? {} : { listboxId: props.listboxId }),
itemValue: props.itemValue,
});
const styleAttrs = style.attrs(commandStyles.item, props.styles?.item);
return (
<button
{...styleAttrs}
{...passThroughProps(props)}
aria-disabled={attrs['aria-disabled']}
aria-selected={attrs['aria-selected']}
data-disabled={attrs['data-disabled']}
data-highlighted={attrs['data-highlighted']}
data-state={attrs['data-state']}
disabled={attrs['data-disabled'] === '' ? true : undefined}
id={attrs.id}
role={attrs.role}
tabIndex={attrs.tabIndex}
type="button"
value={attrs.value}
>
{props.children ?? props.itemLabel ?? props.itemValue ?? ''}
</button>
);
},
});CommandClose#
Renders the styled command close primitive.
Copyable example
import { CommandClose } from "@kovojs/ui/command";
const component = CommandClose;Signature
const CommandClose = component({
render(props: CommandCloseProps) {
const attrs = commandCloseAttributes({
...toCommandState(props),
...(props.contentId === undefined ? {} : { contentId: props.contentId }),
});
const styleAttrs = style.attrs(commandStyles.close, props.styles?.close);
return (
<button
{...styleAttrs}
{...passThroughProps(props)}
command={attrs.command}
commandfor={attrs.commandfor}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
disabled={attrs.disabled}
type={attrs.type}
>
{props.children ?? 'Close'}
</button>
);
},
});CommandEmpty#
Renders the styled command empty primitive.
Copyable example
import { CommandEmpty } from "@kovojs/ui/command";
const component = CommandEmpty;Signature
const CommandEmpty = component({
render(props: CommandEmptyProps) {
const attrs = commandEmptyAttributes({
...toCommandState(props),
...(props.id === undefined ? {} : { id: props.id }),
});
const styleAttrs = style.attrs(commandStyles.empty, props.styles?.empty);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
data-empty={attrs['data-empty']}
hidden={attrs.hidden}
id={attrs.id}
>
{props.children ?? 'No results'}
</div>
);
},
});CommandValue#
Renders the styled command value primitive.
Copyable example
import { CommandValue } from "@kovojs/ui/command";
const component = CommandValue;Signature
const CommandValue = component({
render(props: CommandValueProps) {
const styleAttrs = style.attrs(commandStyles.value, props.styles?.value);
return (
<span {...styleAttrs} {...passThroughProps(props)} id={props.id}>
{commandValueText(props)}
</span>
);
},
});Supporting types#
CommandStyleOverrides#
Style override slots accepted by the command components.
Copyable example
import type { CommandStyleOverrides } from "@kovojs/ui/command";
const styles: CommandStyleOverrides = {};Signature
interface CommandStyleOverrides {
close?: style.StyleInput;
dialog?: style.StyleInput;
empty?: style.StyleInput;
input?: style.StyleInput;
item?: style.StyleInput;
listbox?: style.StyleInput;
root?: style.StyleInput;
trigger?: style.StyleInput;
value?: style.StyleInput;
}CommandStateProps#
Shared state props for the command component family.
Copyable example
import type { CommandStateProps } from "@kovojs/ui/command";
const state: CommandStateProps = {};Signature
interface CommandStateProps {
disabled?: boolean;
form?: string;
highlightedValue?: string;
inputValue?: string;
invalid?: boolean;
items?: readonly HeadlessCommandItem[];
name?: string;
open?: boolean;
placeholder?: string;
required?: boolean;
value?: string;
}CommandProps#
Props for the command component.
Copyable example
import type { CommandProps } from "@kovojs/ui/command";
const props: CommandProps = { children: 'Content' };Signature
interface CommandProps extends CommandStateProps {
children?: ComponentChild;
id?: string;
styles?: CommandStyleOverrides;
}CommandTriggerProps#
Props for the command trigger component.
Copyable example
import type { CommandTriggerProps } from "@kovojs/ui/command";
const props: CommandTriggerProps = { children: 'Content' };Signature
interface CommandTriggerProps extends CommandStateProps {
children?: ComponentChild;
contentId?: string;
id?: string;
labelledBy?: string;
styles?: CommandStyleOverrides;
}CommandDialogProps#
Props for the command dialog component.
Copyable example
import type { CommandDialogProps } from "@kovojs/ui/command";
const props: CommandDialogProps = { children: 'Content' };Signature
interface CommandDialogProps extends CommandStateProps {
children?: ComponentChild;
contentId?: string;
descriptionId?: string;
styles?: CommandStyleOverrides;
titleId?: string;
}CommandCloseProps#
Props for the command close component.
Copyable example
import type { CommandCloseProps } from "@kovojs/ui/command";
const props: CommandCloseProps = { children: 'Content' };Signature
interface CommandCloseProps extends CommandStateProps {
children?: ComponentChild;
contentId?: string;
styles?: CommandStyleOverrides;
}CommandInputProps#
Props for the command input component.
Copyable example
import type { CommandInputProps } from "@kovojs/ui/command";
const props: CommandInputProps = {};Signature
interface CommandInputProps extends CommandStateProps {
autocomplete?: string;
descriptionId?: string;
id?: string;
labelledBy?: string;
listboxId?: string;
styles?: CommandStyleOverrides;
}CommandListboxProps#
Props for the command listbox component.
Copyable example
import type { CommandListboxProps } from "@kovojs/ui/command";
const props: CommandListboxProps = { children: 'Content' };Signature
interface CommandListboxProps extends CommandStateProps {
children?: ComponentChild;
id?: string;
labelledBy?: string;
styles?: CommandStyleOverrides;
}CommandItemProps#
Props for the command item component.
Copyable example
import type { CommandItemProps } from "@kovojs/ui/command";
const props: CommandItemProps = { itemValue: 'item', children: 'Content' };Signature
interface CommandItemProps extends CommandStateProps {
children?: ComponentChild;
id?: string;
itemDisabled?: boolean;
itemLabel?: string;
itemValue: string;
listboxId?: string;
styles?: CommandStyleOverrides;
}CommandEmptyProps#
Props for the command empty component.
Copyable example
import type { CommandEmptyProps } from "@kovojs/ui/command";
const props: CommandEmptyProps = { children: 'Content' };Signature
interface CommandEmptyProps extends CommandStateProps {
children?: ComponentChild;
id?: string;
styles?: CommandStyleOverrides;
}CommandValueProps#
Props for the command value component.
Copyable example
import type { CommandValueProps } from "@kovojs/ui/command";
const props: CommandValueProps = {};Signature
interface CommandValueProps extends CommandStateProps {
id?: string;
styles?: CommandStyleOverrides;
}@kovojs/ui/context-menu#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/context-menu.tsx
Values#
ContextMenu#
Renders the styled context menu primitive.
Copyable example
import { ContextMenu } from "@kovojs/ui/context-menu";
const component = ContextMenu;Signature
const ContextMenu = component({
render(props: ContextMenuProps) {
const attrs = contextMenuRootAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.highlightedValue === undefined ? {} : { highlightedValue: props.highlightedValue }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.items === undefined ? {} : { items: props.items }),
...(props.open === undefined ? {} : { open: props.open }),
...(props.point === undefined ? {} : { point: props.point }),
});
const styleAttrs = style.attrs(contextMenuStyles.root, props.styles?.root);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
id={attrs.id}
>
{props.children}
</div>
);
},
});ContextMenuTrigger#
Renders the styled context menu trigger primitive.
Copyable example
import { ContextMenuTrigger } from "@kovojs/ui/context-menu";
const component = ContextMenuTrigger;Signature
const ContextMenuTrigger = component({
render(props: ContextMenuTriggerProps) {
const attrs = contextMenuTriggerAttributes({
...(props.contentId === undefined ? {} : { contentId: props.contentId }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.highlightedValue === undefined ? {} : { highlightedValue: props.highlightedValue }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.items === undefined ? {} : { items: props.items }),
...(props.labelledBy === undefined ? {} : { labelledBy: props.labelledBy }),
...(props.open === undefined ? {} : { open: props.open }),
...(props.point === undefined ? {} : { point: props.point }),
});
const styleAttrs = style.attrs(contextMenuStyles.trigger, props.styles?.trigger);
return (
<div
aria-controls={attrs['aria-controls']}
aria-disabled={attrs['aria-disabled']}
aria-expanded={attrs['aria-expanded']}
aria-haspopup={attrs['aria-haspopup']}
aria-labelledby={attrs['aria-labelledby']}
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
id={attrs.id}
kovo-context-menu={attrs['kovo-context-menu']}
role={attrs.role}
tabIndex={props.disabled === true ? -1 : 0}
>
{props.children}
</div>
);
},
});ContextMenuContent#
Renders the styled context menu content primitive.
Copyable example
import { ContextMenuContent } from "@kovojs/ui/context-menu";
const component = ContextMenuContent;Signature
const ContextMenuContent = component({
render(props: ContextMenuContentProps) {
const attrs = contextMenuContentAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.highlightedValue === undefined ? {} : { highlightedValue: props.highlightedValue }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.items === undefined ? {} : { items: props.items }),
...(props.labelledBy === undefined ? {} : { labelledBy: props.labelledBy }),
...(props.open === undefined ? {} : { open: props.open }),
...(props.point === undefined ? {} : { point: props.point }),
});
const styleAttrs = style.attrs(contextMenuStyles.content, props.styles?.content);
return (
<div
aria-labelledby={attrs['aria-labelledby']}
{...styleAttrs}
{...passThroughProps(props)}
data-anchor-x={attrs['data-anchor-x']}
data-anchor-y={attrs['data-anchor-y']}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
hidden={attrs.hidden}
id={attrs.id}
role={attrs.role}
tabIndex={attrs.tabIndex}
>
{props.children}
</div>
);
},
});ContextMenuItem#
Renders the styled context menu item primitive.
Copyable example
import { ContextMenuItem } from "@kovojs/ui/context-menu";
const component = ContextMenuItem;Signature
const ContextMenuItem = component({
render(props: ContextMenuItemProps) {
const attrs = contextMenuItemAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.highlightedValue === undefined ? {} : { highlightedValue: props.highlightedValue }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.itemDisabled === undefined ? {} : { itemDisabled: props.itemDisabled }),
...(props.itemLabel === undefined ? {} : { itemLabel: props.itemLabel }),
...(props.items === undefined ? {} : { items: props.items }),
itemValue: props.itemValue,
...(props.open === undefined ? {} : { open: props.open }),
...(props.point === undefined ? {} : { point: props.point }),
});
const styleAttrs = style.attrs(contextMenuStyles.item, props.styles?.item);
return (
<button
aria-disabled={attrs['aria-disabled']}
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-highlighted={attrs['data-highlighted']}
data-state={attrs['data-state']}
disabled={attrs['data-disabled'] === '' ? true : undefined}
id={attrs.id}
role={attrs.role}
tabIndex={attrs.tabIndex}
type="button"
value={attrs.value}
>
{props.children ?? props.itemLabel ?? props.itemValue}
</button>
);
},
});ContextMenuGroup#
Renders the styled context menu group primitive.
Copyable example
import { ContextMenuGroup } from "@kovojs/ui/context-menu";
const component = ContextMenuGroup;Signature
const ContextMenuGroup = component({
render(props: ContextMenuGroupProps) {
const attrs = contextMenuGroupAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.highlightedValue === undefined ? {} : { highlightedValue: props.highlightedValue }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.items === undefined ? {} : { items: props.items }),
...(props.labelledBy === undefined ? {} : { labelledBy: props.labelledBy }),
...(props.open === undefined ? {} : { open: props.open }),
...(props.point === undefined ? {} : { point: props.point }),
});
const styleAttrs = style.attrs(contextMenuStyles.group, props.styles?.group);
return (
<div
aria-labelledby={attrs['aria-labelledby']}
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
id={attrs.id}
role={attrs.role}
>
{props.children}
</div>
);
},
});ContextMenuSeparator#
Renders the styled context menu separator primitive.
Copyable example
import { ContextMenuSeparator } from "@kovojs/ui/context-menu";
const component = ContextMenuSeparator;Signature
const ContextMenuSeparator = component({
render(props: ContextMenuSeparatorProps) {
const attrs = contextMenuSeparatorAttributes(props.id === undefined ? {} : { id: props.id });
const styleAttrs = style.attrs(contextMenuStyles.separator, props.styles?.separator);
return <div {...styleAttrs} id={attrs.id} role={attrs.role} />;
},
});Supporting types#
ContextMenuStyleOverrides#
Style override slots accepted by the context menu components.
Copyable example
import type { ContextMenuStyleOverrides } from "@kovojs/ui/context-menu";
const styles: ContextMenuStyleOverrides = {};Signature
interface ContextMenuStyleOverrides {
content?: style.StyleInput;
group?: style.StyleInput;
item?: style.StyleInput;
root?: style.StyleInput;
separator?: style.StyleInput;
trigger?: style.StyleInput;
}ContextMenuStateProps#
Shared state props for the context menu component family.
Copyable example
import type { ContextMenuStateProps } from "@kovojs/ui/context-menu";
const state: ContextMenuStateProps = {};Signature
interface ContextMenuStateProps {
disabled?: boolean;
highlightedValue?: string;
items?: readonly HeadlessContextMenuItem[];
open?: boolean;
point?: ContextMenuPoint;
}ContextMenuProps#
Props for the context menu component.
Copyable example
import type { ContextMenuProps } from "@kovojs/ui/context-menu";
const props: ContextMenuProps = { children: 'Content' };Signature
interface ContextMenuProps extends ContextMenuStateProps {
children?: ComponentChild;
id?: string;
styles?: ContextMenuStyleOverrides;
}ContextMenuTriggerProps#
Props for the context menu trigger component.
Copyable example
import type { ContextMenuTriggerProps } from "@kovojs/ui/context-menu";
const props: ContextMenuTriggerProps = { children: 'Content' };Signature
interface ContextMenuTriggerProps extends ContextMenuStateProps {
children?: ComponentChild;
contentId?: string;
id?: string;
labelledBy?: string;
styles?: ContextMenuStyleOverrides;
}ContextMenuContentProps#
Props for the context menu content component.
Copyable example
import type { ContextMenuContentProps } from "@kovojs/ui/context-menu";
const props: ContextMenuContentProps = { children: 'Content' };Signature
interface ContextMenuContentProps extends ContextMenuStateProps {
children?: ComponentChild;
id?: string;
labelledBy?: string;
styles?: ContextMenuStyleOverrides;
}ContextMenuItemProps#
Props for the context menu item component.
Copyable example
import type { ContextMenuItemProps } from "@kovojs/ui/context-menu";
const props: ContextMenuItemProps = { itemValue: 'item', children: 'Content' };Signature
interface ContextMenuItemProps extends ContextMenuStateProps {
children?: ComponentChild;
id?: string;
itemDisabled?: boolean;
itemLabel?: string;
itemValue: string;
styles?: ContextMenuStyleOverrides;
}ContextMenuGroupProps#
Props for the context menu group component.
Copyable example
import type { ContextMenuGroupProps } from "@kovojs/ui/context-menu";
const props: ContextMenuGroupProps = { children: 'Content' };Signature
interface ContextMenuGroupProps extends ContextMenuStateProps {
children?: ComponentChild;
id?: string;
labelledBy?: string;
styles?: ContextMenuStyleOverrides;
}ContextMenuSeparatorProps#
Props for the context menu separator component.
Copyable example
import type { ContextMenuSeparatorProps } from "@kovojs/ui/context-menu";
const props: ContextMenuSeparatorProps = {};Signature
interface ContextMenuSeparatorProps {
id?: string;
styles?: ContextMenuStyleOverrides;
}@kovojs/ui/dialog#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/dialog.tsx
Values#
Dialog#
Renders the styled dialog primitive.
Copyable example
import { Dialog } from "@kovojs/ui/dialog";
const component = Dialog;Signature
const Dialog = component({
render(props: DialogProps) {
const attrs = dialogRootAttributes(dialogState(props));
const styleAttrs = style.attrs(dialogStyles.root, props.styles?.root);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
id={props.id}
>
{props.children}
</div>
);
},
});DialogTrigger#
Renders the styled dialog trigger primitive.
Copyable example
import { DialogTrigger } from "@kovojs/ui/dialog";
const component = DialogTrigger;Signature
const DialogTrigger = component({
render(props: DialogTriggerProps) {
const attrs = dialogTriggerAttributes({
...dialogState(props),
...(props.contentId === undefined ? {} : { contentId: props.contentId }),
});
const styleAttrs = style.attrs(dialogStyles.trigger, props.styles?.trigger);
return (
<button
{...styleAttrs}
{...passThroughProps(props)}
aria-controls={attrs['aria-controls']}
aria-expanded={attrs['aria-expanded']}
aria-haspopup={attrs['aria-haspopup']}
command={attrs.command}
commandfor={attrs.commandfor}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
disabled={attrs.disabled}
id={props.id}
type={attrs.type}
>
{props.children}
</button>
);
},
});DialogContent#
Renders the styled dialog content primitive.
Copyable example
import { DialogContent } from "@kovojs/ui/dialog";
const component = DialogContent;Signature
const DialogContent = component({
render(props: DialogContentProps) {
const attrs = dialogContentAttributes({
...dialogState(props),
...(props.contentId === undefined ? {} : { contentId: props.contentId }),
...(props.descriptionId === undefined ? {} : { descriptionId: props.descriptionId }),
...(props.dismissible === undefined ? {} : { dismissible: props.dismissible }),
...(props.titleId === undefined ? {} : { titleId: props.titleId }),
});
const styleAttrs = style.attrs(dialogStyles.content, props.styles?.content);
return (
<dialog
{...styleAttrs}
{...passThroughProps(props)}
aria-describedby={attrs['aria-describedby']}
aria-labelledby={attrs['aria-labelledby']}
aria-modal={attrs['aria-modal']}
closedby={attrs.closedby}
data-state={attrs['data-state']}
id={attrs.id}
open={attrs.open}
role={attrs.role}
>
{props.children}
</dialog>
);
},
});DialogClose#
Renders the styled dialog close primitive.
Copyable example
import { DialogClose } from "@kovojs/ui/dialog";
const component = DialogClose;Signature
const DialogClose = component({
render(props: DialogCloseProps) {
const attrs = dialogCloseAttributes({
...dialogState(props),
...(props.contentId === undefined ? {} : { contentId: props.contentId }),
});
const styleAttrs = style.attrs(dialogStyles.close, props.styles?.close);
return (
<button
{...styleAttrs}
{...passThroughProps(props)}
command={attrs.command}
commandfor={attrs.commandfor}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
disabled={attrs.disabled}
id={props.id}
type={attrs.type}
>
{props.children ?? 'Close'}
</button>
);
},
});DialogCloseX#
Renders the styled dialog close x primitive.
Copyable example
import { DialogCloseX } from "@kovojs/ui/dialog";
const component = DialogCloseX;Signature
const DialogCloseX = component({
render(props: DialogCloseProps) {
const attrs = dialogCloseAttributes({
...dialogState(props),
...(props.contentId === undefined ? {} : { contentId: props.contentId }),
});
const styleAttrs = style.attrs(dialogStyles.closeX, props.styles?.closeX);
return (
<button
{...styleAttrs}
{...passThroughProps(props)}
aria-label="Close"
command={attrs.command}
commandfor={attrs.commandfor}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
disabled={attrs.disabled}
id={props.id}
type={attrs.type}
>
{props.children ?? '×'}
</button>
);
},
});DialogHeader#
Renders the styled dialog header primitive.
Copyable example
import { DialogHeader } from "@kovojs/ui/dialog";
const component = DialogHeader;Signature
const DialogHeader = component({
render(props: DialogPartProps) {
const styleAttrs = style.attrs(dialogStyles.header, props.styles?.header);
return (
<div {...styleAttrs} {...passThroughProps(props)} id={props.id}>
{props.children}
</div>
);
},
});DialogTitle#
Renders the styled dialog title primitive.
Copyable example
import { DialogTitle } from "@kovojs/ui/dialog";
const component = DialogTitle;Signature
const DialogTitle = component({
render(props: DialogPartProps) {
const styleAttrs = style.attrs(dialogStyles.title, props.styles?.title);
return (
<h2 {...styleAttrs} {...passThroughProps(props)} id={props.id}>
{props.children}
</h2>
);
},
});DialogDescription#
Renders the styled dialog description primitive.
Copyable example
import { DialogDescription } from "@kovojs/ui/dialog";
const component = DialogDescription;Signature
const DialogDescription = component({
render(props: DialogPartProps) {
const styleAttrs = style.attrs(dialogStyles.description, props.styles?.description);
return (
<p {...styleAttrs} {...passThroughProps(props)} id={props.id}>
{props.children}
</p>
);
},
});Supporting types#
DialogStyleOverrides#
Style override slots accepted by the dialog components.
Copyable example
import type { DialogStyleOverrides } from "@kovojs/ui/dialog";
const styles: DialogStyleOverrides = {};Signature
interface DialogStyleOverrides {
close?: style.StyleInput;
closeX?: style.StyleInput;
content?: style.StyleInput;
description?: style.StyleInput;
header?: style.StyleInput;
root?: style.StyleInput;
title?: style.StyleInput;
trigger?: style.StyleInput;
}DialogStateProps#
Shared state props for the dialog component family.
Copyable example
import type { DialogStateProps } from "@kovojs/ui/dialog";
const state: DialogStateProps = {};Signature
interface DialogStateProps {
disabled?: boolean;
open?: boolean;
}DialogProps#
Props for the dialog component.
Copyable example
import type { DialogProps } from "@kovojs/ui/dialog";
const props: DialogProps = { children: 'Content' };Signature
interface DialogProps extends DialogStateProps {
children?: ComponentChild;
id?: string;
styles?: DialogStyleOverrides;
}DialogTriggerProps#
Props for the dialog trigger component.
Copyable example
import type { DialogTriggerProps } from "@kovojs/ui/dialog";
const props: DialogTriggerProps = { children: 'Content' };Signature
interface DialogTriggerProps extends DialogStateProps {
children?: ComponentChild;
contentId?: string;
id?: string;
styles?: DialogStyleOverrides;
}DialogContentProps#
Props for the dialog content component.
Copyable example
import type { DialogContentProps } from "@kovojs/ui/dialog";
const props: DialogContentProps = { children: 'Content' };Signature
interface DialogContentProps extends DialogStateProps {
children?: ComponentChild;
contentId?: string;
descriptionId?: string;
dismissible?: boolean;
styles?: DialogStyleOverrides;
titleId?: string;
}DialogCloseProps#
Props for the dialog close component.
Copyable example
import type { DialogCloseProps } from "@kovojs/ui/dialog";
const props: DialogCloseProps = { children: 'Content' };Signature
interface DialogCloseProps extends DialogStateProps {
children?: ComponentChild;
contentId?: string;
id?: string;
styles?: DialogStyleOverrides;
}DialogPartProps#
Props for the dialog part component.
Copyable example
import type { DialogPartProps } from "@kovojs/ui/dialog";
const props: DialogPartProps = { children: 'Content' };Signature
interface DialogPartProps {
children?: ComponentChild;
id?: string;
styles?: DialogStyleOverrides;
}@kovojs/ui/disclosure#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/disclosure.tsx
Values#
Disclosure#
Renders the styled disclosure primitive.
Copyable example
import { Disclosure } from "@kovojs/ui/disclosure";
const component = Disclosure;Signature
const Disclosure = component({
render(props: DisclosureProps) {
const attrs = disclosureRootAttributes(disclosureState(props));
const styleAttrs = style.attrs(disclosureStyles.root, props.styles?.root);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
id={props.id}
>
{props.children}
</div>
);
},
});DisclosureTrigger#
Renders the styled disclosure trigger primitive.
Copyable example
import { DisclosureTrigger } from "@kovojs/ui/disclosure";
const component = DisclosureTrigger;Signature
const DisclosureTrigger = component({
render(props: DisclosureTriggerProps) {
const attrs = disclosureTriggerAttributes({
...disclosureState(props),
...(props.contentId === undefined ? {} : { contentId: props.contentId }),
});
const styleAttrs = style.attrs(disclosureStyles.trigger, props.styles?.trigger);
return (
<button
aria-controls={attrs['aria-controls']}
aria-expanded={attrs['aria-expanded']}
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
disabled={attrs.disabled}
id={props.id}
type={attrs.type}
>
{props.children}
</button>
);
},
});DisclosureContent#
Renders the styled disclosure content primitive.
Copyable example
import { DisclosureContent } from "@kovojs/ui/disclosure";
const component = DisclosureContent;Signature
const DisclosureContent = component({
render(props: DisclosureContentProps) {
const attrs = disclosureContentAttributes({
...disclosureState(props),
...(props.contentId === undefined ? {} : { contentId: props.contentId }),
});
const styleAttrs = style.attrs(disclosureStyles.content, props.styles?.content);
const innerStyleAttrs = style.attrs(disclosureStyles.contentInner);
return (
// passThroughProps forwards the compiler-emitted data-bind:* reactive stamps
// (data-bind:data-state / data-bind:hidden) so the panel reveals client-side;
// without it the SSR closed value stays frozen and clicking does nothing.
// Outer div is the animatable grid wrapper and keeps the hidden/id/data-state
// contract; the inner div holds the padded content and collapses with the row.
<div
{...styleAttrs}
{...passThroughProps(props)}
data-state={attrs['data-state']}
hidden={attrs.hidden}
id={attrs.id}
>
<div {...innerStyleAttrs} data-state={attrs['data-state']}>
{props.children}
</div>
</div>
);
},
});Supporting types#
DisclosureStateProps#
Shared state props for the disclosure component family.
Copyable example
import type { DisclosureStateProps } from "@kovojs/ui/disclosure";
const state: DisclosureStateProps = {};Signature
interface DisclosureStateProps {
disabled?: boolean;
open?: boolean;
}DisclosureStyleOverrides#
Style override slots accepted by the disclosure components.
Copyable example
import type { DisclosureStyleOverrides } from "@kovojs/ui/disclosure";
const styles: DisclosureStyleOverrides = {};Signature
interface DisclosureStyleOverrides {
content?: style.StyleInput;
root?: style.StyleInput;
trigger?: style.StyleInput;
}DisclosureProps#
Props for the disclosure component.
Copyable example
import type { DisclosureProps } from "@kovojs/ui/disclosure";
const props: DisclosureProps = { children: 'Content' };Signature
interface DisclosureProps extends DisclosureStateProps {
children?: ComponentChild;
id?: string;
styles?: DisclosureStyleOverrides;
}DisclosureTriggerProps#
Props for the disclosure trigger component.
Copyable example
import type { DisclosureTriggerProps } from "@kovojs/ui/disclosure";
const props: DisclosureTriggerProps = { children: 'Content' };Signature
interface DisclosureTriggerProps extends DisclosureStateProps {
children?: ComponentChild;
contentId?: string;
id?: string;
styles?: DisclosureStyleOverrides;
}DisclosureContentProps#
Props for the disclosure content component.
Copyable example
import type { DisclosureContentProps } from "@kovojs/ui/disclosure";
const props: DisclosureContentProps = { children: 'Content' };Signature
interface DisclosureContentProps extends DisclosureStateProps {
children?: ComponentChild;
contentId?: string;
styles?: DisclosureStyleOverrides;
}@kovojs/ui/drawer#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/drawer.tsx
Values#
Drawer#
Renders the styled drawer primitive.
Copyable example
import { Drawer } from "@kovojs/ui/drawer";
const component = Drawer;Signature
const Drawer = component({
render(props: DrawerProps) {
const open = props.open === true;
const side = props.side ?? 'bottom';
const titleId = `${props.contentId}-title`;
const descriptionId =
props.description === undefined ? undefined : `${props.contentId}-description`;
const disabledState = props.disabled === undefined ? {} : { disabled: props.disabled };
const descriptionState = descriptionId === undefined ? {} : { descriptionId };
const rootAttrs = dialogRootAttributes({ ...disabledState, open });
const triggerAttrs = dialogTriggerAttributes({
...disabledState,
contentId: props.contentId,
open,
});
const contentAttrs = dialogContentAttributes({
...descriptionState,
contentId: props.contentId,
open,
titleId,
});
const closeAttrs = dialogCloseAttributes({
...disabledState,
contentId: props.contentId,
open,
});
const rootStyleAttrs = style.attrs(drawerStyles.root, props.styles?.root);
const triggerStyleAttrs = style.attrs(drawerStyles.trigger, props.styles?.trigger);
const contentStyleAttrs = style.attrs(
drawerStyles.content,
drawerSideStyles[side],
props.styles?.content,
);
const handleStyleAttrs = style.attrs(drawerStyles.handle, props.styles?.handle);
const headerStyleAttrs = style.attrs(drawerStyles.header, props.styles?.header);
const titleStyleAttrs = style.attrs(drawerStyles.title, props.styles?.title);
const descriptionStyleAttrs = style.attrs(drawerStyles.description, props.styles?.description);
const bodyStyleAttrs = style.attrs(drawerStyles.body, props.styles?.body);
const closeStyleAttrs = style.attrs(drawerStyles.close, props.styles?.close);
return (
<div
{...rootStyleAttrs}
{...passThroughProps(props)}
data-disabled={rootAttrs['data-disabled']}
data-state={rootAttrs['data-state']}
>
<button
{...triggerStyleAttrs}
{...passThroughProps(props)}
aria-controls={triggerAttrs['aria-controls']}
aria-expanded={triggerAttrs['aria-expanded']}
aria-haspopup={triggerAttrs['aria-haspopup']}
command={triggerAttrs.command}
commandfor={triggerAttrs.commandfor}
data-disabled={triggerAttrs['data-disabled']}
data-state={triggerAttrs['data-state']}
disabled={triggerAttrs.disabled}
type={triggerAttrs.type}
>
{props.trigger ?? 'Open'}
</button>
<dialog
{...contentStyleAttrs}
{...passThroughProps(props)}
aria-describedby={contentAttrs['aria-describedby']}
aria-labelledby={contentAttrs['aria-labelledby']}
aria-modal={contentAttrs['aria-modal']}
closedby={contentAttrs.closedby}
data-state={contentAttrs['data-state']}
id={contentAttrs.id}
open={contentAttrs.open}
role={contentAttrs.role}
>
<div {...handleStyleAttrs} aria-hidden="true" />
<header {...headerStyleAttrs}>
<h2 {...titleStyleAttrs} id={titleId}>
{props.title}
</h2>
{descriptionId === undefined ? (
''
) : (
<p {...descriptionStyleAttrs} id={descriptionId}>
{props.description ?? ''}
</p>
)}
</header>
<div {...bodyStyleAttrs}>{props.children}</div>
<button
{...closeStyleAttrs}
{...passThroughProps(props)}
command={closeAttrs.command}
commandfor={closeAttrs.commandfor}
data-disabled={closeAttrs['data-disabled']}
data-state={closeAttrs['data-state']}
disabled={closeAttrs.disabled}
type={closeAttrs.type}
>
{props.closeLabel ?? 'Close'}
</button>
</dialog>
</div>
);
},
});DrawerRoot#
Renders the styled drawer root primitive.
Copyable example
import { DrawerRoot } from "@kovojs/ui/drawer";
const component = DrawerRoot;Signature
const DrawerRoot = component({
render(props: DrawerRootProps) {
const attrs = dialogRootAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
open: props.open === true,
});
const styleAttrs = style.attrs(drawerStyles.root, props.styles?.root);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
id={props.id}
>
{props.children}
</div>
);
},
});DrawerTrigger#
Renders the styled drawer trigger primitive.
Copyable example
import { DrawerTrigger } from "@kovojs/ui/drawer";
const component = DrawerTrigger;Signature
const DrawerTrigger = component({
render(props: DrawerTriggerProps) {
const attrs = dialogTriggerAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
contentId: props.contentId,
open: props.open === true,
});
const styleAttrs = style.attrs(drawerStyles.trigger, props.styles?.trigger);
return (
<button
{...styleAttrs}
{...passThroughProps(props)}
aria-controls={attrs['aria-controls']}
aria-expanded={attrs['aria-expanded']}
aria-haspopup={attrs['aria-haspopup']}
command={attrs.command}
commandfor={attrs.commandfor}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
disabled={attrs.disabled}
id={props.id}
type={attrs.type}
>
{props.children}
</button>
);
},
});DrawerContent#
Renders the styled drawer content primitive.
Copyable example
import { DrawerContent } from "@kovojs/ui/drawer";
const component = DrawerContent;Signature
const DrawerContent = component({
render(props: DrawerContentProps) {
const side = props.side ?? 'bottom';
const attrs = dialogContentAttributes({
contentId: props.contentId,
...(props.descriptionId === undefined ? {} : { descriptionId: props.descriptionId }),
open: props.open === true,
titleId: props.titleId,
});
const styleAttrs = style.attrs(
drawerStyles.content,
drawerSideStyles[side],
props.styles?.content,
);
return (
<dialog
{...styleAttrs}
{...passThroughProps(props)}
aria-describedby={attrs['aria-describedby']}
aria-labelledby={attrs['aria-labelledby']}
aria-modal={attrs['aria-modal']}
closedby={attrs.closedby}
data-state={attrs['data-state']}
id={attrs.id}
open={attrs.open}
role={attrs.role}
>
{props.children}
</dialog>
);
},
});DrawerHandle#
Renders the styled drawer handle primitive.
Copyable example
import { DrawerHandle } from "@kovojs/ui/drawer";
const component = DrawerHandle;Signature
const DrawerHandle = component({
render(props: DrawerPartProps) {
const styleAttrs = style.attrs(drawerStyles.handle, props.styles?.handle);
return <div {...styleAttrs} {...passThroughProps(props)} aria-hidden="true" id={props.id} />;
},
});DrawerHeader#
Renders the styled drawer header primitive.
Copyable example
import { DrawerHeader } from "@kovojs/ui/drawer";
const component = DrawerHeader;Signature
const DrawerHeader = component({
render(props: DrawerPartProps) {
const styleAttrs = style.attrs(drawerStyles.header, props.styles?.header);
return (
<header {...styleAttrs} {...passThroughProps(props)} id={props.id}>
{props.children}
</header>
);
},
});DrawerTitle#
Renders the styled drawer title primitive.
Copyable example
import { DrawerTitle } from "@kovojs/ui/drawer";
const component = DrawerTitle;Signature
const DrawerTitle = component({
render(props: DrawerPartProps) {
const styleAttrs = style.attrs(drawerStyles.title, props.styles?.title);
return (
<h2 {...styleAttrs} {...passThroughProps(props)} id={props.id}>
{props.children}
</h2>
);
},
});DrawerDescription#
Renders the styled drawer description primitive.
Copyable example
import { DrawerDescription } from "@kovojs/ui/drawer";
const component = DrawerDescription;Signature
const DrawerDescription = component({
render(props: DrawerPartProps) {
const styleAttrs = style.attrs(drawerStyles.description, props.styles?.description);
return (
<p {...styleAttrs} {...passThroughProps(props)} id={props.id}>
{props.children}
</p>
);
},
});DrawerClose#
Renders the styled drawer close primitive.
Copyable example
import { DrawerClose } from "@kovojs/ui/drawer";
const component = DrawerClose;Signature
const DrawerClose = component({
render(props: DrawerCloseProps) {
const attrs = dialogCloseAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
contentId: props.contentId,
open: props.open === true,
});
const styleAttrs = style.attrs(drawerStyles.close, props.styles?.close);
return (
<button
{...styleAttrs}
{...passThroughProps(props)}
command={attrs.command}
commandfor={attrs.commandfor}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
disabled={attrs.disabled}
id={props.id}
type={attrs.type}
>
{props.children ?? 'Close'}
</button>
);
},
});Supporting types#
DrawerSide#
Supported drawer side values.
Copyable example
import type { DrawerSide } from "@kovojs/ui/drawer";
const value: DrawerSide = 'right';Signature
type DrawerSide = 'top' | 'right' | 'bottom' | 'left';DrawerStyleOverrides#
Style override slots accepted by the drawer components.
Copyable example
import type { DrawerStyleOverrides } from "@kovojs/ui/drawer";
const styles: DrawerStyleOverrides = {};Signature
interface DrawerStyleOverrides {
body?: style.StyleInput;
close?: style.StyleInput;
content?: style.StyleInput;
description?: style.StyleInput;
handle?: style.StyleInput;
header?: style.StyleInput;
root?: style.StyleInput;
title?: style.StyleInput;
trigger?: style.StyleInput;
}DrawerProps#
Props for the drawer component.
Copyable example
import type { DrawerProps } from "@kovojs/ui/drawer";
const props: DrawerProps = { contentId: 'content-id', title: 'Title', children: 'Content' };Signature
interface DrawerProps {
children?: ComponentChild;
closeLabel?: string;
contentId: string;
description?: string;
disabled?: boolean;
open?: boolean;
side?: DrawerSide;
styles?: DrawerStyleOverrides;
title: string;
trigger?: string;
}DrawerStateProps#
Shared state props for the drawer component family.
Copyable example
import type { DrawerStateProps } from "@kovojs/ui/drawer";
const state: DrawerStateProps = {};Signature
interface DrawerStateProps {
disabled?: boolean;
open?: boolean;
styles?: DrawerStyleOverrides;
}DrawerRootProps#
Props for the drawer root component.
Copyable example
import type { DrawerRootProps } from "@kovojs/ui/drawer";
const props: DrawerRootProps = { children: 'Content' };Signature
interface DrawerRootProps extends DrawerStateProps {
children?: ComponentChild;
id?: string;
}DrawerTriggerProps#
Props for the drawer trigger component.
Copyable example
import type { DrawerTriggerProps } from "@kovojs/ui/drawer";
const props: DrawerTriggerProps = { contentId: 'content-id', children: 'Content' };Signature
interface DrawerTriggerProps extends DrawerStateProps {
children?: ComponentChild;
contentId: string;
id?: string;
}DrawerContentProps#
Props for the drawer content component.
Copyable example
import type { DrawerContentProps } from "@kovojs/ui/drawer";
const props: DrawerContentProps = { contentId: 'content-id', titleId: 'title-id', children: 'Content' };Signature
interface DrawerContentProps extends DrawerStateProps {
children?: ComponentChild;
contentId: string;
descriptionId?: string;
side?: DrawerSide;
titleId: string;
}DrawerPartProps#
Props for the drawer part component.
Copyable example
import type { DrawerPartProps } from "@kovojs/ui/drawer";
const props: DrawerPartProps = { children: 'Content' };Signature
interface DrawerPartProps {
children?: ComponentChild;
id?: string;
styles?: DrawerStyleOverrides;
}DrawerCloseProps#
Props for the drawer close component.
Copyable example
import type { DrawerCloseProps } from "@kovojs/ui/drawer";
const props: DrawerCloseProps = { contentId: 'content-id', children: 'Content' };Signature
interface DrawerCloseProps extends DrawerStateProps {
children?: ComponentChild;
contentId: string;
id?: string;
}@kovojs/ui/dropdown-menu#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/dropdown-menu.tsx
Values#
DropdownMenu#
Renders the styled dropdown menu primitive.
Copyable example
import { DropdownMenu } from "@kovojs/ui/dropdown-menu";
const component = DropdownMenu;Signature
const DropdownMenu = component({
render(props: DropdownMenuProps) {
const attrs = dropdownMenuRootAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.highlightedValue === undefined ? {} : { highlightedValue: props.highlightedValue }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.items === undefined ? {} : { items: props.items }),
...(props.open === undefined ? {} : { open: props.open }),
});
const styleAttrs = style.attrs(dropdownMenuStyles.root, props.styles?.root);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
id={attrs.id}
>
{props.children}
</div>
);
},
});DropdownMenuTrigger#
Renders the styled dropdown menu trigger primitive.
Copyable example
import { DropdownMenuTrigger } from "@kovojs/ui/dropdown-menu";
const component = DropdownMenuTrigger;Signature
const DropdownMenuTrigger = component({
render(props: DropdownMenuTriggerProps) {
const attrs = dropdownMenuTriggerAttributes({
...(props.contentId === undefined ? {} : { contentId: props.contentId }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.highlightedValue === undefined ? {} : { highlightedValue: props.highlightedValue }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.items === undefined ? {} : { items: props.items }),
...(props.labelledBy === undefined ? {} : { labelledBy: props.labelledBy }),
...(props.open === undefined ? {} : { open: props.open }),
});
const styleAttrs = style.attrs(dropdownMenuStyles.trigger, props.styles?.trigger);
return (
<button
aria-controls={attrs['aria-controls']}
aria-expanded={attrs['aria-expanded']}
aria-haspopup={attrs['aria-haspopup']}
aria-labelledby={attrs['aria-labelledby']}
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
disabled={attrs.disabled}
id={attrs.id}
type={attrs.type}
>
{props.children}
</button>
);
},
});DropdownMenuContent#
Renders the styled dropdown menu content primitive.
Copyable example
import { DropdownMenuContent } from "@kovojs/ui/dropdown-menu";
const component = DropdownMenuContent;Signature
const DropdownMenuContent = component({
render(props: DropdownMenuContentProps) {
const attrs = dropdownMenuContentAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.highlightedValue === undefined ? {} : { highlightedValue: props.highlightedValue }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.items === undefined ? {} : { items: props.items }),
...(props.labelledBy === undefined ? {} : { labelledBy: props.labelledBy }),
...(props.open === undefined ? {} : { open: props.open }),
});
const styleAttrs = style.attrs(dropdownMenuStyles.content, props.styles?.content);
return (
<div
aria-labelledby={attrs['aria-labelledby']}
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
hidden={attrs.hidden}
id={attrs.id}
role={attrs.role}
tabIndex={attrs.tabIndex}
>
{props.children}
</div>
);
},
});DropdownMenuItem#
Renders the styled dropdown menu item primitive.
Copyable example
import { DropdownMenuItem } from "@kovojs/ui/dropdown-menu";
const component = DropdownMenuItem;Signature
const DropdownMenuItem = component({
render(props: DropdownMenuItemProps) {
const attrs = dropdownMenuItemAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.highlightedValue === undefined ? {} : { highlightedValue: props.highlightedValue }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.itemDisabled === undefined ? {} : { itemDisabled: props.itemDisabled }),
...(props.itemLabel === undefined ? {} : { itemLabel: props.itemLabel }),
...(props.items === undefined ? {} : { items: props.items }),
itemValue: props.itemValue,
...(props.open === undefined ? {} : { open: props.open }),
});
const styleAttrs = style.attrs(dropdownMenuStyles.item, props.styles?.item);
return (
<button
aria-disabled={attrs['aria-disabled']}
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-highlighted={attrs['data-highlighted']}
data-state={attrs['data-state']}
disabled={attrs['data-disabled'] === '' ? true : undefined}
id={attrs.id}
role={attrs.role}
tabIndex={attrs.tabIndex}
type="button"
value={attrs.value}
>
{props.children ?? props.itemLabel ?? props.itemValue}
</button>
);
},
});DropdownMenuGroup#
Renders the styled dropdown menu group primitive.
Copyable example
import { DropdownMenuGroup } from "@kovojs/ui/dropdown-menu";
const component = DropdownMenuGroup;Signature
const DropdownMenuGroup = component({
render(props: DropdownMenuGroupProps) {
const attrs = dropdownMenuGroupAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.highlightedValue === undefined ? {} : { highlightedValue: props.highlightedValue }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.items === undefined ? {} : { items: props.items }),
...(props.labelledBy === undefined ? {} : { labelledBy: props.labelledBy }),
...(props.open === undefined ? {} : { open: props.open }),
});
const styleAttrs = style.attrs(dropdownMenuStyles.group, props.styles?.group);
return (
<div
aria-labelledby={attrs['aria-labelledby']}
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
id={attrs.id}
role={attrs.role}
>
{props.children}
</div>
);
},
});DropdownMenuSeparator#
Renders the styled dropdown menu separator primitive.
Copyable example
import { DropdownMenuSeparator } from "@kovojs/ui/dropdown-menu";
const component = DropdownMenuSeparator;Signature
const DropdownMenuSeparator = component({
render(props: DropdownMenuSeparatorProps) {
const attrs = dropdownMenuSeparatorAttributes(props.id === undefined ? {} : { id: props.id });
const styleAttrs = style.attrs(dropdownMenuStyles.separator, props.styles?.separator);
return <div {...styleAttrs} id={attrs.id} role={attrs.role} />;
},
});Supporting types#
DropdownMenuStyleOverrides#
Style override slots accepted by the dropdown menu components.
Copyable example
import type { DropdownMenuStyleOverrides } from "@kovojs/ui/dropdown-menu";
const styles: DropdownMenuStyleOverrides = {};Signature
interface DropdownMenuStyleOverrides {
content?: style.StyleInput;
group?: style.StyleInput;
item?: style.StyleInput;
root?: style.StyleInput;
separator?: style.StyleInput;
trigger?: style.StyleInput;
}DropdownMenuStateProps#
Shared state props for the dropdown menu component family.
Copyable example
import type { DropdownMenuStateProps } from "@kovojs/ui/dropdown-menu";
const state: DropdownMenuStateProps = {};Signature
interface DropdownMenuStateProps {
disabled?: boolean;
highlightedValue?: string;
items?: readonly HeadlessDropdownMenuItem[];
open?: boolean;
}DropdownMenuProps#
Props for the dropdown menu component.
Copyable example
import type { DropdownMenuProps } from "@kovojs/ui/dropdown-menu";
const props: DropdownMenuProps = { children: 'Content' };Signature
interface DropdownMenuProps extends DropdownMenuStateProps {
children?: ComponentChild;
id?: string;
styles?: DropdownMenuStyleOverrides;
}DropdownMenuTriggerProps#
Props for the dropdown menu trigger component.
Copyable example
import type { DropdownMenuTriggerProps } from "@kovojs/ui/dropdown-menu";
const props: DropdownMenuTriggerProps = { children: 'Content' };Signature
interface DropdownMenuTriggerProps extends DropdownMenuStateProps {
children?: ComponentChild;
contentId?: string;
id?: string;
labelledBy?: string;
styles?: DropdownMenuStyleOverrides;
}DropdownMenuContentProps#
Props for the dropdown menu content component.
Copyable example
import type { DropdownMenuContentProps } from "@kovojs/ui/dropdown-menu";
const props: DropdownMenuContentProps = { children: 'Content' };Signature
interface DropdownMenuContentProps extends DropdownMenuStateProps {
children?: ComponentChild;
id?: string;
labelledBy?: string;
styles?: DropdownMenuStyleOverrides;
}DropdownMenuItemProps#
Props for the dropdown menu item component.
Copyable example
import type { DropdownMenuItemProps } from "@kovojs/ui/dropdown-menu";
const props: DropdownMenuItemProps = { itemValue: 'item', children: 'Content' };Signature
interface DropdownMenuItemProps extends DropdownMenuStateProps {
children?: ComponentChild;
id?: string;
itemDisabled?: boolean;
itemLabel?: string;
itemValue: string;
styles?: DropdownMenuStyleOverrides;
}DropdownMenuGroupProps#
Props for the dropdown menu group component.
Copyable example
import type { DropdownMenuGroupProps } from "@kovojs/ui/dropdown-menu";
const props: DropdownMenuGroupProps = { children: 'Content' };Signature
interface DropdownMenuGroupProps extends DropdownMenuStateProps {
children?: ComponentChild;
id?: string;
labelledBy?: string;
styles?: DropdownMenuStyleOverrides;
}DropdownMenuSeparatorProps#
Props for the dropdown menu separator component.
Copyable example
import type { DropdownMenuSeparatorProps } from "@kovojs/ui/dropdown-menu";
const props: DropdownMenuSeparatorProps = {};Signature
interface DropdownMenuSeparatorProps {
id?: string;
styles?: DropdownMenuStyleOverrides;
}@kovojs/ui/field#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/field.tsx
Values#
Field#
Renders the styled field primitive.
Copyable example
import { Field } from "@kovojs/ui/field";
const component = Field;Signature
const Field = component({
render(props: FieldProps) {
const attrs = fieldRootAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.required === undefined ? {} : { required: props.required }),
});
const styleAttrs = style.attrs(fieldStyles.root, props.styles?.root);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-invalid={attrs['data-invalid']}
data-required={attrs['data-required']}
id={attrs.id}
>
{props.children}
</div>
);
},
});FieldLabel#
Renders the styled field label primitive.
Copyable example
import { FieldLabel } from "@kovojs/ui/field";
const component = FieldLabel;Signature
const FieldLabel = component({
render(props: FieldLabelProps) {
const attrs = fieldLabelAttributes({
...(props.controlId === undefined ? {} : { controlId: props.controlId }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.required === undefined ? {} : { required: props.required }),
});
const styleAttrs = style.attrs(fieldStyles.label, props.styles?.label);
return (
<label
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-invalid={attrs['data-invalid']}
data-required={attrs['data-required']}
for={attrs.for}
id={attrs.id}
>
{props.children}
</label>
);
},
});FieldControl#
Renders the styled field control primitive.
Copyable example
import { FieldControl } from "@kovojs/ui/field";
const component = FieldControl;Signature
const FieldControl = component({
render(props: FieldControlProps) {
const attrs = fieldControlAttributes({
...(props.autoComplete === undefined ? {} : { autoComplete: props.autoComplete }),
...(props.descriptionId === undefined ? {} : { descriptionId: props.descriptionId }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.errorId === undefined ? {} : { errorId: props.errorId }),
...(props.form === undefined ? {} : { form: props.form }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.inputMode === undefined ? {} : { inputMode: props.inputMode }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.maxLength === undefined ? {} : { maxLength: props.maxLength }),
...(props.minLength === undefined ? {} : { minLength: props.minLength }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.pattern === undefined ? {} : { pattern: props.pattern }),
...(props.required === undefined ? {} : { required: props.required }),
});
const styleAttrs = style.attrs(fieldStyles.control, props.styles?.control);
return (
<input
{...styleAttrs}
{...passThroughProps(props)}
aria-describedby={attrs['aria-describedby']}
aria-invalid={attrs['aria-invalid']}
autoComplete={attrs.autoComplete}
data-disabled={attrs['data-disabled']}
data-invalid={attrs['data-invalid']}
data-required={attrs['data-required']}
disabled={attrs.disabled}
form={attrs.form}
id={attrs.id}
inputMode={attrs.inputMode}
maxLength={attrs.maxLength}
minLength={attrs.minLength}
name={attrs.name}
pattern={attrs.pattern}
placeholder={props.placeholder}
required={attrs.required}
type={props.type ?? 'text'}
value={props.value}
/>
);
},
});FieldTextarea#
Renders the styled field textarea primitive.
Copyable example
import { FieldTextarea } from "@kovojs/ui/field";
const component = FieldTextarea;Signature
const FieldTextarea = component({
render(props: FieldTextareaProps) {
const attrs = fieldControlAttributes({
...(props.autoComplete === undefined ? {} : { autoComplete: props.autoComplete }),
...(props.descriptionId === undefined ? {} : { descriptionId: props.descriptionId }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.errorId === undefined ? {} : { errorId: props.errorId }),
...(props.form === undefined ? {} : { form: props.form }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.inputMode === undefined ? {} : { inputMode: props.inputMode }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.maxLength === undefined ? {} : { maxLength: props.maxLength }),
...(props.minLength === undefined ? {} : { minLength: props.minLength }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.required === undefined ? {} : { required: props.required }),
});
const styleAttrs = style.attrs(fieldStyles.textarea, props.styles?.textarea);
return (
<textarea
{...styleAttrs}
{...passThroughProps(props)}
aria-describedby={attrs['aria-describedby']}
aria-invalid={attrs['aria-invalid']}
autoComplete={attrs.autoComplete}
data-disabled={attrs['data-disabled']}
data-invalid={attrs['data-invalid']}
data-required={attrs['data-required']}
disabled={attrs.disabled}
form={attrs.form}
id={attrs.id}
inputMode={attrs.inputMode}
maxLength={attrs.maxLength}
minLength={attrs.minLength}
name={attrs.name}
placeholder={props.placeholder}
required={attrs.required}
rows={props.rows}
>
{props.children}
</textarea>
);
},
});FieldSelect#
Renders the styled field select primitive.
Copyable example
import { FieldSelect } from "@kovojs/ui/field";
const component = FieldSelect;Signature
const FieldSelect = component({
render(props: FieldSelectProps) {
const attrs = fieldControlAttributes({
...(props.descriptionId === undefined ? {} : { descriptionId: props.descriptionId }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.errorId === undefined ? {} : { errorId: props.errorId }),
...(props.form === undefined ? {} : { form: props.form }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.required === undefined ? {} : { required: props.required }),
});
const styleAttrs = style.attrs(fieldStyles.select, props.styles?.select);
return (
<select
{...styleAttrs}
{...passThroughProps(props)}
aria-describedby={attrs['aria-describedby']}
aria-invalid={attrs['aria-invalid']}
data-disabled={attrs['data-disabled']}
data-invalid={attrs['data-invalid']}
data-required={attrs['data-required']}
disabled={attrs.disabled}
form={attrs.form}
id={attrs.id}
name={attrs.name}
required={attrs.required}
value={props.value}
>
{props.children}
</select>
);
},
});FieldSelectOption#
Renders the styled field select option primitive.
Copyable example
import { FieldSelectOption } from "@kovojs/ui/field";
const component = FieldSelectOption;Signature
const FieldSelectOption = component({
render(props: FieldSelectOptionProps) {
const styleAttrs = style.attrs(fieldStyles.selectOption, props.styles?.selectOption);
return (
<option
{...styleAttrs}
{...passThroughProps(props)}
disabled={props.disabled}
selected={props.selected}
value={props.value}
>
{props.children}
</option>
);
},
});FieldDescription#
Renders the styled field description primitive.
Copyable example
import { FieldDescription } from "@kovojs/ui/field";
const component = FieldDescription;Signature
const FieldDescription = component({
render(props: FieldMessageProps) {
const attrs = fieldDescriptionAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.required === undefined ? {} : { required: props.required }),
...(props.visible === undefined ? {} : { visible: props.visible }),
});
const styleAttrs = style.attrs(fieldStyles.description, props.styles?.description);
return (
<p
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-invalid={attrs['data-invalid']}
data-required={attrs['data-required']}
hidden={attrs.hidden}
id={attrs.id}
>
{props.children}
</p>
);
},
});FieldErrorMessage#
Renders the styled field error primitive.
Copyable example
import { FieldErrorMessage } from "@kovojs/ui/field";
const component = FieldErrorMessage;Signature
const FieldErrorMessage = component({
render(props: FieldMessageProps) {
const attrs = fieldErrorAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.required === undefined ? {} : { required: props.required }),
...(props.visible === undefined ? {} : { visible: props.visible }),
});
const styleAttrs = style.attrs(fieldStyles.error, props.styles?.error);
return (
<p
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-invalid={attrs['data-invalid']}
data-required={attrs['data-required']}
hidden={attrs.hidden}
id={attrs.id}
role={attrs.role}
>
{props.children}
</p>
);
},
});Fieldset#
Renders the styled fieldset primitive.
Copyable example
import { Fieldset } from "@kovojs/ui/field";
const component = Fieldset;Signature
const Fieldset = component({
render(props: FieldsetProps) {
const attrs = fieldsetRootAttributes({
...(props.descriptionId === undefined ? {} : { descriptionId: props.descriptionId }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.errorId === undefined ? {} : { errorId: props.errorId }),
...(props.form === undefined ? {} : { form: props.form }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.required === undefined ? {} : { required: props.required }),
});
const styleAttrs = style.attrs(fieldStyles.fieldset, props.styles?.fieldset);
return (
<fieldset
{...styleAttrs}
{...passThroughProps(props)}
aria-describedby={attrs['aria-describedby']}
aria-invalid={attrs['aria-invalid']}
data-disabled={attrs['data-disabled']}
data-invalid={attrs['data-invalid']}
data-required={attrs['data-required']}
disabled={attrs.disabled}
form={attrs.form}
id={attrs.id}
name={attrs.name}
>
{props.children}
</fieldset>
);
},
});FieldsetLegend#
Renders the styled fieldset legend primitive.
Copyable example
import { FieldsetLegend } from "@kovojs/ui/field";
const component = FieldsetLegend;Signature
const FieldsetLegend = component({
render(props: FieldsetLegendProps) {
const attrs = fieldsetLegendAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.required === undefined ? {} : { required: props.required }),
});
const styleAttrs = style.attrs(fieldStyles.fieldsetLegend, props.styles?.fieldsetLegend);
return (
<legend
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-invalid={attrs['data-invalid']}
data-required={attrs['data-required']}
id={attrs.id}
>
{props.children}
</legend>
);
},
});Supporting types#
FieldStyleOverrides#
Style override slots accepted by the field components.
Copyable example
import type { FieldStyleOverrides } from "@kovojs/ui/field";
const styles: FieldStyleOverrides = {};Signature
interface FieldStyleOverrides {
control?: style.StyleInput;
description?: style.StyleInput;
error?: style.StyleInput;
fieldset?: style.StyleInput;
fieldsetLegend?: style.StyleInput;
label?: style.StyleInput;
root?: style.StyleInput;
select?: style.StyleInput;
selectOption?: style.StyleInput;
textarea?: style.StyleInput;
}FieldStateProps#
Shared state props for the field component family.
Copyable example
import type { FieldStateProps } from "@kovojs/ui/field";
const state: FieldStateProps = {};Signature
interface FieldStateProps {
disabled?: boolean;
invalid?: boolean;
required?: boolean;
}FieldProps#
Props for the field component.
Copyable example
import type { FieldProps } from "@kovojs/ui/field";
const props: FieldProps = { children: 'Content' };Signature
interface FieldProps extends FieldStateProps {
children?: ComponentChild;
id?: string;
styles?: FieldStyleOverrides;
}FieldLabelProps#
Props for the field label component.
Copyable example
import type { FieldLabelProps } from "@kovojs/ui/field";
const props: FieldLabelProps = { children: 'Content' };Signature
interface FieldLabelProps extends FieldStateProps {
children?: ComponentChild;
controlId?: string;
id?: string;
styles?: FieldStyleOverrides;
}FieldControlProps#
Props for the field control component.
Copyable example
import type { FieldControlProps } from "@kovojs/ui/field";
const props: FieldControlProps = {};Signature
interface FieldControlProps extends FieldStateProps {
autoComplete?: string;
descriptionId?: string;
errorId?: string;
form?: string;
id?: string;
inputMode?: string;
maxLength?: number;
minLength?: number;
name?: string;
pattern?: string;
placeholder?: string;
styles?: FieldStyleOverrides;
type?: string;
value?: string;
}FieldTextareaProps#
Props for the field textarea component.
Copyable example
import type { FieldTextareaProps } from "@kovojs/ui/field";
const props: FieldTextareaProps = { children: 'Content' };Signature
interface FieldTextareaProps extends FieldStateProps {
autoComplete?: string;
children?: ComponentChild;
descriptionId?: string;
errorId?: string;
form?: string;
id?: string;
inputMode?: string;
maxLength?: number;
minLength?: number;
name?: string;
placeholder?: string;
rows?: number;
styles?: FieldStyleOverrides;
}FieldSelectProps#
Props for the field select component.
Copyable example
import type { FieldSelectProps } from "@kovojs/ui/field";
const props: FieldSelectProps = { children: 'Content' };Signature
interface FieldSelectProps extends FieldStateProps {
children?: ComponentChild;
descriptionId?: string;
errorId?: string;
form?: string;
id?: string;
name?: string;
styles?: FieldStyleOverrides;
value?: string;
}FieldSelectOptionProps#
Props for the field select option component.
Copyable example
import type { FieldSelectOptionProps } from "@kovojs/ui/field";
const props: FieldSelectOptionProps = { children: 'Content' };Signature
interface FieldSelectOptionProps {
children?: ComponentChild;
disabled?: boolean;
selected?: boolean;
styles?: FieldStyleOverrides;
value?: string;
}FieldMessageProps#
Props for the field message component.
Copyable example
import type { FieldMessageProps } from "@kovojs/ui/field";
const props: FieldMessageProps = { children: 'Content' };Signature
interface FieldMessageProps extends FieldStateProps {
children?: ComponentChild;
id?: string;
styles?: FieldStyleOverrides;
visible?: boolean;
}FieldsetProps#
Props for the fieldset component.
Copyable example
import type { FieldsetProps } from "@kovojs/ui/field";
const props: FieldsetProps = { children: 'Content' };Signature
interface FieldsetProps extends FieldStateProps {
children?: ComponentChild;
descriptionId?: string;
errorId?: string;
form?: string;
id?: string;
name?: string;
styles?: FieldStyleOverrides;
}FieldsetLegendProps#
Props for the fieldset legend component.
Copyable example
import type { FieldsetLegendProps } from "@kovojs/ui/field";
const props: FieldsetLegendProps = { children: 'Content' };Signature
interface FieldsetLegendProps extends FieldStateProps {
children?: ComponentChild;
id?: string;
styles?: FieldStyleOverrides;
}@kovojs/ui/hover-card#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/hover-card.tsx
Values#
HoverCard#
Renders the styled hover card primitive.
Copyable example
import { HoverCard } from "@kovojs/ui/hover-card";
const component = HoverCard;Signature
const HoverCard = component({
render(props: HoverCardProps) {
const attrs = hoverCardRootAttributes(hoverCardState(props));
const styleAttrs = style.attrs(hoverCardStyles.root, props.styles?.root);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
id={props.id}
>
{props.children}
</div>
);
},
});HoverCardTrigger#
Renders the styled hover card trigger primitive.
Copyable example
import { HoverCardTrigger } from "@kovojs/ui/hover-card";
const component = HoverCardTrigger;Signature
const HoverCardTrigger = component({
render(props: HoverCardTriggerProps) {
const attrs = hoverCardTriggerAttributes({
...hoverCardState(props),
...(props.contentId === undefined ? {} : { contentId: props.contentId }),
});
return (
<a
{...styleAttributes(hoverCardStyles.trigger, props.styles?.trigger)}
{...passThroughProps(props)}
aria-controls={attrs['aria-controls']}
aria-disabled={props.disabled === true ? 'true' : undefined}
aria-expanded={attrs['aria-expanded']}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
// SECURITY_FINDINGS.md H3: sanitize the caller href so a dangerous
// scheme is neutralized to the '#' fallback. Existing semantics kept:
// omit href when disabled, default to '#' when no href is supplied.
href={props.disabled === true ? undefined : safeUrl(props.href)}
id={props.id}
kovo-hover-card={attrs['kovo-hover-card']}
>
{props.children}
</a>
);
},
});HoverCardContent#
Renders the styled hover card content primitive.
Copyable example
import { HoverCardContent } from "@kovojs/ui/hover-card";
const component = HoverCardContent;Signature
const HoverCardContent = component({
render(props: HoverCardContentProps) {
const attrs = hoverCardContentAttributes({
...hoverCardState(props),
...(props.contentId === undefined ? {} : { contentId: props.contentId }),
});
const styleAttrs = style.attrs(hoverCardStyles.content, props.styles?.content);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
data-state={attrs['data-state']}
hidden={attrs.hidden}
id={attrs.id}
popover={attrs.popover}
>
{props.children}
</div>
);
},
});Supporting types#
HoverCardStyleOverrides#
Style override slots accepted by the hover card components.
Copyable example
import type { HoverCardStyleOverrides } from "@kovojs/ui/hover-card";
const styles: HoverCardStyleOverrides = {};Signature
interface HoverCardStyleOverrides {
content?: style.StyleInput;
root?: style.StyleInput;
trigger?: style.StyleInput;
}HoverCardStateProps#
Shared state props for the hover card component family.
Copyable example
import type { HoverCardStateProps } from "@kovojs/ui/hover-card";
const state: HoverCardStateProps = {};Signature
interface HoverCardStateProps {
disabled?: boolean;
open?: boolean;
}HoverCardProps#
Props for the hover card component.
Copyable example
import type { HoverCardProps } from "@kovojs/ui/hover-card";
const props: HoverCardProps = { children: 'Content' };Signature
interface HoverCardProps extends HoverCardStateProps {
children?: ComponentChild;
id?: string;
styles?: HoverCardStyleOverrides;
}HoverCardTriggerProps#
Props for the hover card trigger component.
Copyable example
import type { HoverCardTriggerProps } from "@kovojs/ui/hover-card";
const props: HoverCardTriggerProps = { children: 'Content' };Signature
interface HoverCardTriggerProps extends HoverCardStateProps {
children?: ComponentChild;
contentId?: string;
href?: string | TrustedUrl;
id?: string;
styles?: HoverCardStyleOverrides;
}HoverCardContentProps#
Props for the hover card content component.
Copyable example
import type { HoverCardContentProps } from "@kovojs/ui/hover-card";
const props: HoverCardContentProps = { children: 'Content' };Signature
interface HoverCardContentProps extends HoverCardStateProps {
children?: ComponentChild;
contentId?: string;
styles?: HoverCardStyleOverrides;
}@kovojs/ui/kbd#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/kbd.tsx
Values#
Kbd#
Renders the styled keyboard key primitive.
Copyable example
import { Kbd } from "@kovojs/ui/kbd";
const component = Kbd;Signature
const Kbd = component({
render(props: KbdProps) {
const attrs = style.attrs(kbdStyles.root, props.style);
return <kbd {...attrs}>{props.children}</kbd>;
},
});Supporting types#
KbdProps#
Props for the keyboard key component.
Copyable example
import type { KbdProps } from "@kovojs/ui/kbd";
const props: KbdProps = { children: 'Content' };Signature
interface KbdProps {
children?: ComponentChild;
style?: style.StyleInput;
}@kovojs/ui/menubar#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/menubar.tsx
Values#
Menubar#
Renders the styled menubar primitive.
Copyable example
import { Menubar } from "@kovojs/ui/menubar";
const component = Menubar;Signature
const Menubar = component({
render(props: MenubarProps) {
const attrs = menubarRootAttributes({
...(props.activeValue === undefined ? {} : { activeValue: props.activeValue }),
...(props.descriptionId === undefined ? {} : { descriptionId: props.descriptionId }),
...(props.dir === undefined ? {} : { dir: props.dir }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.items === undefined ? {} : { items: props.items }),
...(props.label === undefined ? {} : { label: props.label }),
...(props.labelledBy === undefined ? {} : { labelledBy: props.labelledBy }),
...(props.loop === undefined ? {} : { loop: props.loop }),
...(props.openValue === undefined ? {} : { openValue: props.openValue }),
...(props.orientation === undefined ? {} : { orientation: props.orientation }),
});
const styleAttrs = style.attrs(menubarStyles.root, props.styles?.root);
return (
<div
aria-describedby={attrs['aria-describedby']}
aria-disabled={attrs['aria-disabled']}
aria-label={attrs['aria-label']}
aria-labelledby={attrs['aria-labelledby']}
aria-orientation={attrs['aria-orientation']}
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-orientation={attrs['data-orientation']}
id={attrs.id}
role={attrs.role}
>
{props.children}
</div>
);
},
});MenubarItem#
Renders the styled menubar item primitive.
Copyable example
import { MenubarItem } from "@kovojs/ui/menubar";
const component = MenubarItem;Signature
const MenubarItem = component({
render(props: MenubarItemProps) {
const attrs = menubarItemAttributes({
...(props.activeValue === undefined ? {} : { activeValue: props.activeValue }),
...(props.contentId === undefined ? {} : { contentId: props.contentId }),
...(props.dir === undefined ? {} : { dir: props.dir }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.itemDisabled === undefined ? {} : { itemDisabled: props.itemDisabled }),
...(props.itemLabel === undefined ? {} : { itemLabel: props.itemLabel }),
...(props.itemParentValue === undefined ? {} : { itemParentValue: props.itemParentValue }),
itemValue: props.itemValue,
...(props.items === undefined ? {} : { items: props.items }),
...(props.loop === undefined ? {} : { loop: props.loop }),
...(props.openValue === undefined ? {} : { openValue: props.openValue }),
...(props.orientation === undefined ? {} : { orientation: props.orientation }),
});
const styleAttrs = style.attrs(menubarStyles.item, props.styles?.item);
return (
<button
aria-controls={attrs['aria-controls']}
aria-disabled={attrs['aria-disabled']}
aria-expanded={attrs['aria-expanded']}
aria-haspopup={attrs['aria-haspopup']}
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-highlighted={attrs['data-highlighted']}
data-state={attrs['data-state']}
disabled={attrs['data-disabled'] === '' ? true : undefined}
id={attrs.id}
role={attrs.role}
tabIndex={attrs.tabIndex}
type="button"
value={attrs.value}
>
{props.children ?? props.itemLabel ?? props.itemValue ?? ''}
</button>
);
},
});MenubarSubmenu#
Renders the styled menubar submenu primitive.
Copyable example
import { MenubarSubmenu } from "@kovojs/ui/menubar";
const component = MenubarSubmenu;Signature
const MenubarSubmenu = component({
render(props: MenubarSubmenuProps) {
const attrs = menubarSubmenuAttributes({
...(props.activeValue === undefined ? {} : { activeValue: props.activeValue }),
...(props.dir === undefined ? {} : { dir: props.dir }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.items === undefined ? {} : { items: props.items }),
...(props.labelledBy === undefined ? {} : { labelledBy: props.labelledBy }),
...(props.loop === undefined ? {} : { loop: props.loop }),
...(props.openValue === undefined ? {} : { openValue: props.openValue }),
...(props.orientation === undefined ? {} : { orientation: props.orientation }),
value: props.value,
});
const styleAttrs = style.attrs(menubarStyles.submenu, props.styles?.submenu);
return (
<div
aria-labelledby={attrs['aria-labelledby']}
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
hidden={attrs.hidden}
id={attrs.id}
role={attrs.role}
tabIndex={attrs.tabIndex}
>
{props.children}
</div>
);
},
});MenubarGroup#
Renders the styled menubar group primitive.
Copyable example
import { MenubarGroup } from "@kovojs/ui/menubar";
const component = MenubarGroup;Signature
const MenubarGroup = component({
render(props: MenubarGroupProps) {
const attrs = menubarGroupAttributes({
...(props.activeValue === undefined ? {} : { activeValue: props.activeValue }),
...(props.dir === undefined ? {} : { dir: props.dir }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.items === undefined ? {} : { items: props.items }),
...(props.labelledBy === undefined ? {} : { labelledBy: props.labelledBy }),
...(props.loop === undefined ? {} : { loop: props.loop }),
...(props.openValue === undefined ? {} : { openValue: props.openValue }),
...(props.orientation === undefined ? {} : { orientation: props.orientation }),
});
const styleAttrs = style.attrs(menubarStyles.group, props.styles?.group);
return (
<div
aria-labelledby={attrs['aria-labelledby']}
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-orientation={attrs['data-orientation']}
id={attrs.id}
role={attrs.role}
>
{props.children}
</div>
);
},
});MenubarSeparator#
Renders the styled menubar separator primitive.
Copyable example
import { MenubarSeparator } from "@kovojs/ui/menubar";
const component = MenubarSeparator;Signature
const MenubarSeparator = component({
render(props: MenubarSeparatorProps) {
const attrs = menubarSeparatorAttributes(props.id === undefined ? {} : { id: props.id });
const styleAttrs = style.attrs(menubarStyles.separator, props.styles?.separator);
return <div {...styleAttrs} id={attrs.id} role={attrs.role} />;
},
});Supporting types#
MenubarStyleOverrides#
Style override slots accepted by the menubar components.
Copyable example
import type { MenubarStyleOverrides } from "@kovojs/ui/menubar";
const styles: MenubarStyleOverrides = {};Signature
interface MenubarStyleOverrides {
group?: style.StyleInput;
item?: style.StyleInput;
root?: style.StyleInput;
separator?: style.StyleInput;
submenu?: style.StyleInput;
}MenubarStateProps#
Shared state props for the menubar component family.
Copyable example
import type { MenubarStateProps } from "@kovojs/ui/menubar";
const state: MenubarStateProps = {};Signature
interface MenubarStateProps {
activeValue?: string;
dir?: TextDirection;
disabled?: boolean;
items?: readonly HeadlessMenubarItem[];
loop?: boolean;
openValue?: string | undefined;
orientation?: CollectionOrientation;
}MenubarProps#
Props for the menubar component.
Copyable example
import type { MenubarProps } from "@kovojs/ui/menubar";
const props: MenubarProps = { children: 'Content' };Signature
interface MenubarProps extends MenubarStateProps {
children?: ComponentChild;
descriptionId?: string;
id?: string;
label?: string;
labelledBy?: string;
styles?: MenubarStyleOverrides;
}MenubarItemProps#
Props for the menubar item component.
Copyable example
import type { MenubarItemProps } from "@kovojs/ui/menubar";
const props: MenubarItemProps = { itemValue: 'item', children: 'Content' };Signature
interface MenubarItemProps extends MenubarStateProps {
children?: ComponentChild;
contentId?: string;
id?: string;
itemDisabled?: boolean;
itemLabel?: string;
itemParentValue?: string;
itemValue: string;
styles?: MenubarStyleOverrides;
}MenubarSubmenuProps#
Props for the menubar submenu component.
Copyable example
import type { MenubarSubmenuProps } from "@kovojs/ui/menubar";
const props: MenubarSubmenuProps = { value: 'value', children: 'Content' };Signature
interface MenubarSubmenuProps extends MenubarStateProps {
children?: ComponentChild;
id?: string;
labelledBy?: string;
styles?: MenubarStyleOverrides;
value: string;
}MenubarGroupProps#
Props for the menubar group component.
Copyable example
import type { MenubarGroupProps } from "@kovojs/ui/menubar";
const props: MenubarGroupProps = { children: 'Content' };Signature
interface MenubarGroupProps extends MenubarStateProps {
children?: ComponentChild;
id?: string;
labelledBy?: string;
styles?: MenubarStyleOverrides;
}MenubarSeparatorProps#
Props for the menubar separator component.
Copyable example
import type { MenubarSeparatorProps } from "@kovojs/ui/menubar";
const props: MenubarSeparatorProps = {};Signature
interface MenubarSeparatorProps {
id?: string;
styles?: MenubarStyleOverrides;
}@kovojs/ui/meter#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/meter.tsx
Values#
Meter#
Renders the styled meter primitive.
Copyable example
import { Meter } from "@kovojs/ui/meter";
const component = Meter;Signature
const Meter = component({
render(props: MeterProps) {
const attrs = meterRootAttributes({
...(props.high === undefined ? {} : { high: props.high }),
...(props.low === undefined ? {} : { low: props.low }),
...(props.max === undefined ? {} : { max: props.max }),
...(props.min === undefined ? {} : { min: props.min }),
...(props.optimum === undefined ? {} : { optimum: props.optimum }),
...(props.value === undefined ? {} : { value: props.value }),
...(props.valueText === undefined ? {} : { valueText: props.valueText }),
});
const slots = props.styles;
// The `style` prop is NOT applied to the root track: a call-site reactive
// `style={{ width }}` (the only way to emit a `data-bind:style`) would
// otherwise shrink the whole track. It is forwarded as the indicator fill
// binding below (see bindingProps) so the visible bar can animate client-side.
const rootStyleAttrs = style.attrs(meterStyles.root, slots?.root);
const nativeStyleAttrs = style.attrs(meterStyles.native, slots?.native);
const indicatorStyleAttrs = style.attrs(meterStyles.indicator, slots?.indicator);
const indicatorWidth = fillStyle(attrs['data-value'], attrs['data-min'], attrs['data-max']);
return (
<div {...rootStyleAttrs} data-state={attrs['data-state']}>
<meter
{...nativeStyleAttrs}
{...passThroughProps(props)}
aria-valuetext={attrs['aria-valuetext']}
data-high={attrs['data-high']}
data-low={attrs['data-low']}
data-max={attrs['data-max']}
data-min={attrs['data-min']}
data-optimum={attrs['data-optimum']}
data-state={attrs['data-state']}
data-value={attrs['data-value']}
high={attrs.high}
low={attrs.low}
max={attrs.max}
min={attrs.min}
optimum={attrs.optimum}
value={attrs.value}
>
{props.children}
</meter>
<span
{...indicatorStyleAttrs}
{...bindingProps(props, ['style', 'data-state'])}
aria-hidden="true"
data-state={attrs['data-state']}
style={{ width: indicatorWidth }}
/>
</div>
);
},
});Supporting types#
MeterStyleOverrides#
Style override slots accepted by the meter components.
Copyable example
import type { MeterStyleOverrides } from "@kovojs/ui/meter";
const styles: MeterStyleOverrides = {};Signature
interface MeterStyleOverrides {
indicator?: style.StyleInput;
native?: style.StyleInput;
root?: style.StyleInput;
}MeterProps#
Props for the meter component.
Copyable example
import type { MeterProps } from "@kovojs/ui/meter";
const props: MeterProps = { children: 'Content' };Signature
interface MeterProps {
children?: ComponentChild;
high?: number;
low?: number;
max?: number;
min?: number;
optimum?: number;
style?: style.StyleInput;
styles?: MeterStyleOverrides;
value?: number;
valueText?: string;
}@kovojs/ui/navigation-menu#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/navigation-menu.tsx
Values#
NavigationMenu#
Renders the styled navigation menu primitive.
Copyable example
import { NavigationMenu } from "@kovojs/ui/navigation-menu";
const component = NavigationMenu;Signature
const NavigationMenu = component({
render(props: NavigationMenuProps) {
const attrs = navigationMenuRootAttributes({
...toNavigationState(props),
...(props.descriptionId === undefined ? {} : { descriptionId: props.descriptionId }),
...(props.label === undefined ? {} : { label: props.label }),
...(props.labelledBy === undefined ? {} : { labelledBy: props.labelledBy }),
});
const styleAttrs = style.attrs(navigationMenuStyles.root, props.styles?.root);
return (
<nav
aria-describedby={attrs['aria-describedby']}
aria-disabled={attrs['aria-disabled']}
aria-label={attrs['aria-label']}
aria-labelledby={attrs['aria-labelledby']}
aria-orientation={attrs['aria-orientation']}
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-orientation={attrs['data-orientation']}
data-state={attrs['data-state']}
id={attrs.id}
role={attrs.role}
>
{props.children}
</nav>
);
},
});NavigationMenuList#
Renders the styled navigation menu list primitive.
Copyable example
import { NavigationMenuList } from "@kovojs/ui/navigation-menu";
const component = NavigationMenuList;Signature
const NavigationMenuList = component({
render(props: NavigationMenuListProps) {
const attrs = navigationMenuListAttributes({
...toNavigationState(props),
...(props.labelledBy === undefined ? {} : { labelledBy: props.labelledBy }),
});
const styleAttrs = style.attrs(navigationMenuStyles.list, props.styles?.list);
return (
<div
aria-labelledby={attrs['aria-labelledby']}
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-orientation={attrs['data-orientation']}
data-state={attrs['data-state']}
id={attrs.id}
role={attrs.role}
>
{props.children}
</div>
);
},
});NavigationMenuItem#
Renders the styled navigation menu item primitive.
Copyable example
import { NavigationMenuItem } from "@kovojs/ui/navigation-menu";
const component = NavigationMenuItem;Signature
const NavigationMenuItem = component({
render(props: NavigationMenuItemProps) {
const attrs = navigationMenuItemAttributes({
...toNavigationState(props),
...(props.id === undefined ? {} : { id: props.id }),
...(props.itemDisabled === undefined ? {} : { itemDisabled: props.itemDisabled }),
itemValue: props.itemValue,
});
const styleAttrs = style.attrs(navigationMenuStyles.item, props.styles?.item);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-highlighted={attrs['data-highlighted']}
data-state={attrs['data-state']}
id={attrs.id}
role={attrs.role}
>
{props.children}
</div>
);
},
});NavigationMenuTrigger#
Renders the styled navigation menu trigger primitive.
Copyable example
import { NavigationMenuTrigger } from "@kovojs/ui/navigation-menu";
const component = NavigationMenuTrigger;Signature
const NavigationMenuTrigger = component({
render(props: NavigationMenuTriggerProps) {
const attrs = navigationMenuTriggerAttributes({
...toNavigationState(props),
...(props.contentId === undefined ? {} : { contentId: props.contentId }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.itemDisabled === undefined ? {} : { itemDisabled: props.itemDisabled }),
...(props.itemLabel === undefined ? {} : { itemLabel: props.itemLabel }),
itemValue: props.itemValue,
});
const styleAttrs = style.attrs(navigationMenuStyles.trigger, props.styles?.trigger);
return (
<button
aria-controls={attrs['aria-controls']}
aria-expanded={attrs['aria-expanded']}
aria-haspopup={attrs['aria-haspopup']}
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-highlighted={attrs['data-highlighted']}
data-state={attrs['data-state']}
disabled={attrs.disabled}
id={attrs.id}
tabIndex={attrs.tabIndex}
type={attrs.type}
value={attrs.value}
>
{/* SPEC.md §4.5/§5.2: the @kovojs/server JSX runtime escapes scalar text
children exactly once, so pass itemLabel/itemValue raw — pre-escaping here
would double-escape (`AT&T` → `AT&amp;T`). props.children is the
composition slot and may carry framework-rendered HTML, so leave it raw. */}
{props.children ?? props.itemLabel ?? props.itemValue}
{/* shadcn-style chevron: a real (decorative) icon child carrying the trigger's
[data-state] so triggerIcon can rotate it 180deg when the menu is open. */}
<ChevronDown style={navigationMenuStyles.triggerIcon} data-state={attrs['data-state']} />
</button>
);
},
});NavigationMenuContent#
Renders the styled navigation menu content primitive.
Copyable example
import { NavigationMenuContent } from "@kovojs/ui/navigation-menu";
const component = NavigationMenuContent;Signature
const NavigationMenuContent = component({
render(props: NavigationMenuContentProps) {
const attrs = navigationMenuContentAttributes({
...toNavigationState(props),
...(props.id === undefined ? {} : { id: props.id }),
...(props.labelledBy === undefined ? {} : { labelledBy: props.labelledBy }),
value: props.value,
});
const styleAttrs = style.attrs(navigationMenuStyles.content, props.styles?.content);
return (
<div
aria-labelledby={attrs['aria-labelledby']}
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
hidden={attrs.hidden}
id={attrs.id}
role={attrs.role}
tabIndex={attrs.tabIndex}
>
{props.children}
</div>
);
},
});NavigationMenuLink#
Renders the styled navigation menu link primitive.
Copyable example
import { NavigationMenuLink } from "@kovojs/ui/navigation-menu";
const component = NavigationMenuLink;Signature
const NavigationMenuLink = component({
render(props: NavigationMenuLinkProps) {
const hrefCandidate = props.href;
const attrs = navigationMenuLinkAttributes({
...toNavigationState(props),
...(typeof hrefCandidate === 'string' ? { href: hrefCandidate } : {}),
...(props.id === undefined ? {} : { id: props.id }),
...(props.itemDisabled === undefined ? {} : { itemDisabled: props.itemDisabled }),
...(props.itemLabel === undefined ? {} : { itemLabel: props.itemLabel }),
itemValue: props.itemValue,
});
return (
<a
{...styleAttributes(navigationMenuStyles.link, props.styles?.link)}
{...passThroughProps(props)}
aria-disabled={attrs['aria-disabled']}
data-disabled={attrs['data-disabled']}
data-highlighted={attrs['data-highlighted']}
data-state={attrs['data-state']}
href={
attrs['aria-disabled'] === 'true' || hrefCandidate === undefined
? undefined
: typeof hrefCandidate === 'string'
? attrs.href
: safeUrl(hrefCandidate)
}
id={attrs.id}
tabIndex={attrs.tabIndex}
value={attrs.value}
>
{/*
SPEC.md §4.5/§5.2: the JSX runtime escapes the scalar itemLabel/itemValue
text fallback exactly once, so pass it raw (pre-escaping would
double-escape); leave props.children — the composition slot — raw.
*/}
{props.children ?? props.itemLabel ?? props.itemValue}
</a>
);
},
});NavigationMenuViewport#
Renders the styled navigation menu viewport primitive.
Copyable example
import { NavigationMenuViewport } from "@kovojs/ui/navigation-menu";
const component = NavigationMenuViewport;Signature
const NavigationMenuViewport = component({
render(props: NavigationMenuPartProps) {
const attrs = navigationMenuViewportAttributes(toNavigationState(props));
const styleAttrs = style.attrs(navigationMenuStyles.viewport, props.styles?.viewport);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
hidden={attrs.hidden}
id={attrs.id}
>
{props.children}
</div>
);
},
});NavigationMenuIndicator#
Renders the styled navigation menu indicator primitive.
Copyable example
import { NavigationMenuIndicator } from "@kovojs/ui/navigation-menu";
const component = NavigationMenuIndicator;Signature
const NavigationMenuIndicator = component({
render(props: NavigationMenuPartProps) {
const attrs = navigationMenuIndicatorAttributes(toNavigationState(props));
const styleAttrs = style.attrs(navigationMenuStyles.indicator, props.styles?.indicator);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
hidden={attrs.hidden}
id={attrs.id}
>
{props.children}
</div>
);
},
});Supporting types#
NavigationMenuStyleOverrides#
Style override slots accepted by the navigation menu components.
Copyable example
import type { NavigationMenuStyleOverrides } from "@kovojs/ui/navigation-menu";
const styles: NavigationMenuStyleOverrides = {};Signature
interface NavigationMenuStyleOverrides {
content?: style.StyleInput;
indicator?: style.StyleInput;
item?: style.StyleInput;
link?: style.StyleInput;
list?: style.StyleInput;
root?: style.StyleInput;
trigger?: style.StyleInput;
viewport?: style.StyleInput;
}NavigationMenuStateProps#
Shared state props for the navigation menu component family.
Copyable example
import type { NavigationMenuStateProps } from "@kovojs/ui/navigation-menu";
const state: NavigationMenuStateProps = {};Signature
interface NavigationMenuStateProps {
activeValue?: string;
dir?: TextDirection;
disabled?: boolean;
items?: readonly HeadlessNavigationMenuItem[];
loop?: boolean;
openValue?: string | undefined;
orientation?: CollectionOrientation;
}NavigationMenuProps#
Props for the navigation menu component.
Copyable example
import type { NavigationMenuProps } from "@kovojs/ui/navigation-menu";
const props: NavigationMenuProps = { children: 'Content' };Signature
interface NavigationMenuProps extends NavigationMenuStateProps {
children?: ComponentChild;
descriptionId?: string;
id?: string;
label?: string;
labelledBy?: string;
styles?: NavigationMenuStyleOverrides;
}NavigationMenuListProps#
Props for the navigation menu list component.
Copyable example
import type { NavigationMenuListProps } from "@kovojs/ui/navigation-menu";
const props: NavigationMenuListProps = { children: 'Content' };Signature
interface NavigationMenuListProps extends NavigationMenuStateProps {
children?: ComponentChild;
id?: string;
labelledBy?: string;
styles?: NavigationMenuStyleOverrides;
}NavigationMenuItemProps#
Props for the navigation menu item component.
Copyable example
import type { NavigationMenuItemProps } from "@kovojs/ui/navigation-menu";
const props: NavigationMenuItemProps = { itemValue: 'item', children: 'Content' };Signature
interface NavigationMenuItemProps extends NavigationMenuStateProps {
children?: ComponentChild;
id?: string;
itemDisabled?: boolean;
itemValue: string;
styles?: NavigationMenuStyleOverrides;
}NavigationMenuTriggerProps#
Props for the navigation menu trigger component.
Copyable example
import type { NavigationMenuTriggerProps } from "@kovojs/ui/navigation-menu";
const props: NavigationMenuTriggerProps = { itemValue: 'item', children: 'Content' };Signature
interface NavigationMenuTriggerProps extends NavigationMenuItemProps {
contentId?: string;
itemLabel?: string;
}NavigationMenuContentProps#
Props for the navigation menu content component.
Copyable example
import type { NavigationMenuContentProps } from "@kovojs/ui/navigation-menu";
const props: NavigationMenuContentProps = { value: 'value', children: 'Content' };Signature
interface NavigationMenuContentProps extends NavigationMenuStateProps {
children?: ComponentChild;
id?: string;
labelledBy?: string;
styles?: NavigationMenuStyleOverrides;
value: string;
}NavigationMenuLinkProps#
Props for the navigation menu link component.
Copyable example
import type { NavigationMenuLinkProps } from "@kovojs/ui/navigation-menu";
const props: NavigationMenuLinkProps = { itemValue: 'item', children: 'Content' };Signature
interface NavigationMenuLinkProps extends NavigationMenuItemProps {
href?: string | TrustedUrl;
itemLabel?: string;
}NavigationMenuPartProps#
Props for the navigation menu part component.
Copyable example
import type { NavigationMenuPartProps } from "@kovojs/ui/navigation-menu";
const props: NavigationMenuPartProps = { children: 'Content' };Signature
interface NavigationMenuPartProps extends NavigationMenuStateProps {
children?: ComponentChild;
id?: string;
styles?: NavigationMenuStyleOverrides;
}@kovojs/ui/number-field#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/number-field.tsx
Values#
NumberField#
Renders the styled number field primitive.
Copyable example
import { NumberField } from "@kovojs/ui/number-field";
const component = NumberField;Signature
const NumberField = component({
render(props: NumberFieldProps) {
const attrs = numberFieldRootAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.max === undefined ? {} : { max: props.max }),
...(props.min === undefined ? {} : { min: props.min }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.required === undefined ? {} : { required: props.required }),
...(props.step === undefined ? {} : { step: props.step }),
...(props.value === undefined ? {} : { value: props.value }),
});
const styleAttrs = style.attrs(numberFieldStyles.root, props.styles?.root);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-invalid={attrs['data-invalid']}
data-required={attrs['data-required']}
id={attrs.id}
>
{props.children}
</div>
);
},
});NumberFieldControl#
Renders the styled number field control primitive.
Copyable example
import { NumberFieldControl } from "@kovojs/ui/number-field";
const component = NumberFieldControl;Signature
const NumberFieldControl = component({
render(props: NumberFieldProps) {
const attrs = numberFieldRootAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.max === undefined ? {} : { max: props.max }),
...(props.min === undefined ? {} : { min: props.min }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.required === undefined ? {} : { required: props.required }),
...(props.step === undefined ? {} : { step: props.step }),
...(props.value === undefined ? {} : { value: props.value }),
});
const styleAttrs = style.attrs(numberFieldStyles.control, props.styles?.control);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-invalid={attrs['data-invalid']}
data-required={attrs['data-required']}
id={attrs.id}
>
{props.children}
</div>
);
},
});NumberFieldInput#
Renders the styled number field input primitive.
Copyable example
import { NumberFieldInput } from "@kovojs/ui/number-field";
const component = NumberFieldInput;Signature
const NumberFieldInput = component({
render(props: NumberFieldInputProps) {
const attrs = numberFieldInputAttributes({
...(props.descriptionId === undefined ? {} : { descriptionId: props.descriptionId }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.errorId === undefined ? {} : { errorId: props.errorId }),
...(props.form === undefined ? {} : { form: props.form }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.label === undefined ? {} : { label: props.label }),
...(props.labelledBy === undefined ? {} : { labelledBy: props.labelledBy }),
...(props.max === undefined ? {} : { max: props.max }),
...(props.min === undefined ? {} : { min: props.min }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.required === undefined ? {} : { required: props.required }),
...(props.step === undefined ? {} : { step: props.step }),
...(props.value === undefined ? {} : { value: props.value }),
});
const styleAttrs = style.attrs(numberFieldStyles.input, props.styles?.input);
return (
<input
{...styleAttrs}
{...passThroughProps(props)}
aria-describedby={attrs['aria-describedby']}
aria-invalid={attrs['aria-invalid']}
aria-label={attrs['aria-label']}
aria-labelledby={attrs['aria-labelledby']}
data-disabled={attrs['data-disabled']}
data-invalid={attrs['data-invalid']}
data-required={attrs['data-required']}
disabled={attrs.disabled}
form={attrs.form}
id={attrs.id}
max={attrs.max}
min={attrs.min}
name={attrs.name}
required={attrs.required}
step={attrs.step}
type={attrs.type}
value={attrs.value}
/>
);
},
});NumberFieldDecrement#
Renders the styled number field decrement primitive.
Copyable example
import { NumberFieldDecrement } from "@kovojs/ui/number-field";
const component = NumberFieldDecrement;Signature
const NumberFieldDecrement = component({
render(props: NumberFieldButtonProps) {
const attrs = numberFieldDecrementAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.inputId === undefined ? {} : { inputId: props.inputId }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.label === undefined ? {} : { label: props.label }),
...(props.max === undefined ? {} : { max: props.max }),
...(props.min === undefined ? {} : { min: props.min }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.required === undefined ? {} : { required: props.required }),
...(props.step === undefined ? {} : { step: props.step }),
...(props.value === undefined ? {} : { value: props.value }),
});
const styleAttrs = style.attrs(numberFieldStyles.button, props.styles?.button);
return (
<button
{...styleAttrs}
{...passThroughProps(props)}
aria-controls={attrs['aria-controls']}
aria-label={attrs['aria-label']}
data-action={attrs['data-action']}
data-disabled={attrs['data-disabled']}
data-invalid={attrs['data-invalid']}
data-required={attrs['data-required']}
disabled={attrs.disabled}
id={attrs.id}
type={attrs.type}
>
{props.children ?? '-'}
</button>
);
},
});NumberFieldIncrement#
Renders the styled number field increment primitive.
Copyable example
import { NumberFieldIncrement } from "@kovojs/ui/number-field";
const component = NumberFieldIncrement;Signature
const NumberFieldIncrement = component({
render(props: NumberFieldButtonProps) {
const attrs = numberFieldIncrementAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.inputId === undefined ? {} : { inputId: props.inputId }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.label === undefined ? {} : { label: props.label }),
...(props.max === undefined ? {} : { max: props.max }),
...(props.min === undefined ? {} : { min: props.min }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.required === undefined ? {} : { required: props.required }),
...(props.step === undefined ? {} : { step: props.step }),
...(props.value === undefined ? {} : { value: props.value }),
});
const styleAttrs = style.attrs(numberFieldStyles.button, props.styles?.button);
return (
<button
{...styleAttrs}
{...passThroughProps(props)}
aria-controls={attrs['aria-controls']}
aria-label={attrs['aria-label']}
data-action={attrs['data-action']}
data-disabled={attrs['data-disabled']}
data-invalid={attrs['data-invalid']}
data-required={attrs['data-required']}
disabled={attrs.disabled}
id={attrs.id}
type={attrs.type}
>
{props.children ?? '+'}
</button>
);
},
});Supporting types#
NumberFieldStyleOverrides#
Style override slots accepted by the number field components.
Copyable example
import type { NumberFieldStyleOverrides } from "@kovojs/ui/number-field";
const styles: NumberFieldStyleOverrides = {};Signature
interface NumberFieldStyleOverrides {
button?: style.StyleInput;
control?: style.StyleInput;
input?: style.StyleInput;
root?: style.StyleInput;
}NumberFieldStateProps#
Shared state props for the number field component family.
Copyable example
import type { NumberFieldStateProps } from "@kovojs/ui/number-field";
const state: NumberFieldStateProps = {};Signature
interface NumberFieldStateProps {
disabled?: boolean;
invalid?: boolean;
max?: number;
min?: number;
name?: string;
required?: boolean;
step?: number;
value?: NumberFieldValue;
}NumberFieldProps#
Props for the number field component.
Copyable example
import type { NumberFieldProps } from "@kovojs/ui/number-field";
const props: NumberFieldProps = { children: 'Content' };Signature
interface NumberFieldProps extends NumberFieldStateProps {
children?: ComponentChild;
id?: string;
styles?: NumberFieldStyleOverrides;
}NumberFieldInputProps#
Props for the number field input component.
Copyable example
import type { NumberFieldInputProps } from "@kovojs/ui/number-field";
const props: NumberFieldInputProps = {};Signature
interface NumberFieldInputProps extends NumberFieldStateProps {
descriptionId?: string;
errorId?: string;
form?: string;
id?: string;
label?: string;
labelledBy?: string;
styles?: NumberFieldStyleOverrides;
}NumberFieldButtonProps#
Props for the number field button component.
Copyable example
import type { NumberFieldButtonProps } from "@kovojs/ui/number-field";
const props: NumberFieldButtonProps = { children: 'Content' };Signature
interface NumberFieldButtonProps extends NumberFieldStateProps {
children?: ComponentChild;
id?: string;
inputId?: string;
label?: string;
styles?: NumberFieldStyleOverrides;
}@kovojs/ui/otp-field#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/otp-field.tsx
Values#
OtpField#
Renders the styled otp field primitive.
Copyable example
import { OtpField } from "@kovojs/ui/otp-field";
const component = OtpField;Signature
const OtpField = component({
render(props: OtpFieldProps) {
const attrs = otpFieldRootAttributes({
...(props.descriptionId === undefined ? {} : { descriptionId: props.descriptionId }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.errorId === undefined ? {} : { errorId: props.errorId }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.inputMode === undefined ? {} : { inputMode: props.inputMode }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.labelledBy === undefined ? {} : { labelledBy: props.labelledBy }),
...(props.length === undefined ? {} : { length: props.length }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.pattern === undefined ? {} : { pattern: props.pattern }),
...(props.required === undefined ? {} : { required: props.required }),
...(props.value === undefined ? {} : { value: props.value }),
});
const styleAttrs = style.attrs(otpFieldStyles.root, props.styles?.root);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
aria-describedby={attrs['aria-describedby']}
aria-disabled={attrs['aria-disabled']}
aria-invalid={attrs['aria-invalid']}
aria-labelledby={attrs['aria-labelledby']}
aria-required={attrs['aria-required']}
data-complete={attrs['data-complete']}
data-disabled={attrs['data-disabled']}
data-invalid={attrs['data-invalid']}
data-required={attrs['data-required']}
id={attrs.id}
role={attrs.role}
>
{props.children}
</div>
);
},
});OtpFieldGroup#
Renders the styled otp field group primitive.
Copyable example
import { OtpFieldGroup } from "@kovojs/ui/otp-field";
const component = OtpFieldGroup;Signature
const OtpFieldGroup = component({
render(props: OtpFieldGroupProps) {
const styleAttrs = style.attrs(otpFieldStyles.group, props.styles?.group);
return <div {...styleAttrs}>{props.children}</div>;
},
});OtpFieldHiddenInput#
Renders the styled otp field hidden input primitive.
Copyable example
import { OtpFieldHiddenInput } from "@kovojs/ui/otp-field";
const component = OtpFieldHiddenInput;Signature
const OtpFieldHiddenInput = component({
render(props: OtpFieldHiddenInputProps) {
const attrs = otpFieldHiddenInputAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.form === undefined ? {} : { form: props.form }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.inputMode === undefined ? {} : { inputMode: props.inputMode }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.length === undefined ? {} : { length: props.length }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.pattern === undefined ? {} : { pattern: props.pattern }),
...(props.required === undefined ? {} : { required: props.required }),
...(props.value === undefined ? {} : { value: props.value }),
});
const styleAttrs = style.attrs(otpFieldStyles.hiddenInput, props.styles?.hiddenInput);
return (
<input
{...styleAttrs}
{...passThroughProps(props)}
aria-hidden={attrs['aria-hidden']}
autoComplete={attrs.autoComplete}
data-complete={attrs['data-complete']}
data-disabled={attrs['data-disabled']}
data-invalid={attrs['data-invalid']}
data-required={attrs['data-required']}
data-slot={attrs['data-slot']}
disabled={attrs.disabled}
form={attrs.form}
id={attrs.id}
inputMode={attrs.inputMode}
maxLength={attrs.maxLength}
minLength={attrs.minLength}
name={attrs.name}
pattern={attrs.pattern}
required={attrs.required}
tabIndex={attrs.tabIndex}
type={attrs.type}
value={attrs.value}
/>
);
},
});OtpFieldInput#
Renders the styled otp field input primitive.
Copyable example
import { OtpFieldInput } from "@kovojs/ui/otp-field";
const component = OtpFieldInput;Signature
const OtpFieldInput = component({
render(props: OtpFieldInputProps) {
const attrs = otpFieldInputAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.inputMode === undefined ? {} : { inputMode: props.inputMode }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.label === undefined ? {} : { label: props.label }),
...(props.labelledBy === undefined ? {} : { labelledBy: props.labelledBy }),
...(props.length === undefined ? {} : { length: props.length }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.pattern === undefined ? {} : { pattern: props.pattern }),
...(props.required === undefined ? {} : { required: props.required }),
slotIndex: props.slotIndex,
...(props.value === undefined ? {} : { value: props.value }),
});
const isFirst = props.slotIndex === 0;
const isLast = props.length !== undefined && props.slotIndex === props.length - 1;
const styleAttrs = style.attrs(
otpFieldStyles.input,
isFirst ? otpFieldStyles.inputFirst : null,
isLast ? otpFieldStyles.inputLast : null,
props.styles?.input,
);
return (
<input
{...styleAttrs}
{...passThroughProps(props)}
aria-invalid={attrs['aria-invalid']}
aria-label={attrs['aria-label']}
aria-labelledby={attrs['aria-labelledby']}
autoComplete={attrs.autoComplete}
data-complete={attrs['data-complete']}
data-disabled={attrs['data-disabled']}
data-filled={attrs['data-filled']}
data-invalid={attrs['data-invalid']}
data-required={attrs['data-required']}
data-slot={attrs['data-slot']}
disabled={attrs.disabled}
id={attrs.id}
inputMode={attrs.inputMode}
maxLength={attrs.maxLength}
pattern={attrs.pattern}
required={attrs.required}
type={attrs.type}
value={attrs.value}
/>
);
},
});Supporting types#
OtpFieldStyleOverrides#
Style override slots accepted by the otp field components.
Copyable example
import type { OtpFieldStyleOverrides } from "@kovojs/ui/otp-field";
const styles: OtpFieldStyleOverrides = {};Signature
interface OtpFieldStyleOverrides {
group?: style.StyleInput;
hiddenInput?: style.StyleInput;
input?: style.StyleInput;
root?: style.StyleInput;
}OtpFieldStateProps#
Shared state props for the otp field component family.
Copyable example
import type { OtpFieldStateProps } from "@kovojs/ui/otp-field";
const state: OtpFieldStateProps = {};Signature
interface OtpFieldStateProps {
disabled?: boolean;
form?: string;
inputMode?: OtpFieldInputMode;
invalid?: boolean;
length?: number;
name?: string;
pattern?: string;
required?: boolean;
value?: string;
}OtpFieldProps#
Props for the otp field component.
Copyable example
import type { OtpFieldProps } from "@kovojs/ui/otp-field";
const props: OtpFieldProps = { children: 'Content' };Signature
interface OtpFieldProps extends OtpFieldStateProps {
children?: ComponentChild;
descriptionId?: string;
errorId?: string;
id?: string;
labelledBy?: string;
styles?: OtpFieldStyleOverrides;
}OtpFieldHiddenInputProps#
Props for the otp field hidden input component.
Copyable example
import type { OtpFieldHiddenInputProps } from "@kovojs/ui/otp-field";
const props: OtpFieldHiddenInputProps = {};Signature
interface OtpFieldHiddenInputProps extends OtpFieldStateProps {
id?: string;
styles?: OtpFieldStyleOverrides;
}OtpFieldInputProps#
Props for the otp field input component.
Copyable example
import type { OtpFieldInputProps } from "@kovojs/ui/otp-field";
const props: OtpFieldInputProps = { slotIndex: 0 };Signature
interface OtpFieldInputProps extends OtpFieldStateProps {
id?: string;
label?: string;
labelledBy?: string;
slotIndex: number;
styles?: OtpFieldStyleOverrides;
}@kovojs/ui/popover#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/popover.tsx
Values#
Popover#
Renders the styled popover primitive.
Copyable example
import { Popover } from "@kovojs/ui/popover";
const component = Popover;Signature
const Popover = component({
render(props: PopoverProps) {
const attrs = popoverRootAttributes(popoverState(props));
const styleAttrs = style.attrs(popoverStyles.root, props.styles?.root);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
id={props.id}
>
{props.children}
</div>
);
},
});PopoverTrigger#
Renders the styled popover trigger primitive.
Copyable example
import { PopoverTrigger } from "@kovojs/ui/popover";
const component = PopoverTrigger;Signature
const PopoverTrigger = component({
render(props: PopoverTriggerProps) {
const attrs = popoverTriggerAttributes({
...popoverState(props),
...(props.contentId === undefined ? {} : { contentId: props.contentId }),
});
const styleAttrs = style.attrs(popoverStyles.trigger, props.styles?.trigger);
return (
<button
{...styleAttrs}
{...passThroughProps(props)}
aria-controls={attrs['aria-controls']}
aria-expanded={attrs['aria-expanded']}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
disabled={attrs.disabled}
id={props.id}
popovertarget={attrs.popovertarget}
popovertargetaction={attrs.popovertargetaction}
type={attrs.type}
>
{props.children}
</button>
);
},
});PopoverContent#
Renders the styled popover content primitive.
Copyable example
import { PopoverContent } from "@kovojs/ui/popover";
const component = PopoverContent;Signature
const PopoverContent = component({
render(props: PopoverContentProps) {
const attrs = popoverContentAttributes({
...popoverState(props),
...(props.contentId === undefined ? {} : { contentId: props.contentId }),
});
const styleAttrs = style.attrs(popoverStyles.content, props.styles?.content);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
data-state={attrs['data-state']}
id={attrs.id}
popover={attrs.popover}
>
{props.children}
</div>
);
},
});Supporting types#
PopoverStyleOverrides#
Style override slots accepted by the popover components.
Copyable example
import type { PopoverStyleOverrides } from "@kovojs/ui/popover";
const styles: PopoverStyleOverrides = {};Signature
interface PopoverStyleOverrides {
content?: style.StyleInput;
root?: style.StyleInput;
trigger?: style.StyleInput;
}PopoverStateProps#
Shared state props for the popover component family.
Copyable example
import type { PopoverStateProps } from "@kovojs/ui/popover";
const state: PopoverStateProps = {};Signature
interface PopoverStateProps {
disabled?: boolean;
open?: boolean;
}PopoverProps#
Props for the popover component.
Copyable example
import type { PopoverProps } from "@kovojs/ui/popover";
const props: PopoverProps = { children: 'Content' };Signature
interface PopoverProps extends PopoverStateProps {
children?: ComponentChild;
id?: string;
styles?: PopoverStyleOverrides;
}PopoverTriggerProps#
Props for the popover trigger component.
Copyable example
import type { PopoverTriggerProps } from "@kovojs/ui/popover";
const props: PopoverTriggerProps = { children: 'Content' };Signature
interface PopoverTriggerProps extends PopoverStateProps {
children?: ComponentChild;
contentId?: string;
id?: string;
styles?: PopoverStyleOverrides;
}PopoverContentProps#
Props for the popover content component.
Copyable example
import type { PopoverContentProps } from "@kovojs/ui/popover";
const props: PopoverContentProps = { children: 'Content' };Signature
interface PopoverContentProps extends PopoverStateProps {
children?: ComponentChild;
contentId?: string;
styles?: PopoverStyleOverrides;
}@kovojs/ui/progress#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/progress.tsx
Values#
Progress#
Renders the styled progress primitive.
Copyable example
import { Progress } from "@kovojs/ui/progress";
const component = Progress;Signature
const Progress = component({
render(props: ProgressProps) {
const attrs = progressRootAttributes({
...(props.max === undefined ? {} : { max: props.max }),
...(props.value === undefined ? {} : { value: props.value }),
...(props.valueText === undefined ? {} : { valueText: props.valueText }),
});
const slots = props.styles;
// The `style` prop is NOT applied to the root track: a call-site reactive
// `style={{ width }}` (the only way to emit a `data-bind:style`) would
// otherwise shrink the whole track. It is forwarded as the indicator fill
// binding below (see bindingProps) so the visible bar can animate client-side.
const rootStyleAttrs = style.attrs(progressStyles.root, slots?.root);
const nativeStyleAttrs = style.attrs(progressStyles.native, slots?.native);
const indicatorStyleAttrs = style.attrs(progressStyles.indicator, slots?.indicator);
const indicatorWidth = fillStyle(attrs['data-value'], attrs['data-max']);
return (
<div {...rootStyleAttrs} data-state={attrs['data-state']}>
<progress
{...nativeStyleAttrs}
{...passThroughProps(props)}
aria-valuetext={attrs['aria-valuetext']}
data-max={attrs['data-max']}
data-state={attrs['data-state']}
data-value={attrs['data-value']}
max={attrs.max}
value={attrs.value}
>
{props.children}
</progress>
<span
{...indicatorStyleAttrs}
{...bindingProps(props, ['style', 'data-state'])}
aria-hidden="true"
data-state={attrs['data-state']}
style={{ width: indicatorWidth }}
/>
</div>
);
},
});Supporting types#
ProgressStyleOverrides#
Style override slots accepted by the progress components.
Copyable example
import type { ProgressStyleOverrides } from "@kovojs/ui/progress";
const styles: ProgressStyleOverrides = {};Signature
interface ProgressStyleOverrides {
indicator?: style.StyleInput;
native?: style.StyleInput;
root?: style.StyleInput;
}ProgressProps#
Props for the progress component.
Copyable example
import type { ProgressProps } from "@kovojs/ui/progress";
const props: ProgressProps = { children: 'Content' };Signature
interface ProgressProps {
children?: ComponentChild;
max?: number;
style?: style.StyleInput;
styles?: ProgressStyleOverrides;
value?: number | null;
valueText?: string;
}@kovojs/ui/radio-group#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/radio-group.tsx
Values#
RadioGroup#
Renders the styled radio group primitive.
Copyable example
import { RadioGroup } from "@kovojs/ui/radio-group";
const component = RadioGroup;Signature
const RadioGroup = component({
render(props: RadioGroupProps) {
const attrs = radioGroupRootAttributes({
...(props.descriptionId === undefined ? {} : { descriptionId: props.descriptionId }),
...(props.dir === undefined ? {} : { dir: props.dir }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.errorId === undefined ? {} : { errorId: props.errorId }),
...(props.form === undefined ? {} : { form: props.form }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.items === undefined ? {} : { items: props.items }),
...(props.labelledBy === undefined ? {} : { labelledBy: props.labelledBy }),
...(props.loop === undefined ? {} : { loop: props.loop }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.orientation === undefined ? {} : { orientation: props.orientation }),
...(props.required === undefined ? {} : { required: props.required }),
...(props.value === undefined ? {} : { value: props.value }),
});
const styleAttrs = style.attrs(radioGroupStyles.root, props.styles?.root);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
aria-describedby={attrs['aria-describedby']}
aria-disabled={attrs['aria-disabled']}
aria-invalid={attrs['aria-invalid']}
aria-labelledby={attrs['aria-labelledby']}
aria-required={attrs['aria-required']}
data-disabled={attrs['data-disabled']}
data-invalid={attrs['data-invalid']}
data-orientation={attrs['data-orientation']}
data-required={attrs['data-required']}
id={attrs.id}
role={attrs.role}
>
{props.children}
</div>
);
},
});RadioGroupItem#
Renders the styled radio group item primitive.
Copyable example
import { RadioGroupItem } from "@kovojs/ui/radio-group";
const component = RadioGroupItem;Signature
const RadioGroupItem = component({
render(props: RadioGroupItemProps) {
const attrs = radioGroupItemAttributes({
...(props.dir === undefined ? {} : { dir: props.dir }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.form === undefined ? {} : { form: props.form }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.itemDisabled === undefined ? {} : { itemDisabled: props.itemDisabled }),
...(props.items === undefined ? {} : { items: props.items }),
itemValue: props.itemValue,
...(props.loop === undefined ? {} : { loop: props.loop }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.orientation === undefined ? {} : { orientation: props.orientation }),
...(props.required === undefined ? {} : { required: props.required }),
...(props.value === undefined ? {} : { value: props.value }),
});
const styleAttrs = style.attrs(radioGroupStyles.item, props.styles?.item);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
id={attrs.id}
>
{props.children}
</div>
);
},
});RadioGroupRadio#
Renders the styled radio group radio primitive.
Copyable example
import { RadioGroupRadio } from "@kovojs/ui/radio-group";
const component = RadioGroupRadio;Signature
const RadioGroupRadio = component({
render(props: RadioGroupRadioProps) {
const attrs = radioGroupRadioAttributes({
...(props.dir === undefined ? {} : { dir: props.dir }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.form === undefined ? {} : { form: props.form }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.itemDisabled === undefined ? {} : { itemDisabled: props.itemDisabled }),
...(props.items === undefined ? {} : { items: props.items }),
itemValue: props.itemValue,
...(props.loop === undefined ? {} : { loop: props.loop }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.orientation === undefined ? {} : { orientation: props.orientation }),
...(props.required === undefined ? {} : { required: props.required }),
...(props.value === undefined ? {} : { value: props.value }),
...(props.controlId === undefined ? {} : { controlId: props.controlId }),
});
const styleAttrs = style.attrs(radioGroupStyles.radio, props.styles?.radio);
const controlStyleAttrs = style.attrs(
radioGroupStyles.radioControl,
props.styles?.radioControl,
);
return (
<span
{...controlStyleAttrs}
{...bindingProps(props, ['data-state'])}
data-state={attrs['data-state']}
>
<input
{...styleAttrs}
{...passThroughProps(props, { island: false })}
aria-checked={attrs['aria-checked']}
checked={attrs.checked}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
disabled={attrs.disabled}
form={attrs.form}
id={attrs.id}
name={attrs.name}
required={attrs.required}
tabIndex={attrs.tabIndex}
type={attrs.type}
value={attrs.value}
/>
</span>
);
},
});RadioGroupLabel#
Renders the styled radio group label primitive.
Copyable example
import { RadioGroupLabel } from "@kovojs/ui/radio-group";
const component = RadioGroupLabel;Signature
const RadioGroupLabel = component({
render(props: RadioGroupLabelProps) {
const attrs = radioGroupLabelAttributes({
...(props.dir === undefined ? {} : { dir: props.dir }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.form === undefined ? {} : { form: props.form }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.itemDisabled === undefined ? {} : { itemDisabled: props.itemDisabled }),
...(props.items === undefined ? {} : { items: props.items }),
itemValue: props.itemValue,
...(props.loop === undefined ? {} : { loop: props.loop }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.orientation === undefined ? {} : { orientation: props.orientation }),
...(props.required === undefined ? {} : { required: props.required }),
...(props.value === undefined ? {} : { value: props.value }),
...(props.controlId === undefined ? {} : { controlId: props.controlId }),
});
const styleAttrs = style.attrs(radioGroupStyles.label, props.styles?.label);
return (
<label
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
for={attrs.for}
id={attrs.id}
>
{props.children}
</label>
);
},
});Supporting types#
RadioGroupStyleOverrides#
Style override slots accepted by the radio group components.
Copyable example
import type { RadioGroupStyleOverrides } from "@kovojs/ui/radio-group";
const styles: RadioGroupStyleOverrides = {};Signature
interface RadioGroupStyleOverrides {
item?: style.StyleInput;
label?: style.StyleInput;
radio?: style.StyleInput;
radioControl?: style.StyleInput;
root?: style.StyleInput;
}RadioGroupStateProps#
Shared state props for the radio group component family.
Copyable example
import type { RadioGroupStateProps } from "@kovojs/ui/radio-group";
const state: RadioGroupStateProps = {};Signature
interface RadioGroupStateProps {
descriptionId?: string;
dir?: TextDirection;
disabled?: boolean;
errorId?: string;
form?: string;
invalid?: boolean;
items?: readonly HeadlessRadioGroupItem[];
loop?: boolean;
name?: string;
orientation?: CollectionOrientation;
required?: boolean;
value?: string;
}RadioGroupProps#
Props for the radio group component.
Copyable example
import type { RadioGroupProps } from "@kovojs/ui/radio-group";
const props: RadioGroupProps = { children: 'Content' };Signature
interface RadioGroupProps extends RadioGroupStateProps {
children?: ComponentChild;
id?: string;
labelledBy?: string;
styles?: RadioGroupStyleOverrides;
}RadioGroupItemProps#
Props for the radio group item component.
Copyable example
import type { RadioGroupItemProps } from "@kovojs/ui/radio-group";
const props: RadioGroupItemProps = { itemValue: 'item', children: 'Content' };Signature
interface RadioGroupItemProps extends RadioGroupStateProps {
children?: ComponentChild;
id?: string;
itemDisabled?: boolean;
itemValue: string;
styles?: RadioGroupStyleOverrides;
}RadioGroupRadioProps#
Props for the radio group radio component.
Copyable example
import type { RadioGroupRadioProps } from "@kovojs/ui/radio-group";
const props: RadioGroupRadioProps = { itemValue: 'item' };Signature
interface RadioGroupRadioProps extends RadioGroupStateProps {
controlId?: string;
itemDisabled?: boolean;
itemValue: string;
styles?: RadioGroupStyleOverrides;
}RadioGroupLabelProps#
Props for the radio group label component.
Copyable example
import type { RadioGroupLabelProps } from "@kovojs/ui/radio-group";
const props: RadioGroupLabelProps = { itemValue: 'item', children: 'Content' };Signature
interface RadioGroupLabelProps extends RadioGroupStateProps {
children?: ComponentChild;
controlId?: string;
id?: string;
itemDisabled?: boolean;
itemValue: string;
styles?: RadioGroupStyleOverrides;
}@kovojs/ui/scroll-area#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/scroll-area.tsx
Values#
ScrollArea#
Renders the styled scroll area primitive.
Copyable example
import { ScrollArea } from "@kovojs/ui/scroll-area";
const component = ScrollArea;Signature
const ScrollArea = component({
render(props: ScrollAreaProps) {
const attrs = scrollAreaRootAttributes({
...(props.dir === undefined ? {} : { dir: props.dir }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.scrollbars === undefined ? {} : { scrollbars: props.scrollbars }),
});
const styleAttrs = style.attrs(scrollAreaStyles.root, props.styles?.root);
return (
<div
{...styleAttrs}
{...passThroughProps(props, { style: true })}
data-disabled={attrs['data-disabled']}
data-scrollbars={attrs['data-scrollbars']}
dir={attrs.dir}
id={attrs.id}
>
{props.children}
</div>
);
},
});ScrollAreaViewport#
Renders the styled scroll area viewport primitive.
Copyable example
import { ScrollAreaViewport } from "@kovojs/ui/scroll-area";
const component = ScrollAreaViewport;Signature
const ScrollAreaViewport = component({
render(props: ScrollAreaViewportProps) {
const attrs = scrollAreaViewportAttributes({
...(props.descriptionId === undefined ? {} : { descriptionId: props.descriptionId }),
...(props.dir === undefined ? {} : { dir: props.dir }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.label === undefined ? {} : { label: props.label }),
...(props.labelledBy === undefined ? {} : { labelledBy: props.labelledBy }),
...(props.scrollX === undefined ? {} : { scrollX: props.scrollX }),
...(props.scrollbars === undefined ? {} : { scrollbars: props.scrollbars }),
...(props.scrollY === undefined ? {} : { scrollY: props.scrollY }),
});
const styleAttrs = style.attrs(scrollAreaStyles.viewport, props.styles?.viewport);
return (
// { style: true } forwards a consumer's inline style (e.g. the demo's
// max-height:72px) so it can override the StyleX maxHeight default; without
// it the inline style is dropped and the viewport keeps the 224px default,
// leaving almost nothing to scroll (T7 / scroll-area V8).
<div
{...styleAttrs}
{...passThroughProps(props, { style: true })}
aria-describedby={attrs['aria-describedby']}
aria-disabled={attrs['aria-disabled']}
aria-label={attrs['aria-label']}
aria-labelledby={attrs['aria-labelledby']}
data-disabled={attrs['data-disabled']}
data-scroll-x={attrs['data-scroll-x']}
data-scroll-y={attrs['data-scroll-y']}
data-scrollbars={attrs['data-scrollbars']}
id={attrs.id}
role={attrs.role}
tabIndex={attrs.tabIndex}
>
{props.children}
</div>
);
},
});ScrollAreaScrollbar#
Renders the styled scroll area scrollbar primitive.
Copyable example
import { ScrollAreaScrollbar } from "@kovojs/ui/scroll-area";
const component = ScrollAreaScrollbar;Signature
const ScrollAreaScrollbar = component({
render(props: ScrollAreaScrollbarProps) {
const attrs = scrollAreaScrollbarAttributes({
...(props.dir === undefined ? {} : { dir: props.dir }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.forceMount === undefined ? {} : { forceMount: props.forceMount }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.orientation === undefined ? {} : { orientation: props.orientation }),
...(props.scrollPosition === undefined ? {} : { scrollPosition: props.scrollPosition }),
...(props.scrollbars === undefined ? {} : { scrollbars: props.scrollbars }),
...(props.visible === undefined ? {} : { visible: props.visible }),
});
const styleAttrs = style.attrs(scrollAreaStyles.scrollbar, props.styles?.scrollbar);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
aria-hidden={attrs['aria-hidden']}
data-disabled={attrs['data-disabled']}
data-orientation={attrs['data-orientation']}
data-scroll-position={attrs['data-scroll-position']}
data-scrollbars={attrs['data-scrollbars']}
data-state={attrs['data-state']}
hidden={attrs.hidden}
id={attrs.id}
>
{props.children}
</div>
);
},
});ScrollAreaThumb#
Renders the styled scroll area thumb primitive.
Copyable example
import { ScrollAreaThumb } from "@kovojs/ui/scroll-area";
const component = ScrollAreaThumb;Signature
const ScrollAreaThumb = component({
render(props: ScrollAreaThumbProps) {
const attrs = scrollAreaThumbAttributes({
...(props.dir === undefined ? {} : { dir: props.dir }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.forceMount === undefined ? {} : { forceMount: props.forceMount }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.orientation === undefined ? {} : { orientation: props.orientation }),
...(props.scrollPosition === undefined ? {} : { scrollPosition: props.scrollPosition }),
...(props.scrollbars === undefined ? {} : { scrollbars: props.scrollbars }),
...(props.visible === undefined ? {} : { visible: props.visible }),
});
const styleAttrs = style.attrs(scrollAreaStyles.thumb, props.styles?.thumb);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
aria-hidden={attrs['aria-hidden']}
data-disabled={attrs['data-disabled']}
data-orientation={attrs['data-orientation']}
data-scroll-position={attrs['data-scroll-position']}
data-scrollbars={attrs['data-scrollbars']}
data-state={attrs['data-state']}
hidden={attrs.hidden}
id={attrs.id}
/>
);
},
});ScrollAreaCorner#
Renders the styled scroll area corner primitive.
Copyable example
import { ScrollAreaCorner } from "@kovojs/ui/scroll-area";
const component = ScrollAreaCorner;Signature
const ScrollAreaCorner = component({
render(props: ScrollAreaCornerProps) {
const attrs = scrollAreaCornerAttributes({
...(props.dir === undefined ? {} : { dir: props.dir }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.forceMount === undefined ? {} : { forceMount: props.forceMount }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.scrollbars === undefined ? {} : { scrollbars: props.scrollbars }),
...(props.visible === undefined ? {} : { visible: props.visible }),
});
const styleAttrs = style.attrs(scrollAreaStyles.corner, props.styles?.corner);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
aria-hidden={attrs['aria-hidden']}
data-disabled={attrs['data-disabled']}
data-scrollbars={attrs['data-scrollbars']}
data-state={attrs['data-state']}
hidden={attrs.hidden}
id={attrs.id}
/>
);
},
});Supporting types#
ScrollAreaStyleOverrides#
Style override slots accepted by the scroll area components.
Copyable example
import type { ScrollAreaStyleOverrides } from "@kovojs/ui/scroll-area";
const styles: ScrollAreaStyleOverrides = {};Signature
interface ScrollAreaStyleOverrides {
corner?: style.StyleInput;
root?: style.StyleInput;
scrollbar?: style.StyleInput;
thumb?: style.StyleInput;
viewport?: style.StyleInput;
}ScrollAreaStateProps#
Shared state props for the scroll area component family.
Copyable example
import type { ScrollAreaStateProps } from "@kovojs/ui/scroll-area";
const state: ScrollAreaStateProps = {};Signature
interface ScrollAreaStateProps {
disabled?: boolean;
dir?: TextDirection;
scrollbars?: ScrollAreaScrollbars;
}ScrollAreaProps#
Props for the scroll area component.
Copyable example
import type { ScrollAreaProps } from "@kovojs/ui/scroll-area";
const props: ScrollAreaProps = { children: 'Content' };Signature
interface ScrollAreaProps extends ScrollAreaStateProps {
children?: ComponentChild;
id?: string;
styles?: ScrollAreaStyleOverrides;
}ScrollAreaViewportProps#
Props for the scroll area viewport component.
Copyable example
import type { ScrollAreaViewportProps } from "@kovojs/ui/scroll-area";
const props: ScrollAreaViewportProps = { children: 'Content' };Signature
interface ScrollAreaViewportProps extends ScrollAreaStateProps {
children?: ComponentChild;
descriptionId?: string;
id?: string;
label?: string;
labelledBy?: string;
scrollTop?: number;
scrollX?: ScrollAreaScrollPosition;
scrollY?: ScrollAreaScrollPosition;
styles?: ScrollAreaStyleOverrides;
}ScrollAreaScrollbarProps#
Props for the scroll area scrollbar component.
Copyable example
import type { ScrollAreaScrollbarProps } from "@kovojs/ui/scroll-area";
const props: ScrollAreaScrollbarProps = { children: 'Content' };Signature
interface ScrollAreaScrollbarProps extends ScrollAreaStateProps {
children?: ComponentChild;
forceMount?: boolean;
id?: string;
orientation?: ScrollAreaOrientation;
scrollPosition?: ScrollAreaScrollPosition;
styles?: ScrollAreaStyleOverrides;
visible?: boolean;
}ScrollAreaThumbProps#
Props for the scroll area thumb component.
Copyable example
import type { ScrollAreaThumbProps } from "@kovojs/ui/scroll-area";
const props: ScrollAreaThumbProps = { children: 'Content' };Signature
interface ScrollAreaThumbProps extends ScrollAreaScrollbarProps {}ScrollAreaCornerProps#
Props for the scroll area corner component.
Copyable example
import type { ScrollAreaCornerProps } from "@kovojs/ui/scroll-area";
const props: ScrollAreaCornerProps = {};Signature
interface ScrollAreaCornerProps extends ScrollAreaStateProps {
forceMount?: boolean;
id?: string;
styles?: ScrollAreaStyleOverrides;
visible?: boolean;
}@kovojs/ui/separator#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/separator.tsx
Values#
Separator#
Renders the styled separator primitive.
Copyable example
import { Separator } from "@kovojs/ui/separator";
const component = Separator;Signature
const Separator = component({
render(props: SeparatorProps) {
const orientation = props.orientation ?? 'horizontal';
const attrs = separatorRootAttributes({
...(props.decorative === undefined ? {} : { decorative: props.decorative }),
orientation,
});
const styleAttrs = style.attrs(base.root, orientations[orientation], props.style);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
aria-orientation={attrs['aria-orientation']}
data-orientation={attrs['data-orientation']}
role={attrs.role}
/>
);
},
});Supporting types#
SeparatorProps#
Props for the separator component.
Copyable example
import type { SeparatorProps } from "@kovojs/ui/separator";
const props: SeparatorProps = {};Signature
interface SeparatorProps {
decorative?: boolean;
orientation?: SeparatorOrientation;
style?: style.StyleInput;
}@kovojs/ui/sheet#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/sheet.tsx
Values#
Sheet#
Renders the styled sheet primitive.
Copyable example
import { Sheet } from "@kovojs/ui/sheet";
const component = Sheet;Signature
const Sheet = component({
render(props: SheetProps) {
return renderDialogPanel(props, 'right');
},
});SheetRoot#
Renders the styled sheet root primitive.
Copyable example
import { SheetRoot } from "@kovojs/ui/sheet";
const component = SheetRoot;Signature
const SheetRoot = component({
render(props: SheetRootProps) {
const attrs = dialogRootAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
open: props.open === true,
});
const styleAttrs = style.attrs(sheetStyles.root, props.styles?.root);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
id={props.id}
>
{props.children}
</div>
);
},
});SheetTrigger#
Renders the styled sheet trigger primitive.
Copyable example
import { SheetTrigger } from "@kovojs/ui/sheet";
const component = SheetTrigger;Signature
const SheetTrigger = component({
render(props: SheetTriggerProps) {
const attrs = dialogTriggerAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
contentId: props.contentId,
open: props.open === true,
});
const styleAttrs = style.attrs(sheetStyles.trigger, props.styles?.trigger);
return (
<button
{...styleAttrs}
{...passThroughProps(props)}
aria-controls={attrs['aria-controls']}
aria-expanded={attrs['aria-expanded']}
aria-haspopup={attrs['aria-haspopup']}
command={attrs.command}
commandfor={attrs.commandfor}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
disabled={attrs.disabled}
id={props.id}
type={attrs.type}
>
{props.children}
</button>
);
},
});SheetContent#
Renders the styled sheet content primitive.
Copyable example
import { SheetContent } from "@kovojs/ui/sheet";
const component = SheetContent;Signature
const SheetContent = component({
render(props: SheetContentProps) {
const side = props.side ?? 'right';
const attrs = dialogContentAttributes({
contentId: props.contentId,
...(props.descriptionId === undefined ? {} : { descriptionId: props.descriptionId }),
open: props.open === true,
titleId: props.titleId,
});
const styleAttrs = style.attrs(
sheetStyles.content,
sheetSideStyles[side],
props.styles?.content,
);
return (
<dialog
{...styleAttrs}
{...passThroughProps(props)}
aria-describedby={attrs['aria-describedby']}
aria-labelledby={attrs['aria-labelledby']}
aria-modal={attrs['aria-modal']}
closedby={attrs.closedby}
data-state={attrs['data-state']}
id={attrs.id}
open={attrs.open}
role={attrs.role}
>
{props.children}
</dialog>
);
},
});SheetHeader#
Renders the styled sheet header primitive.
Copyable example
import { SheetHeader } from "@kovojs/ui/sheet";
const component = SheetHeader;Signature
const SheetHeader = component({
render(props: SheetPartProps) {
const styleAttrs = style.attrs(sheetStyles.header, props.styles?.header);
return (
<header {...styleAttrs} {...passThroughProps(props)} id={props.id}>
{props.children}
</header>
);
},
});SheetTitle#
Renders the styled sheet title primitive.
Copyable example
import { SheetTitle } from "@kovojs/ui/sheet";
const component = SheetTitle;Signature
const SheetTitle = component({
render(props: SheetPartProps) {
const styleAttrs = style.attrs(sheetStyles.title, props.styles?.title);
return (
<h2 {...styleAttrs} {...passThroughProps(props)} id={props.id}>
{props.children}
</h2>
);
},
});SheetDescription#
Renders the styled sheet description primitive.
Copyable example
import { SheetDescription } from "@kovojs/ui/sheet";
const component = SheetDescription;Signature
const SheetDescription = component({
render(props: SheetPartProps) {
const styleAttrs = style.attrs(sheetStyles.description, props.styles?.description);
return (
<p {...styleAttrs} {...passThroughProps(props)} id={props.id}>
{props.children}
</p>
);
},
});SheetClose#
Renders the styled sheet close primitive.
Copyable example
import { SheetClose } from "@kovojs/ui/sheet";
const component = SheetClose;Signature
const SheetClose = component({
render(props: SheetCloseProps) {
const attrs = dialogCloseAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
contentId: props.contentId,
open: props.open === true,
});
const styleAttrs = style.attrs(sheetStyles.close, props.styles?.close);
return (
<button
{...styleAttrs}
{...passThroughProps(props)}
aria-label="Close"
command={attrs.command}
commandfor={attrs.commandfor}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
disabled={attrs.disabled}
id={props.id}
type={attrs.type}
>
{/* shadcn-style: default to an icon-only X dismiss (accessible name on the
button's aria-label); a caller may still pass custom children. */}
{props.children ?? <X style={sheetStyles.closeIcon} aria-hidden="true" />}
</button>
);
},
});Supporting types#
SheetSide#
Supported sheet side values.
Copyable example
import type { SheetSide } from "@kovojs/ui/sheet";
const value: SheetSide = 'right';Signature
type SheetSide = 'top' | 'right' | 'bottom' | 'left';SheetStyleOverrides#
Style override slots accepted by the sheet components.
Copyable example
import type { SheetStyleOverrides } from "@kovojs/ui/sheet";
const styles: SheetStyleOverrides = {};Signature
interface SheetStyleOverrides {
body?: style.StyleInput;
close?: style.StyleInput;
content?: style.StyleInput;
description?: style.StyleInput;
header?: style.StyleInput;
root?: style.StyleInput;
title?: style.StyleInput;
trigger?: style.StyleInput;
}SheetProps#
Props for the sheet component.
Copyable example
import type { SheetProps } from "@kovojs/ui/sheet";
const props: SheetProps = { contentId: 'content-id', title: 'Title', children: 'Content' };Signature
interface SheetProps {
children?: ComponentChild;
closeLabel?: string;
contentId: string;
description?: string;
disabled?: boolean;
open?: boolean;
side?: SheetSide;
styles?: SheetStyleOverrides;
title: string;
trigger?: string;
}SheetStateProps#
Shared state props for the sheet component family.
Copyable example
import type { SheetStateProps } from "@kovojs/ui/sheet";
const state: SheetStateProps = {};Signature
interface SheetStateProps {
disabled?: boolean;
open?: boolean;
styles?: SheetStyleOverrides;
}SheetRootProps#
Props for the sheet root component.
Copyable example
import type { SheetRootProps } from "@kovojs/ui/sheet";
const props: SheetRootProps = { children: 'Content' };Signature
interface SheetRootProps extends SheetStateProps {
children?: ComponentChild;
id?: string;
}SheetTriggerProps#
Props for the sheet trigger component.
Copyable example
import type { SheetTriggerProps } from "@kovojs/ui/sheet";
const props: SheetTriggerProps = { contentId: 'content-id', children: 'Content' };Signature
interface SheetTriggerProps extends SheetStateProps {
children?: ComponentChild;
contentId: string;
id?: string;
}SheetContentProps#
Props for the sheet content component.
Copyable example
import type { SheetContentProps } from "@kovojs/ui/sheet";
const props: SheetContentProps = { contentId: 'content-id', titleId: 'title-id', children: 'Content' };Signature
interface SheetContentProps extends SheetStateProps {
children?: ComponentChild;
contentId: string;
descriptionId?: string;
side?: SheetSide;
titleId: string;
}SheetPartProps#
Props for the sheet part component.
Copyable example
import type { SheetPartProps } from "@kovojs/ui/sheet";
const props: SheetPartProps = { children: 'Content' };Signature
interface SheetPartProps {
children?: ComponentChild;
id?: string;
styles?: SheetStyleOverrides;
}SheetCloseProps#
Props for the sheet close component.
Copyable example
import type { SheetCloseProps } from "@kovojs/ui/sheet";
const props: SheetCloseProps = { contentId: 'content-id', children: 'Content' };Signature
interface SheetCloseProps extends SheetStateProps {
children?: ComponentChild;
contentId: string;
id?: string;
}@kovojs/ui/select#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/select.tsx
Values#
Select#
Renders the styled select primitive.
Copyable example
import { Select } from "@kovojs/ui/select";
const component = Select;Signature
const Select = component({
render(props: SelectProps) {
const attrs = selectRootAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.highlightedValue === undefined ? {} : { highlightedValue: props.highlightedValue }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.items === undefined ? {} : { items: props.items }),
...(props.listboxId === undefined ? {} : { listboxId: props.listboxId }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.open === undefined ? {} : { open: props.open }),
...(props.placeholder === undefined ? {} : { placeholder: props.placeholder }),
...(props.required === undefined ? {} : { required: props.required }),
...(props.value === undefined ? {} : { value: props.value }),
});
const styleAttrs = style.attrs(selectStyles.root, props.styles?.root);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-invalid={attrs['data-invalid']}
data-placeholder={attrs['data-placeholder']}
data-required={attrs['data-required']}
data-state={attrs['data-state']}
id={attrs.id}
>
{props.children}
</div>
);
},
});SelectTrigger#
Renders the styled select trigger primitive.
Copyable example
import { SelectTrigger } from "@kovojs/ui/select";
const component = SelectTrigger;Signature
const SelectTrigger = component({
render(props: SelectTriggerProps) {
const attrs = selectTriggerAttributes({
...(props.descriptionId === undefined ? {} : { descriptionId: props.descriptionId }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.errorId === undefined ? {} : { errorId: props.errorId }),
...(props.form === undefined ? {} : { form: props.form }),
...(props.highlightedValue === undefined ? {} : { highlightedValue: props.highlightedValue }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.items === undefined ? {} : { items: props.items }),
...(props.labelledBy === undefined ? {} : { labelledBy: props.labelledBy }),
...(props.listboxId === undefined ? {} : { listboxId: props.listboxId }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.open === undefined ? {} : { open: props.open }),
...(props.placeholder === undefined ? {} : { placeholder: props.placeholder }),
...(props.required === undefined ? {} : { required: props.required }),
...(props.value === undefined ? {} : { value: props.value }),
});
const styleAttrs = style.attrs(selectStyles.trigger, props.styles?.trigger);
return (
<button
{...styleAttrs}
{...passThroughProps(props)}
aria-activedescendant={props['aria-activedescendant'] ?? attrs['aria-activedescendant']}
aria-describedby={attrs['aria-describedby']}
aria-controls={attrs['aria-controls']}
aria-expanded={attrs['aria-expanded']}
aria-haspopup={attrs['aria-haspopup']}
aria-invalid={attrs['aria-invalid']}
aria-labelledby={attrs['aria-labelledby']}
data-disabled={attrs['data-disabled']}
data-invalid={attrs['data-invalid']}
data-placeholder={attrs['data-placeholder']}
data-required={attrs['data-required']}
data-state={attrs['data-state']}
disabled={attrs.disabled}
id={attrs.id}
role={attrs.role}
type={attrs.type}
>
{props.children}
</button>
);
},
});SelectHiddenInput#
Renders the styled select hidden input primitive.
Copyable example
import { SelectHiddenInput } from "@kovojs/ui/select";
const component = SelectHiddenInput;Signature
const SelectHiddenInput = component({
render(props: SelectHiddenInputProps) {
const attrs = selectHiddenInputAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.form === undefined ? {} : { form: props.form }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.value === undefined ? {} : { value: props.value }),
});
const styleAttrs = style.attrs(selectStyles.hiddenInput, props.styles?.hiddenInput);
return (
<input
{...styleAttrs}
{...passThroughProps(props)}
disabled={attrs.disabled}
form={attrs.form}
id={props.id}
name={attrs.name}
type={attrs.type}
value={attrs.value}
/>
);
},
});SelectContent#
Renders the styled select content primitive.
Copyable example
import { SelectContent } from "@kovojs/ui/select";
const component = SelectContent;Signature
const SelectContent = component({
render(props: SelectContentProps) {
const attrs = selectContentAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.highlightedValue === undefined ? {} : { highlightedValue: props.highlightedValue }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.items === undefined ? {} : { items: props.items }),
...(props.labelledBy === undefined ? {} : { labelledBy: props.labelledBy }),
...(props.listboxId === undefined ? {} : { listboxId: props.listboxId }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.open === undefined ? {} : { open: props.open }),
...(props.placeholder === undefined ? {} : { placeholder: props.placeholder }),
...(props.required === undefined ? {} : { required: props.required }),
...(props.value === undefined ? {} : { value: props.value }),
});
const styleAttrs = style.attrs(selectStyles.content, props.styles?.content);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
aria-labelledby={attrs['aria-labelledby']}
data-disabled={attrs['data-disabled']}
data-invalid={attrs['data-invalid']}
data-placeholder={attrs['data-placeholder']}
data-required={attrs['data-required']}
data-state={attrs['data-state']}
hidden={attrs.hidden}
id={attrs.id}
role={attrs.role}
>
{props.children}
</div>
);
},
});SelectItem#
Renders the styled select item primitive.
Copyable example
import { SelectItem } from "@kovojs/ui/select";
const component = SelectItem;Signature
const SelectItem = component({
render(props: SelectItemProps) {
const attrs = selectItemAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.highlightedValue === undefined ? {} : { highlightedValue: props.highlightedValue }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.itemDisabled === undefined ? {} : { itemDisabled: props.itemDisabled }),
...(props.itemLabel === undefined ? {} : { itemLabel: props.itemLabel }),
...(props.items === undefined ? {} : { items: props.items }),
...(props.listboxId === undefined ? {} : { listboxId: props.listboxId }),
itemValue: props.itemValue,
...(props.name === undefined ? {} : { name: props.name }),
...(props.open === undefined ? {} : { open: props.open }),
...(props.placeholder === undefined ? {} : { placeholder: props.placeholder }),
...(props.required === undefined ? {} : { required: props.required }),
...(props.value === undefined ? {} : { value: props.value }),
});
const styleAttrs = style.attrs(selectStyles.item, props.styles?.item);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
aria-disabled={attrs['aria-disabled']}
aria-selected={attrs['aria-selected']}
data-disabled={attrs['data-disabled']}
data-highlighted={attrs['data-highlighted']}
data-state={attrs['data-state']}
id={attrs.id}
label={attrs.label}
role={attrs.role}
value={attrs.value}
>
{props.children ?? props.itemLabel ?? props.itemValue ?? ''}
</div>
);
},
});SelectValue#
Renders the styled select value primitive.
Copyable example
import { SelectValue } from "@kovojs/ui/select";
const component = SelectValue;Signature
const SelectValue = component({
render(props: SelectValueProps) {
const attrs = selectValueAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.highlightedValue === undefined ? {} : { highlightedValue: props.highlightedValue }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.items === undefined ? {} : { items: props.items }),
...(props.listboxId === undefined ? {} : { listboxId: props.listboxId }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.open === undefined ? {} : { open: props.open }),
...(props.placeholder === undefined ? {} : { placeholder: props.placeholder }),
...(props.required === undefined ? {} : { required: props.required }),
...(props.value === undefined ? {} : { value: props.value }),
});
const styleAttrs = style.attrs(selectStyles.value, props.styles?.value);
return (
<span
{...styleAttrs}
{...passThroughProps(props)}
data-placeholder={attrs['data-placeholder']}
id={attrs.id}
>
{props.children ?? selectValueText(props)}
</span>
);
},
});Supporting types#
SelectStyleOverrides#
Style override slots accepted by the select components.
Copyable example
import type { SelectStyleOverrides } from "@kovojs/ui/select";
const styles: SelectStyleOverrides = {};Signature
interface SelectStyleOverrides {
content?: style.StyleInput;
hiddenInput?: style.StyleInput;
item?: style.StyleInput;
root?: style.StyleInput;
trigger?: style.StyleInput;
value?: style.StyleInput;
}SelectStateProps#
Shared state props for the select component family.
Copyable example
import type { SelectStateProps } from "@kovojs/ui/select";
const state: SelectStateProps = {
items: [{ label: 'Standard', value: 'standard' }],
name: 'shippingSpeed',
value: 'standard',
};Signature
interface SelectStateProps {
disabled?: boolean;
form?: string;
highlightedValue?: string;
invalid?: boolean;
items?: readonly HeadlessSelectItem[];
listboxId?: string;
name?: string;
open?: boolean;
placeholder?: string;
required?: boolean;
value?: string;
}SelectProps#
Props for the select component.
Copyable example
import type { SelectProps } from "@kovojs/ui/select";
const props: SelectProps = {
children: 'Shipping speed',
items: [{ label: 'Standard', value: 'standard' }],
value: 'standard',
};Signature
interface SelectProps extends SelectStateProps {
children?: ComponentChild;
id?: string;
styles?: SelectStyleOverrides;
}SelectTriggerProps#
Props for the select trigger component.
Copyable example
import type { SelectTriggerProps } from "@kovojs/ui/select";
const props: SelectTriggerProps = {
children: 'Standard',
id: 'shipping-speed-trigger',
labelledBy: 'shipping-speed-label',
value: 'standard',
};Signature
interface SelectTriggerProps extends SelectStateProps {
'aria-activedescendant'?: string | undefined;
children?: ComponentChild;
descriptionId?: string;
errorId?: string;
id?: string;
labelledBy?: string;
styles?: SelectStyleOverrides;
}SelectHiddenInputProps#
Props for the select hidden input component.
Copyable example
import type { SelectHiddenInputProps } from "@kovojs/ui/select";
const props: SelectHiddenInputProps = {
id: 'shipping-speed-input',
name: 'shippingSpeed',
value: 'standard',
};Signature
interface SelectHiddenInputProps extends SelectStateProps {
id?: string;
styles?: SelectStyleOverrides;
}SelectContentProps#
Props for the select content component.
Copyable example
import type { SelectContentProps } from "@kovojs/ui/select";
const props: SelectContentProps = {
children: 'Shipping options',
id: 'shipping-speed-listbox',
labelledBy: 'shipping-speed-label',
open: true,
};Signature
interface SelectContentProps extends SelectStateProps {
children?: ComponentChild;
id?: string;
label?: string;
labelledBy?: string;
styles?: SelectStyleOverrides;
}SelectItemProps#
Props for the select item component.
Copyable example
import type { SelectItemProps } from "@kovojs/ui/select";
const props: SelectItemProps = {
children: 'Standard',
itemLabel: 'Standard',
itemValue: 'standard',
value: 'standard',
};Signature
interface SelectItemProps extends SelectStateProps {
children?: ComponentChild;
id?: string;
itemDisabled?: boolean;
itemLabel?: string;
itemValue: string;
styles?: SelectStyleOverrides;
}SelectValueProps#
Props for the select value component.
Copyable example
import type { SelectValueProps } from "@kovojs/ui/select";
const props: SelectValueProps = {
children: 'Standard',
placeholder: 'Choose a speed',
value: 'standard',
};Signature
interface SelectValueProps extends SelectStateProps {
children?: ComponentChild;
id?: string;
styles?: SelectStyleOverrides;
}@kovojs/ui/skeleton#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/skeleton.tsx
Values#
Skeleton#
Renders the styled skeleton primitive.
Copyable example
import { Skeleton } from "@kovojs/ui/skeleton";
const component = Skeleton;Signature
const Skeleton = component({
render(props: SkeletonProps) {
return <div {...style.attrs(skeletonStyles.root, props.style)} aria-hidden="true" />;
},
});Supporting types#
SkeletonProps#
Props for the skeleton component.
Copyable example
import type { SkeletonProps } from "@kovojs/ui/skeleton";
const props: SkeletonProps = {};Signature
interface SkeletonProps {
style?: style.StyleInput;
}@kovojs/ui/slider#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/slider.tsx
Values#
Slider#
Renders the styled slider primitive.
Copyable example
import { Slider } from "@kovojs/ui/slider";
const component = Slider;Signature
const Slider = component({
render(props: SliderProps) {
const attrs = sliderRootAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.max === undefined ? {} : { max: props.max }),
...(props.min === undefined ? {} : { min: props.min }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.orientation === undefined ? {} : { orientation: props.orientation }),
...(props.required === undefined ? {} : { required: props.required }),
...(props.step === undefined ? {} : { step: props.step }),
...(props.value === undefined ? {} : { value: props.value }),
});
const styleAttrs = style.attrs(sliderStyles.root, props.styles?.root);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-invalid={attrs['data-invalid']}
data-max={attrs['data-max']}
data-min={attrs['data-min']}
data-orientation={attrs['data-orientation']}
data-required={attrs['data-required']}
data-value={attrs['data-value']}
id={attrs.id}
>
{props.children}
</div>
);
},
});SliderInput#
Renders the styled slider input primitive.
Copyable example
import { SliderInput } from "@kovojs/ui/slider";
const component = SliderInput;Signature
const SliderInput = component({
render(props: SliderInputProps) {
const attrs = sliderInputAttributes({
...(props.descriptionId === undefined ? {} : { descriptionId: props.descriptionId }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.errorId === undefined ? {} : { errorId: props.errorId }),
...(props.form === undefined ? {} : { form: props.form }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.label === undefined ? {} : { label: props.label }),
...(props.labelledBy === undefined ? {} : { labelledBy: props.labelledBy }),
...(props.max === undefined ? {} : { max: props.max }),
...(props.min === undefined ? {} : { min: props.min }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.orientation === undefined ? {} : { orientation: props.orientation }),
...(props.required === undefined ? {} : { required: props.required }),
...(props.step === undefined ? {} : { step: props.step }),
...(props.value === undefined ? {} : { value: props.value }),
...(props.valueText === undefined ? {} : { valueText: props.valueText }),
});
const styleAttrs = style.attrs(sliderStyles.input, props.styles?.input);
return (
<input
{...styleAttrs}
{...passThroughProps(props)}
aria-describedby={attrs['aria-describedby']}
aria-invalid={attrs['aria-invalid']}
aria-label={attrs['aria-label']}
aria-labelledby={attrs['aria-labelledby']}
aria-orientation={attrs['aria-orientation']}
aria-valuetext={attrs['aria-valuetext']}
data-disabled={attrs['data-disabled']}
data-invalid={attrs['data-invalid']}
data-max={attrs['data-max']}
data-min={attrs['data-min']}
data-orientation={attrs['data-orientation']}
data-required={attrs['data-required']}
data-value={attrs['data-value']}
disabled={attrs.disabled}
form={attrs.form}
id={attrs.id}
max={attrs.max}
min={attrs.min}
name={attrs.name}
required={attrs.required}
step={attrs.step}
type={attrs.type}
value={attrs.value}
/>
);
},
});SliderTrack#
Renders the styled slider track primitive.
Copyable example
import { SliderTrack } from "@kovojs/ui/slider";
const component = SliderTrack;Signature
const SliderTrack = component({
render(props: SliderPartProps) {
const attrs = sliderTrackAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.max === undefined ? {} : { max: props.max }),
...(props.min === undefined ? {} : { min: props.min }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.orientation === undefined ? {} : { orientation: props.orientation }),
...(props.required === undefined ? {} : { required: props.required }),
...(props.step === undefined ? {} : { step: props.step }),
...(props.value === undefined ? {} : { value: props.value }),
});
const styleAttrs = style.attrs(sliderStyles.track, props.styles?.track);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
aria-hidden={attrs['aria-hidden']}
data-disabled={attrs['data-disabled']}
data-invalid={attrs['data-invalid']}
data-max={attrs['data-max']}
data-min={attrs['data-min']}
data-orientation={attrs['data-orientation']}
data-part={attrs['data-part']}
data-required={attrs['data-required']}
data-value={attrs['data-value']}
data-value-ratio={attrs['data-value-ratio']}
id={attrs.id}
>
{props.children}
</div>
);
},
});SliderRange#
Renders the styled slider range primitive.
Copyable example
import { SliderRange } from "@kovojs/ui/slider";
const component = SliderRange;Signature
const SliderRange = component({
render(props: SliderPartProps) {
const attrs = sliderRangeAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.max === undefined ? {} : { max: props.max }),
...(props.min === undefined ? {} : { min: props.min }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.orientation === undefined ? {} : { orientation: props.orientation }),
...(props.required === undefined ? {} : { required: props.required }),
...(props.step === undefined ? {} : { step: props.step }),
...(props.value === undefined ? {} : { value: props.value }),
});
const styleAttrs = style.attrs(sliderStyles.range, props.styles?.range);
const vertical = attrs['data-orientation'] === 'vertical';
const pct = valuePercent(attrs['data-value-ratio']);
return (
<span
{...styleAttrs}
{...passThroughProps(props)}
aria-hidden={attrs['aria-hidden']}
data-disabled={attrs['data-disabled']}
data-invalid={attrs['data-invalid']}
data-max={attrs['data-max']}
data-min={attrs['data-min']}
data-orientation={attrs['data-orientation']}
data-part={attrs['data-part']}
data-required={attrs['data-required']}
data-value={attrs['data-value']}
data-value-ratio={attrs['data-value-ratio']}
id={attrs.id}
style={{ height: vertical ? pct : undefined, width: vertical ? undefined : pct }}
>
{props.children}
</span>
);
},
});SliderThumb#
Renders the styled slider thumb primitive.
Copyable example
import { SliderThumb } from "@kovojs/ui/slider";
const component = SliderThumb;Signature
const SliderThumb = component({
render(props: SliderThumbProps) {
const attrs = sliderThumbAttributes({
...(props.descriptionId === undefined ? {} : { descriptionId: props.descriptionId }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.errorId === undefined ? {} : { errorId: props.errorId }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.invalid === undefined ? {} : { invalid: props.invalid }),
...(props.label === undefined ? {} : { label: props.label }),
...(props.labelledBy === undefined ? {} : { labelledBy: props.labelledBy }),
...(props.max === undefined ? {} : { max: props.max }),
...(props.min === undefined ? {} : { min: props.min }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.orientation === undefined ? {} : { orientation: props.orientation }),
...(props.required === undefined ? {} : { required: props.required }),
...(props.step === undefined ? {} : { step: props.step }),
...(props.value === undefined ? {} : { value: props.value }),
...(props.valueText === undefined ? {} : { valueText: props.valueText }),
});
const styleAttrs = style.attrs(sliderStyles.thumb, props.styles?.thumb);
const vertical = attrs['data-orientation'] === 'vertical';
const pct = valuePercent(attrs['data-value-ratio']);
return (
<span
{...styleAttrs}
{...passThroughProps(props)}
aria-describedby={attrs['aria-describedby']}
aria-disabled={attrs['aria-disabled']}
aria-invalid={attrs['aria-invalid']}
aria-label={attrs['aria-label']}
aria-labelledby={attrs['aria-labelledby']}
aria-orientation={attrs['aria-orientation']}
aria-valuemax={attrs['aria-valuemax']}
aria-valuemin={attrs['aria-valuemin']}
aria-valuenow={attrs['aria-valuenow']}
aria-valuetext={attrs['aria-valuetext']}
data-disabled={attrs['data-disabled']}
data-invalid={attrs['data-invalid']}
data-max={attrs['data-max']}
data-min={attrs['data-min']}
data-orientation={attrs['data-orientation']}
data-part={attrs['data-part']}
data-required={attrs['data-required']}
data-value={attrs['data-value']}
data-value-ratio={attrs['data-value-ratio']}
id={attrs.id}
role={attrs.role}
style={{
bottom: vertical ? pct : undefined,
left: vertical ? undefined : pct,
top: vertical ? 'auto' : undefined,
}}
tabIndex={attrs.tabIndex}
/>
);
},
});Supporting types#
SliderStyleOverrides#
Style override slots accepted by the slider components.
Copyable example
import type { SliderStyleOverrides } from "@kovojs/ui/slider";
const styles: SliderStyleOverrides = {};Signature
interface SliderStyleOverrides {
input?: style.StyleInput;
range?: style.StyleInput;
root?: style.StyleInput;
thumb?: style.StyleInput;
track?: style.StyleInput;
}SliderStateProps#
Shared state props for the slider component family.
Copyable example
import type { SliderStateProps } from "@kovojs/ui/slider";
const state: SliderStateProps = {};Signature
interface SliderStateProps {
disabled?: boolean;
invalid?: boolean;
max?: number;
min?: number;
name?: string;
orientation?: SliderOrientation;
required?: boolean;
step?: number;
value?: number;
}SliderProps#
Props for the slider component.
Copyable example
import type { SliderProps } from "@kovojs/ui/slider";
const props: SliderProps = { children: 'Content' };Signature
interface SliderProps extends SliderStateProps {
children?: ComponentChild;
id?: string;
styles?: SliderStyleOverrides;
}SliderInputProps#
Props for the slider input component.
Copyable example
import type { SliderInputProps } from "@kovojs/ui/slider";
const props: SliderInputProps = {};Signature
interface SliderInputProps extends SliderStateProps {
descriptionId?: string;
errorId?: string;
form?: string;
id?: string;
label?: string;
labelledBy?: string;
styles?: SliderStyleOverrides;
valueText?: string;
}SliderPartProps#
Props for the slider part component.
Copyable example
import type { SliderPartProps } from "@kovojs/ui/slider";
const props: SliderPartProps = { children: 'Content' };Signature
interface SliderPartProps extends SliderStateProps {
children?: ComponentChild;
id?: string;
style?: unknown;
styles?: SliderStyleOverrides;
}SliderThumbProps#
Props for the slider thumb component.
Copyable example
import type { SliderThumbProps } from "@kovojs/ui/slider";
const props: SliderThumbProps = { children: 'Content' };Signature
interface SliderThumbProps extends SliderPartProps {
descriptionId?: string;
errorId?: string;
label?: string;
labelledBy?: string;
valueText?: string;
}@kovojs/ui/switch#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/switch.tsx
Values#
Switch#
Renders the styled switch primitive.
Copyable example
import { Switch } from "@kovojs/ui/switch";
const component = Switch;Signature
const Switch = component({
render(props: SwitchProps) {
const attrs = switchRootAttributes({
checked: props.checked ?? false,
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.form === undefined ? {} : { form: props.form }),
...(props.name === undefined ? {} : { name: props.name }),
...(props.required === undefined ? {} : { required: props.required }),
...(props.value === undefined ? {} : { value: props.value }),
});
const rootStyleAttrs = style.attrs(switchStyles.root, props.styles?.root);
const inputStyleAttrs = style.attrs(switchStyles.input, props.styles?.input);
const trackStyleAttrs = style.attrs(switchStyles.track, props.styles?.track);
const thumbStyleAttrs = style.attrs(switchStyles.thumb, props.styles?.thumb);
return (
<label
{...rootStyleAttrs}
{...passThroughProps(props, { events: false, bindings: false })}
{...bindingProps(props, ['data-state'])}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
>
<span
{...trackStyleAttrs}
{...bindingProps(props, ['data-state'])}
data-state={attrs['data-state']}
>
<input
{...inputStyleAttrs}
{...passThroughProps(props, { island: false })}
aria-checked={attrs['aria-checked']}
aria-describedby={props.describedBy}
aria-labelledby={props.labelledBy}
checked={attrs.checked}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
disabled={attrs.disabled}
form={attrs.form}
id={props.id}
name={attrs.name}
required={attrs.required}
role={attrs.role}
type={attrs.type}
value={attrs.value}
/>
<span
{...thumbStyleAttrs}
{...bindingProps(props, ['data-state'])}
aria-hidden="true"
data-state={attrs['data-state']}
/>
</span>
{props.children}
</label>
);
},
});Supporting types#
SwitchStyleOverrides#
Style override slots accepted by the switch components.
Copyable example
import type { SwitchStyleOverrides } from "@kovojs/ui/switch";
const styles: SwitchStyleOverrides = {};Signature
interface SwitchStyleOverrides {
input?: style.StyleInput;
root?: style.StyleInput;
thumb?: style.StyleInput;
track?: style.StyleInput;
}SwitchProps#
Props for the switch component.
Copyable example
import type { SwitchProps } from "@kovojs/ui/switch";
const props: SwitchProps = { children: 'Content' };Signature
interface SwitchProps {
describedBy?: string;
checked?: boolean;
children?: ComponentChild;
disabled?: boolean;
form?: string;
id?: string;
labelledBy?: string;
name?: string;
required?: boolean;
styles?: SwitchStyleOverrides;
value?: string;
}@kovojs/ui/table#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/table.tsx
Values#
Table#
Renders the styled table primitive.
Copyable example
import { Table } from "@kovojs/ui/table";
const component = Table;Signature
const Table = component({
render(props: TableProps) {
const wrapperAttrs = style.attrs(tableStyles.wrapper, props.styles?.wrapper);
const tableAttrs = style.attrs(tableStyles.table, props.styles?.table);
const captionAttrs = style.attrs(tableStyles.caption, props.styles?.caption);
const caption =
props.caption === undefined
? ''
: `<caption${tableAttributes(captionAttrs)}>${escapeHtml(props.caption)}</caption>`;
return withTableChildren(props.children, (children) =>
tableRenderedHtml(
`<div${tableAttributes(wrapperAttrs)}><table${tableAttributes(tableAttrs)}>${caption}${children}</table></div>`,
),
);
},
});TableHead#
Renders the styled table head primitive.
Copyable example
import { TableHead } from "@kovojs/ui/table";
const component = TableHead;Signature
const TableHead = component({
render(props: TableSectionProps) {
return tablePartWithChildren(
'thead',
style.attrs(tableStyles.head, props.styles?.head),
props.children,
);
},
});TableBody#
Renders the styled table body primitive.
Copyable example
import { TableBody } from "@kovojs/ui/table";
const component = TableBody;Signature
const TableBody = component({
render(props: TableSectionProps) {
return tablePartWithChildren(
'tbody',
style.attrs(tableStyles.body, props.styles?.body),
props.children,
);
},
});TableRow#
Renders the styled table row primitive.
Copyable example
import { TableRow } from "@kovojs/ui/table";
const component = TableRow;Signature
const TableRow = component({
render(props: TableSectionProps) {
const rowChildren = props.children;
return tablePartWithChildren(
'tr',
style.attrs(tableStyles.row, props.styles?.row),
rowChildren,
);
},
});TableHeaderCell#
Renders the styled table header cell primitive.
Copyable example
import { TableHeaderCell } from "@kovojs/ui/table";
const component = TableHeaderCell;Signature
const TableHeaderCell = component({
render(props: TableCellProps) {
return tablePartWithChildren(
'th',
{
...style.attrs(tableStyles.headerCell, props.styles?.headerCell),
colspan: props.colSpan,
scope: props.scope ?? 'col',
},
props.children,
);
},
});TableCell#
Renders the styled table cell primitive.
Copyable example
import { TableCell } from "@kovojs/ui/table";
const component = TableCell;Signature
const TableCell = component({
render(props: TableCellProps) {
return tablePartWithChildren(
'td',
{ ...style.attrs(tableStyles.cell, props.styles?.cell), colspan: props.colSpan },
props.children,
);
},
});Supporting types#
TableStyleOverrides#
Style override slots accepted by the table components.
Copyable example
import type { TableStyleOverrides } from "@kovojs/ui/table";
const styles: TableStyleOverrides = {};Signature
interface TableStyleOverrides {
body?: style.StyleInput;
caption?: style.StyleInput;
cell?: style.StyleInput;
head?: style.StyleInput;
headerCell?: style.StyleInput;
row?: style.StyleInput;
table?: style.StyleInput;
wrapper?: style.StyleInput;
}TableProps#
Props for the table component.
Copyable example
import type { TableProps } from "@kovojs/ui/table";
const props: TableProps = { children: 'Content' };Signature
interface TableProps {
caption?: string;
children?: ComponentChild;
styles?: TableStyleOverrides;
}TableSectionProps#
Props for the table section component.
Copyable example
import type { TableSectionProps } from "@kovojs/ui/table";
const props: TableSectionProps = { children: 'Content' };Signature
interface TableSectionProps {
children?: ComponentChild;
styles?: TableStyleOverrides;
}TableCellProps#
Props for the table cell component.
Copyable example
import type { TableCellProps } from "@kovojs/ui/table";
const props: TableCellProps = { children: 'Content' };Signature
interface TableCellProps {
children?: ComponentChild;
colSpan?: number;
scope?: 'col' | 'row';
styles?: TableStyleOverrides;
}@kovojs/ui/tabs#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/tabs.tsx
Values#
Tabs#
Renders the styled tabs primitive.
Copyable example
import { Tabs } from "@kovojs/ui/tabs";
const component = Tabs;Signature
const Tabs = component({
render(props: TabsProps) {
const attrs = tabsRootAttributes({
...(props.activationMode === undefined ? {} : { activationMode: props.activationMode }),
...(props.activeValue === undefined ? {} : { activeValue: props.activeValue }),
...(props.dir === undefined ? {} : { dir: props.dir }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.items === undefined ? {} : { items: props.items }),
...(props.loop === undefined ? {} : { loop: props.loop }),
...(props.orientation === undefined ? {} : { orientation: props.orientation }),
...(props.value === undefined ? {} : { value: props.value }),
});
const styleAttrs = style.attrs(tabsStyles.root, props.styles?.root);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-orientation={attrs['data-orientation']}
id={attrs.id}
>
{props.children}
</div>
);
},
});TabsList#
Renders the styled tabs list primitive.
Copyable example
import { TabsList } from "@kovojs/ui/tabs";
const component = TabsList;Signature
const TabsList = component({
render(props: TabsListProps) {
const attrs = tabsListAttributes({
...(props.activationMode === undefined ? {} : { activationMode: props.activationMode }),
...(props.activeValue === undefined ? {} : { activeValue: props.activeValue }),
...(props.descriptionId === undefined ? {} : { descriptionId: props.descriptionId }),
...(props.dir === undefined ? {} : { dir: props.dir }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.items === undefined ? {} : { items: props.items }),
...(props.label === undefined ? {} : { label: props.label }),
...(props.labelledBy === undefined ? {} : { labelledBy: props.labelledBy }),
...(props.loop === undefined ? {} : { loop: props.loop }),
...(props.orientation === undefined ? {} : { orientation: props.orientation }),
...(props.value === undefined ? {} : { value: props.value }),
});
const styleAttrs = style.attrs(tabsStyles.list, props.styles?.list);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
aria-describedby={attrs['aria-describedby']}
aria-disabled={attrs['aria-disabled']}
aria-label={attrs['aria-label']}
aria-labelledby={attrs['aria-labelledby']}
aria-orientation={attrs['aria-orientation']}
data-disabled={attrs['data-disabled']}
data-orientation={attrs['data-orientation']}
id={attrs.id}
role={attrs.role}
>
{props.children}
</div>
);
},
});TabsTrigger#
Renders the styled tabs trigger primitive.
Copyable example
import { TabsTrigger } from "@kovojs/ui/tabs";
const component = TabsTrigger;Signature
const TabsTrigger = component({
render(props: TabsTriggerProps) {
const attrs = tabsTriggerAttributes({
...(props.activationMode === undefined ? {} : { activationMode: props.activationMode }),
...(props.activeValue === undefined ? {} : { activeValue: props.activeValue }),
...(props.dir === undefined ? {} : { dir: props.dir }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.itemDisabled === undefined ? {} : { itemDisabled: props.itemDisabled }),
...(props.items === undefined ? {} : { items: props.items }),
itemValue: props.itemValue,
...(props.loop === undefined ? {} : { loop: props.loop }),
...(props.orientation === undefined ? {} : { orientation: props.orientation }),
...(props.panelId === undefined ? {} : { panelId: props.panelId }),
...(props.value === undefined ? {} : { value: props.value }),
});
const styleAttrs = style.attrs(tabsStyles.trigger, props.styles?.trigger);
return (
<button
{...styleAttrs}
{...passThroughProps(props)}
aria-controls={attrs['aria-controls']}
aria-selected={attrs['aria-selected']}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
disabled={attrs.disabled}
id={attrs.id}
role={attrs.role}
tabIndex={attrs.tabIndex}
type={attrs.type}
value={attrs.value}
>
{props.children}
</button>
);
},
});TabsPanel#
Renders the styled tabs panel primitive.
Copyable example
import { TabsPanel } from "@kovojs/ui/tabs";
const component = TabsPanel;Signature
const TabsPanel = component({
render(props: TabsPanelProps) {
const attrs = tabsPanelAttributes({
...(props.activationMode === undefined ? {} : { activationMode: props.activationMode }),
...(props.activeValue === undefined ? {} : { activeValue: props.activeValue }),
...(props.dir === undefined ? {} : { dir: props.dir }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.itemDisabled === undefined ? {} : { itemDisabled: props.itemDisabled }),
...(props.items === undefined ? {} : { items: props.items }),
itemValue: props.itemValue,
...(props.loop === undefined ? {} : { loop: props.loop }),
...(props.orientation === undefined ? {} : { orientation: props.orientation }),
...(props.triggerId === undefined ? {} : { triggerId: props.triggerId }),
...(props.value === undefined ? {} : { value: props.value }),
});
const styleAttrs = style.attrs(tabsStyles.panel, props.styles?.panel);
return (
<section
{...styleAttrs}
{...passThroughProps(props)}
aria-labelledby={attrs['aria-labelledby']}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
hidden={attrs.hidden}
id={attrs.id}
role={attrs.role}
tabIndex={attrs.tabIndex}
>
{props.children}
</section>
);
},
});Supporting types#
TabsStyleOverrides#
Style override slots accepted by the tabs components.
Copyable example
import type { TabsStyleOverrides } from "@kovojs/ui/tabs";
const styles: TabsStyleOverrides = {};Signature
interface TabsStyleOverrides {
list?: style.StyleInput;
panel?: style.StyleInput;
root?: style.StyleInput;
trigger?: style.StyleInput;
}TabsStateProps#
Shared state props for the tabs component family.
Copyable example
import type { TabsStateProps } from "@kovojs/ui/tabs";
const state: TabsStateProps = {};Signature
interface TabsStateProps {
activationMode?: TabsActivationMode;
activeValue?: string;
dir?: TextDirection;
disabled?: boolean;
items?: readonly TabsItem[];
loop?: boolean;
orientation?: CollectionOrientation;
value?: string;
}TabsProps#
Props for the tabs component.
Copyable example
import type { TabsProps } from "@kovojs/ui/tabs";
const props: TabsProps = { children: 'Content' };Signature
interface TabsProps extends TabsStateProps {
children?: ComponentChild;
id?: string;
styles?: TabsStyleOverrides;
}TabsListProps#
Props for the tabs list component.
Copyable example
import type { TabsListProps } from "@kovojs/ui/tabs";
const props: TabsListProps = { children: 'Content' };Signature
interface TabsListProps extends TabsStateProps {
children?: ComponentChild;
descriptionId?: string;
id?: string;
label?: string;
labelledBy?: string;
styles?: TabsStyleOverrides;
}TabsTriggerProps#
Props for the tabs trigger component.
Copyable example
import type { TabsTriggerProps } from "@kovojs/ui/tabs";
const props: TabsTriggerProps = { itemValue: 'item', children: 'Content' };Signature
interface TabsTriggerProps extends TabsStateProps {
children?: ComponentChild;
id?: string;
itemDisabled?: boolean;
itemValue: string;
panelId?: string;
styles?: TabsStyleOverrides;
}TabsPanelProps#
Props for the tabs panel component.
Copyable example
import type { TabsPanelProps } from "@kovojs/ui/tabs";
const props: TabsPanelProps = { itemValue: 'item', children: 'Content' };Signature
interface TabsPanelProps extends TabsStateProps {
children?: ComponentChild;
id?: string;
itemDisabled?: boolean;
itemValue: string;
styles?: TabsStyleOverrides;
triggerId?: string;
}@kovojs/ui/tooltip#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/tooltip.tsx
Values#
Tooltip#
Renders the styled tooltip primitive.
Copyable example
import { Tooltip } from "@kovojs/ui/tooltip";
const component = Tooltip;Signature
const Tooltip = component({
render(props: TooltipProps) {
const attrs = tooltipRootAttributes(tooltipState(props));
const styleAttrs = style.attrs(tooltipStyles.root, props.styles?.root);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
id={props.id}
>
{props.children}
</div>
);
},
});TooltipTrigger#
Renders the styled tooltip trigger primitive.
Copyable example
import { TooltipTrigger } from "@kovojs/ui/tooltip";
const component = TooltipTrigger;Signature
const TooltipTrigger = component({
render(props: TooltipTriggerProps) {
const attrs = tooltipTriggerAttributes({
...tooltipState(props),
...(props.contentId === undefined ? {} : { contentId: props.contentId }),
});
const styleAttrs = style.attrs(tooltipStyles.trigger, props.styles?.trigger);
return (
<button
{...styleAttrs}
{...passThroughProps(props)}
aria-describedby={attrs['aria-describedby']}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
disabled={props.disabled === true}
id={props.id}
kovo-tooltip={attrs['kovo-tooltip']}
type="button"
>
{props.children}
</button>
);
},
});TooltipContent#
Renders the styled tooltip content primitive.
Copyable example
import { TooltipContent } from "@kovojs/ui/tooltip";
const component = TooltipContent;Signature
const TooltipContent = component({
render(props: TooltipContentProps) {
const attrs = tooltipContentAttributes({
...tooltipState(props),
...(props.contentId === undefined ? {} : { contentId: props.contentId }),
});
const styleAttrs = style.attrs(tooltipStyles.content, props.styles?.content);
const arrowAttrs = style.attrs(tooltipStyles.arrow);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
data-state={attrs['data-state']}
hidden={attrs.hidden}
id={attrs.id}
popover={attrs.popover}
role={attrs.role}
>
{props.children}
<span {...arrowAttrs} aria-hidden="true" />
</div>
);
},
});Supporting types#
TooltipStyleOverrides#
Style override slots accepted by the tooltip components.
Copyable example
import type { TooltipStyleOverrides } from "@kovojs/ui/tooltip";
const styles: TooltipStyleOverrides = {};Signature
interface TooltipStyleOverrides {
content?: style.StyleInput;
root?: style.StyleInput;
trigger?: style.StyleInput;
}TooltipStateProps#
Shared state props for the tooltip component family.
Copyable example
import type { TooltipStateProps } from "@kovojs/ui/tooltip";
const state: TooltipStateProps = {};Signature
interface TooltipStateProps {
disabled?: boolean;
open?: boolean;
}TooltipProps#
Props for the tooltip component.
Copyable example
import type { TooltipProps } from "@kovojs/ui/tooltip";
const props: TooltipProps = { children: 'Content' };Signature
interface TooltipProps extends TooltipStateProps {
children?: ComponentChild;
id?: string;
styles?: TooltipStyleOverrides;
}TooltipTriggerProps#
Props for the tooltip trigger component.
Copyable example
import type { TooltipTriggerProps } from "@kovojs/ui/tooltip";
const props: TooltipTriggerProps = { children: 'Content' };Signature
interface TooltipTriggerProps extends TooltipStateProps {
children?: ComponentChild;
contentId?: string;
id?: string;
styles?: TooltipStyleOverrides;
}TooltipContentProps#
Props for the tooltip content component.
Copyable example
import type { TooltipContentProps } from "@kovojs/ui/tooltip";
const props: TooltipContentProps = { children: 'Content' };Signature
interface TooltipContentProps extends TooltipStateProps {
children?: ComponentChild;
contentId?: string;
styles?: TooltipStyleOverrides;
}@kovojs/ui/toggle#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/toggle.tsx
Values#
Toggle#
Renders the styled toggle primitive.
Copyable example
import { Toggle } from "@kovojs/ui/toggle";
const component = Toggle;Signature
const Toggle = component({
render(props: ToggleProps) {
const attrs = toggleRootAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
pressed: props.pressed ?? false,
});
const styleAttrs = style.attrs(base.root, variants[props.variant ?? 'outline'], props.style);
return (
<button
{...styleAttrs}
{...passThroughProps(props)}
aria-pressed={attrs['aria-pressed']}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
disabled={attrs.disabled}
type={attrs.type}
>
{props.children}
</button>
);
},
});Supporting types#
ToggleVariant#
Supported toggle variant values.
Copyable example
import type { ToggleVariant } from "@kovojs/ui/toggle";
const value: ToggleVariant = 'outline';Signature
type ToggleVariant = 'outline' | 'subtle';ToggleProps#
Props for the toggle component.
Copyable example
import type { ToggleProps } from "@kovojs/ui/toggle";
const props: ToggleProps = { children: 'Content' };Signature
interface ToggleProps {
children?: ComponentChild;
disabled?: boolean;
pressed?: boolean;
style?: style.StyleInput;
variant?: ToggleVariant;
}@kovojs/ui/toggle-group#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/toggle-group.tsx
Values#
ToggleGroup#
Renders the styled toggle group primitive.
Copyable example
import { ToggleGroup } from "@kovojs/ui/toggle-group";
const component = ToggleGroup;Signature
const ToggleGroup = component({
render(props: ToggleGroupProps) {
const attrs = toggleGroupRootAttributes({
...(props.activeValue === undefined ? {} : { activeValue: props.activeValue }),
...(props.collapsible === undefined ? {} : { collapsible: props.collapsible }),
...(props.descriptionId === undefined ? {} : { descriptionId: props.descriptionId }),
...(props.dir === undefined ? {} : { dir: props.dir }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.items === undefined ? {} : { items: props.items }),
...(props.labelledBy === undefined ? {} : { labelledBy: props.labelledBy }),
...(props.loop === undefined ? {} : { loop: props.loop }),
...(props.orientation === undefined ? {} : { orientation: props.orientation }),
...(props.type === undefined ? {} : { type: props.type }),
...(props.value === undefined ? {} : { value: props.value }),
});
const styleAttrs = style.attrs(toggleGroupStyles.root, props.styles?.root);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
aria-describedby={attrs['aria-describedby']}
aria-disabled={attrs['aria-disabled']}
aria-labelledby={attrs['aria-labelledby']}
data-disabled={attrs['data-disabled']}
data-orientation={attrs['data-orientation']}
id={attrs.id}
role={attrs.role}
>
{props.children}
</div>
);
},
});ToggleGroupItem#
Renders the styled toggle group item primitive.
Copyable example
import { ToggleGroupItem } from "@kovojs/ui/toggle-group";
const component = ToggleGroupItem;Signature
const ToggleGroupItem = component({
render(props: ToggleGroupItemProps) {
const attrs = toggleGroupItemAttributes({
...(props.activeValue === undefined ? {} : { activeValue: props.activeValue }),
...(props.collapsible === undefined ? {} : { collapsible: props.collapsible }),
...(props.dir === undefined ? {} : { dir: props.dir }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.itemDisabled === undefined ? {} : { itemDisabled: props.itemDisabled }),
itemValue: props.itemValue,
...(props.items === undefined ? {} : { items: props.items }),
...(props.loop === undefined ? {} : { loop: props.loop }),
...(props.orientation === undefined ? {} : { orientation: props.orientation }),
...(props.type === undefined ? {} : { type: props.type }),
...(props.value === undefined ? {} : { value: props.value }),
});
const styleAttrs = style.attrs(toggleGroupStyles.item, props.styles?.item);
return (
<span
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
id={attrs.id}
>
{props.children}
</span>
);
},
});ToggleGroupButton#
Renders the styled toggle group button primitive.
Copyable example
import { ToggleGroupButton } from "@kovojs/ui/toggle-group";
const component = ToggleGroupButton;Signature
const ToggleGroupButton = component({
render(props: ToggleGroupButtonProps) {
const attrs = toggleGroupButtonAttributes({
...(props.activeValue === undefined ? {} : { activeValue: props.activeValue }),
...(props.collapsible === undefined ? {} : { collapsible: props.collapsible }),
...(props.dir === undefined ? {} : { dir: props.dir }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.itemDisabled === undefined ? {} : { itemDisabled: props.itemDisabled }),
itemValue: props.itemValue,
...(props.items === undefined ? {} : { items: props.items }),
...(props.loop === undefined ? {} : { loop: props.loop }),
...(props.orientation === undefined ? {} : { orientation: props.orientation }),
...(props.type === undefined ? {} : { type: props.type }),
...(props.value === undefined ? {} : { value: props.value }),
});
const styleAttrs = style.attrs(toggleGroupStyles.button, props.styles?.button);
return (
<button
{...styleAttrs}
{...passThroughProps(props)}
aria-pressed={attrs['aria-pressed']}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
disabled={attrs.disabled}
id={attrs.id}
tabIndex={attrs.tabIndex}
type={attrs.type}
value={attrs.value}
>
{props.children}
</button>
);
},
});Supporting types#
ToggleGroupStyleOverrides#
Style override slots accepted by the toggle group components.
Copyable example
import type { ToggleGroupStyleOverrides } from "@kovojs/ui/toggle-group";
const styles: ToggleGroupStyleOverrides = {};Signature
interface ToggleGroupStyleOverrides {
button?: style.StyleInput;
item?: style.StyleInput;
root?: style.StyleInput;
}ToggleGroupStateProps#
Shared state props for the toggle group component family.
Copyable example
import type { ToggleGroupStateProps } from "@kovojs/ui/toggle-group";
const state: ToggleGroupStateProps = {};Signature
interface ToggleGroupStateProps {
activeValue?: string;
collapsible?: boolean;
dir?: TextDirection;
disabled?: boolean;
items?: readonly HeadlessToggleGroupItem[];
loop?: boolean;
orientation?: CollectionOrientation;
type?: ToggleGroupType;
value?: ToggleGroupValue;
}ToggleGroupProps#
Props for the toggle group component.
Copyable example
import type { ToggleGroupProps } from "@kovojs/ui/toggle-group";
const props: ToggleGroupProps = { children: 'Content' };Signature
interface ToggleGroupProps extends ToggleGroupStateProps {
children?: ComponentChild;
descriptionId?: string;
id?: string;
labelledBy?: string;
styles?: ToggleGroupStyleOverrides;
}ToggleGroupItemProps#
Props for the toggle group item component.
Copyable example
import type { ToggleGroupItemProps } from "@kovojs/ui/toggle-group";
const props: ToggleGroupItemProps = { itemValue: 'item', children: 'Content' };Signature
interface ToggleGroupItemProps extends ToggleGroupStateProps {
children?: ComponentChild;
id?: string;
itemDisabled?: boolean;
itemValue: string;
styles?: ToggleGroupStyleOverrides;
}ToggleGroupButtonProps#
Props for the toggle group button component.
Copyable example
import type { ToggleGroupButtonProps } from "@kovojs/ui/toggle-group";
const props: ToggleGroupButtonProps = { itemValue: 'item', children: 'Content' };Signature
interface ToggleGroupButtonProps extends ToggleGroupStateProps {
children?: ComponentChild;
id?: string;
itemDisabled?: boolean;
itemValue: string;
styles?: ToggleGroupStyleOverrides;
}@kovojs/ui/toast#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/toast.tsx
Values#
ToastViewport#
Renders the styled toast viewport primitive.
Copyable example
import { ToastViewport } from "@kovojs/ui/toast";
const component = ToastViewport;Signature
const ToastViewport = component({
render(props: ToastViewportProps) {
const attrs = toastViewportAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.label === undefined ? {} : { label: props.label }),
...(props.placement === undefined ? {} : { placement: props.placement }),
});
const styleAttrs = style.attrs(toastStyles.viewport, props.styles?.viewport);
return (
<div
{...styleAttrs}
{...passThroughProps(props, { style: true })}
aria-label={attrs['aria-label']}
data-disabled={attrs['data-disabled']}
data-placement={attrs['data-placement']}
id={attrs.id}
role={attrs.role}
tabIndex={attrs.tabIndex}
>
{props.children}
</div>
);
},
});Toast#
Renders the styled toast primitive.
Copyable example
import { Toast } from "@kovojs/ui/toast";
const component = Toast;Signature
const Toast = component({
render(props: ToastProps) {
const attrs = toastRootAttributes({
...(props.descriptionId === undefined ? {} : { descriptionId: props.descriptionId }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
id: props.id,
...(props.open === undefined ? {} : { open: props.open }),
...(props.politeness === undefined ? {} : { politeness: props.politeness }),
...(props.titleId === undefined ? {} : { titleId: props.titleId }),
...(props.variant === undefined ? {} : { variant: props.variant }),
});
const styleAttrs = style.attrs(toastStyles.root, props.styles?.root);
const ariaLive: ToastPoliteness = attrs['aria-live'] === 'assertive' ? 'assertive' : 'polite';
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
aria-atomic={attrs['aria-atomic']}
aria-describedby={attrs['aria-describedby']}
aria-labelledby={attrs['aria-labelledby']}
aria-live={ariaLive}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
data-variant={attrs['data-variant']}
hidden={attrs.hidden}
id={attrs.id}
role={attrs.role}
>
{props.children}
</div>
);
},
});ToastTitle#
Renders the styled toast title primitive.
Copyable example
import { ToastTitle } from "@kovojs/ui/toast";
const component = ToastTitle;Signature
const ToastTitle = component({
render(props: ToastPartProps) {
const attrs = toastTitleAttributes(props.id === undefined ? {} : { id: props.id });
const styleAttrs = style.attrs(toastStyles.title, props.styles?.title);
return (
<div {...styleAttrs} data-part={attrs['data-part']} id={attrs.id}>
{props.children}
</div>
);
},
});ToastDescription#
Renders the styled toast description primitive.
Copyable example
import { ToastDescription } from "@kovojs/ui/toast";
const component = ToastDescription;Signature
const ToastDescription = component({
render(props: ToastPartProps) {
const attrs = toastDescriptionAttributes(props.id === undefined ? {} : { id: props.id });
const styleAttrs = style.attrs(toastStyles.description, props.styles?.description);
return (
<div {...styleAttrs} data-part={attrs['data-part']} id={attrs.id}>
{props.children}
</div>
);
},
});ToastAction#
Renders the styled toast action primitive.
Copyable example
import { ToastAction } from "@kovojs/ui/toast";
const component = ToastAction;Signature
const ToastAction = component({
render(props: ToastActionProps) {
const attrs = toastActionAttributes({
...(props.actionValue === undefined ? {} : { actionValue: props.actionValue }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.dismissOnAction === undefined ? {} : { dismissOnAction: props.dismissOnAction }),
id: props.id,
...(props.open === undefined ? {} : { open: props.open }),
...(props.variant === undefined ? {} : { variant: props.variant }),
});
const styleAttrs = style.attrs(toastStyles.action, props.styles?.action);
return (
<button
{...styleAttrs}
{...passThroughProps(props)}
data-action={attrs['data-action']}
data-dismiss-on-action={attrs['data-dismiss-on-action']}
data-disabled={attrs['data-disabled']}
data-state={attrs['data-state']}
data-variant={attrs['data-variant']}
disabled={attrs.disabled}
type={attrs.type}
value={attrs.value}
>
{props.children}
</button>
);
},
});ToastClose#
Renders the styled toast close primitive.
Copyable example
import { ToastClose } from "@kovojs/ui/toast";
const component = ToastClose;Signature
const ToastClose = component({
render(props: ToastCloseProps) {
const attrs = toastCloseAttributes({
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
id: props.id,
...(props.open === undefined ? {} : { open: props.open }),
...(props.variant === undefined ? {} : { variant: props.variant }),
});
const styleAttrs = style.attrs(toastStyles.close, props.styles?.close);
return (
<button
{...styleAttrs}
{...passThroughProps(props)}
aria-label={props.children === undefined ? 'Dismiss notification' : undefined}
data-disabled={attrs['data-disabled']}
data-dismiss={attrs['data-dismiss']}
data-state={attrs['data-state']}
data-variant={attrs['data-variant']}
disabled={attrs.disabled}
type={attrs.type}
>
{props.children ?? X({ style: toastStyles.closeIcon })}
</button>
);
},
});Supporting types#
ToastStyleOverrides#
Style override slots accepted by the toast components.
Copyable example
import type { ToastStyleOverrides } from "@kovojs/ui/toast";
const styles: ToastStyleOverrides = {};Signature
interface ToastStyleOverrides {
action?: style.StyleInput;
close?: style.StyleInput;
description?: style.StyleInput;
root?: style.StyleInput;
title?: style.StyleInput;
viewport?: style.StyleInput;
}ToastViewportProps#
Props for the toast viewport component.
Copyable example
import type { ToastViewportProps } from "@kovojs/ui/toast";
const props: ToastViewportProps = { children: 'Content' };Signature
interface ToastViewportProps {
children?: ComponentChild;
disabled?: boolean;
id?: string;
label?: string;
placement?: ToastPlacement;
styles?: ToastStyleOverrides;
}ToastProps#
Props for the toast component.
Copyable example
import type { ToastProps } from "@kovojs/ui/toast";
const props: ToastProps = { id: 'id', children: 'Content' };Signature
interface ToastProps {
children?: ComponentChild;
descriptionId?: string;
disabled?: boolean;
id: string;
open?: boolean;
politeness?: ToastPoliteness;
styles?: ToastStyleOverrides;
titleId?: string;
variant?: ToastVariant;
}ToastPartProps#
Props for the toast part component.
Copyable example
import type { ToastPartProps } from "@kovojs/ui/toast";
const props: ToastPartProps = { children: 'Content' };Signature
interface ToastPartProps {
children?: ComponentChild;
id?: string;
styles?: ToastStyleOverrides;
}ToastActionProps#
Props for the toast action component.
Copyable example
import type { ToastActionProps } from "@kovojs/ui/toast";
const props: ToastActionProps = { id: 'id', children: 'Content' };Signature
interface ToastActionProps {
actionValue?: string;
children?: ComponentChild;
disabled?: boolean;
dismissOnAction?: boolean;
id: string;
open?: boolean;
styles?: ToastStyleOverrides;
variant?: ToastVariant;
}ToastCloseProps#
Props for the toast close component.
Copyable example
import type { ToastCloseProps } from "@kovojs/ui/toast";
const props: ToastCloseProps = { id: 'id' };Signature
type ToastCloseProps = ToastActionProps;@kovojs/ui/toolbar#
Task: Styled Kovo server components: versioned component subpaths, StyleX slot overrides, and copy-in source surfaces.
Source: packages/ui/src/toolbar.tsx
Values#
Toolbar#
Renders the styled toolbar primitive.
Copyable example
import { Toolbar } from "@kovojs/ui/toolbar";
const component = Toolbar;Signature
const Toolbar = component({
render(props: ToolbarProps) {
const attrs = toolbarRootAttributes({
...(props.activeValue === undefined ? {} : { activeValue: props.activeValue }),
...(props.descriptionId === undefined ? {} : { descriptionId: props.descriptionId }),
...(props.dir === undefined ? {} : { dir: props.dir }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.items === undefined ? {} : { items: props.items }),
...(props.label === undefined ? {} : { label: props.label }),
...(props.labelledBy === undefined ? {} : { labelledBy: props.labelledBy }),
...(props.loop === undefined ? {} : { loop: props.loop }),
...(props.orientation === undefined ? {} : { orientation: props.orientation }),
});
const styleAttrs = style.attrs(toolbarStyles.root, props.styles?.root);
return (
<div
{...styleAttrs}
{...passThroughProps(props)}
aria-describedby={attrs['aria-describedby']}
aria-disabled={attrs['aria-disabled']}
aria-label={attrs['aria-label']}
aria-labelledby={attrs['aria-labelledby']}
aria-orientation={attrs['aria-orientation']}
data-disabled={attrs['data-disabled']}
data-orientation={attrs['data-orientation']}
id={attrs.id}
role={attrs.role}
>
{props.children}
</div>
);
},
});ToolbarItem#
Renders the styled toolbar item primitive.
Copyable example
import { ToolbarItem } from "@kovojs/ui/toolbar";
const component = ToolbarItem;Signature
const ToolbarItem = component({
render(props: ToolbarItemProps) {
const attrs = toolbarItemAttributes({
...(props.activeValue === undefined ? {} : { activeValue: props.activeValue }),
...(props.dir === undefined ? {} : { dir: props.dir }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.itemDisabled === undefined ? {} : { itemDisabled: props.itemDisabled }),
itemValue: props.itemValue,
...(props.items === undefined ? {} : { items: props.items }),
...(props.loop === undefined ? {} : { loop: props.loop }),
...(props.orientation === undefined ? {} : { orientation: props.orientation }),
});
const styleAttrs = style.attrs(toolbarStyles.item, props.styles?.item);
return (
<span
{...styleAttrs}
{...passThroughProps(props)}
data-disabled={attrs['data-disabled']}
id={attrs.id}
>
{props.children}
</span>
);
},
});ToolbarButton#
Renders the styled toolbar button primitive.
Copyable example
import { ToolbarButton } from "@kovojs/ui/toolbar";
const component = ToolbarButton;Signature
const ToolbarButton = component({
render(props: ToolbarButtonProps) {
const attrs = toolbarButtonAttributes({
...(props.activeValue === undefined ? {} : { activeValue: props.activeValue }),
...(props.dir === undefined ? {} : { dir: props.dir }),
...(props.disabled === undefined ? {} : { disabled: props.disabled }),
...(props.id === undefined ? {} : { id: props.id }),
...(props.itemDisabled === undefined ? {} : { itemDisabled: props.itemDisabled }),
itemValue: props.itemValue,
...(props.items === undefined ? {} : { items: props.items }),
...(props.loop === undefined ? {} : { loop: props.loop }),
...(props.orientation === undefined ? {} : { orientation: props.orientation }),
...(props.pressed === undefined ? {} : { pressed: props.pressed }),
});
const styleAttrs = style.attrs(toolbarStyles.button, props.styles?.button);
return (
<button
{...styleAttrs}
{...passThroughProps(props)}
aria-pressed={attrs['aria-pressed']}
data-disabled={attrs['data-disabled']}
data-pressed={attrs['data-pressed']}
disabled={attrs.disabled}
id={attrs.id}
tabIndex={attrs.tabIndex}
type={attrs.type}
value={attrs.value}
>
{props.children}
</button>
);
},
});Supporting types#
ToolbarStyleOverrides#
Style override slots accepted by the toolbar components.
Copyable example
import type { ToolbarStyleOverrides } from "@kovojs/ui/toolbar";
const styles: ToolbarStyleOverrides = {};Signature
interface ToolbarStyleOverrides {
button?: style.StyleInput;
item?: style.StyleInput;
root?: style.StyleInput;
}ToolbarStateProps#
Shared state props for the toolbar component family.
Copyable example
import type { ToolbarStateProps } from "@kovojs/ui/toolbar";
const state: ToolbarStateProps = {};Signature
interface ToolbarStateProps {
activeValue?: string;
dir?: TextDirection;
disabled?: boolean;
items?: readonly HeadlessToolbarItem[];
loop?: boolean;
orientation?: ToolbarOrientation;
}ToolbarProps#
Props for the toolbar component.
Copyable example
import type { ToolbarProps } from "@kovojs/ui/toolbar";
const props: ToolbarProps = { children: 'Content' };Signature
interface ToolbarProps extends ToolbarStateProps {
children?: ComponentChild;
descriptionId?: string;
id?: string;
label?: string;
labelledBy?: string;
styles?: ToolbarStyleOverrides;
}ToolbarItemProps#
Props for the toolbar item component.
Copyable example
import type { ToolbarItemProps } from "@kovojs/ui/toolbar";
const props: ToolbarItemProps = { itemValue: 'item', children: 'Content' };Signature
interface ToolbarItemProps extends ToolbarStateProps {
children?: ComponentChild;
id?: string;
itemDisabled?: boolean;
itemValue: string;
styles?: ToolbarStyleOverrides;
}ToolbarButtonProps#
Props for the toolbar button component.
Copyable example
import type { ToolbarButtonProps } from "@kovojs/ui/toolbar";
const props: ToolbarButtonProps = { itemValue: 'item', children: 'Content' };Signature
interface ToolbarButtonProps extends ToolbarItemProps {
pressed?: boolean;
}