diff --git a/.firecrawl/kobalte-animation.md b/.firecrawl/kobalte-animation.md deleted file mode 100644 index 618d34c..0000000 --- a/.firecrawl/kobalte-animation.md +++ /dev/null @@ -1,73 +0,0 @@ -# Animation - -Kobalte components can be animated with CSS keyframes or your JavaScript animation library of choice. However, there are some caveats noted here in regard to exiting animations with JavaScript animation libraries. - -## Animating with CSS animation - -The simplest way to animate Kobalte components is with CSS. - -You can use CSS animation to animate both mount and unmount phases of several Kobalte components. The latter is possible because this components will suspend unmount while your animation plays out. - -``` -Copycss -.popover__content { - animation: fadeOut 300ms ease-in forwards; -} - -.popover__content[data-expanded] { - animation: fadeIn 300ms ease-out; -} - -@keyframes fadeIn { - from { - opacity: 0; - } - to { - opacity: 1; - } -} - -@keyframes fadeOut { - from { - opacity: 1; - } - to { - opacity: 0; - } -} -``` - -``` -Copycss -.popover__content { - animation: fadeOut 300ms ease-in forwards; -} - -.popover__content[data-expanded] { - animation: fadeIn 300ms ease-out; -} - -@keyframes fadeIn { - from { - opacity: 0; - } - to { - opacity: 1; - } -} - -@keyframes fadeOut { - from { - opacity: 1; - } - to { - opacity: 0; - } -} -``` - -## Delegating unmounting for JavaScript animation - -When many stateful Kobalte components are hidden from view, they are actually removed from the DOM. JavaScript animation libraries need control of the unmounting phase, so we provide the `forceMount` prop on many components to allow consumers to delegate the mounting and unmounting of children based on the animation state determined by those libraries. - -Previous[←Styling](https://kobalte.dev/docs/core/overview/styling)Next[Polymorphism→](https://kobalte.dev/docs/core/overview/polymorphism) \ No newline at end of file diff --git a/.firecrawl/kobalte-changelog.md b/.firecrawl/kobalte-changelog.md deleted file mode 100644 index 060d1e2..0000000 --- a/.firecrawl/kobalte-changelog.md +++ /dev/null @@ -1,129 +0,0 @@ -# v0.13.x - -## v0.13.11 (July 27, 2025) - -**Bug fixes** - -- Update createInteractOutside to work with other Element types ( [#612](https://github.com/kobaltedev/kobalte/pull/612)) -- Meter, Progress: remove rounding from fill width ( [#602](https://github.com/kobaltedev/kobalte/pull/602)) -- Image: handle crossOrigin and referrerPolicy ( [#598](https://github.com/kobaltedev/kobalte/pull/598)) -- ToggleGroup: reactive disabled state ( [#595](https://github.com/kobaltedev/kobalte/pull/595)) -- ColorArea: double onChange trigger ( [#593](https://github.com/kobaltedev/kobalte/pull/593)) -- ColorChannelField: fix handling of alpha values ( [#590](https://github.com/kobaltedev/kobalte/pull/590)) -- Colors: color parsing and rgb(a)/hsl(a) format ( [#587](https://github.com/kobaltedev/kobalte/pull/587)) - -## v0.13.10 (May 30, 2025) - -**New features** - -- [New `SegmentedControl` component](https://kobalte.dev/docs/core/components/segmented-control) ( [#531](https://github.com/kobaltedev/kobalte/pull/531)) - -## v0.13.9 (February 21, 2025) - -**New features** - -- [New `ColorWheel` component](https://kobalte.dev/docs/core/components/color-wheel) ( [#510](https://github.com/kobaltedev/kobalte/pull/510)) -- [New `ColorField` component](https://kobalte.dev/docs/core/components/color-field) ( [#510](https://github.com/kobaltedev/kobalte/pull/510)) -- [New `ColorChannelField` component](https://kobalte.dev/docs/core/components/color-channel-field) ( [#508](https://github.com/kobaltedev/kobalte/pull/508)) -- [New `ColorArea` component](https://kobalte.dev/docs/core/components/color-area) ( [#508](https://github.com/kobaltedev/kobalte/pull/508)) -- [New `ColorSlider` component](https://kobalte.dev/docs/core/components/color-slider) ( [#508](https://github.com/kobaltedev/kobalte/pull/508)) -- [New `ColorSwatch` component](https://kobalte.dev/docs/core/components/color-swatch) ( [#508](https://github.com/kobaltedev/kobalte/pull/508)) -- [New `Search` component](https://kobalte.dev/docs/core/components/search) ( [#506](https://github.com/kobaltedev/kobalte/pull/506)) - -## v0.13.8 (February 7, 2025) - -**New features** - -- [New `FileField` component](https://kobalte.dev/docs/core/components/file-field) ( [#512](https://github.com/kobaltedev/kobalte/pull/512)) -- [New `Badge` component](https://kobalte.dev/docs/core/components/badge) ( [#503](https://github.com/kobaltedev/kobalte/pull/503)) -- [New `Meter` component](https://kobalte.dev/docs/core/components/meter) ( [#500](https://github.com/kobaltedev/kobalte/pull/500)) - -## v0.13.7 (October 7, 2024) - -**Bug fixes** - -- ToggleGroup: root value type definition ( [#479](https://github.com/kobaltedev/kobalte/pull/479)) -- Collapsible: close animation on default open ( [#483](https://github.com/kobaltedev/kobalte/pull/483)) -- Toast: filter dismissed toasts in region ( [#489](https://github.com/kobaltedev/kobalte/pull/489)) - -## v0.13.6 (August 27, 2024) - -**Bug fixes** - -- Update missing export from `@kobalte/utils` ( [#477](https://github.com/kobaltedev/kobalte/pull/477)) - -## v0.13.5 (August 27, 2024) - -**New features** - -- Tooltip: add skipDelayDuration prop ( [#467](https://github.com/kobaltedev/kobalte/pull/467)) - -**Bug fixes** - -- NumberField: only format when enabled ( [#456](https://github.com/kobaltedev/kobalte/pull/456)) -- NumberField: don't trigger `onRawValueChange` on mount when NaN ( [#456](https://github.com/kobaltedev/kobalte/pull/456)) -- Select: correct type definition & empty value for multiselect ( [#456](https://github.com/kobaltedev/kobalte/pull/456)) -- TextField: clear input when controlled value set to undefined ( [#456](https://github.com/kobaltedev/kobalte/pull/456)) -- Combobox: correct type definition & empty value for multiselect ( [#456](https://github.com/kobaltedev/kobalte/pull/456)) -- Skeleton: correct data-animate & data-visible attribute value ( [#456](https://github.com/kobaltedev/kobalte/pull/456)) -- Combobox: close list on outside click ( [#456](https://github.com/kobaltedev/kobalte/pull/456)) -- NavigationMenu: incorrect animation after closed ( [#456](https://github.com/kobaltedev/kobalte/pull/456)) -- Tabs: recalculate indicator styles on resize ( [#458](https://github.com/kobaltedev/kobalte/pull/458)) -- Pagination: correctly render fixedItems with low page count ( [#464](https://github.com/kobaltedev/kobalte/pull/464)) -- Combobox: prevent opening on input with triggerMode="manual" ( [#465](https://github.com/kobaltedev/kobalte/pull/465)) -- NumberField: precision handling with floating point offsets and value snapping ( [#468](https://github.com/kobaltedev/kobalte/pull/468)) - -## v0.13.4 (June 22, 2024) - -**New features** - -- Add source exports ( [#408](https://github.com/kobaltedev/kobalte/pull/408)) -- Support string style prop ( [#432](https://github.com/kobaltedev/kobalte/pull/432)) - -**Bug fixes** - -- Combobox: convert textValue with optionTextValue ( [#436](https://github.com/kobaltedev/kobalte/pull/436)) -- Polymorphic: override the `component` prop of `` ( [#437](https://github.com/kobaltedev/kobalte/pull/437)) -- Slider: inverted slider thumb in the wrong position ( [#441](https://github.com/kobaltedev/kobalte/pull/441)) -- Wait for presence to finish before enabling scroll ( [#447](https://github.com/kobaltedev/kobalte/pull/447)) - -## v0.13.3 (June 3, 2024) - -**New features** - -- [New `NavigationMenu` component](https://kobalte.dev/docs/core/components/navigation-menu) ( [#409](https://github.com/kobaltedev/kobalte/pull/409)) - -## v0.13.2 (May 29, 2024) - -**Bug fixes** - -- Refactored polymorphic element type in CommonProps ( [#420](https://github.com/kobaltedev/kobalte/pull/420)) - -## v0.13.1 (May 3, 2024) - -**New features** - -- NumberField: improve input handling ( [#379](https://github.com/kobaltedev/kobalte/pull/379)) ( [#395](https://github.com/kobaltedev/kobalte/pull/395)) - -**Bug fixes** - -- Slider: call `onChangeEnd` on blur after changing value ( [#402](https://github.com/kobaltedev/kobalte/pull/402)) -- Select: `options` non reactive inside suspense ( [#401](https://github.com/kobaltedev/kobalte/pull/401)) -- Combobox: close on select with `focus` trigger mode ( [#400](https://github.com/kobaltedev/kobalte/pull/400)) -- Menu: open link menu items ( [#397](https://github.com/kobaltedev/kobalte/pull/397)) - -## v0.13.0 (May 1, 2024) - -**Breaking changes** - -- [#381](https://github.com/kobaltedev/kobalte/pull/381) -- Removed `asChild` and ``: [Polymorphism documentation](https://kobalte.dev/docs/core/overview/polymorphism) -- Refactored `as` prop: [Polymorphism documentation](https://kobalte.dev/docs/core/overview/polymorphism) -- [New component types](https://kobalte.dev/docs/core/overview/polymorphism#types) - -**New features** - -- Allow importing individual components ( [#391](https://github.com/kobaltedev/kobalte/pull/391)) -- [New `ToggleGroup` component](https://kobalte.dev/docs/core/components/toggle-group) ( [#378](https://github.com/kobaltedev/kobalte/pull/378)) - -Next[v0.12.x→](https://kobalte.dev/docs/changelog/0-12-x) \ No newline at end of file diff --git a/.firecrawl/kobalte-color-area.md b/.firecrawl/kobalte-color-area.md deleted file mode 100644 index ad077da..0000000 --- a/.firecrawl/kobalte-color-area.md +++ /dev/null @@ -1,349 +0,0 @@ -# Color Area - -Allows users to adjust two channels of an RGB, HSL, or HSB color value against a two-dimensional gradient background. - -## Import - -``` -Copyts -import { ColorArea } from "@kobalte/core/color-area"; -// or -import { Root, Background, ... } from "@kobalte/core/color-area"; -``` - -``` -Copyts -import { ColorArea } from "@kobalte/core/color-area"; -// or -import { Root, Background, ... } from "@kobalte/core/color-area"; -``` - -## Features - -- Can be controlled or uncontrolled. -- Support for adjusting two-channel values of an RGB, HSL or HSB color value. -- Pressing on the color area background moves the thumb to that position. -- Supports using the arrow keys, for changing value by step, as well as shift + arrow key, page up/down, home, and end keys, for changing the value by page step. -- Support for disabling the color area. -- Prevents text selection while dragging. -- Exposed to assistive technology as a 2D slider element via ARIA. -- Uses two hidden native input elements within a group to support touch screen readers. -- Automatic ARIA labeling using the localized channel names by default. -- Support for mirroring in RTL locales. - -## Anatomy - -The color area consists of: - -- **ColorArea:** The root container for the color area. -- **ColorArea.Background:** The component that visually represents the range of colors from which a user can select. -- **ColorArea.Thumb:** The thumb that is used to visually indicate a value in the color area background. -- **ColorArea.HiddenInputX:** The horizontal native html input that is visually hidden in the color area thumb. -- **ColorArea.HiddenInputY:** The vertical native html input that is visually hidden in the color area thumb. -- **ColorArea.Label:** The label that gives the user information on the color area. - -``` -Copytsx - - - - - - - - - -``` - -``` -Copytsx - - - - - - - - - -``` - -## Example - -Label - -index.tsxstyle.css - -``` -Copytsx -import { ColorArea } from "@kobalte/core/color-area"; -import { parseColor } from "@kobalte/utils"; -import "./style.css"; - -function App() { - return ( - - Label - - - - - - - - ); -} -``` - -``` -Copytsx -import { ColorArea } from "@kobalte/core/color-area"; -import { parseColor } from "@kobalte/utils"; -import "./style.css"; - -function App() { - return ( - - Label - - - - - - - - ); -} -``` - -## Usage - -The value provided to `defaultValue` or `value` should be `Color` object. You can obtain a Color object by using the `parseColor` function to parse a color from a string. -The `xChannel` and `yChannel` must be one of the channels included in the color value, for example, for RGB colors, the "red", "green", and "blue" channels are available. -If no `xChannel` or `yChannel` is provided, for the RGB color space, the red color channel maps to the horizontal axis or xChannel, and the green color channel maps to the vertical axis or yChannel. Similarly, for the HSL and HSB color spaces, the hue color channel maps to the horizontal axis or xChannel, and the saturation color channel maps to the vertical axis or yChannel. - -### Default value - -Label - -``` -Copytsx - - Label - - - - - - - -``` - -``` -Copytsx - - Label - - - - - - - -``` - -### Controlled value - -Label - -Current color value: hsl(0 100% 50%) - -``` -Copytsx -import { createSignal } from "solid-js"; - -const [value, setValue] = createSignal(parseColor("hsl(0, 100%, 50%)")); -<> - - Label - - - - - - - -

Current color value: {value().toString("hsl")}

-; -``` - -``` -Copytsx -import { createSignal } from "solid-js"; - -const [value, setValue] = createSignal(parseColor("hsl(0, 100%, 50%)")); -<> - - Label - - - - - - - -

Current color value: {value().toString("hsl")}

-; -``` - -### xChannel and yChannel - -The color channel for each axis of a color area can be specified using the `xChannel` and `yChannel` props. An array of channel names for a color can be returned using the color.getColorChannels method. - -Label - -``` -Copytsx -const [value, setValue] = createSignal(parseColor("rgb(100, 149, 237)")); -const [rChannel, gChannel, bChannel] = value().getColorChannels(); - - - Label - - - - - - -; -``` - -``` -Copytsx -const [value, setValue] = createSignal(parseColor("rgb(100, 149, 237)")); -const [rChannel, gChannel, bChannel] = value().getColorChannels(); - - - Label - - - - - - -; -``` - -### HTML forms - -ColorArea supports the `xName` and `yName` props for integration with HTML forms. - -Label - -ResetSubmit - -``` -Copytsx - - Label - - - - - - - -``` - -``` -Copytsx - - Label - - - - - - - -``` - -## API Reference - -### ColorArea - -`ColorArea` is equivalent to the `Root` import from `@kobalte/core/color-area`. - -| Prop | Description | -| --- | --- | -| value | `Color`
The controlled value of the color area.. | -| defaultValue | `Color`
The value of the color area when initially rendered. | -| colorSpace | `ColorSpace`
The color space that the color area operates in. The `xChannel` and `yChannel` must be in this color space. | -| onChange | `(value: Color) => void`
Event handler called when the value changes. | -| onChangeEnd | `(value: Color) => void`
Event handler called when the value changes at the end of an interaction. | -| xChannel | `ColorChannel`
Color channel for the horizontal axis. | -| yChannel | `ColorChannel`
Color channel for the vertical axis. | -| xName | `string`
The name of the x channel input element, used when submitting an HTML form. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefname). | -| yName | `string`
The name of the y channel input element, used when submitting an HTML form. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefname). | -| name | `string`
The name of the color area, used when submitting an HTML form. | -| validationState | `'valid' | 'invalid'`
Whether the color area should display its "valid" or "invalid" visual styling. | -| required | `boolean`
Whether the user must check a radio group item before the owning form can be submitted. | -| disabled | `boolean`
Whether the radio group is disabled. | -| readOnly | `boolean`
Whether the radio group items can be selected but not changed by the user. | -| translations | `ColorAreaIntlTranslations`
Localization strings. | - -| Data attribute | Description | -| --- | --- | -| data-valid | Present when the slider is valid according to the validation rules. | -| data-invalid | Present when the slider is invalid according to the validation rules. | -| data-required | Present when the user must slider an item before the owning form can be submitted. | -| data-disabled | Present when the slider is disabled. | -| data-readonly | Present when the slider is read only. | - -`ColorArea.Background`, `ColorArea.Thumb`, `ColorArea.HiddenInputX`, `ColorArea.HiddenInputY` and `ColorArea.Label` share the same data-attributes. - -### ColorArea.Thumb - -The current color is available on the thumb using the custom css property `--kb-color-current`. - -### ColorArea.HiddenInputX - -| Data attribute | Description | -| --- | --- | -| data-orientation='horizontal' | Always presesnt | - -### ColorArea.HiddenInputY - -| Data attribute | Description | -| --- | --- | -| data-orientation='vertical' | Always presesnt | - -## Rendered elements - -| Component | Default rendered element | -| --- | --- | -| `ColorArea` | `div` | -| `ColorArea.Background` | `div` | -| `ColorArea.Thumb` | `span` | -| `ColorArea.HiddenInputX` | `input` | -| `ColorArea.HiddenInputY` | `input` | -| `ColorArea.Label` | `label` | -| `ColorArea.Description` | `div` | -| `ColorArea.ErrorMessage` | `div` | - -## Accessibility - -### Keyboard Interactions - -| Key | Description | -| --- | --- | -| `PageUp` | Increments the value of the thumb in the vertical axis by a larger step. | -| `PageDown` | Decrements the value of the thumb in the vertical axis by a larger step. | -| `ArrowDown` | Decrements the value of the thumb in the vertical axis by the step amount. | -| `ArrowUp` | Increments the value of the thumb in the vertical axis by the step amount. | -| `ArrowRight` | Increments the value of the thumb in the horizontal axis by the step amount. | -| `ArrowLeft` | Decrements the value of the thumb in the vertical axis by the step amount. | -| `Home` | Decrements the value of the thumb in the horizontal axis by a larger step. | -| `End` | Increments the value of the thumb in the horizontal axis by a larger step. | - -Previous[←Collapsible](https://kobalte.dev/docs/core/components/collapsible)Next[Color Channel Field→](https://kobalte.dev/docs/core/components/color-channel-field) \ No newline at end of file diff --git a/.firecrawl/kobalte-combobox.md b/.firecrawl/kobalte-combobox.md deleted file mode 100644 index 0cc2dd4..0000000 --- a/.firecrawl/kobalte-combobox.md +++ /dev/null @@ -1,1451 +0,0 @@ -# Combobox - -Combines a text input with a listbox, allowing users to filter a list of options to items matching a query. - -## Import - -``` -Copyts -import { Combobox } from "@kobalte/core/combobox"; -// or -import { Root, Label, ... } from "@kobalte/core/combobox"; -// or (deprecated) -import { Combobox } from "@kobalte/core"; -``` - -``` -Copyts -import { Combobox } from "@kobalte/core/combobox"; -// or -import { Root, Label, ... } from "@kobalte/core/combobox"; -// or (deprecated) -import { Combobox } from "@kobalte/core"; -``` - -## Features - -- Exposed to assistive technology as a combobox using the [WAI ARIA Combobox](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/) design pattern. -- Support for single and multiple selection. -- Support for disabled options. -- Labeling support for accessibility. -- Support for description and error message help text linked to the button via ARIA. -- Tab stop focus management. -- Keyboard support for opening the listbox using the arrow keys, including automatically focusing the first or last item accordingly. -- Support for opening the list box when typing, on focus, or manually. -- Browser autofill integration via a hidden native `` element, which is visually hidden to allow custom styling. -- Syncs with form reset events. -- Group and segment labeling support for assistive technology. -- Can be controlled or uncontrolled. -- Supports animatable indicator. - -## Anatomy - -The segmented control consists of: - -- **SegmentedControl**: The root container for the segmented control. -- **SegmentedControl.Label**: The label that gives the user information on the segmented control. -- **SegmentedControl.Description**: The description that gives the user more information on the segmented control. -- **SegmentedControl.ErrorMessage**: The error message that gives the user information about how to fix a validation error on the segmented control. -- **SegmentedControl.Indicator:** The visual indicator displayed below the items to indicate the selected item. - -The segmented control item consists of: - -- **SegmentedControl.Item**: The root container for an item's radio button. -- **SegmentedControl.ItemInput**: The native html input that is visually hidden in the item's radio button. -- **SegmentedControl.ItemControl**: The element that visually represents an item's radio button. -- **SegmentedControl.ItemIndicator**: The visual indicator rendered when the item's radio button is in a checked state. -- **SegmentedControl.ItemLabel**: The label that gives the user information on the item's radio button. -- **SegmentedControl.ItemDescription**: The description that gives the user more information on the item's radio button. - -``` -Copytsx - - - - - - - - - - - - - - -``` - -``` -Copytsx - - - - - - - - - - - - - - -``` - -## Example - -Favorite fruit - -Apple - -Orange - -Watermelon - -index.tsxstyle.css - -``` -Copytsx -import { SegmentedControl } from "@kobalte/core/segmented-control"; - -import "./style.css"; - -function App() { - return ( - - - Favorite fruit - - - - ); -} -``` - -``` -Copytsx -import { SegmentedControl } from "@kobalte/core/segmented-control"; - -import "./style.css"; - -function App() { - return ( - - - Favorite fruit - - - - ); -} -``` - -## Usage - -The `role="presentation"` is required for all non content elements between the `SegmentedControl` and `SegmentedControl.Item` due to a bug in Chromium based browsers that incorrectly parse semantics and break screen readers. - -### Controlled value - -The `value` prop, which accepts a value corresponding with the `value` prop of each radio, can be used to make the value controlled. The `onChange` event is fired when the user selects a radio, and receives the new value. - -Favorite fruit - -Apple - -Orange - -Watermelon - -Your favorite fruit is: Orange. - -``` -Copytsx -import { createSignal } from "solid-js"; - -function ControlledExample() { - const [value, setValue] = createSignal("Orange"); - - return ( - <> - - Favorite fruit -
- -
- - {fruit => ( - - - {fruit} - - )} - -
-
-
-

Your favorite fruit is: {value()}.

- - ); -} -``` - -``` -Copytsx -import { createSignal } from "solid-js"; - -function ControlledExample() { - const [value, setValue] = createSignal("Orange"); - - return ( - <> - - Favorite fruit -
- -
- - {fruit => ( - - - {fruit} - - )} - -
-
-
-

Your favorite fruit is: {value()}.

- - ); -} -``` - -### Description - -The `SegmentedControl.Description` component can be used to associate additional help text with a segmented control. - -Favorite fruit - -Apple - -Orange - -Watermelon - -Choose the fruit you like the most. - -``` -Copytsx - - Favorite fruit -
- -
- - {fruit => ...} - -
-
- Choose the fruit you like the most. -
-``` - -``` -Copytsx - - Favorite fruit -
- -
- - {fruit => ...} - -
-
- Choose the fruit you like the most. -
-``` - -### Error message - -The `SegmentedControl.ErrorMessage` component can be used to help the user fix a validation error. It should be combined with the `validationState` prop to semantically mark the segmented control as invalid for assistive technologies. - -By default, it will render only when the `validationState` prop is set to `invalid`, use the `forceMount` prop to always render the error message (ex: for usage with animation libraries). - -Favorite fruit - -Apple - -Orange - -Watermelon - -Hmm, I prefer apples. - -``` -Copytsx -import { createSignal } from "solid-js"; - -function ErrorMessageExample() { - const [value, setValue] = createSignal("Orange"); - - return ( - - Favorite fruit -
- -
- - {fruit => ...} - -
-
- Hmm, I prefer apples. -
- ); -} -``` - -``` -Copytsx -import { createSignal } from "solid-js"; - -function ErrorMessageExample() { - const [value, setValue] = createSignal("Orange"); - - return ( - - Favorite fruit -
- -
- - {fruit => ...} - -
-
- Hmm, I prefer apples. -
- ); -} -``` - -### HTML forms - -The segmented control `name` prop, paired with the item's radio `value` prop, can be used for integration with HTML forms. - -Favorite fruit - -Apple - -Orange - -Watermelon - -ResetSubmit - -``` -Copytsx -function HTMLFormExample() { - const onSubmit = (e: SubmitEvent) => { - // handle form submission. - }; - - return ( -
- - Favorite fruit -
- -
- - {fruit => ...} - -
-
-
-
- - -
-
- ); -} -``` - -``` -Copytsx -function HTMLFormExample() { - const onSubmit = (e: SubmitEvent) => { - // handle form submission. - }; - - return ( -
- - Favorite fruit -
- -
- - {fruit => ...} - -
-
-
-
- - -
-
- ); -} -``` - -### Orientation - -The segmented control `orientation` prop can be used to change the segmented control's orientation. - -Favorite fruit - -Apple - -Orange - -Watermelon - -``` -Copytsx - - Favorite fruit -
- -
- - {fruit => ...} - -
-
- Choose the fruit you like the most. -
-``` - -``` -Copytsx - - Favorite fruit -
- -
- - {fruit => ...} - -
-
- Choose the fruit you like the most. -
-``` - -## API Reference - -### SegmentedControl - -`SegmentedControl` is equivalent to the `Root` import from `@kobalte/core/segmented-control`. - -| Prop | Description | -| --- | --- | -| value | `string`
The controlled value of the item's radio button to check. | -| defaultValue | `string`
The value of the item's radio button that should be checked when initially rendered. Useful when you do not need to control the state of the radio buttons. | -| onChange | `(value: string) => void`
Event handler called when the value changes. | -| orientation | `'horizontal' | 'vertical'`
The axis the segmented control items should align with. | -| name | `string`
The name of the segmented control. Submitted with its owning form as part of a name/value pair. | -| validationState | `'valid' | 'invalid'`
Whether the segmented control should display its "valid" or "invalid" visual styling. | -| required | `boolean`
Whether the user must check a segmented control item before the owning form can be submitted. | -| disabled | `boolean`
Whether the segmented control is disabled. | -| readOnly | `boolean`
Whether the segmented control items can be selected but not changed by the user. | - -| Data attribute | Description | -| --- | --- | -| data-valid | Present when the segmented control is valid according to the validation rules. | -| data-invalid | Present when the segmented control is invalid according to the validation rules. | -| data-required | Present when the user must check a segmented control item before the owning form can be submitted. | -| data-disabled | Present when the segmented control is disabled. | -| data-readonly | Present when the segmented control is read only. | - -`SegmentedControl.Label`, `SegmentedControl.Description` and `SegmentedControl.ErrorMesssage` shares the same data-attributes. - -### SegmentedControl.ErrorMessage - -| Prop | Description | -| --- | --- | -| forceMount | `boolean`
Used to force mounting when more control is needed. Useful when controlling animation with SolidJS animation libraries. | - -### SegmentedControl.Item - -| Prop | Description | -| --- | --- | -| value | `string`
The value of the item's radio button, used when submitting an HTML form. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/radio#Value). | -| disabled | `boolean`
Whether the item's radio button is disabled or not. | - -| Data attribute | Description | -| --- | --- | -| data-valid | Present when the parent segmented control is valid according to the validation rules. | -| data-invalid | Present when the parent segmented control is invalid according to the validation rules. | -| data-checked | Present when the segmented control checked. | -| data-disabled | Present when the segmented control disabled. | - -`SegmentedControl.ItemInput`, `SegmentedControl.ItemControl`, `SegmentedControl.ItemIndicator` and `SegmentedControl.ItemLabel` shares the same data-attributes. - -### SegmentedControl.ItemIndicator - -| Prop | Description | -| --- | --- | -| forceMount | `boolean`
Used to force mounting when more control is needed. Useful when controlling animation with SolidJS animation libraries. | - -## Rendered elements - -| Component | Default rendered element | -| --- | --- | -| `SegmentedControl` | `div` | -| `SegmentedControl.Label` | `span` | -| `SegmentedControl.Description` | `div` | -| `SegmentedControl.ErrorMessage` | `div` | -| `SegmentedControl.Indicator` | `div` | -| `SegmentedControl.Item` | `div` | -| `SegmentedControl.ItemInput` | `input` | -| `SegmentedControl.ItemControl` | `div` | -| `SegmentedControl.ItemIndicator` | `div` | -| `SegmentedControl.ItemLabel` | `label` | -| `SegmentedControl.ItemDescription` | `div` | - -## Accessibility - -### Keyboard Interactions - -| Key | Description | -| --- | --- | -| `Tab` | Moves focus to either the checked item's radio button or the first item's radio button in the group. | -| `Space` | When focus is on an unchecked item's radio button, checks it. | -| `ArrowDown` | Moves focus and checks the next item's radio button in the group. | -| `ArrowRight` | Moves focus and checks the next item's radio button in the group. | -| `ArrowUp` | Moves focus and checks the previous item's radio button in the group. | -| `ArrowLeft` | Moves focus and checks the previous item's radio button in the group. | - -Previous[←Search](https://kobalte.dev/docs/core/components/search)Next[Select→](https://kobalte.dev/docs/core/components/select) \ No newline at end of file diff --git a/.firecrawl/kobalte-select2.md b/.firecrawl/kobalte-select2.md deleted file mode 100644 index 8389aa4..0000000 --- a/.firecrawl/kobalte-select2.md +++ /dev/null @@ -1,1464 +0,0 @@ -# Select - -Displays a list of options for the user to pick from — triggered by a button. - -## Import - -``` -Copyts -import { Select } from "@kobalte/core/select"; -// or -import { Root, Label, ... } from "@kobalte/core/select"; -// or (deprecated) -import { Select } from "@kobalte/core"; -``` - -``` -Copyts -import { Select } from "@kobalte/core/select"; -// or -import { Root, Label, ... } from "@kobalte/core/select"; -// or (deprecated) -import { Select } from "@kobalte/core"; -``` - -## Features - -- Exposed to assistive technology as a button with a listbox popup using the [WAI ARIA Listbox](https://www.w3.org/WAI/ARIA/apg/patterns/listbox/) design pattern. -- Support for single and multiple selection. -- Support for disabled options. -- Labeling support for accessibility. -- Support for description and error message help text linked to the button via ARIA. -- Tab stop focus management. -- Keyboard support for opening the listbox using the arrow keys, including automatically focusing the first or last item accordingly. -- Typeahead to allow selecting options by typing text, even without opening the listbox. -- Browser autofill integration via a hidden native ` - - - - - - - - - - - - - - - -``` - -``` -Copytsx - -``` - -## Example - -Select a fruit…Sort - -index.tsxstyle.css - -``` -Copytsx -import { Select } from "@kobalte/core/select"; -import { CaretSortIcon, CheckIcon } from "some-icon-library"; -import "./style.css"; - -function App() { - return ( - - ); -} -``` - -``` -Copytsx -import { Select } from "@kobalte/core/select"; -import { CaretSortIcon, CheckIcon } from "some-icon-library"; -import "./style.css"; - -function App() { - return ( - - ); -} -``` - -## Usage - -### Default value - -An initial, uncontrolled value can be provided using the `defaultValue` prop, which accepts a value corresponding with the `options`. - -BlueberrySort - -``` -Copytsx - -``` - -``` -Copytsx - -``` - -### Controlled value - -The `value` prop, which accepts a value corresponding with the `options` prop, can be used to make the value controlled. The `onChange` event is fired when the user selects an option, and receives the selected option. - -BlueberrySort - -Your favorite fruit is: Blueberry. - -``` -Copytsx -import { createSignal } from "solid-js"; - -export function ControlledExample() { - const [value, setValue] = createSignal("Blueberry"); - - return ( - <> - -

Your favorite fruit is: {value()}.

- - ); -} -``` - -``` -Copytsx -import { createSignal } from "solid-js"; - -export function ControlledExample() { - const [value, setValue] = createSignal("Blueberry"); - - return ( - <> - -

Your favorite fruit is: {value()}.

- - ); -} -``` - -### Description - -The `Select.Description` component can be used to associate additional help text with a select. - -Select a fruit…Sort - -Choose the fruit you like the most. - -``` -Copytsx - -``` - -``` -Copytsx - -``` - -### Error message - -The `Select.ErrorMessage` component can be used to help the user fix a validation error. It should be combined with the `validationState` prop to semantically mark the select as invalid for assistive technologies. - -By default, it will render only when the `validationState` prop is set to `invalid`, use the `forceMount` prop to always render the error message (ex: for usage with animation libraries). - -GrapesSort - -Hmm, I prefer apples. - -``` -Copytsx -import { createSignal } from "solid-js"; - -export function ErrorMessageExample() { - const [value, setValue] = createSignal("Grapes"); - - return ( - - ); -} -``` - -``` -Copytsx -import { createSignal } from "solid-js"; - -export function ErrorMessageExample() { - const [value, setValue] = createSignal("Grapes"); - - return ( - - ); -} -``` - -### HTML forms - -The select `name` prop, paired with the `Select.HiddenSelect` component, can be used for integration with HTML forms. - -AppleBananaBlueberryGrapesPineapple - -Select a fruit…Sort - -ResetSubmit - -``` -Copytsx -function HTMLFormExample() { - const onSubmit = (e: SubmitEvent) => { - // handle form submission. - }; - - return ( -
- -
- - -
-
- ); -} -``` - -``` -Copytsx -function HTMLFormExample() { - const onSubmit = (e: SubmitEvent) => { - // handle form submission. - }; - - return ( -
- -
- - -
-
- ); -} -``` - -### Using object as options - -Objects can be used as options instead of plain strings. In this case you have to tell the select how it should work with the provided options. For this you **have to use** the following props : - -- `optionValue`: The property name to use as the value of an option (submitted with `
`). -- `optionTextValue`: The property name to use as the text value of an option for keyboard navigation. -- `optionDisabled`: The property name to use as the disabled flag of an option. - -Select a food…Sort - -``` -Copytsx -interface Fruit { - value: string; - label: string; - disabled: boolean; -} - -const options: Fruit[] = [\ - { value: "apple", label: "Apple", disabled: false },\ - { value: "banana", label: "Banana", disabled: false },\ - { value: "blueberry", label: "Blueberry", disabled: false },\ - { value: "grapes", label: "Grapes", disabled: true },\ - { value: "pineapple", label: "Pineapple", disabled: false },\ -]; - -function ObjectExample() { - return ( - - ); -} -``` - -``` -Copytsx -interface Fruit { - value: string; - label: string; - disabled: boolean; -} - -const options: Fruit[] = [\ - { value: "apple", label: "Apple", disabled: false },\ - { value: "banana", label: "Banana", disabled: false },\ - { value: "blueberry", label: "Blueberry", disabled: false },\ - { value: "grapes", label: "Grapes", disabled: true },\ - { value: "pineapple", label: "Pineapple", disabled: false },\ -]; - -function ObjectExample() { - return ( - - ); -} -``` - -### Using option groups - -When using option groups you have to tell the select how to distinguish an option from a group. For this you **have to use** the following props : - -- `optionGroupChildren`: The property name that refers to the children options of an option group. - -Additionally, the `sectionComponent` prop is used to display the option group label in the select. - -Select a food…Sort - -``` -Copytsx -interface Food { - value: string; - label: string; - disabled: boolean; -} - -interface Category { - label: string; - options: Food[]; -} - -const options: Category[] = [\ - {\ - label: "Fruits",\ - options: [\ - { value: "apple", label: "Apple", disabled: false },\ - { value: "banana", label: "Banana", disabled: false },\ - { value: "blueberry", label: "Blueberry", disabled: false },\ - { value: "grapes", label: "Grapes", disabled: true },\ - { value: "pineapple", label: "Pineapple", disabled: false },\ - ],\ - },\ - {\ - label: "Meat",\ - options: [\ - { value: "beef", label: "Beef", disabled: false },\ - { value: "chicken", label: "Chicken", disabled: false },\ - { value: "lamb", label: "Lamb", disabled: false },\ - { value: "pork", label: "Pork", disabled: false },\ - ],\ - },\ -]; - -function OptionGroupExample() { - return ( - - options={options} - optionValue="value" - optionTextValue="label" - optionDisabled="disabled" - optionGroupChildren="options" - placeholder="Select a food…" - itemComponent={props => ( - - {props.item.rawValue.label} - - - - - )} - sectionComponent={props => {props.section.rawValue.label}} - > - - >{state => state.selectedOption().label} - - - - - - - - - - - ); -} -``` - -``` -Copytsx -interface Food { - value: string; - label: string; - disabled: boolean; -} - -interface Category { - label: string; - options: Food[]; -} - -const options: Category[] = [\ - {\ - label: "Fruits",\ - options: [\ - { value: "apple", label: "Apple", disabled: false },\ - { value: "banana", label: "Banana", disabled: false },\ - { value: "blueberry", label: "Blueberry", disabled: false },\ - { value: "grapes", label: "Grapes", disabled: true },\ - { value: "pineapple", label: "Pineapple", disabled: false },\ - ],\ - },\ - {\ - label: "Meat",\ - options: [\ - { value: "beef", label: "Beef", disabled: false },\ - { value: "chicken", label: "Chicken", disabled: false },\ - { value: "lamb", label: "Lamb", disabled: false },\ - { value: "pork", label: "Pork", disabled: false },\ - ],\ - },\ -]; - -function OptionGroupExample() { - return ( - - options={options} - optionValue="value" - optionTextValue="label" - optionDisabled="disabled" - optionGroupChildren="options" - placeholder="Select a food…" - itemComponent={props => ( - - {props.item.rawValue.label} - - - - - )} - sectionComponent={props => {props.section.rawValue.label}} - > - - >{state => state.selectedOption().label} - - - - - - - - - - - ); -} -``` - -Notice the usage of generics on `Select` for proper TypeScript support. - -### Multiple selection - -The `multiple` prop can be used to create a select that allow multi-selection. In this case the value provided to `value`, `defaultValue` and `onChange` props is of type `Array`. - -The `Select.Value` children _render prop_ expose an array of selected options, and two method for removing an option from the selection and clear the selection. - -Additionally, the example below uses the `as` prop to render a `div` for the `Select.Trigger` since HTML button can't contain interactive elements according to the [W3C](https://html.spec.whatwg.org/multipage/form-elements.html#the-button-element). - -BlueberryCrossGrapesCross -CrossSort - -Your favorite fruits are: Blueberry, Grapes. - -``` -Copytsx -import { createSignal } from "solid-js"; - -function MultipleSelectionExample() { - const [values, setValues] = createSignal(["Blueberry", "Grapes"]); - - return ( - <> - - multiple - value={values()} - onChange={setValues} - options={["Apple", "Banana", "Blueberry", "Grapes", "Pineapple"]} - placeholder="Select some fruits…" - itemComponent={props => ( - - {props.item.rawValue} - - - - - )} - > - - > - {state => ( - <> -
- - {option => ( - e.stopPropagation()}> - {option} - - - )} - -
- - - )} - - - - -
- - - - - - -

Your favorite fruits are: {values().join(", ")}.

- - ); -} -``` - -``` -Copytsx -import { createSignal } from "solid-js"; - -function MultipleSelectionExample() { - const [values, setValues] = createSignal(["Blueberry", "Grapes"]); - - return ( - <> - - multiple - value={values()} - onChange={setValues} - options={["Apple", "Banana", "Blueberry", "Grapes", "Pineapple"]} - placeholder="Select some fruits…" - itemComponent={props => ( - - {props.item.rawValue} - - - - - )} - > - - > - {state => ( - <> -
- - {option => ( - e.stopPropagation()}> - {option} - - - )} - -
- - - )} - - - - -
- - - - - - -

Your favorite fruits are: {values().join(", ")}.

- - ); -} -``` - -### Virtual scrolling - -When dealing with large collection of items, it's recommended to use a virtual scrolling solution to improve performance. - -While Kobalte doesn't provide any built-in virtual scrolling API, it can easily be integrated with a 3rd party library. The example below demonstrate how to virtualize an array of 100,000 options using the [`@tanstack/solid-virtual`](https://tanstack.com/virtual/v3) package. - -Select an item…Sort - -``` -Copytsx -import { Select } from "@kobalte/core/select"; -import { createVirtualizer } from "@tanstack/solid-virtual"; - -interface Item { - value: string; - label: string; - disabled: boolean; -} - -const options: Item[] = Array.from({ length: 100_000 }, (_, i) => ({ - value: `${i}`, - label: `Item #${i + 1}`, - disabled: false, -})); - -function SelectContent(props: { options: Item[] }) { - let listboxRef: HTMLUListElement | undefined; - - const virtualizer = createVirtualizer({ - count: props.options.length, - getScrollElement: () => listboxRef, - getItemKey: (index: number) => props.options[index].value, - estimateSize: () => 32, - enableSmoothScroll: false, - overscan: 5, - }); - - return ( - - - virtualizer.scrollToIndex(props.options.findIndex(option => option.value === key)) - } - style={{ height: "200px", width: "100%", overflow: "auto" }} - > - {items => ( -
- - {virtualRow => { - const item = items().getItem(virtualRow.key); - - if (item) { - return ( - - {item.rawValue.label} - - - - - ); - } - }} - -
- )} -
-
- ); -} - -function VirtualizedExample() { - return ( - - ); -} -``` - -``` -Copytsx -import { Select } from "@kobalte/core/select"; -import { createVirtualizer } from "@tanstack/solid-virtual"; - -interface Item { - value: string; - label: string; - disabled: boolean; -} - -const options: Item[] = Array.from({ length: 100_000 }, (_, i) => ({ - value: `${i}`, - label: `Item #${i + 1}`, - disabled: false, -})); - -function SelectContent(props: { options: Item[] }) { - let listboxRef: HTMLUListElement | undefined; - - const virtualizer = createVirtualizer({ - count: props.options.length, - getScrollElement: () => listboxRef, - getItemKey: (index: number) => props.options[index].value, - estimateSize: () => 32, - enableSmoothScroll: false, - overscan: 5, - }); - - return ( - - - virtualizer.scrollToIndex(props.options.findIndex(option => option.value === key)) - } - style={{ height: "200px", width: "100%", overflow: "auto" }} - > - {items => ( -
- - {virtualRow => { - const item = items().getItem(virtualRow.key); - - if (item) { - return ( - - {item.rawValue.label} - - - - - ); - } - }} - -
- )} -
-
- ); -} - -function VirtualizedExample() { - return ( - - ); -} -``` - -### Origin-aware animations - -We expose a CSS custom property `--kb-select-content-transform-origin` which can be used to animate the content from its computed origin. - -``` -Copycss -/* style.css */ -.select__content { - transform-origin: var(--kb-select-content-transform-origin); - animation: contentHide 250ms ease-in forwards; -} - -.select__content[data-expanded] { - animation: contentShow 250ms ease-out; -} - -@keyframes contentShow { - from { - opacity: 0; - transform: translateY(-8px); - } - to { - opacity: 1; - transform: translateY(0); - } -} - -@keyframes contentHide { - from { - opacity: 1; - transform: translateY(0); - } - to { - opacity: 0; - transform: translateY(-8px); - } -} -``` - -``` -Copycss -/* style.css */ -.select__content { - transform-origin: var(--kb-select-content-transform-origin); - animation: contentHide 250ms ease-in forwards; -} - -.select__content[data-expanded] { - animation: contentShow 250ms ease-out; -} - -@keyframes contentShow { - from { - opacity: 0; - transform: translateY(-8px); - } - to { - opacity: 1; - transform: translateY(0); - } -} - -@keyframes contentHide { - from { - opacity: 1; - transform: translateY(0); - } - to { - opacity: 0; - transform: translateY(-8px); - } -} -``` - -## API Reference - -### Select - -`Select` is equivalent to the `Root` import from `@kobalte/core/select` (and deprecated `Select.Root`). - -| Prop | Description | -| --- | --- | -| options | `Array`
An array of options to display as the available options. | -| optionValue | `keyof T | ((option: T) => string | number)`
Property name or getter function to use as the value of an option. This is the value that will be submitted when the select is part of a ``. | -| optionTextValue | `keyof T | ((option: T) => string)`
Property name or getter function to use as the text value of an option for typeahead purpose. | -| optionDisabled | `keyof T | ((option: T) => boolean)`
Property name or getter function to use as the disabled flag of an option. | -| optionGroupChildren | `keyof U`
Property name that refers to the children options of an option group. | -| itemComponent | `Component>`
When NOT virtualized, the component to render as an item in the `Select.Listbox`. | -| sectionComponent | `Component>`
When NOT virtualized, the component to render as a section in the `Select.Listbox`. | -| multiple | `boolean`
Whether the select allows multi-selection. | -| placeholder | `JSX.Element`
The content that will be rendered when no value or defaultValue is set. | -| value | `T | Array`
The controlled value of the select. | -| defaultValue | `T | Array`
The value of the select when initially rendered. Useful when you do not need to control the value. | -| onChange | `(value: T | Array) => void`
Event handler called when the value changes. | -| open | `boolean`
The controlled open state of the select. | -| defaultOpen | `boolean`
The default open state when initially rendered. Useful when you do not need to control the open state. | -| onOpenChange | `(open: boolean) => void`
Event handler called when the open state of the select changes. | -| allowDuplicateSelectionEvents | `boolean`
Whether `onChange` should fire even if the new value is the same as the last. | -| disallowEmptySelection | `boolean`
Whether the select allows empty selection or not. | -| closeOnSelection | `boolean`
Whether the select closes after selection. | -| selectionBehavior | `'toggle' | 'replace'`
How selection should behave in the select. | -| virtualized | `boolean`
Whether the select uses virtual scrolling. | -| modal | `boolean`
Whether the select should be the only visible content for screen readers, when set to `true`:
\- interaction with outside elements will be disabled.
\- scroll will be locked.
\- focus will be locked inside the select content.
\- elements outside the select content will not be visible for screen readers. | -| preventScroll | `boolean`
Whether the scroll should be locked even if the select is not modal. | -| forceMount | `boolean`
Used to force mounting the select (portal, positioner and content) when more control is needed. Useful when controlling animation with SolidJS animation libraries. | -| name | `string`
The name of the select. Submitted with its owning form as part of a name/value pair. | -| validationState | `'valid' | 'invalid'`
Whether the select should display its "valid" or "invalid" visual styling. | -| required | `boolean`
Whether the user must select an item before the owning form can be submitted. | -| disabled | `boolean`
Whether the select is disabled. | -| readOnly | `boolean`
Whether the select items can be selected but not changed by the user. | -| autoComplete | `string`
Describes the type of autocomplete functionality the input should provide if any. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefautocomplete) | - -`Select` also accepts the following props to customize the placement of the `Select.Content`. - -| Prop | Description | -| --- | --- | -| placement | `Placement`
The placement of the select content. | -| gutter | `number`
The distance between the select content and the trigger element. | -| shift | `number`
The skidding of the select content along the trigger element. | -| flip | `boolean | string`
Controls the behavior of the select content when it overflows the viewport:
\- If a `boolean`, specifies whether the select content should flip to the opposite side when it overflows.
\- If a `string`, indicates the preferred fallback placements when it overflows.
The placements must be spaced-delimited, e.g. "top left". | -| slide | `boolean`
Whether the select content should slide when it overflows. | -| overlap | `boolean`
Whether the select content can overlap the trigger element when it overflows. | -| sameWidth | `boolean`
Whether the select content should have the same width as the trigger element. This will be exposed to CSS as `--kb-popper-anchor-width`. | -| fitViewport | `boolean`
Whether the select content should fit the viewport. If this is set to true, the select content will have `maxWidth` and `maxHeight` set to the viewport size. This will be exposed to CSS as `--kb-popper-available-width` and `--kb-popper-available-height`. | -| hideWhenDetached | `boolean`
Whether to hide the select content when the trigger element becomes occluded. | -| detachedPadding | `number`
The minimum padding in order to consider the trigger element occluded. | -| arrowPadding | `number`
The minimum padding between the arrow and the select content corner. | -| overflowPadding | `number`
The minimum padding between the select content and the viewport edge. This will be exposed to CSS as `--kb-popper-overflow-padding`. | - -| Data attribute | Description | -| --- | --- | -| data-valid | Present when the select is valid according to the validation rules. | -| data-invalid | Present when the select is invalid according to the validation rules. | -| data-required | Present when the user must select an item before the owning form can be submitted. | -| data-disabled | Present when the select is disabled. | -| data-readonly | Present when the select is read only. | - -`Select.Label`, `Select.Trigger`, `Select.Value`, `Select.Description` and `Select.ErrorMesssage` shares the same data-attributes. - -### Select.Trigger - -`Select.Trigger` consists of [Button](https://kobalte.dev/docs/core/components/button). - -| Data attribute | Description | -| --- | --- | -| data-expanded | Present when the select is open. | -| data-closed | Present when the select is close. | - -### Select.Value - -| Render Prop | Description | -| --- | --- | -| selectedOption | `Accessor`
The first (or only, in case of single select) selected option. | -| selectedOptions | `Accessor`
An array of selected options. It will contain only one value in case of single select. | -| remove | `(option: T) => void`
A function to remove an option from the selection. | -| clear | `() => void`
A function to clear the selection. | - -| Data attribute | Description | -| --- | --- | -| data-placeholder-shown | Present when the select placeholder is visible (no value selected). | - -### Select.Icon - -| Data attribute | Description | -| --- | --- | -| data-expanded | Present when the select is open. | -| data-closed | Present when the select is close. | - -### Select.ErrorMessage - -| Prop | Description | -| --- | --- | -| forceMount | `boolean`
Used to force mounting when more control is needed. Useful when controlling animation with SolidJS animation libraries. | - -### Select.Content - -The popper positioner will copy the same `z-index` as the `Select.Content`. - -| Data attribute | Description | -| --- | --- | -| data-expanded | Present when the select is open. | -| data-closed | Present when the select is close. | - -### Select.Arrow - -| Prop | Description | -| --- | --- | -| size | `number`
The size of the arrow. | - -### Select.Listbox - -| Prop | Description | -| --- | --- | -| scrollRef | `Accessor`
The ref attached to the scrollable element, used to provide automatic scrolling on item focus. If not provided, defaults to the listbox. | -| scrollToItem | `(key: string) => void`
When virtualized, the Virtualizer function used to scroll to the item of the given key. | -| children | `(items: Accessor>>) => JSX.Element`
When virtualized, a map function that receives an _items_ signal representing all items and sections. | - -### Select.Item - -| Prop | Description | -| --- | --- | -| item | `CollectionNode`
The collection node to render. | - -| Data attribute | Description | -| --- | --- | -| data-disabled | Present when the item is disabled. | -| data-selected | Present when the item is selected. | -| data-highlighted | Present when the item is highlighted. | - -`Select.ItemLabel`, `Select.ItemDescription` and `Select.ItemIndicator` shares the same data-attributes. - -### Select.ItemIndicator - -| Prop | Description | -| --- | --- | -| forceMount | `boolean`
Used to force mounting when more control is needed. Useful when controlling animation with SolidJS animation libraries. | - -## Rendered elements - -| Component | Default rendered element | -| --- | --- | -| `Select` | `div` | -| `Select.Label` | `span` | -| `Select.Description` | `div` | -| `Select.ErrorMessage` | `div` | -| `Select.Trigger` | `button` | -| `Select.Value` | `span` | -| `Select.Icon` | `span` | -| `Select.Portal` | `Portal` | -| `Select.Content` | `div` | -| `Select.Arrow` | `div` | -| `Select.Listbox` | `ul` | -| `Select.Section` | `li` | -| `Select.Item` | `li` | -| `Select.ItemLabel` | `div` | -| `Select.ItemDescription` | `div` | -| `Select.ItemIndicator` | `div` | - -## Accessibility - -### Keyboard Interactions - -| Key | Description | -| --- | --- | -| `Space` | When focus is on the trigger, opens the select and focuses the first or selected item.
When focus is on an item, selects the focused item. | -| `Enter` | When focus is on the trigger, opens the select and focuses the first or selected item.
When focus is on an item, selects the focused item. | -| `ArrowDown` | When focus is on the trigger, opens the select and focuses the first or selected item.
When focus is on an item, moves focus to the next item. | -| `ArrowUp` | When focus is on the trigger, opens the select and focuses the last or selected item.
When focus is on an item, moves focus to the previous item. | -| `Home` | When focus is on an item, moves focus to first item. | -| `End` | When focus is on an item, moves focus to last item. | -| `ArrowRight` | In `Select`, when focus is on the trigger, change the selection to the next item. | -| `ArrowLeft` | In `Select`, when focus is on the trigger, change the selection to the previous item. | -| `Shift` \+ `ArrowDown` | In `Select`, moves focus to and toggles the selected state of the next item. | -| `Shift` \+ `ArrowUp` | In `Select`, moves focus to and toggles the selected state of the previous item. | -| `Shift` \+ `Space` | In `Select`, selects contiguous items from the most recently selected item to the focused item. | -| `Ctrl` \+ `Shift` \+ `Home` | In `Select`, selects the focused item and all options up to the first item. | -| `Ctrl` \+ `Shift` \+ `End` | In `Select`, selects the focused item and all options down to the last item. | -| `Ctrl` \+ `A` | In `Select`, selects all item in the list. | -| `Esc` | Closes the select and moves focus to the trigger. | - -Previous[←Segmented Control](https://kobalte.dev/docs/core/components/segmented-control)Next[Separator→](https://kobalte.dev/docs/core/components/separator) \ No newline at end of file diff --git a/.firecrawl/kobalte-styling-full.md b/.firecrawl/kobalte-styling-full.md deleted file mode 100644 index f7b8bad..0000000 --- a/.firecrawl/kobalte-styling-full.md +++ /dev/null @@ -1,315 +0,0 @@ -# Styling - -Kobalte components are unstyled, allowing you to completely customize the look and feel. Bring your preferred styling solution (vanilla CSS, Tailwind, CSS-in-JS libraries, etc...). - -## Styling a component part - -All components and their parts accept a `class` prop. This class will be passed through to the DOM element. You can style a component part by targeting the `class` that you provide. - -index.tsxstyle.css - -``` -Copytsx -import { Popover as KPopover } from "@kobalte/core"; -import "./style.css"; - -export const Popover = () => { - return ( - - - Open - - - ... - - - ); -}; -``` - -``` -Copytsx -import { Popover as KPopover } from "@kobalte/core"; -import "./style.css"; - -export const Popover = () => { - return ( - - - Open - - - ... - - - ); -}; -``` - -## Styling a state - -When a component or its parts can have multiple states, we automatically attach `data-*` attributes that represents the specific state. For example, a popover's trigger can have: - -- `data-expanded` — When the popover is expanded. -- `data-disabled` — When the popover is disabled. - -You can style a component state by targeting the `data-*` attributes added by Kobalte. - -style.css - -``` -Copycss -.popover__trigger[data-disabled] { - /* The popover trigger style when disabled. */ -} -``` - -``` -Copycss -.popover__trigger[data-disabled] { - /* The popover trigger style when disabled. */ -} -``` - -## Using the TailwindCSS plugin - -If you are using [TailwindCSS](https://tailwindcss.com/), you can use the `@kobalte/tailwindcss` plugin to target Kobalte's `data-*` attributes with modifiers like `ui-expanded:*`. - -### Installation - -npmyarnpnpm - -``` -Copybash -npm install @kobalte/tailwindcss -``` - -``` -Copybash -npm install @kobalte/tailwindcss -``` - -### Usage - -Add the plugin to your `tailwind.config.js` : - -``` -Copyjs -/** @type {import('tailwindcss').Config} */ -module.exports = { - content: [], - theme: { - extend: {}, - }, - plugins: [\ - // default prefix is "ui"\ - require("@kobalte/tailwindcss"),\ -\ - // or with a custom prefix:\ - require("@kobalte/tailwindcss")({ prefix: "kb" }),\ - ], -}; -``` - -``` -Copyjs -/** @type {import('tailwindcss').Config} */ -module.exports = { - content: [], - theme: { - extend: {}, - }, - plugins: [\ - // default prefix is "ui"\ - require("@kobalte/tailwindcss"),\ -\ - // or with a custom prefix:\ - require("@kobalte/tailwindcss")({ prefix: "kb" }),\ - ], -}; -``` - -Style your component: - -``` -Copytsx -import { Popover as KPopover } from "@kobalte/core/popover"; - -export const Popover = () => ( - - - Open - - ... - -); -``` - -``` -Copytsx -import { Popover as KPopover } from "@kobalte/core/popover"; - -export const Popover = () => ( - - - Open - - ... - -); -``` - -You can use the following modifiers: - -| Modifier | CSS Selector | -| --- | --- | -| `ui-valid` | `&[data-valid]` | -| `ui-invalid` | `&[data-invalid]` | -| `ui-required` | `&[data-required]` | -| `ui-disabled` | `&[data-disabled]` | -| `ui-readonly` | `&[data-readonly]` | -| `ui-checked` | `&[data-checked]` | -| `ui-indeterminate` | `&[data-indeterminate]` | -| `ui-selected` | `&[data-selected]` | -| `ui-pressed` | `&[data-pressed]` | -| `ui-expanded` | `&[data-expanded]` | -| `ui-highlighted` | `&[data-highlighted]` | -| `ui-current` | `&[data-current]` | - -It's also possible to use _inverse modifiers_ in the form of `ui-not-*`, _group and peer modifiers_ in the form of `ui-group-*` and `ui-peer-*`. - -## Using the Vanilla Extract plugin - -If you are using [Vanilla Extract](https://vanilla-extract.style/), you can use the `@kobalte/vanilla-extract` plugin to target Kobalte's `data-*` attributes. - -### Installation - -npmyarnpnpm - -``` -Copybash -npm install @kobalte/vanilla-extract -``` - -``` -Copybash -npm install @kobalte/vanilla-extract -``` - -### Usage - -Use the `componentStateStyles` utility function to create vanilla-extract styles that target `data-*` attributes of Kobalte components. - -``` -Copyts -// styles.css -import { componentStateStyles } from "@kobalte/vanilla-extract"; -import { style } from "@vanilla-extract/css"; - -const button = style([\ - {\ - background: "blue",\ - padding: "2px 6px",\ - },\ - componentStateStyles({\ - disabled: {\ - opacity: 0.4,\ - },\ - invalid: {\ - backgroundColor: "red",\ - not: {\ - backgroundColor: "yellow",\ - },\ - },\ - }),\ - componentStateStyles(\ - {\ - invalid: {\ - backgroundColor: "red",\ - },\ - },\ - { parentSelector: "[data-theme=dark]" },\ - ),\ -]); -``` - -``` -Copyts -// styles.css -import { componentStateStyles } from "@kobalte/vanilla-extract"; -import { style } from "@vanilla-extract/css"; - -const button = style([\ - {\ - background: "blue",\ - padding: "2px 6px",\ - },\ - componentStateStyles({\ - disabled: {\ - opacity: 0.4,\ - },\ - invalid: {\ - backgroundColor: "red",\ - not: {\ - backgroundColor: "yellow",\ - },\ - },\ - }),\ - componentStateStyles(\ - {\ - invalid: {\ - backgroundColor: "red",\ - },\ - },\ - { parentSelector: "[data-theme=dark]" },\ - ),\ -]); -``` - -Then apply your styles to the component: - -``` -Copytsx -import { Button } from "@kobalte/core/button"; -import { button } from "./styles.css"; - -export const MyButton = () => ; -``` - -``` -Copytsx -import { Button } from "@kobalte/core/button"; -import { button } from "./styles.css"; - -export const MyButton = () => ; -``` - -## Usage with UnoCSS - -The [UnoCSS preset](https://github.com/zirbest/unocss-preset-primitives#kobalte) made by the community can be used to achieve the same behavior of the TailwindCSS plugin. - -## Extending a component - -Extending a component is done the same way you extend any SolidJS component. - -``` -Copytsx -import { Popover as KPopover } from "@kobalte/core/popover"; -import { ComponentProps } from "solid-js"; - -export const PopoverTrigger = (props: ComponentProps) => { - return ; -}; -``` - -``` -Copytsx -import { Popover as KPopover } from "@kobalte/core/popover"; -import { ComponentProps } from "solid-js"; - -export const PopoverTrigger = (props: ComponentProps) => { - return ; -}; -``` - -Previous[←Getting started](https://kobalte.dev/docs/core/overview/getting-started)Next[Animation→](https://kobalte.dev/docs/core/overview/animation) \ No newline at end of file diff --git a/.firecrawl/kobalte-time-field.md b/.firecrawl/kobalte-time-field.md deleted file mode 100644 index 5ae64c1..0000000 --- a/.firecrawl/kobalte-time-field.md +++ /dev/null @@ -1,648 +0,0 @@ -# Time Field - -A time field allows users to enter and edit time values using a keyboard. Each part of a time value is displayed in an individually editable segment. - -## Import - -``` -Copyts -import { TimeField } from "@kobalte/core/time-field"; -// or -import { Root, Label, ... } from "@kobalte/core/time-field"; -``` - -``` -Copyts -import { TimeField } from "@kobalte/core/time-field"; -// or -import { Root, Label, ... } from "@kobalte/core/time-field"; -``` - -## Features - -- Times can optionally include a time zone. All modifications follow time zone rules such as daylight saving time. -- Support for locale-specific formatting, number systems, hour cycles, and right-to-left layout. -- Each time unit is displayed as an individually focusable and editable segment, which allows users an easy way to edit times using the keyboard, in any format and locale. -- Time segments are editable using an easy to use numeric keypad, and all interactions are accessible using touch-based screen readers. -- Can be controlled or uncontrolled. -- Integrates with HTML forms. - -## Anatomy - -The time field consists of: - -- **TimeField**: The root container for the time field. -- **TimeField.Label**: The label that gives the user information on the time field. -- **TimeField.Field**: The container for the segments. -- **TimeField.Segment**: The component that represents a unit of a time. -- **TimeField.Description**: The description that gives the user more information on the time field. -- **TimeField.ErrorMessage**: The error message that gives the user information about how to fix a validation error on the time field. -- **TimeField.HiddenInput**: The native html input that is visually hidden in the time field. - -``` -Copytsx - - - - - - - - - -``` - -``` -Copytsx - - - - - - - - - -``` - -## Example - -Event time - -–– - -: - -–– - -AM - -index.tsxstyle.css - -``` -Copytsx -import { TimeField } from "@kobalte/core/time-field"; -import "./style.css"; - -function App() { - return ( - - Event time - - {segment => } - - - ); -} -``` - -``` -Copytsx -import { TimeField } from "@kobalte/core/time-field"; -import "./style.css"; - -function App() { - return ( - - Event time - - {segment => } - - - ); -} -``` - -## Usage - -### Default Value - -A TimeField displays a placeholder by default. An initial, uncontrolled value can be provided to the TimeField using the `defaultValue` prop. - -Time values are provided using objects in the [@internationalized/date](https://react-spectrum.adobe.com/internationalized/date/) package. This library handles correct international date and time manipulation across calendars, time zones, and other localization concerns. - -11 - -: - -45 - -AM - -Selected Time: 11:45 AM - -``` -Copytsx -import { Time } from "@internationalized/date"; - - - - {(segment) => ( - - )} - - -``` - -``` -Copytsx -import { Time } from "@internationalized/date"; - - - - {(segment) => ( - - )} - - -``` - -### Controlled Value - -The `value` prop can be used to make the value controlled. The `onChange` event is fired when the time value changes. - -9 - -: - -45 - -AM - -Selected Time: 9:45 AM - -Selected time: 9:45 AM - -``` -Copytsx -import { createSignal } from "solid-js"; -import { createDateFormatter } from "@kobalte/core/i18n"; -import { getLocalTimeZone, Time, toCalendarDateTime, today } from "@internationalized/date"; - -function ControlledValueExample() { - const [value, setValue] = createSignal(new Time(9, 45)); - - const dateFormatter = createDateFormatter({ - hour12: true, - timeStyle: "short", - }); - - return ( - <> - - {segment => } - -

- Selected time:{" "} - {value() - ? dateFormatter().format( - toCalendarDateTime(today(getLocalTimeZone()), value()).toDate(getLocalTimeZone()), - ) - : "––"} -

- - ); -} -``` - -``` -Copytsx -import { createSignal } from "solid-js"; -import { createDateFormatter } from "@kobalte/core/i18n"; -import { getLocalTimeZone, Time, toCalendarDateTime, today } from "@internationalized/date"; - -function ControlledValueExample() { - const [value, setValue] = createSignal(new Time(9, 45)); - - const dateFormatter = createDateFormatter({ - hour12: true, - timeStyle: "short", - }); - - return ( - <> - - {segment => } - -

- Selected time:{" "} - {value() - ? dateFormatter().format( - toCalendarDateTime(today(getLocalTimeZone()), value()).toDate(getLocalTimeZone()), - ) - : "––"} -

- - ); -} -``` - -### Time Zones - -TimeField is time zone aware when a `ZonedDateTime` object is provided as the value. In this case, the time zone abbreviation is displayed, and time zone concerns such as daylight saving time are taken into account when the value is manipulated. - -[@internationalized/date](https://react-spectrum.adobe.com/internationalized/date/) includes functions for parsing strings in multiple formats into `ZonedDateTime` objects. - -12 - -: - -45 - -AM - -PST - -Selected Time: 12:45 AM PST - -``` -Copytsx -import { parseZonedDateTime } from "@internationalized/date"; - - - {segment => } -; -``` - -``` -Copytsx -import { parseZonedDateTime } from "@internationalized/date"; - - - {segment => } -; -``` - -### Granularity - -The `granularity` prop allows you to control the smallest unit that is displayed by a TimeField. By default, times are displayed with "minute" granularity. More granular time values can be displayed by setting the `granularity` prop to "second". - -–– - -: - -–– - -: - -–– - -AM - -``` -Copytsx - - {segment => } - -``` - -``` -Copytsx - - {segment => } - -``` - -### Minimum and Maximum Values - -The `minValue` and `maxValue` props can be used to perform builtin validation. This marks the time field as invalid using ARIA if the user enters an invalid time. - -9 - -: - -45 - -AM - -Selected Time: 9:45 AM - -``` -Copytsx - - {segment => } - Select time between 9 AM and 5 PM. - -``` - -``` -Copytsx - - {segment => } - Select time between 9 AM and 5 PM. - -``` - -### Placeholder Value - -When no value is set, a placeholder is shown. The format of the placeholder is influenced by the `granularity` and `placeholderValue` props. `placeholderValue` also controls the default values of each segment when the user first interacts with them, e.g. using the up and down arrow keys. By default, the `placeholderValue` is midnight. - -9 - -: - -–– - -AM - -``` -Copytsx - - {segment => } - -``` - -``` -Copytsx - - {segment => } - -``` - -### Hide Time Zone - -When a `ZonedDateTime` object is provided as the value of a TimeField, the time zone abbreviation is displayed by default. It can be hidden using the `hideTimeZone` prop. - -12 - -: - -45 - -AM - -Selected Time: 12:45 AM - -``` -Copytsx - - {segment => } - -``` - -``` -Copytsx - - {segment => } - -``` - -### Hour Cycle - -By default, TimeField displays times in either 12 or 24 hour format depending on the user's locale. This can be overridden using the `hourCycle` prop. - -–– - -: - -–– - -``` -Copytsx - - {segment => } - -``` - -``` -Copytsx - - {segment => } - -``` - -### Description - -The `TimeField.Description` component can be used to associate additional help text with a time field. - -Time - -–– - -: - -–– - -AM - -Select a meeting time. - -``` -Copytsx - - Time - {segment => } - Select a meeting time. - -``` - -``` -Copytsx - - Time - {segment => } - Select a meeting time. - -``` - -### Error message - -The `TimeField.ErrorMessage` component can be used to help the user fix a validation error. It should be combined with the `validationState` prop to semantically mark the time field as invalid for assistive technologies. - -By default, it will render only when the `validationState` prop is set to `invalid`, use the `forceMount` prop to always render the error message (ex: for usage with animation libraries). - -Time - -–– - -: - -–– - -AM - -Please select a time. - -``` -Copytsx -import { createSignal } from "solid-js"; - -function ErrorMessageExample() { - const [value, setValue] = createSignal(undefined); - - return ( - - Time - {segment => } - Please select a time. - - ); -} -``` - -``` -Copytsx -import { createSignal } from "solid-js"; - -function ErrorMessageExample() { - const [value, setValue] = createSignal(undefined); - - return ( - - Time - {segment => } - Please select a time. - - ); -} -``` - -### HTML forms - -The `name` prop can be used for integration with HTML forms. - -–– - -: - -–– - -AM - -ResetSubmit - -``` -Copytsx -function HTMLFormExample() { - const onSubmit = (e: SubmitEvent) => { - // handle form submission. - }; - - return ( - - - {segment => } - - -
- - -
- - ); -} -``` - -``` -Copytsx -function HTMLFormExample() { - const onSubmit = (e: SubmitEvent) => { - // handle form submission. - }; - - return ( -
- - {segment => } - - -
- - -
-
- ); -} -``` - -## API Reference - -### TimeField - -`TimeField` is equivalent to the `Root` import from `@kobalte/core/time-field`. - -| Prop | Description | -| --- | --- | -| value | `TimeValue`
The current value (controlled). | -| defaultValue | `TimeValue`
The default value (uncontrolled). | -| onChange | `(value: MappedTimeValue) => void`
Handler that is called when the value changes. | -| hourCycle | `12 | 24`
Whether to display the time in 12 or 24-hour format. By default, this is determined by the user's locale. | -| granularity | `'hour' | 'minute' | 'second'`
Determines the smallest unit that is displayed in the time field. Defaults to `"minute"`. | -| hideTimeZone | `boolean`
Whether to hide the time zone abbreviation. | -| shouldForceLeadingZeros | `boolean`
Whether to always show leading zeros in the hour field. By default, this is determined by the user's locale. | -| placeholderValue | `TimeValue`
A placeholder time that influences the format of the placeholder shown when no value is selected. Defaults to 12:00 AM or 00:00 depending on the hour cycle. | -| minValue | `TimeValue`
The minimum allowed time that a user may select. | -| maxValue | `TimeValue`
The maximum allowed time that a user may select. | -| name | `string`
The name of the time field. Submitted with its owning form as part of a name/value pair. | -| validationState | `'valid' | 'invalid'`
Whether the time field should display its "valid" or "invalid" visual styling. | -| required | `boolean`
Whether the time field is required. | -| disabled | `boolean`
Whether the time field is disabled. | -| readOnly | `boolean`
Whether the time field is read only. | -| translations | `TimeFieldIntlTranslations`
The localized strings of the component. | - -| Data attribute | Description | -| --- | --- | -| data-valid | Present when the time field is valid according to the validation rules. | -| data-invalid | Present when the time field is invalid according to the validation rules. | -| data-required | Present when the time field is required. | -| data-disabled | Present when the time field is disabled. | -| data-readonly | Present when the time field is read only. | - -`TimeField.Label`, `TimeField.Field`, `TimeField.Segment`, `TimeField.Description` and `TimeField.ErrorMesssage` share the same data-attributes. - -### TimeField.Segment - -| Prop | Description | -| --- | --- | -| segment | `TimeSegment`
A segment of the time field. | - -| Data attribute | Description | -| --- | --- | -| data-separator | Present when the segment is a separator. | -| data-type | Always present. | -| data-placeholder | Present when the segment's value is a placeholder. | - -### TimeField.ErrorMessage - -| Prop | Description | -| --- | --- | -| forceMount | `boolean`
Used to force mounting when more control is needed. Useful when controlling animation with SolidJS animation libraries. | - -## Rendered elements - -| Component | Default rendered element | -| --- | --- | -| `TimeField` | `div` | -| `TimeField.Label` | `span` | -| `TimeField.Field` | `div` | -| `TimeField.Segment` | `div` | -| `TimeField.Description` | `div` | -| `TimeField.ErrorMessage` | `div` | -| `TimeField.HiddenInput` | `input` | - -## Accessibility - -### Keyboard Interactions - -| Key | Description | -| --- | --- | -| `Backspace` | Deletes the value in the current segment and moves focus to the previous segment when empty. | -| `Delete` | Deletes the value in the current segment and moves focus to the previous segment when empty. | -| `ArrowRight` | Moves focus to the next segment. | -| `ArrowLeft` | Moves focus to the previous segment. | -| `ArrowUp` | Increments the given segment. Upon reaching the minimum or maximum value, the value wraps around to the opposite limit. | -| `ArrowDown` | Decrements the given segment. Upon reaching the minimum or maximum value, the value wraps around to the opposite limit. | -| `PageUp` | Increments the given segment by a larger amount, rounding it to the nearest increment. The amount to increment by depends on the segment, for example 2 hours, 15 minutes, and 15 seconds. Upon reaching the minimum or maximum value, the value wraps around to the opposite limit. | -| `PageDown` | Decrements the given segment by a larger amount, rounding it to the nearest decrement. The amount to decrement by depends on the segment, for example 2 hours, 15 minutes, and 15 seconds. Upon reaching the minimum or maximum value, the value wraps around to the opposite limit. | -| `Home` | Decrements the given segment by the segment's minimum value. | -| `End` | Increments the given segment by the segment's maximum value. | - -Previous[←Text Field](https://kobalte.dev/docs/core/components/text-field)Next[Toast→](https://kobalte.dev/docs/core/components/toast) \ No newline at end of file diff --git a/.firecrawl/kobalte-toast.md b/.firecrawl/kobalte-toast.md deleted file mode 100644 index afa33b0..0000000 --- a/.firecrawl/kobalte-toast.md +++ /dev/null @@ -1,860 +0,0 @@ -# Toast - -A succinct message that is displayed temporarily. - -## Import - -``` -Copyts -import { Toast, toaster } from "@kobalte/core/toast"; -// or -import { Root, toaster, ... } from "@kobalte/core/toast"; -// or (deprecated) -import { Toast, toaster } from "@kobalte/core"; -``` - -``` -Copyts -import { Toast, toaster } from "@kobalte/core/toast"; -// or -import { Root, toaster, ... } from "@kobalte/core/toast"; -// or (deprecated) -import { Toast, toaster } from "@kobalte/core"; -``` - -## Features - -- Automatically closes. -- Pauses closing on hover, focus and window blur. -- Supports hotkey to jump to toast region. -- Supports closing via swipe gesture. -- Exposes CSS variables for swipe gesture animations. -- Limit the number of visible toasts. -- Manage promises within toast. -- Can remove or update toast programmatically. -- Multiple toast regions. - -## Anatomy - -The toast region consists of: - -- **Toast.Region:** The fixed area where toasts appear. Users can jump to the viewport by pressing a hotkey. -- **Toast.List:** The list containing all rendered toasts. - -``` -Copytsx - - - -``` - -``` -Copytsx - - - -``` - -The toast consists of: - -- **Toast:** The root container for a toast. -- **Toast.CloseButton:** The button that closes the toast. -- **Toast.Title:** An accessible title to be announced when the toast is opened. -- **Toast.Description:** An optional accessible description to be announced when the toast is opened. -- **Toast.ProgressTrack:** The component that visually represents the lifetime of the toast. -- **Toast.ProgressFill:** The component that visually represents the remaining lifetime of the toast. - -``` -Copytsx - - - - - - - - -``` - -``` -Copytsx - - - - - - - - -``` - -## Example - -Show toastUpdate toast - -index.tsxstyle.css - -``` -Copytsx -import { Toast, toaster } from "@kobalte/core/toast"; -import { CrossIcon } from "some-icon-library"; -import "./style.css"; - -function App() { - let id: number; - - const showToast = () => { - id = toaster.show(props => ( - -
-
- Event has been created - - Monday, January 3rd at 6:00pm - -
- - - -
- - - -
- )); - }; - - const updateToast = () => { - toaster.update(id, props => ( - -
-
- Event has been updated - - Friday, January 7th at 10:00pm - -
- - - -
- - - -
- )); - }; - - return ( - <> - - - - - - - - - ); -} -``` - -``` -Copytsx -import { Toast, toaster } from "@kobalte/core/toast"; -import { CrossIcon } from "some-icon-library"; -import "./style.css"; - -function App() { - let id: number; - - const showToast = () => { - id = toaster.show(props => ( - -
-
- Event has been created - - Monday, January 3rd at 6:00pm - -
- - - -
- - - -
- )); - }; - - const updateToast = () => { - toaster.update(id, props => ( - -
-
- Event has been updated - - Friday, January 7th at 10:00pm - -
- - - -
- - - -
- )); - }; - - return ( - <> - - - - - - - - - ); -} -``` - -## Usage - -### Showing a toast - -To create a toast, use the `toaster.show()` method and pass the generated `toastId` to `Toast.Root`. - -``` -Copytsx -const id = toaster.show(props => ...); -``` - -``` -Copytsx -const id = toaster.show(props => ...); -``` - -### Updating a toast - -The `toaster.update()` method can be used to update a toast by providing a toast id and the new component to render. - -``` -Copytsx -toaster.update(id, props => ...); -``` - -``` -Copytsx -toaster.update(id, props => ...); -``` - -Notice that you always need to pass the `toastId` to `Toast`, because it doesn't know anything -about the `toaster` nor the toast it is supposed to represent. - -### Dismissing a toast - -The `toaster.dismiss()` method can be used to dismiss a toast by providing a toast id. - -``` -Copytsx -toaster.dismiss(id); -``` - -``` -Copytsx -toaster.dismiss(id); -``` - -### Clearing the toast stack and queue - -Use `toaster.clear()` method to dismiss all toasts. - -``` -Copytsx -toaster.clear(); -``` - -``` -Copytsx -toaster.clear(); -``` - -### Handling promises - -The toaster API exposes a `toaster.promise()` method to allow you update a toast when the promise resolves or rejects. - -In addition to the `toastId`, props will contain the following properties: - -- **state**: The state of the promise, can be `"pending" | "fulfilled" | "rejected"`. -- **data**: The data returned by the promise when fulfilled, if any. -- **error**: The error returned by the promise when rejected, if any. - -``` -Copytsx -toaster.promise(promise, props => ( - - - Loading - {props.data} - {props.error} - - -)); -``` - -``` -Copytsx -toaster.promise(promise, props => ( - - - Loading - {props.data} - {props.error} - - -)); -``` - -### Pausing the toasts - -The `Toast.Region` component exposes the following props to pause the toasts it contains. - -- `pauseOnInteraction`: prop can be used to pause the toasts close timeout when a toast is hovered or focused. -- `pauseOnPageIdle`: prop can be used to pause the toasts close timeout when the document loses focus or the page is idle (e.g. switching to a new browser tab). - -``` -Copytsx - - - -``` - -``` -Copytsx - - - -``` - -### Limiting the number of visible toasts - -Use the `limit` prop of the `Toast.Region` to limit the number of toasts visible at the same time. All toasts added after limit was reached will be added into queue and displayed when a visible toast is closed. - -``` -Copytsx - - - -``` - -``` -Copytsx - - - -``` - -### Progress bar fill width - -We expose a CSS custom property `--kb-toast-progress-fill-width` which corresponds to the remaining toast lifetime (in percentage). If you are building a linear progress bar to show the toast duration, you can use it to set the width of the `Toast.ProgressFill` component in CSS. - -``` -Copycss -/* style.css*/ - -.toast__progress-fill { - background-color: hsl(200 98% 39%); - border-radius: 3px; - height: 100%; - width: var(--kb-toast-progress-fill-width); - transition: width 250ms linear; -} -``` - -``` -Copycss -/* style.css*/ - -.toast__progress-fill { - background-color: hsl(200 98% 39%); - border-radius: 3px; - height: 100%; - width: var(--kb-toast-progress-fill-width); - transition: width 250ms linear; -} -``` - -### Animating swipe gesture - -We expose the CSS custom properties `--kb-toast-swipe-move-[x|y]` and `--kb-toast-swipe-end-[x|y]` which can be used with `data-swipe="[start|move|cancel|end]"` attributes to animate a swipe to close gesture. - -``` -Copytsx -// index.tsx - -import { Toast, toaster } from "@kobalte/core/toast"; -import "./style.css"; - -function App() { - const showToast = () => { - toaster.show(props => ( - - ... - - )); - }; - - return ( - <> - - - - - - - - ); -} -``` - -``` -Copytsx -// index.tsx - -import { Toast, toaster } from "@kobalte/core/toast"; -import "./style.css"; - -function App() { - const showToast = () => { - toaster.show(props => ( - - ... - - )); - }; - - return ( - <> - - - - - - - - ); -} -``` - -``` -Copycss -/* style.css */ - -.toast[data-swipe="move"] { - transform: translateX(var(--kb-toast-swipe-move-x)); -} - -.toast[data-swipe="cancel"] { - transform: translateX(0); - transition: transform 200ms ease-out; -} - -.toast[data-swipe="end"] { - animation: slideRight 100ms ease-out; -} - -@keyframes slideRight { - from { - transform: translateX(var(--kb-toast-swipe-end-x)); - } - to { - transform: translateX(100%); - } -} -``` - -``` -Copycss -/* style.css */ - -.toast[data-swipe="move"] { - transform: translateX(var(--kb-toast-swipe-move-x)); -} - -.toast[data-swipe="cancel"] { - transform: translateX(0); - transition: transform 200ms ease-out; -} - -.toast[data-swipe="end"] { - animation: slideRight 100ms ease-out; -} - -@keyframes slideRight { - from { - transform: translateX(var(--kb-toast-swipe-end-x)); - } - to { - transform: translateX(100%); - } -} -``` - -### Abstracting the `toaster` API - -It's common in toast libraries to have method for displaying different type of toast like success or error. This can be done in Kobalte by abstracting the toaster API like below. - -``` -Copytsx -// toast.tsx - -import { Toast, toaster } from "@kobalte/core/toast"; -import { JSX } from "solid-js/jsx-runtime"; -import { Switch, Match } from "solid-js/web"; - -function show(message: string) { - return toaster.show(props => ( - - {message} - - )); -} - -function success(message: string) { - return toaster.show(props => ( - - {message} - - )); -} - -function error(message: string) { - return toaster.show(props => ( - - {message} - - )); -} - -function promise( - promise: Promise | (() => Promise), - options: { - loading?: JSX.Element; - success?: (data: T) => JSX.Element; - error?: (error: U) => JSX.Element; - }, -) { - return toaster.promise(promise, props => ( - - - {options.loading} - {options.success?.(props.data)} - {options.error?.(props.error)} - - - )); -} - -function custom(jsx: () => JSX.Element) { - return toaster.show(props => {jsx}); -} - -function dismiss(id: number) { - return toaster.dismiss(id); -} - -export const toast = { - show, - success, - error, - promise, - custom, - dismiss, -}; -``` - -``` -Copytsx -// toast.tsx - -import { Toast, toaster } from "@kobalte/core/toast"; -import { JSX } from "solid-js/jsx-runtime"; -import { Switch, Match } from "solid-js/web"; - -function show(message: string) { - return toaster.show(props => ( - - {message} - - )); -} - -function success(message: string) { - return toaster.show(props => ( - - {message} - - )); -} - -function error(message: string) { - return toaster.show(props => ( - - {message} - - )); -} - -function promise( - promise: Promise | (() => Promise), - options: { - loading?: JSX.Element; - success?: (data: T) => JSX.Element; - error?: (error: U) => JSX.Element; - }, -) { - return toaster.promise(promise, props => ( - - - {options.loading} - {options.success?.(props.data)} - {options.error?.(props.error)} - - - )); -} - -function custom(jsx: () => JSX.Element) { - return toaster.show(props => {jsx}); -} - -function dismiss(id: number) { - return toaster.dismiss(id); -} - -export const toast = { - show, - success, - error, - promise, - custom, - dismiss, -}; -``` - -Then inside your application, use your own toast API: - -``` -Copytsx -// App.tsx - -import { toast } from "./toast"; - -function App() { - const showToast = () => { - toast.success("Event has been created"); - }; - - return ( - <> - - - - - - - - ); -} -``` - -``` -Copytsx -// App.tsx - -import { toast } from "./toast"; - -function App() { - const showToast = () => { - toast.success("Event has been created"); - }; - - return ( - <> - - - - - - - - ); -} -``` - -### Multiple regions - -The `region` option in `toaster.show()` allows you to display toast in multiple regions at the same time. Not providing a region uses the default one. - -``` -Copytsx -toaster.show(props => ..., { - region: "custom-region-id", -}); -``` - -``` -Copytsx -toaster.show(props => ..., { - region: "custom-region-id", -}); -``` - -Inside your application, use add your custom region: - -``` -Copytsx - - {/* Default region */} - - - - - - - -``` - -``` -Copytsx - - {/* Default region */} - - - - - - - -``` - -Show toastShow toast (custom region) - -## API reference - -### toaster - -| Method | Description | -| --- | --- | -| show | `(toastComponent: ToastComponent, options?: ShowToastOptions) => number`
Adds a new toast to the visible toasts or queue depending on current state, region and limit, and return the id of the created toast. | -| update | `(id: number, toastComponent: ToastComponent) => void`
Update the toast of the given id with a new rendered component. | -| promise | `(promise: Promise | (() => Promise), toastComponent: ToastPromiseComponent, options?: ShowToastOptions) => number`
Adds a new promise-based toast to the visible toasts or queue depending on current state and limit, and return the id of the created toast. | -| dismiss | `(id: number) => void`
Removes toast with given id from visible toasts and queue. | -| clear | `() => void`
Removes all toasts from visible toasts and queue. | - -### Toast.Region - -| Prop | Description | -| --- | --- | -| aria-label | `string`
**default:** "Notifications ({hotkey})"
A label for the toast region to provide context for screen reader users when navigating page landmarks. Can contain a `{hotkey}` placeholder which will be replaced for you. | -| hotkey | `string[]`
**default:** alt + T
The keys to use as the keyboard shortcut that will move focus to the toast region. Use `event.code` value for each key from [keycode.info](https://www.toptal.com/developers/keycode). For meta keys, use `ctrlKey`, `shiftKey`, `altKey` and/or `metaKey`. | -| duration | `number`
**default:** 5000
The time in milliseconds that should elapse before automatically closing each toast. | -| limit | `number`
**default:** 3
The maximum amount of toasts that can be displayed at the same time. | -| swipeDirection | `"up" | "down" | "left" | "right"`
**default:** "right"
The direction of the pointer swipe that should close the toast. | -| swipeThreshold | `number`
**default:** 50
The distance in pixels that the swipe gesture must travel before a close is triggered. | -| pauseOnInteraction | `boolean`
**default:** true
Whether the toasts close timeout should pause when a toast is hovered or focused. | -| pauseOnPageIdle | `boolean`
**default:** true
Whether the toasts close timeout should pause when the document loses focus or the page is idle (e.g. switching to a new browser tab). | -| topLayer | `boolean`
**default:** true
Whether the toast region is marked as a "top layer", so that it:
\- is not aria-hidden when opening an overlay.
\- allows focus even outside a containing focus scope.
\- doesn’t dismiss overlays when clicking on it, even though it is outside. | -| regionId | `string`
The custom id of the region used for multiple regions. | -| translations | [`ToastRegionIntlTranslations`](https://github.com/kobaltedev/kobalte/blob/main/packages/core/src/toast/toast.intl.ts)
Localization strings. | - -### Toast - -`Toast` is equivalent to the `Root` import from `@kobalte/core/toast` (and deprecated `Toast.Root`). - -| Prop | Description | -| --- | --- | -| toastId | `number`
The id of the toast provided by the `toaster`. | -| priority | `"high" | "low"`
**default:** "high"
Control the sensitivity of the toast for accessibility purposes. For toasts that are the result of a user action, choose `high`. Toasts generated from background tasks should use `low`. | -| duration | `number`
The time in milliseconds that should elapse before automatically closing the toast. This will override the value supplied to `Toast.Region`. | -| persistent | `boolean`
Whether the toast should ignore duration and disappear only by a user action. | -| onPause | `() => void`
Event handler called when the dismiss timer is paused. This occurs when the pointer is moved over the region or the region is focused. | -| onResume | `() => void`
Event handler called when the dismiss timer is resumed. This occurs when the pointer is moved away from the region or the region is blurred. | -| onSwipeStart | `(event: SwipeEvent) => void`
Event handler called when starting a swipe interaction. | -| onSwipeMove | `(event: SwipeEvent) => void`
Event handler called during a swipe interaction. | -| onSwipeCancel | `(event: SwipeEvent) => void`
Event handler called when a swipe interaction is cancelled. | -| onSwipeEnd | `(event: SwipeEvent) => void`
Event handler called at the end of a swipe interaction. | -| onEscapeKeyDown | `(event: KeyboardEvent) => void`
Event handler called when the escape key is down. It can be prevented by calling `event.preventDefault`. | -| translations | [`ToastIntlTranslations`](https://github.com/kobaltedev/kobalte/blob/main/packages/core/src/toast/toast.intl.ts)
Localization strings. | - -| Data attribute | Description | -| --- | --- | -| data-opened | Present when the toast is open. | -| data-closed | Present when the toast disappear. | -| data-swipe | The state of the swipe, can be `"start" | "move" | "cancel" | "end"`. | -| data-swipe-direction | The direction of the pointer swipe that should close the toast. | - -| CSS custom property | Description | -| --- | --- | -| --kb-toast-swipe-move-x | The offset position of the toast when horizontally swiping. | -| --kb-toast-swipe-move-y | The offset position of the toast when vertically swiping. | -| --kb-toast-swipe-end-x | The offset end position of the toast after horizontally swiping. | -| --kb-toast-swipe-end-y | The offset end position of the toast after vertically swiping. | - -## Rendered elements - -| Component | Default rendered element | -| --- | --- | -| `Toast` | `li` | -| `Toast.CloseButton` | `button` | -| `Toast.Title` | `div` | -| `Toast.Description` | `div` | -| `Toast.ProgressTrack` | `div` | -| `Toast.ProgressFill` | `div` | -| `Toast.Region` | `div` | -| `Toast.List` | `ol` | - -## Accessibility - -### Keyboard Interactions - -| Key | Description | -| --- | --- | -| `Alt` \+ `T` | Focuses toasts region. | -| `Tab` | Moves focus to the next focusable element. | -| `Shift` \+ `Tab` | Moves focus to the previous focusable element. | -| `Space` | When focus is on a `Toast.CloseButton`, closes the toast. | -| `Enter` | When focus is on a `Toast.CloseButton`, closes the toast. | -| `Esc` | When focus is on a toast, closes the toast. | - -Previous[←Time Field](https://kobalte.dev/docs/core/components/time-field)Next[Toggle Button→](https://kobalte.dev/docs/core/components/toggle-button) \ No newline at end of file diff --git a/.firecrawl/kobalte-utils-npm.md b/.firecrawl/kobalte-utils-npm.md deleted file mode 100644 index 803c901..0000000 --- a/.firecrawl/kobalte-utils-npm.md +++ /dev/null @@ -1,55 +0,0 @@ -# @kobalte/utils ![TypeScript icon, indicating that this package has built-in type declarations](https://static-production.npmjs.com/4a2a680dfcadf231172b78b1d3beb975.svg) - -0.9.1 • Public • Published 2 years ago - -- [Readme](https://www.npmjs.com/package/@kobalte/utils?activeTab=readme) -- [Code Beta](https://www.npmjs.com/package/@kobalte/utils?activeTab=code) -- [7 Dependencies](https://www.npmjs.com/package/@kobalte/utils?activeTab=dependencies) -- [10 Dependents](https://www.npmjs.com/package/@kobalte/utils?activeTab=dependents) -- [16 Versions](https://www.npmjs.com/package/@kobalte/utils?activeTab=versions) - -# @kobalte/utils - -[Permalink: @kobalte/utils](https://www.npmjs.com/package/@kobalte/utils#kobalteutils) - -Common utilities and types for Kobalte. - -## Installation - -[Permalink: Installation](https://www.npmjs.com/package/@kobalte/utils#installation) - -``` -npm install @kobalte/utils -# or -yarn add @kobalte/utils -# or -pnpm add @kobalte/utils -``` - -## Documentation - -[Permalink: Documentation](https://www.npmjs.com/package/@kobalte/utils#documentation) - -For full documentation, visit [kobalte.dev](https://kobalte.dev/). - -## Changelog - -[Permalink: Changelog](https://www.npmjs.com/package/@kobalte/utils#changelog) - -All notable changes are described in the [CHANGELOG.md](https://github.com/kobaltedev/kobalte/blob/HEAD/CHANGELOG.md) file. - -## Readme - -### Keywords - -- [solid](https://www.npmjs.com/search?q=keywords:solid) -- [solidjs](https://www.npmjs.com/search?q=keywords:solidjs) -- [ui](https://www.npmjs.com/search?q=keywords:ui) -- [library](https://www.npmjs.com/search?q=keywords:library) -- [design-system](https://www.npmjs.com/search?q=keywords:design-system) -- [components](https://www.npmjs.com/search?q=keywords:components) -- [headless](https://www.npmjs.com/search?q=keywords:headless) -- [unstyled](https://www.npmjs.com/search?q=keywords:unstyled) -- [aria](https://www.npmjs.com/search?q=keywords:aria) - -Viewing @kobalte/utils version 0.9.1 \ No newline at end of file diff --git a/.firecrawl/kobalte.dev-docs-core-components-alert-dialog.md b/.firecrawl/kobalte.dev-docs-core-components-alert-dialog.md deleted file mode 100644 index 0170abc..0000000 --- a/.firecrawl/kobalte.dev-docs-core-components-alert-dialog.md +++ /dev/null @@ -1,258 +0,0 @@ -# Alert Dialog - -A modal dialog that interrupts the user's workflow to communicate an important message and acquire a response. Examples include action confirmation prompts and error message confirmations. The alertdialog role enables assistive technologies and browsers to distinguish alert dialogs from other dialogs so they have the option of giving alert dialogs special treatment, such as playing a system alert sound. - -## Import - -``` -Copyts -import { AlertDialog } from "@kobalte/core/alert-dialog"; -// or -import { Root, Trigger, ... } from "@kobalte/core/alert-dialog"; -// or (deprecated) -import { AlertDialog } from "@kobalte/core"; -``` - -``` -Copyts -import { AlertDialog } from "@kobalte/core/alert-dialog"; -// or -import { Root, Trigger, ... } from "@kobalte/core/alert-dialog"; -// or (deprecated) -import { AlertDialog } from "@kobalte/core"; -``` - -## Features - -- Follow the [WAI ARIA Alert Dialog](https://www.w3.org/WAI/ARIA/apg/patterns/alertdialog/) design pattern. -- Supports modal and non-modal modes. -- Provides screen reader announcements via rendered title and description. -- Focus is trapped and scrolling is blocked while it is open. -- Pressing `Esc` closes the alert dialog. -- Can be controlled or uncontrolled. - -## Anatomy - -The alert dialog consists of: - -- **AlertDialog:** Contains all the parts of a dialog. -- **AlertDialog.Trigger:** The button that opens the dialog. -- **AlertDialog.Portal:** Portals its children into the `body` when the dialog is open. -- **AlertDialog.Overlay:** The layer that covers the inert portion of the view when the dialog is open. -- **AlertDialog.Content:** Contains the content to be rendered when the dialog is open. -- **AlertDialog.CloseButton:** The button that closes the dialog. -- **AlertDialog.Title:** An accessible title to be announced when the dialog is opened. -- **AlertDialog.Description:** An optional accessible description to be announced when the dialog is opened. - -``` -Copytsx - - - - - - - - - - - -``` - -``` -Copytsx - - - - - - - - - - - -``` - -## Example - -Open - -index.tsxstyle.css - -``` -Copytsx -import { AlertDialog } from "@kobalte/core/alert-dialog"; -import { CrossIcon } from "some-icon-library"; -import "./style.css"; - -function App() { - return ( - - Open - - -
- -
- Alert Dialog - - - -
- - An Alert Dialog enables assistive technologies and browsers to distinguish alert dialogs from other dialogs so they have the option of giving alert dialogs special treatment, such as playing a system alert sound. - -
-
-
-
- ); -} -``` - -``` -Copytsx -import { AlertDialog } from "@kobalte/core/alert-dialog"; -import { CrossIcon } from "some-icon-library"; -import "./style.css"; - -function App() { - return ( - - Open - - -
- -
- Alert Dialog - - - -
- - An Alert Dialog enables assistive technologies and browsers to distinguish alert dialogs from other dialogs so they have the option of giving alert dialogs special treatment, such as playing a system alert sound. - -
-
-
-
- ); -} -``` - -## Usage - -### Default open - -An initial, uncontrolled open value can be provided using the `defaultOpen` prop. - -``` -Copytsx -... -``` - -``` -Copytsx -... -``` - -### Controlled open - -The `open` prop can be used to make the open state controlled. The `onOpenChange` event is fired when the user presses the trigger, close button or overlay, and receives the new value. - -``` -Copytsx -import { createSignal } from "solid-js"; - -function ControlledExample() { - const [open, setOpen] = createSignal(false); - - return ( - - ... - - ); -} -``` - -``` -Copytsx -import { createSignal } from "solid-js"; - -function ControlledExample() { - const [open, setOpen] = createSignal(false); - - return ( - - ... - - ); -} -``` - -## API Reference - -### AlertDialog - -`AlertDialog` is equivalent to the `Root` import from `@kobalte/core/alert-dialog` (and deprecated `AlertDialog.Root`). - -| Prop | Description | -| --- | --- | -| open | `boolean`
The controlled open state of the dialog. | -| defaultOpen | `boolean`
The default open state when initially rendered. Useful when you do not need to control the open state. | -| onOpenChange | `(open: boolean) => void`
Event handler called when the open state of the dialog changes. | -| id | `string`
A unique identifier for the component. The id is used to generate id attributes for nested components. If no id prop is provided, a generated id will be used. | -| modal | `boolean`
Whether the dialog should be the only visible content for screen readers, when set to `true`:
\- interaction with outside elements will be disabled.
\- scroll will be locked.
\- focus will be locked inside the dialog content.
\- elements outside the dialog content will not be visible for screen readers. | -| preventScroll | `boolean`
Whether the scroll should be locked even if the alert dialog is not modal. | -| forceMount | `boolean`
Used to force mounting the dialog (portal, overlay and content) when more control is needed. Useful when controlling animation with SolidJS animation libraries. | - -### AlertDialog.Trigger - -`AlertDialog.Trigger` consists of [Button](https://kobalte.dev/docs/core/components/button). - -| Data attribute | Description | -| --- | --- | -| data-expanded | Present when the dialog is open. | -| data-closed | Present when the dialog is close. | - -`AlertDialog.Content` and `AlertDialog.Overlay` shares the same data-attributes. - -### AlertDialog.Content - -| Prop | Description | -| --- | --- | -| onOpenAutoFocus | `(event: Event) => void`
Event handler called when focus moves into the component after opening. It can be prevented by calling `event.preventDefault`. | -| onCloseAutoFocus | `(event: Event) => void`
Event handler called when focus moves to the trigger after closing. It can be prevented by calling `event.preventDefault`. | -| onEscapeKeyDown | `(event: KeyboardEvent) => void`
Event handler called when the escape key is down. It can be prevented by calling `event.preventDefault`. | -| onPointerDownOutside | `(event: PointerDownOutsideEvent) => void`
Event handler called when a pointer event occurs outside the bounds of the component. It can be prevented by calling `event.preventDefault`. | -| onFocusOutside | `(event: FocusOutsideEvent) => void`
Event handler called when the focus moves outside the bounds of the component. It can be prevented by calling `event.preventDefault`. | -| onInteractOutside | `(event: InteractOutsideEvent) => void`
Event handler called when an interaction (pointer or focus event) happens outside the bounds of the component. It can be prevented by calling `event.preventDefault`. | - -## Rendered elements - -| Component | Default rendered element | -| --- | --- | -| `AlertDialog` | none | -| `AlertDialog.Trigger` | `button` | -| `AlertDialog.Portal` | `Portal` | -| `AlertDialog.Overlay` | `div` | -| `AlertDialog.Content` | `div` | -| `AlertDialog.CloseButton` | `button` | -| `AlertDialog.Title` | `h2` | -| `AlertDialog.Description` | `p` | - -## Accessibility - -### Keyboard Interactions - -| Key | Description | -| --- | --- | -| `Space` | When focus is on the trigger, opens/closes the dialog. | -| `Enter` | When focus is on the trigger, opens/closes the dialog. | -| `Tab` | Moves focus to the next focusable element. | -| `Shift` \+ `Tab` | Moves focus to the previous focusable element. | -| `Esc` | Closes the dialog and moves focus to the trigger. | - -Previous[←Alert](https://kobalte.dev/docs/core/components/alert)Next[Badge→](https://kobalte.dev/docs/core/components/badge) \ No newline at end of file diff --git a/.firecrawl/kobalte.dev-docs-core-components-alert.md b/.firecrawl/kobalte.dev-docs-core-components-alert.md deleted file mode 100644 index b002e30..0000000 --- a/.firecrawl/kobalte.dev-docs-core-components-alert.md +++ /dev/null @@ -1,85 +0,0 @@ -# Alert - -Display a brief, important message in a way that attracts the user's attention without interrupting the user's task. - -## Import - -``` -Copyts -import { Alert } from "@kobalte/core/alert"; -// or -import { Root } from "@kobalte/core/alert"; -// or (deprecated) -import { Alert } from "@kobalte/core"; -``` - -``` -Copyts -import { Alert } from "@kobalte/core/alert"; -// or -import { Root } from "@kobalte/core/alert"; -// or (deprecated) -import { Alert } from "@kobalte/core"; -``` - -## Features - -- Adhere to the [WAI ARIA Alert](https://www.w3.org/WAI/ARIA/apg/patterns/alert/) design pattern. - -## Anatomy - -The alert consists of : - -- **Alert:** The root container for an alert. - -``` -Copytsx - -``` - -``` -Copytsx - -``` - -## Example - -Kobalte is going live soon, get ready! - -index.tsxstyle.css - -``` -Copytsx -import { Alert } from "@kobalte/core/alert"; -import "./style.css"; - -function App() { - return Kobalte is going live soon, get ready!; -} -``` - -``` -Copytsx -import { Alert } from "@kobalte/core/alert"; -import "./style.css"; - -function App() { - return Kobalte is going live soon, get ready!; -} -``` - -## API reference - -### Alert - -`Alert` is equivalent to the `Root` import from `@kobalte/core/alert` (and deprecated `Alert.Root`). - -Renders a `div` by default and support all its props. - -## Rendered elements - -| Component | Default rendered element | -| --- | --- | -| `Alert` | `div` | - -Previous[←Accordion](https://kobalte.dev/docs/core/components/accordion)Next[Alert Dialog→](https://kobalte.dev/docs/core/components/alert-dialog) \ No newline at end of file diff --git a/.firecrawl/kobalte.dev-docs-core-components-badge.md b/.firecrawl/kobalte.dev-docs-core-components-badge.md deleted file mode 100644 index 48ad382..0000000 --- a/.firecrawl/kobalte.dev-docs-core-components-badge.md +++ /dev/null @@ -1,92 +0,0 @@ -# Badge - -A `Badge` component is used to display small pieces of information or status indicators. - -## Import - -``` -Copyts -import { Badge } from "@kobalte/core/badge"; -// or -import { Root } from "@kobalte/core/badge"; -``` - -``` -Copyts -import { Badge } from "@kobalte/core/badge"; -// or -import { Root } from "@kobalte/core/badge"; -``` - -## Features - -- Auto-populated ARIA labeling via the textValue prop for enhanced accessibility. -- Built-in ARIA support with role="status" to communicate dynamic updates. - -## Anatomy - -The badge consists of: - -- **Badge:** The root container for the badge that supports accessibility and content customization. - -``` -Copytsx - -``` - -``` -Copytsx - -``` - -## Example - -5 messages - -index.tsxstyle.css - -``` -Copytsx -import { Badge } from "@kobalte/core/badge"; -import "./style.css"; - -function App() { - return ( - - 5 messages - - ); -} -``` - -``` -Copytsx -import { Badge } from "@kobalte/core/badge"; -import "./style.css"; - -function App() { - return ( - - 5 messages - - ); -} -``` - -## API Reference - -### Badge - -`Badge` is equivalent to the `Root` import from `@kobalte/core/badge`. - -| Prop | Description | -| --- | --- | -| textValue | `string | undefined`
Accessible text description of the badge if child is not text | - -## Rendered elements - -| Component | Default rendered element | -| --- | --- | -| `Badge` | `span` | - -Previous[←Alert Dialog](https://kobalte.dev/docs/core/components/alert-dialog)Next[Breadcrumbs→](https://kobalte.dev/docs/core/components/breadcrumbs) \ No newline at end of file diff --git a/.firecrawl/kobalte.dev-docs-core-components-breadcrumbs.md b/.firecrawl/kobalte.dev-docs-core-components-breadcrumbs.md deleted file mode 100644 index fe3b00a..0000000 --- a/.firecrawl/kobalte.dev-docs-core-components-breadcrumbs.md +++ /dev/null @@ -1,233 +0,0 @@ -Show hierarchy and navigational context for a user’s location within an application. - -## Import - -``` -Copyts -import { Breadcrumbs } from "@kobalte/core/breadcrumbs"; -// or -import { Root, Link, ... } from "@kobalte/core/breadcrumbs"; -// or (deprecated) -import { Breadcrumbs } from "@kobalte/core"; -``` - -``` -Copyts -import { Breadcrumbs } from "@kobalte/core/breadcrumbs"; -// or -import { Root, Link, ... } from "@kobalte/core/breadcrumbs"; -// or (deprecated) -import { Breadcrumbs } from "@kobalte/core"; -``` - -## Features - -- Support for navigation links via `` elements or custom element types via ARIA. -- Localized ARIA labeling support for landmark navigation region. -- Support for disabled breadcrumb links. - -## Anatomy - -The breadcrumbs consist of: - -- **Breadcrumbs:** The root container for a breadcrumbs. -- **Breadcrumbs.Link:** The breadcrumb link. -- **Breadcrumbs.Separator:** The visual separator between each breadcrumb items. It will not be visible by screen readers. -- **ol:** The native HTML `
    ` element used to contain breadcrumb items. -- **li:** The native HTML `
  1. ` element used to contain breadcrumb link and separator. - -``` -Copytsx - -
      -
    1. - - -
    2. -
    -
    -``` - -``` -Copytsx - -
      -
    1. - - -
    2. -
    -
    -``` - -## Example - -index.tsxstyle.css - -``` -Copytsx -import { Breadcrumbs } from "@kobalte/core/breadcrumbs"; -import "./style.css"; - -function App() { - return ( - - - - ); -} -``` - -``` -Copytsx -import { Breadcrumbs } from "@kobalte/core/breadcrumbs"; -import "./style.css"; - -function App() { - return ( - - - - ); -} -``` - -## Usage - -### Custom separator - -Use the `separator` prop to provide a default content for all `Breadcrumbs.Separator`. You can pass it a `string` or a SolidJS component. - -``` -Copytsx -import { ChevronRightIcon } from "some-icon-library"; - -function App() { - return ( - }> - - - ); -} -``` - -``` -Copytsx -import { ChevronRightIcon } from "some-icon-library"; - -function App() { - return ( - }> - - - ); -} -``` - -You can also override each `Breadcrumbs.Separator` content by providing your own `children`. - -## API Reference - -### Breadcrumbs - -`Breadcrumbs` is equivalent to the `Root` import from `@kobalte/core/breadcrumbs` (and deprecated `Breadcrumbs.Root`). - -| Prop | Description | -| --- | --- | -| separator | `string | JSX.Element`
    The visual separator between each breadcrumb item. It will be used as the default children of `Breadcrumbs.Separator`. | -| translations | [`BreadcrumbsIntlTranslations`](https://github.com/kobaltedev/kobalte/blob/main/packages/core/src/breadcrumbs/breadcrumbs.intl.ts)
    Localization strings. | - -### Breadcrumbs.Link - -`Breadcrumbs.Link` consists of [Link](https://kobalte.dev/docs/core/components/link). - -| Prop | Description | -| --- | --- | -| current | `boolean`
    Whether the breadcrumb link represents the current page. | -| disabled | `boolean`
    Whether the breadcrumb link is disabled. | - -| Data attribute | Description | -| --- | --- | -| data-current | Present when the breadcrumb link represents the current page. | - -## Rendered elements - -| Component | Default rendered element | -| --- | --- | -| `Breadcrumbs` | `nav` | -| `Breadcrumbs.Link` | `a` | -| `Breadcrumbs.Separator` | `span` | - -Previous[←Badge](https://kobalte.dev/docs/core/components/badge)Next[Button→](https://kobalte.dev/docs/core/components/button) \ No newline at end of file diff --git a/.firecrawl/kobalte.dev-docs-core-components-button.md b/.firecrawl/kobalte.dev-docs-core-components-button.md deleted file mode 100644 index 5a927a6..0000000 --- a/.firecrawl/kobalte.dev-docs-core-components-button.md +++ /dev/null @@ -1,102 +0,0 @@ -# Button - -Enables users to trigger an action or event, such as submitting a form, opening a dialog, canceling an action, or performing a delete operation. - -## Import - -``` -Copyts -import { Button } from "@kobalte/core/button"; -// or -import { Root } from "@kobalte/core/button"; -// or (deprecated) -import { Button } from "@kobalte/core"; -``` - -``` -Copyts -import { Button } from "@kobalte/core/button"; -// or -import { Root } from "@kobalte/core/button"; -// or (deprecated) -import { Button } from "@kobalte/core"; -``` - -## Features - -- Native HTML `
    ; -} -``` - -``` -Copytsx -import { Button } from "@kobalte/core/button"; -import "./style.css"; - -function App() { - return ; -} -``` - -## API Reference - -### Button - -`Button` is equivalent to the `Root` import from `@kobalte/core/button` (and deprecated `Button.Root`). - -| Prop | Description | -| --- | --- | -| disabled | `boolean`
    Whether the button is disabled. | - -| Data attribute | Description | -| --- | --- | -| data-disabled | Present when the button is disabled. | - -## Rendered elements - -| Component | Default rendered element | -| --- | --- | -| `Button` | `button` | - -## Accessibility - -### Keyboard Interactions - -| Key | Description | -| --- | --- | -| `Space` | Activates the button. | -| `Enter` | Activates the button. | - -Previous[←Breadcrumbs](https://kobalte.dev/docs/core/components/breadcrumbs)Next[Checkbox→](https://kobalte.dev/docs/core/components/checkbox) \ No newline at end of file diff --git a/.firecrawl/kobalte.dev-docs-core-components-checkbox.md b/.firecrawl/kobalte.dev-docs-core-components-checkbox.md deleted file mode 100644 index 8e11d04..0000000 --- a/.firecrawl/kobalte.dev-docs-core-components-checkbox.md +++ /dev/null @@ -1,400 +0,0 @@ -# Checkbox - -A control that allows the user to toggle between checked and not checked. - -## Import - -``` -Copyts -import { Checkbox } from "@kobalte/core/checkbox"; -// or -import { Root, Input, ... } from "@kobalte/core/checkbox"; -// or (deprecated) -import { Checkbox } from "@kobalte/core"; -``` - -``` -Copyts -import { Checkbox } from "@kobalte/core/checkbox"; -// or -import { Root, Input, ... } from "@kobalte/core/checkbox"; -// or (deprecated) -import { Checkbox } from "@kobalte/core"; -``` - -## Features - -- Built with a native HTML `` element, which is visually hidden to allow custom styling. -- Syncs with form reset events. -- Labeling support for assistive technology. -- Support for description and error message help text linked to the input via ARIA. -- Can be controlled or uncontrolled. - -## Anatomy - -The checkbox consists of: - -- **Checkbox:** The root container for a checkbox. -- **Checkbox.Input:** The native html input that is visually hidden in the checkbox. -- **Checkbox.Control:** The element that visually represents a checkbox. -- **Checkbox.Indicator:** The visual indicator rendered when the checkbox is in a checked or indeterminate state. -- **Checkbox.Label:** The label that gives the user information on the checkbox. -- **Checkbox.Description**: The description that gives the user more information on the checkbox. -- **Checkbox.ErrorMessage**: The error message that gives the user information about how to fix a validation error on the checkbox. - -``` -Copytsx - - - - - - - - - -``` - -``` -Copytsx - - - - - - - - - -``` - -## Example - -Subscribe - -index.tsxstyle.css - -``` -Copytsx -import { Checkbox } from "@kobalte/core/checkbox"; -import { CheckIcon } from "some-icon-library"; -import "./style.css"; - -function App() { - return ( - - - - - - - - Subscribe - - ); -} -``` - -``` -Copytsx -import { Checkbox } from "@kobalte/core/checkbox"; -import { CheckIcon } from "some-icon-library"; -import "./style.css"; - -function App() { - return ( - - - - - - - - Subscribe - - ); -} -``` - -## Usage - -### Default checked - -An initial, uncontrolled value can be provided using the `defaultChecked` prop. - -Check - -Subscribe - -``` -Copytsx -... -``` - -``` -Copytsx -... -``` - -### Controlled checked - -The `checked` prop can be used to make the checked state controlled. The `onChange` event is fired when the user presses the checkbox, and receives the new value. - -Subscribe - -You are unsubscribed. - -``` -Copytsx -import { createSignal } from "solid-js"; - -function ControlledExample() { - const [checked, setChecked] = createSignal(false); - - return ( - <> - - ... - -

    You are {checked() ? "subscribed" : "unsubscribed"}.

    - - ); -} -``` - -``` -Copytsx -import { createSignal } from "solid-js"; - -function ControlledExample() { - const [checked, setChecked] = createSignal(false); - - return ( - <> - - ... - -

    You are {checked() ? "subscribed" : "unsubscribed"}.

    - - ); -} -``` - -### Description - -The `Checkbox.Description` component can be used to associate additional help text with a checkbox. - -Subscribe - -You will receive our weekly newsletter. - -``` -Copytsx - - - - - - - - Subscribe - You will receive our weekly newsletter. - -``` - -``` -Copytsx - - - - - - - - Subscribe - You will receive our weekly newsletter. - -``` - -### Error message - -The `Checkbox.ErrorMessage` component can be used to help the user fix a validation error. It should be combined with the `validationState` prop to semantically mark the checkbox as invalid for assistive technologies. - -By default, it will render only when the `validationState` prop is set to `invalid`, use the `forceMount` prop to always render the error message (ex: for usage with animation libraries). - -Subscribe - -You must agree to our Terms and Conditions. - -``` -Copytsx -import { createSignal } from "solid-js"; - -function ErrorMessageExample() { - const [checked, setChecked] = createSignal(false); - - return ( - - - - - - - - Agree - You must agree to our Terms and Conditions. - - ); -} -``` - -``` -Copytsx -import { createSignal } from "solid-js"; - -function ErrorMessageExample() { - const [checked, setChecked] = createSignal(false); - - return ( - - - - - - - - Agree - You must agree to our Terms and Conditions. - - ); -} -``` - -### HTML forms - -The `name` and `value` props can be used for integration with HTML forms. - -Subscribe - -ResetSubmit - -``` -Copytsx -function HTMLFormExample() { - const onSubmit = (e: SubmitEvent) => { - // handle form submission. - }; - - return ( -
    - - ... - -
    - - -
    -
    - ); -} -``` - -``` -Copytsx -function HTMLFormExample() { - const onSubmit = (e: SubmitEvent) => { - // handle form submission. - }; - - return ( -
    - - ... - -
    - - -
    -
    - ); -} -``` - -## API Reference - -### Checkbox - -`Checkbox` is equivalent to the `Root` import from `@kobalte/core/checkbox` (and deprecated `Checkbox.Root`). - -| Prop | Description | -| --- | --- | -| checked | `boolean`
    The controlled checked state of the checkbox. | -| defaultChecked | `boolean`
    The default checked state when initially rendered. Useful when you do not need to control the checked state. | -| onChange | `(checked: boolean) => void`
    Event handler called when the checked state of the checkbox changes. | -| indeterminate | `boolean`
    Whether the checkbox is in an indeterminate state. | -| name | `string`
    The name of the checkbox, used when submitting an HTML form. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefname). | -| value | `string`
    The value of the checkbox, used when submitting an HTML form. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefvalue). | -| validationState | `'valid' | 'invalid'`
    Whether the checkbox should display its "valid" or "invalid" visual styling. | -| required | `boolean`
    Whether the user must check the checkbox before the owning form can be submitted. | -| disabled | `boolean`
    Whether the checkbox is disabled. | -| readOnly | `boolean`
    Whether the checkbox can be checked but not changed by the user. | -| children | `JSX.Element | (state: CheckboxState) => JSX.Element`
    The children of the checkbox. Can be a `JSX.Element` or a _render prop_ for having access to the internal state. | - -| Render Prop | Description | -| --- | --- | -| checked | `Accessor`
    Whether the checkbox is checked or not. | -| indeterminate | `Accessor`
    Whether the checkbox is in an indeterminate state. | - -| Data attribute | Description | -| --- | --- | -| data-valid | Present when the checkbox is valid according to the validation rules. | -| data-invalid | Present when the checkbox is invalid according to the validation rules. | -| data-required | Present when the checkbox is required. | -| data-disabled | Present when the checkbox is disabled. | -| data-readonly | Present when the checkbox is read only. | -| data-checked | Present when the checkbox is checked. | -| data-indeterminate | Present when the checkbox is in an indeterminate state. | - -`Checkbox.Input`, `Checkbox.Control`, `Checkbox.Indicator`, `Checkbox.Label`, `Checkbox.Description` and `Checkbox.ErrorMessage` share the same data-attributes. - -### Checkbox.Indicator - -| Prop | Description | -| --- | --- | -| forceMount | `boolean`
    Used to force mounting when more control is needed. Useful when controlling animation with SolidJS animation libraries. | - -### Checkbox.ErrorMessage - -| Prop | Description | -| --- | --- | -| forceMount | `boolean`
    Used to force mounting when more control is needed. Useful when controlling animation with SolidJS animation libraries. | - -## Rendered elements - -| Component | Default rendered element | -| --- | --- | -| `Checkbox` | `div` | -| `Checkbox.Input` | `input` | -| `Checkbox.Control` | `div` | -| `Checkbox.Indicator` | `div` | -| `Checkbox.Label` | `label` | -| `Checkbox.Description` | `div` | -| `Checkbox.ErrorMessage` | `div` | - -## Accessibility - -### Keyboard Interactions - -| Key | Description | -| --- | --- | -| `Space` | Toggles the checkbox on and off. | - -Previous[←Button](https://kobalte.dev/docs/core/components/button)Next[Collapsible→](https://kobalte.dev/docs/core/components/collapsible) \ No newline at end of file diff --git a/.firecrawl/kobalte.dev-docs-core-components-collapsible.md b/.firecrawl/kobalte.dev-docs-core-components-collapsible.md deleted file mode 100644 index 9ff830c..0000000 --- a/.firecrawl/kobalte.dev-docs-core-components-collapsible.md +++ /dev/null @@ -1,217 +0,0 @@ -# Collapsible - -An interactive component which expands/collapses a content. - -## Import - -``` -Copyts -import { Collapsible } from "@kobalte/core/collapsible"; -// or -import { Root, Trigger, ... } from "@kobalte/core/collapsible"; -// or (deprecated) -import { Collapsible } from "@kobalte/core"; -``` - -``` -Copyts -import { Collapsible } from "@kobalte/core/collapsible"; -// or -import { Root, Trigger, ... } from "@kobalte/core/collapsible"; -// or (deprecated) -import { Collapsible } from "@kobalte/core"; -``` - -## Features - -- Follow the [WAI ARIA Disclosure](https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/) design pattern. -- Can be controlled or uncontrolled. - -## Anatomy - -The collapsible consists of: - -- **Collapsible:** The root container for a collapsible. -- **Collapsible.Trigger:** The button that expands/collapses the collapsible content. -- **Collapsible.Content:** Contains the content to be rendered when the collapsible is expanded. - -``` -Copytsx - - - - -``` - -``` -Copytsx - - - - -``` - -## Example - -What is Kobalte?Chevron - -index.tsxstyle.css - -``` -Copytsx -import { Collapsible } from "@kobalte/core/collapsible"; -import { ChevronDownIcon } from "some-icon-library"; -import "./style.css"; - -function App() { - return ( - - - What is Kobalte? - - - -

    - Kobalte is a UI toolkit for building accessible web apps and design systems with SolidJS. - It provides a set of low-level UI components and primitives which can be the foundation - for your design system implementation. -

    -
    -
    - ); -} -``` - -``` -Copytsx -import { Collapsible } from "@kobalte/core/collapsible"; -import { ChevronDownIcon } from "some-icon-library"; -import "./style.css"; - -function App() { - return ( - - - What is Kobalte? - - - -

    - Kobalte is a UI toolkit for building accessible web apps and design systems with SolidJS. - It provides a set of low-level UI components and primitives which can be the foundation - for your design system implementation. -

    -
    -
    - ); -} -``` - -## Usage - -### Animating content size - -We expose the CSS custom properties `--kb-collapsible-content-width` and `--kb-collapsible-content-height` which you can use to animate the size of the content when it opens/closes. - -``` -Copycss -/* style.css */ -.collapsible__content { - overflow: hidden; - animation: slideUp 300ms ease-out; -} - -.collapsible__content[data-expanded] { - animation: slideDown 300ms ease-out; -} - -@keyframes slideDown { - from { - height: 0; - } - to { - height: var(--kb-collapsible-content-height); - } -} - -@keyframes slideUp { - from { - height: var(--kb-collapsible-content-height); - } - to { - height: 0; - } -} -``` - -``` -Copycss -/* style.css */ -.collapsible__content { - overflow: hidden; - animation: slideUp 300ms ease-out; -} - -.collapsible__content[data-expanded] { - animation: slideDown 300ms ease-out; -} - -@keyframes slideDown { - from { - height: 0; - } - to { - height: var(--kb-collapsible-content-height); - } -} - -@keyframes slideUp { - from { - height: var(--kb-collapsible-content-height); - } - to { - height: 0; - } -} -``` - -## API Reference - -### Collapsible - -`Collapsible` is equivalent to the `Root` import from `@kobalte/core/collapsible` (and deprecated `Collapsible.Root`). - -| Prop | Description | -| --- | --- | -| open | `boolean`
    The controlled open state of the collapsible. | -| defaultOpen | `boolean`
    The default open state when initially rendered. Useful when you do not need to control the open state. | -| onOpenChange | `(open: boolean) => void`
    Event handler called when the open state of the collapsible changes. | -| disabled | `boolean`
    Whether the collapsible is disabled. | -| forceMount | `boolean`
    Used to force mounting the collapsible content when more control is needed. Useful when controlling animation with SolidJS animation libraries. | - -| Data attribute | Description | -| --- | --- | -| data-expanded | Present when the collapsible is expanded. | -| data-closed | Present when the collapsible is collapsed. | -| data-disabled | Present when the collapsible is disabled. | - -`Collapsible.Trigger` and `Collapsible.Content` share the same data-attributes. - -## Rendered elements - -| Component | Default rendered element | -| --- | --- | -| `Collapsible` | `div` | -| `Collapsible.Trigger` | `button` | -| `Collapsible.Content` | `div` | - -## Accessibility - -### Keyboard Interactions - -| Key | Description | -| --- | --- | -| `Space` | When focus is on the trigger, opens/closes the collapsible. | -| `Enter` | When focus is on the trigger, opens/closes the collapsible. | - -Previous[←Checkbox](https://kobalte.dev/docs/core/components/checkbox)Next[Color Area→](https://kobalte.dev/docs/core/components/color-area) \ No newline at end of file diff --git a/.firecrawl/kobalte.dev-docs-core-components-color-channel-field.md b/.firecrawl/kobalte.dev-docs-core-components-color-channel-field.md deleted file mode 100644 index b2eea38..0000000 --- a/.firecrawl/kobalte.dev-docs-core-components-color-channel-field.md +++ /dev/null @@ -1,493 +0,0 @@ -# Color Channel Field - -A number input that allow users to edit individual color channel value. - -## Import - -``` -Copyts -import { ColorChannelField } from "@kobalte/core/color-channel-field"; -// or -import { Root, Label, ... } from "@kobalte/core/color-channel-field"; -``` - -``` -Copyts -import { ColorChannelField } from "@kobalte/core/color-channel-field"; -// or -import { Root, Label, ... } from "@kobalte/core/color-channel-field"; -``` - -## Features - -- Follows the [WAI ARIA Spinbutton](https://www.w3.org/WAI/ARIA/apg/patterns/spinbutton/) design pattern. -- Built with a native `` element. -- Visual and ARIA labeling support. -- Required and invalid states exposed to assistive technology via ARIA. -- Support for description and error message help text linked to the input via ARIA. -- Syncs with form reset events. -- Can be controlled or uncontrolled. -- Supports increment and decrement buttons. -- Format and localize input number and raw input. -- Supports mouse wheel event and all keyboard events. - -## Anatomy - -The color channel field consists of: - -- **ColorChannelField**: The root container for the color channel field. -- **ColorChannelField.Label**: The label that gives the user information on the color channel field. -- **ColorChannelField.Input**: The native HTML input of the color channel field, used for display number. -- **ColorChannelField.HiddenInput**: The native HTML input of the color channel field, used for raw number form submition. -- **ColorChannelField.IncrementTrigger**: The increment button of the color channel field. -- **ColorChannelField.DecrementTrigger**: The decrement button of the color channel field. -- **ColorChannelField.Description**: The description that gives the user more information on the color channel field. -- **ColorChannelField.ErrorMessage**: The error message that gives the user information about how to fix a validation error on a color channel field. - -``` -Copytsx - - - - - - - - - -``` - -``` -Copytsx - - - - - - - - - -``` - -## Example - -Hue - -ArrowArrow - -index.tsxstyle.css - -``` -Copytsx -import { ColorChannelField } from "@kobalte/core/color-channel-field"; -import { parseColor } from "@kobalte/utils"; -import "./style.css"; - -function App() { - return ( - - - Hue - -
    - - - - - - - -
    -
    - ); -} -``` - -``` -Copytsx -import { ColorChannelField } from "@kobalte/core/color-channel-field"; -import { parseColor } from "@kobalte/utils"; -import "./style.css"; - -function App() { - return ( - - - Hue - -
    - - - - - - - -
    -
    - ); -} -``` - -## Usage - -The value provided to `defaultValue` or `value` should be `Color` object. You can obtain a Color object by using the `parseColor` function to parse a color from a string. The `channel` prop must also be provided to specify which color channel the field manipulates. -This must be one of the channels included in the color value, for example, for RGB colors, the "red", "green", and "blue" channels are available. - -### Default value - -Saturation - -ArrowArrow - -``` -Copytsx - - Saturation -
    - - - -
    -
    -``` - -``` -Copytsx - - Saturation -
    - - - -
    -
    -``` - -### Controlled value - -Lightness - -ArrowArrow - -Lightness: 39% - -``` -Copytsx -import { createSignal } from "solid-js"; - -function ControlledExample() { - const [value, setValue] = createSignal(parseColor("hsl(200, 98%, 39%)")); - - return ( - <> - - Lightness -
    - - - -
    -
    -

    Lightness: {value().getChannelValue("lightness")}%

    - - ); -} -``` - -``` -Copytsx -import { createSignal } from "solid-js"; - -function ControlledExample() { - const [value, setValue] = createSignal(parseColor("hsl(200, 98%, 39%)")); - - return ( - <> - - Lightness -
    - - - -
    -
    -

    Lightness: {value().getChannelValue("lightness")}%

    - - ); -} -``` - -### Description - -The `ColorChannelField.Description` component can be used to associate additional help text with a color channel field. - -Hue - -ArrowArrow - -Enter your favorite hue. - -``` -Copytsx - - Hue -
    - - - -
    - Enter your favorite hue. -
    -``` - -``` -Copytsx - - Hue -
    - - - -
    - Enter your favorite hue. -
    -``` - -### Error message - -The `ColorChannelField.ErrorMessage` component can be used to help the user fix a validation error. It should be combined with the `validationState` prop to semantically mark the field as invalid for assistive technologies. - -By default, it will render only when the `validationState` prop is set to `invalid`, use the `forceMount` prop to always render the error message (ex: for usage with animation libraries). - -Saturation - -ArrowArrow - -Hmm, I prefer 40% saturation. - -``` -Copytsx -import { createSignal } from "solid-js"; - -function ErrorMessageExample() { - const [value, setValue] = createSignal(parseColor("hsl(200, 30%, 39%)")); - - return ( - - Saturation -
    - - - -
    - Hmm, I prefer 40% saturation. -
    - ); -} -``` - -``` -Copytsx -import { createSignal } from "solid-js"; - -function ErrorMessageExample() { - const [value, setValue] = createSignal(parseColor("hsl(200, 30%, 39%)")); - - return ( - - Saturation -
    - - - -
    - Hmm, I prefer 40% saturation. -
    - ); -} -``` - -### HTML forms - -The color channel field `name` prop along with `` can be used for integration with HTML forms. Only the raw value is passed to the form. - -If the formatted value is wanted (unrecommended) set the `name` attribute on ``. - -Hue - -ArrowArrow - -ResetSubmit - -``` -Copytsx -function HTMLFormExample() { - const onSubmit = (e: SubmitEvent) => { - // handle form submission. - }; - - return ( -
    - - Hue - -
    - - - -
    -
    -
    - - -
    -
    - ); -} -``` - -``` -Copytsx -function HTMLFormExample() { - const onSubmit = (e: SubmitEvent) => { - // handle form submission. - }; - - return ( -
    - - Hue - -
    - - - -
    -
    -
    - - -
    -
    - ); -} -``` - -### Triggers - -The color channel field supports optional increment/decrement triggers that are easily customizable. - -Brightness - --+ - -``` -Copytsx - - Brightness -
    - - - - - - - + - -
    -
    -``` - -``` -Copytsx - - Brightness -
    - - - - - - - + - -
    -
    -``` - -## API Reference - -### ColorChannelField - -`ColorChannelField` is equivalent to the `Root` import from `@kobalte/core/color-channel-field`. - -| Prop | Description | -| --- | --- | -| value | `Color`
    The controlled value of the field. | -| defaultValue | `Color`
    The default value when initially rendered. Useful when you do not need to control the value. | -| colorSpace | `ColorSpace`
    The color space that the field operates in. The `channel` must be in this color space. | -| onChange | `(value: Color) => void`
    Event handler called when the value of the field changes. | -| minValue | `number`
    The smallest value allowed in the number field. | -| maxValue | `number`
    The largest value allowed in the number field. | -| step | `number`
    Increment/Decrement step when using the triggers or the arrows on keyboard in the field. | -| largeStep | `number`
    Increment/Decrement step when using the Page UP/Down keys in the field, defaults `10 * step`. | -| changeOnWheel | `boolean`
    Whether to increment/decrement on wheel scroll inside the field. | -| format | `boolean`
    Whether to format the input value. | -| name | `string`
    The name of the ColorChannelField.HiddenInput of the field, used when submitting an HTML form. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefname). | -| validationState | `'valid' | 'invalid'`
    Whether the field should display its "valid" or "invalid" visual styling. | -| required | `boolean`
    Whether the user must fill the field before the owning form can be submitted. | -| disabled | `boolean`
    Whether the field is disabled. | -| readOnly | `boolean`
    Whether the field items can be selected but not changed by the user. | - -| Data attribute | Description | -| --- | --- | -| data-valid | Present when the field is valid according to the validation rules. | -| data-invalid | Present when the field is invalid according to the validation rules. | -| data-required | Present when the user must fill the field before the owning form can be submitted. | -| data-disabled | Present when the field is disabled. | -| data-readonly | Present when the field is read only. | - -`ColorChannelField.Label`, `ColorChannelField.Input`, `ColorChannelField.HiddenInput`, `ColorChannelField.Description` and `ColorChannelField.ErrorMesssage` share the same data-attributes. - -### ColorChannelField.ErrorMessage - -| Prop | Description | -| --- | --- | -| forceMount | `boolean`
    Used to force mounting when more control is needed. Useful when controlling animation with SolidJS animation libraries. | - -## Rendered elements - -| Component | Default rendered element | -| --- | --- | -| `ColorChannelField` | `div` | -| `ColorChannelField.Label` | `label` | -| `ColorChannelField.Input` | `input` | -| `ColorChannelField.HiddenInput` | `input` | -| `ColorChannelField.IncrementTrigger` | `button` | -| `ColorChannelField.DecrementTrigger` | `button` | -| `ColorChannelField.Description` | `div` | -| `ColorChannelField.ErrorMessage` | `div` | - -Previous[←Color Area](https://kobalte.dev/docs/core/components/color-area)Next[Color Field→](https://kobalte.dev/docs/core/components/color-field) \ No newline at end of file diff --git a/.firecrawl/kobalte.dev-docs-core-components-color-field.md b/.firecrawl/kobalte.dev-docs-core-components-color-field.md deleted file mode 100644 index be5b7f3..0000000 --- a/.firecrawl/kobalte.dev-docs-core-components-color-field.md +++ /dev/null @@ -1,336 +0,0 @@ -# Color Field - -Allows users to enter and adjust a hex color value. - -## Import - -``` -Copyts -import { ColorField } from "@kobalte/core/color-field"; -// or -import { Root, Label, ... } from "@kobalte/core/color-field"; -``` - -``` -Copyts -import { ColorField } from "@kobalte/core/color-field"; -// or -import { Root, Label, ... } from "@kobalte/core/color-field"; -``` - -## Features - -- Support for parsing and formatting a hex color value. -- Validates keyboard entry as the user types so that only valid hex characters are accepted. -- Visual and ARIA labeling support. -- Required and invalid states exposed to assistive technology via ARIA. -- Support for description and error message help text linked to the input via ARIA. -- Syncs with form reset events. -- Can be controlled or uncontrolled. - -## Anatomy - -The color field consists of: - -- **ColorField**: The root container for the color field. -- **ColorField.Label**: The label that gives the user information on the color field. -- **ColorField.Input**: The native HTML input of the color field. -- **ColorField.Description**: The description that gives the user more information on the color field. -- **ColorField.ErrorMessage**: The error message that gives the user information about how to fix a validation error on the color field. - -``` -Copytsx - - - - - - -``` - -``` -Copytsx - - - - - - -``` - -## Example - -Favorite hex color - -index.tsxstyle.css - -``` -Copytsx -import { ColorField } from "@kobalte/core/color-field"; -import "./style.css"; - -function App() { - return ( - - Favorite hex color - - - ); -} -``` - -``` -Copytsx -import { ColorField } from "@kobalte/core/color-field"; -import "./style.css"; - -function App() { - return ( - - Favorite hex color - - - ); -} -``` - -## Usage - -### Default value - -An initial, uncontrolled value can be provided using the `defaultValue` prop. - -Favorite hex color - -``` -Copytsx - - Favorite hex color - - -``` - -``` -Copytsx - - Favorite hex color - - -``` - -### Controlled value - -The `value` prop can be used to make the value controlled. The `onChange` event is fired when the user type into the input and receive the new value. - -Favorite hex color - -Your favorite color is: #7f007f - -``` -Copytsx -import { createSignal } from "solid-js"; - -function ControlledExample() { - const [value, setValue] = createSignal("#7f007f"); - - return ( - <> - - Favorite hex color - - -

    Your favorite color is: {value()}

    - - ); -} -``` - -``` -Copytsx -import { createSignal } from "solid-js"; - -function ControlledExample() { - const [value, setValue] = createSignal("#7f007f"); - - return ( - <> - - Favorite hex color - - -

    Your favorite color is: {value()}

    - - ); -} -``` - -### Description - -The `ColorField.Description` component can be used to associate additional help text with a color field. - -Favorite hex color - -Choose the color you like the most. - -``` -Copytsx - - Favorite hex color - - - Choose the color you like the most. - - -``` - -``` -Copytsx - - Favorite hex color - - - Choose the color you like the most. - - -``` - -### Error message - -The `ColorField.ErrorMessage` component can be used to help the user fix a validation error. It should be combined with the `validationState` prop to semantically mark the color field as invalid for assistive technologies. - -By default, it will render only when the `validationState` prop is set to `invalid`, use the `forceMount` prop to always render the error message (ex: for usage with animation libraries). - -Favorite hex color - -Hmm, I prefer black. - -``` -Copytsx -import { createSignal } from "solid-js"; - -function ErrorMessageExample() { - const [value, setValue] = createSignal("#7f007f"); - - return ( - - Favorite hex color - - Hmm, I prefer black. - - ); -} -``` - -``` -Copytsx -import { createSignal } from "solid-js"; - -function ErrorMessageExample() { - const [value, setValue] = createSignal("#7f007f"); - - return ( - - Favorite hex color - - Hmm, I prefer black. - - ); -} -``` - -### HTML forms - -The color field `name` prop can be used for integration with HTML forms. - -Favorite hex color - -ResetSubmit - -``` -Copytsx -function HTMLFormExample() { - const onSubmit = (e: SubmitEvent) => { - // handle form submission. - }; - - return ( -
    - - Favorite hex color - - -
    - ); -} -``` - -``` -Copytsx -function HTMLFormExample() { - const onSubmit = (e: SubmitEvent) => { - // handle form submission. - }; - - return ( -
    - - Favorite hex color - - -
    - ); -} -``` - -## API Reference - -### ColorField - -`ColorField` is equivalent to the `Root` import from `@kobalte/core/color-field`. - -| Prop | Description | -| --- | --- | -| value | `string`
    The controlled value of the color field to check. | -| defaultValue | `string`
    The default value when initially rendered. Useful when you do not need to control the value. | -| onChange | `(value: string) => void`
    Event handler called when the value of the color field changes. | -| name | `string`
    The name of the color field, used when submitting an HTML form. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefname). | -| validationState | `'valid' | 'invalid'`
    Whether the color field should display its "valid" or "invalid" visual styling. | -| required | `boolean`
    Whether the user must fill the color field before the owning form can be submitted. | -| disabled | `boolean`
    Whether the color field is disabled. | -| readOnly | `boolean`
    Whether the color field items can be selected but not changed by the user. | - -| Data attribute | Description | -| --- | --- | -| data-valid | Present when the color field is valid according to the validation rules. | -| data-invalid | Present when the color field is invalid according to the validation rules. | -| data-required | Present when the user must fill the color field before the owning form can be submitted. | -| data-disabled | Present when the color field is disabled. | -| data-readonly | Present when the color field is read only. | - -`ColorField.Label`, `ColorField.Input`, `ColorField.Description` and `ColorField.ErrorMesssage` share the same data-attributes. - -### ColorField.ErrorMessage - -| Prop | Description | -| --- | --- | -| forceMount | `boolean`
    Used to force mounting when more control is needed. Useful when controlling animation with SolidJS animation libraries. | - -## Rendered elements - -| Component | Default rendered element | -| --- | --- | -| `ColorField` | `div` | -| `ColorField.Label` | `label` | -| `ColorField.Input` | `input` | -| `ColorField.Description` | `div` | -| `ColorField.ErrorMessage` | `div` | - -Previous[←Color Channel Field](https://kobalte.dev/docs/core/components/color-channel-field)Next[Color Slider→](https://kobalte.dev/docs/core/components/color-slider) \ No newline at end of file diff --git a/.firecrawl/kobalte.dev-docs-core-components-color-slider.md b/.firecrawl/kobalte.dev-docs-core-components-color-slider.md deleted file mode 100644 index 09ed94f..0000000 --- a/.firecrawl/kobalte.dev-docs-core-components-color-slider.md +++ /dev/null @@ -1,409 +0,0 @@ -# Color Slider - -Adjusts an individual channel of a color value. - -## Import - -``` -Copyts -import { ColorSlider } from "@kobalte/core/color-slider"; -// or -import { Root, Track, ... } from "@kobalte/core/color-slider"; -``` - -``` -Copyts -import { ColorSlider } from "@kobalte/core/color-slider"; -// or -import { Root, Track, ... } from "@kobalte/core/color-slider"; -``` - -## Features - -- Can be controlled or uncontrolled. -- Localized color descriptions for screen reader users. -- Support for adjusting a single channel of RGBA, HSLA and HSBA colors, in both horizontal and vertical orientations. -- Support click or touch on track to change value. -- Support right or left direction. -- Support for custom value label. - -## Anatomy - -The color slider consists of: - -- **ColorSlider:** The root container for the color slider. -- **ColorSlider.Track:** The component that visually represents the color slider track. -- **ColorSlider.Thumb:** The thumb that is used to visually indicate a value in the color slider. -- **ColorSlider.Input:** The native html input that is visually hidden in the color slider thumb. -- **ColorSlider.Label:** The label that gives the user information on the color slider. -- **ColorSlider.ValueLabel:** The accessible label text representing the current value in a human-readable format. - -``` -Copytsx - - - - - - - - - -``` - -``` -Copytsx - - - - - - - - - -``` - -## Example - -Blue - -197 - -index.tsxstyle.css - -``` -Copytsx -import { ColorSlider } from "@kobalte/core/color-slider"; -import { parseColor } from "@kobalte/utils"; -import "./style.css"; - -function App() { - return ( - -
    - Blue - -
    - - - - - -
    - ); -} -``` - -``` -Copytsx -import { ColorSlider } from "@kobalte/core/color-slider"; -import { parseColor } from "@kobalte/utils"; -import "./style.css"; - -function App() { - return ( - -
    - Blue - -
    - - - - - -
    - ); -} -``` - -## Usage - -The value provided to `defaultValue` or `value` should be `Color` object. You can obtain a Color object by using the `parseColor` function to parse a color from a string. The `channel` prop must also be provided to specify which color channel the slider should display. -This must be one of the channels included in the color value, for example, for RGB colors, the "red", "green", and "blue" channels are available. - -### Default value - -Hue - -0° - -index.tsxstyle.css - -``` -Copytsx -import { ColorSlider } from "@kobalte/core/color-slider"; -import { parseColor } from "@kobalte/utils"; -import "./style.css"; - -function App() { - return ( - -
    - Hue - -
    - - - - - -
    - ); -} -``` - -``` -Copytsx -import { ColorSlider } from "@kobalte/core/color-slider"; -import { parseColor } from "@kobalte/utils"; -import "./style.css"; - -function App() { - return ( - -
    - Hue - -
    - - - - - -
    - ); -} -``` - -### Controlled value - -Hue - -0° - -index.tsxstyle.css - -``` -Copytsx -import { createSignal } from "solid-js"; -import { ColorSlider } from "@kobalte/core/color-slider"; -import { parseColor } from "@kobalte/utils"; -import "./style.css"; - -function App() { - const [value, setValue] = createSignal(parseColor('hsl(0, 100%, 50%)')); - return ( - -
    - Hue - -
    - - - - - -
    - ); -} -``` - -``` -Copytsx -import { createSignal } from "solid-js"; -import { ColorSlider } from "@kobalte/core/color-slider"; -import { parseColor } from "@kobalte/utils"; -import "./style.css"; - -function App() { - const [value, setValue] = createSignal(parseColor('hsl(0, 100%, 50%)')); - return ( - -
    - Hue - -
    - - - - - -
    - ); -} -``` - -### Vertical Slider - -Red - -255 - -index.tsxstyle.css - -``` -Copytsx -import { ColorSlider } from "@kobalte/core/color-slider"; -import { parseColor } from "@kobalte/utils"; -import "./style.css"; - -function App() { - return ( - -
    - Hue - -
    - - - - - -
    - ); -} -``` - -``` -Copytsx -import { ColorSlider } from "@kobalte/core/color-slider"; -import { parseColor } from "@kobalte/utils"; -import "./style.css"; - -function App() { - return ( - -
    - Hue - -
    - - - - - -
    - ); -} -``` - -### Custom Value Label - -rgb(255, 0, 255) - -index.tsxstyle.css - -``` -Copytsx -import { ColorSlider } from "@kobalte/core/color-slider"; -import { parseColor } from "@kobalte/utils"; -import "./style.css"; - -function App() { - return ( - `${param.toFormat("rgb")}`}> -
    - -
    - - - - - -
    - ); -} -``` - -``` -Copytsx -import { ColorSlider } from "@kobalte/core/color-slider"; -import { parseColor } from "@kobalte/utils"; -import "./style.css"; - -function App() { - return ( - `${param.toFormat("rgb")}`}> -
    - -
    - - - - - -
    - ); -} -``` - -## API Reference - -### ColorSlider - -`ColorSlider` is equivalent to the `Root` import from `@kobalte/core/color-slider`. - -| Prop | Description | -| --- | --- | -| value | `Color`
    The controlled value of the slider. Must be used in conjunction with `onChange`. | -| defaultValue | `Color`
    The value of the slider when initially rendered. Use when you do not need to control the state of the slider. | -| channel | `ColorChannel`
    The color channel that the slider manipulates. | -| colorSpace | `ColorSpace`
    The color space that the slider operates in. The `channel` must be in this color space. | -| onChange | `(value: Color) => void`
    Event handler called when the value changes. | -| onChangeEnd | `(value: Color) => void`
    Event handler called when the value changes at the end of an interaction. | -| getValueLabel | `(param: Color) => string`
    A function to get the accessible label text representing the current value in a human-readable format. | -| orientation | `'horizontal' | 'vertical'`
    The orientation of the slider. | -| name | `string`
    The name of the slider, used when submitting an HTML form. | -| validationState | `'valid' | 'invalid'`
    Whether the slider should display its "valid" or "invalid" visual styling. | -| required | `boolean`
    Whether the user must check a radio group item before the owning form can be submitted. | -| disabled | `boolean`
    Whether the radio group is disabled. | -| readOnly | `boolean`
    Whether the radio group items can be selected but not changed by the user. | -| translations | `ColorIntlTranslations`
    Localization strings. | - -| Data attribute | Description | -| --- | --- | -| data-orientation='horizontal' | Present when the slider has horizontal orientation. | -| data-orientation='vertical' | Present when the slider has vertical orientation. | -| data-valid | Present when the slider is valid according to the validation rules. | -| data-invalid | Present when the slider is invalid according to the validation rules. | -| data-required | Present when the user must slider an item before the owning form can be submitted. | -| data-disabled | Present when the slider is disabled. | -| data-readonly | Present when the slider is read only. | - -`ColorSlider.ValueLabel`, `ColorSlider.Input`, `ColorSlider.Thumb` and `ColorSlider.Track` share the same data-attributes. - -### ColorSlider.Thumb - -The current color is available on the thumb using the custom css property `--kb-color-current`. - -## Rendered elements - -| Component | Default rendered element | -| --- | --- | -| `ColorSlider` | `div` | -| `ColorSlider.Track` | `div` | -| `ColorSlider.Thumb` | `span` | -| `ColorSlider.Input` | `input` | -| `ColorSlider.ValueLabel` | `div` | -| `ColorSlider.Label` | `label` | -| `ColorSlider.Description` | `div` | -| `ColorSlider.ErrorMessage` | `div` | - -## Accessibility - -### Keyboard Interactions - -| Key | Description | -| --- | --- | -| `PageUp` | Increases the value of the thumb by a larger step. | -| `PageDown` | Decreases the value of the thumb by a larger step. | -| `ArrowDown` | Decreases the value of the thumb by the step amount. | -| `ArrowUp` | Increases the value of the thumb by the step amount. | -| `ArrowRight` | Increments/decrements by the step value depending on `orientation`. | -| `ArrowLeft` | Increments/decrements by the step value depending on `orientation`. | -| `Home` | Sets the value of the thumb to the minimum value. | -| `End` | Sets the value of the thumb to the maximum value. | - -Previous[←Color Field](https://kobalte.dev/docs/core/components/color-field)Next[Color Swatch→](https://kobalte.dev/docs/core/components/color-swatch) \ No newline at end of file diff --git a/.firecrawl/kobalte.dev-docs-core-components-color-swatch.md b/.firecrawl/kobalte.dev-docs-core-components-color-swatch.md deleted file mode 100644 index 2b501bb..0000000 --- a/.firecrawl/kobalte.dev-docs-core-components-color-swatch.md +++ /dev/null @@ -1,153 +0,0 @@ -# Color Swatch - -Displays a preview of a selected color. - -## Import - -``` -Copyts -import { ColorSwatch } from "@kobalte/core/color-swatch"; -// or -import { Root } from "@kobalte/core/color-swatch"; -``` - -``` -Copyts -import { ColorSwatch } from "@kobalte/core/color-swatch"; -// or -import { Root } from "@kobalte/core/color-swatch"; -``` - -## Features - -- Localized color descriptions for screen reader users. - -## Anatomy - -The color swatch consists of: - -- **ColorSwatch:** The root container for the color swatch. - -``` -Copytsx - -``` - -``` -Copytsx - -``` - -## Example - -index.tsxstyle.css - -``` -Copytsx -import { ColorSwatch } from "@kobalte/core/color-swatch"; -import { parseColor } from "@kobalte/utils"; -import "./style.css"; - -function App() { - return ( - - ); -} -``` - -``` -Copytsx -import { ColorSwatch } from "@kobalte/core/color-swatch"; -import { parseColor } from "@kobalte/utils"; -import "./style.css"; - -function App() { - return ( - - ); -} -``` - -## Usage - -ColorSwatch accepts a value via the `value` prop. The value should be `Color` object. You can obtain a Color object by using the `parseColor` function to parse a color from a string. - -### Value - -index.tsxstyle.css - -``` -Copytsx -import { ColorSwatch } from "@kobalte/core/color-swatch"; -import { parseColor } from "@kobalte/utils"; -import "./style.css"; - -function App() { - return ( - - ); -} -``` - -``` -Copytsx -import { ColorSwatch } from "@kobalte/core/color-swatch"; -import { parseColor } from "@kobalte/utils"; -import "./style.css"; - -function App() { - return ( - - ); -} -``` - -### Custom Color Name - -index.tsxstyle.css - -``` -Copytsx -import { ColorSwatch } from "@kobalte/core/color-swatch"; -import { parseColor } from "@kobalte/utils"; -import "./style.css"; - -function App() { - return ( - - ); -} -``` - -``` -Copytsx -import { ColorSwatch } from "@kobalte/core/color-swatch"; -import { parseColor } from "@kobalte/utils"; -import "./style.css"; - -function App() { - return ( - - ); -} -``` - -## API Reference - -### ColorSwatch - -`ColorSwatch` is equivalent to the `Root` import from `@kobalte/core/color-swatch`. - -| Prop | Description | -| --- | --- | -| value | `Color`
    The color value to display in the swatch. | -| colorName | `string`
    A localized accessible name for the color. By default, a description is generated from the color value, but this can be overridden if you have a more specific color name (e.g. Pantone colors). | -| translations | `ColorSwatchIntlTranslations`
    Localization strings. | - -## Rendered elements - -| Component | Default rendered element | -| --- | --- | -| `ColorSwatch` | `div` | - -Previous[←Color Slider](https://kobalte.dev/docs/core/components/color-slider)Next[Color Wheel→](https://kobalte.dev/docs/core/components/color-wheel) \ No newline at end of file diff --git a/.firecrawl/kobalte.dev-docs-core-components-color-wheel.md b/.firecrawl/kobalte.dev-docs-core-components-color-wheel.md deleted file mode 100644 index 9b4d8bc..0000000 --- a/.firecrawl/kobalte.dev-docs-core-components-color-wheel.md +++ /dev/null @@ -1,408 +0,0 @@ -# Color Wheel - -Allows users to adjust the hue of an HSL or HSB color value on a circular track. - -## Import - -``` -Copyts -import { ColorWheel } from "@kobalte/core/color-wheel"; -// or -import { Root, Track, ... } from "@kobalte/core/color-wheel"; -``` - -``` -Copyts -import { ColorWheel } from "@kobalte/core/color-wheel"; -// or -import { Root, Track, ... } from "@kobalte/core/color-wheel"; -``` - -## Features - -- Support for adjusting the hue of an HSL or HSB color value. -- Support click or touch on track to change value. -- Support right or left direction. -- Support for custom value label. -- Localized color descriptions for screen reader users. -- Can be controlled or uncontrolled. - -## Anatomy - -The color wheel consists of: - -- **ColorWheel:** The root container for the color wheel. -- **ColorWheel.Track:** The component that visually represents the color wheel track. -- **ColorWheel.Thumb:** The thumb that is used to visually indicate a value in the color wheel. -- **ColorWheel.Input:** The native html input that is visually hidden in the color wheel thumb. -- **ColorWheel.Label:** The label that gives the user information on the color wheel. -- **ColorWheel.ValueLabel:** The accessible label text representing the current value in a human-readable format. - -``` -Copytsx - - - - - - - - - -``` - -``` -Copytsx - - - - - - - - - -``` - -## Example - -Label - -index.tsxstyle.css - -``` -Copytsx -import { ColorWheel } from "@kobalte/core/color-wheel"; -import "./style.css"; - -function App() { - return ( - - Label - - - - - - - ); -} -``` - -``` -Copytsx -import { ColorWheel } from "@kobalte/core/color-wheel"; -import "./style.css"; - -function App() { - return ( - - Label - - - - - - - ); -} -``` - -## Usage - -### Default value - -By default, `ColorWheel` is uncontrolled with a default value of red (hue = 0). You can change the default value using the `defaultValue` prop. - -Label - -``` -Copytsx -import { ColorWheel } from "@kobalte/core/color-wheel"; -import { parseColor } from "@kobalte/core"; - -function App() { - return ( - - Label - - - - - - - ); -} -``` - -``` -Copytsx -import { ColorWheel } from "@kobalte/core/color-wheel"; -import { parseColor } from "@kobalte/core"; - -function App() { - return ( - - Label - - - - - - - ); -} -``` - -### Controlled value - -A `ColorWheel` can be made controlled using the `value` prop. The `onChange` event is fired when the user drags the thumb and receive the new value. - -Label - -Current color value: hsl(0 100% 50%) - -``` -Copytsx -import { createSignal } from "solid-js"; - -function ControlledValueExample() { - const [value, setValue] = createSignal(parseColor("hsl(0, 100%, 50%)")); - - return ( - <> - - Label - - - - - - -

    Current color value: {value().toString("hsl")}

    - - ); -} -``` - -``` -Copytsx -import { createSignal } from "solid-js"; - -function ControlledValueExample() { - const [value, setValue] = createSignal(parseColor("hsl(0, 100%, 50%)")); - - return ( - <> - - Label - - - - - - -

    Current color value: {value().toString("hsl")}

    - - ); -} -``` - -### Thickness - -The `thickness` prop controls the width of the `ColorWheel`'s circular track. This prop is required. - -Label - -``` -Copytsx - - Label - - - - - - -``` - -``` -Copytsx - - Label - - - - - - -``` - -### Custom Value Label - -Label - -hsla(0 100% 50% / 1) - -``` -Copytsx - - color - .toFormat("hsl") - .withChannelValue("saturation", 100) - .withChannelValue("lightness", 50) - .withChannelValue("alpha", 1) - .toString() - } -> - Label - - - - - -
    - -
    -
    -``` - -``` -Copytsx - - color - .toFormat("hsl") - .withChannelValue("saturation", 100) - .withChannelValue("lightness", 50) - .withChannelValue("alpha", 1) - .toString() - } -> - Label - - - - - -
    - -
    -
    -``` - -### HTML forms - -`ColorWheel` supports the `name` prop for integration with HTML forms. - -Label - -ResetSubmit - -``` -Copytsx -function HTMLFormExample() { - const onSubmit = (e: SubmitEvent) => { - // handle form submission. - }; - - return ( -
    - - - - - - - -
    - ); -} -``` - -``` -Copytsx -function HTMLFormExample() { - const onSubmit = (e: SubmitEvent) => { - // handle form submission. - }; - - return ( -
    - - - - - - - -
    - ); -} -``` - -## API Reference - -### ColorWheel - -`ColorWheel` is equivalent to the `Root` import from `@kobalte/core/color-wheel`. - -| Prop | Description | -| --- | --- | -| value | `Color`
    The controlled value of the color wheel. Must be used in conjunction with `onChange`. | -| defaultValue | `Color`
    The value of the color wheel when initially rendered. Use when you do not need to control the state of the color wheel. | -| thickness | `number`
    The thickness of the track `0-100`. | -| onChange | `(value: Color) => void`
    Event handler called when the value changes. | -| onChangeEnd | `(value: Color) => void`
    Event handler called when the value changes at the end of an interaction. | -| getValueLabel | `(param: Color) => string`
    A function to get the accessible label text representing the current value in a human-readable format. | -| name | `string`
    The name of the color wheel, used when submitting an HTML form. | -| validationState | `'valid' | 'invalid'`
    Whether the color wheel should display its "valid" or "invalid" visual styling. | -| required | `boolean`
    Whether the user must check a radio group item before the owning form can be submitted. | -| disabled | `boolean`
    Whether the color wheel is disabled. | -| readOnly | `boolean`
    Whether the color wheel items can be selected but not changed by the user. | -| translations | `ColorIntlTranslations`
    Localization strings. | - -| Data attribute | Description | -| --- | --- | -| data-valid | Present when the color wheel is valid according to the validation rules. | -| data-invalid | Present when the color wheel is invalid according to the validation rules. | -| data-required | Present when the color wheel is required. | -| data-disabled | Present when the color wheel is disabled. | -| data-readonly | Present when the color wheel is read only. | - -`ColorWheel.ValueLabel`, `ColorWheel.Input`, `ColorWheel.Thumb` and `ColorWheel.Track` share the same data-attributes. - -### ColorWheel.Thumb - -The current color is available on the thumb using the custom css property `--kb-color-current`. - -## Rendered elements - -| Component | Default rendered element | -| --- | --- | -| `ColorWheel` | `div` | -| `ColorWheel.Track` | `div` | -| `ColorWheel.Thumb` | `span` | -| `ColorWheel.Input` | `input` | -| `ColorWheel.ValueLabel` | `div` | -| `ColorWheel.Label` | `label` | -| `ColorWheel.Description` | `div` | -| `ColorWheel.ErrorMessage` | `div` | - -## Accessibility - -### Keyboard Interactions - -| Key | Description | -| --- | --- | -| `PageUp` | Increments the value of the thumb by a larger step. | -| `PageDown` | Decrements the value of the thumb by a larger step. | -| `ArrowDown` | Decrements the value of the thumb by the step amount. | -| `ArrowUp` | Increments the value of the thumb by the step amount. | -| `ArrowRight` | Increments the value of the thumb by the step value. | -| `ArrowLeft` | Decrements the value of the thumb by the step value. | -| `Home` | Sets the value of the thumb to the minimum value. | -| `End` | Sets the value of the thumb to the maximum value. | - -Previous[←Color Swatch](https://kobalte.dev/docs/core/components/color-swatch)Next[Combobox→](https://kobalte.dev/docs/core/components/combobox) \ No newline at end of file diff --git a/.firecrawl/kobalte.dev-docs-core-components-context-menu.md b/.firecrawl/kobalte.dev-docs-core-components-context-menu.md deleted file mode 100644 index 13ddb82..0000000 --- a/.firecrawl/kobalte.dev-docs-core-components-context-menu.md +++ /dev/null @@ -1,669 +0,0 @@ -# Context Menu - -Displays a menu located at the pointer, triggered by a right-click or a long-press. - -## Import - -``` -Copyts -import { ContextMenu } from "@kobalte/core/context-menu"; -// or -import { Root, Trigger, ... } from "@kobalte/core/context-menu"; -// or (deprecated) -import { ContextMenu } from "@kobalte/core"; -``` - -``` -Copyts -import { ContextMenu } from "@kobalte/core/context-menu"; -// or -import { Root, Trigger, ... } from "@kobalte/core/context-menu"; -// or (deprecated) -import { ContextMenu } from "@kobalte/core"; -``` - -## Features - -- Follows the [WAI ARIA Menu](https://www.w3.org/WAI/ARIA/apg/patterns/menu/) design pattern. -- Triggers with a long-press on touch devices. -- Supports modal and non-modal modes. -- Supports submenus. -- Supports items, labels, groups of items. -- Supports checkable items (single or multiple) with optional indeterminate state. -- Support disabled items. -- Complex item labeling support for accessibility. -- Keyboard opening and navigation support. -- Automatic scrolling support during keyboard navigation. -- Typeahead to allow focusing items by typing text. -- Optionally render a pointing arrow. -- Focus is fully managed. - -## Anatomy - -The context menu consists of: - -- **ContextMenu:** The root container for a context menu. -- **ContextMenu.Trigger:** The button that toggles the menu. -- **ContextMenu.Icon:** A small icon that can be displayed inside the menu trigger as a visual affordance for the fact it can be open. -- **ContextMenu.Portal:** Portals its children into the `body` when the menu is open. -- **ContextMenu.Content:** Contains the content to be rendered when the menu is open. -- **ContextMenu.Arrow:** An optional arrow element to render alongside the menu content. -- **ContextMenu.Separator:** Used to visually separate items in the menu. -- **ContextMenu.Group:** Used to group multiple items. Use in conjunction with `ContextMenu.GroupLabel` to ensure good accessibility via automatic labelling. -- **ContextMenu.GroupLabel:** Used to render the label of a group. It won't be focusable using arrow keys. -- **ContextMenu.Sub:** Contains all the parts of a submenu. -- **ContextMenu.SubTrigger:** An item that opens a submenu. Must be rendered inside `ContextMenu.Sub`. -- **ContextMenu.SubContent:** The component that pops out when a submenu is open. Must be rendered inside `ContextMenu.Sub`. - -The menu item consists of: - -- **ContextMenu.Item:** An item of the select. -- **ContextMenu.ItemLabel:** An accessible label to be announced for the item. -- **ContextMenu.ItemDescription:** An optional accessible description to be announced for the item. -- **ContextMenu.ItemIndicator:** The visual indicator rendered when the item is checked. - -The checkable menu item consists of: - -- **ContextMenu.RadioGroup:** Used to group multiple `ContextMenu.RadioItem`s and manage the selection. -- **ContextMenu.RadioItem:** An item that can be controlled and rendered like a radio. -- **ContextMenu.CheckboxItem:** An item that can be controlled and rendered like a checkbox. - -``` -Copytsx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -``` - -``` -Copytsx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -``` - -## Example - -Right click here. - -index.tsxstyle.css - -``` -Copytsx -import { ContextMenu } from "@kobalte/core/context-menu"; -import { createSignal } from "solid-js"; -import { CheckIcon, ChevronRightIcon, DotFilledIcon } from "some-icon-library"; -import "./style.css"; - -function App() { - const [showGitLog, setShowGitLog] = createSignal(true); - const [showHistory, setShowHistory] = createSignal(false); - const [branch, setBranch] = createSignal("main"); - - return ( - - - Right click here. - - - - - Commit
    ⌘+K
    -
    - - Push
    ⇧+⌘+K
    -
    - - Update Project
    ⌘+T
    -
    - - - GitHub -
    - -
    -
    - - - - Create Pull Request… - - - View Pull Requests - - - Sync Fork - - - - Open on GitHub - - - -
    - - - - - - - - Show Git Log - - - - - - Show History - - - - - - - Branches - - - - - - - main - - - - - - develop - - - -
    -
    -
    - ); -} -``` - -``` -Copytsx -import { ContextMenu } from "@kobalte/core/context-menu"; -import { createSignal } from "solid-js"; -import { CheckIcon, ChevronRightIcon, DotFilledIcon } from "some-icon-library"; -import "./style.css"; - -function App() { - const [showGitLog, setShowGitLog] = createSignal(true); - const [showHistory, setShowHistory] = createSignal(false); - const [branch, setBranch] = createSignal("main"); - - return ( - - - Right click here. - - - - - Commit
    ⌘+K
    -
    - - Push
    ⇧+⌘+K
    -
    - - Update Project
    ⌘+T
    -
    - - - GitHub -
    - -
    -
    - - - - Create Pull Request… - - - View Pull Requests - - - Sync Fork - - - - Open on GitHub - - - -
    - - - - - - - - Show Git Log - - - - - - Show History - - - - - - - Branches - - - - - - - main - - - - - - develop - - - -
    -
    -
    - ); -} -``` - -## Usage - -### Origin-aware animations - -We expose a CSS custom property `--kb-popper-content-transform-origin` which can be used to animate the content from its computed origin. - -``` -Copycss -/* style.css */ -.context-menu__content, -.context-menu__sub-content { - transform-origin: var(--kb-menu-content-transform-origin); - animation: contentHide 250ms ease-in forwards; -} - -.context-menu__content[data-expanded], -.context-menu__sub-content[data-expanded] { - animation: contentShow 250ms ease-out; -} - -@keyframes contentShow { - from { - opacity: 0; - transform: scale(0.96); - } - to { - opacity: 1; - transform: scale(1); - } -} - -@keyframes contentHide { - from { - opacity: 1; - transform: scale(1); - } - to { - opacity: 0; - transform: scale(0.96); - } -} -``` - -``` -Copycss -/* style.css */ -.context-menu__content, -.context-menu__sub-content { - transform-origin: var(--kb-menu-content-transform-origin); - animation: contentHide 250ms ease-in forwards; -} - -.context-menu__content[data-expanded], -.context-menu__sub-content[data-expanded] { - animation: contentShow 250ms ease-out; -} - -@keyframes contentShow { - from { - opacity: 0; - transform: scale(0.96); - } - to { - opacity: 1; - transform: scale(1); - } -} - -@keyframes contentHide { - from { - opacity: 1; - transform: scale(1); - } - to { - opacity: 0; - transform: scale(0.96); - } -} -``` - -## API Reference - -### ContextMenu - -`ContextMenu` is equivalent to the `Root` import from `@kobalte/core/context-menu` (and deprecated `ContextMenu.Root`). - -| Prop | Description | -| --- | --- | -| onOpenChange | `(open: boolean) => void`
    Event handler called when the open state of the menu changes. | -| id | `string`
    A unique identifier for the component. The id is used to generate id attributes for nested components. If no id prop is provided, a generated id will be used. | -| modal | `boolean`
    Whether the menu should be the only visible content for screen readers, when set to `true`:
    \- interaction with outside elements will be disabled.
    \- scroll will be locked.
    \- focus will be locked inside the menu content.
    \- elements outside the menu content will not be visible for screen readers. | -| preventScroll | `boolean`
    Whether the scroll should be locked even if the menu is not modal. | -| forceMount | `boolean`
    Used to force mounting the menu (portal and content) when more control is needed. Useful when controlling animation with SolidJS animation libraries. | - -`ContextMenu` also accepts the following props to customize the placement of the `ContextMenu.Content`. - -| Prop | Description | -| --- | --- | -| placement | `Placement`
    The placement of the menu content. | -| gutter | `number`
    The distance between the menu content and the trigger element. By default, it's 0 plus half of the arrow offset, if it exists. | -| shift | `number`
    The skidding of the menu content along the trigger element. | -| flip | `boolean | string`
    Controls the behavior of the menu content when it overflows the viewport:
    \- If a `boolean`, specifies whether the menu content should flip to the opposite side when it overflows.
    \- If a `string`, indicates the preferred fallback placements when it overflows.
    The placements must be spaced-delimited, e.g. "top left". | -| slide | `boolean`
    Whether the menu content should slide when it overflows. | -| overlap | `boolean`
    Whether the menu content can overlap the trigger element when it overflows. | -| sameWidth | `boolean`
    Whether the menu content should have the same width as the trigger element. This will be exposed to CSS as `--kb-popper-anchor-width`. | -| fitViewport | `boolean`
    Whether the menu content should fit the viewport. If this is set to true, the menu content will have `maxWidth` and `maxHeight` set to the viewport size. This will be exposed to CSS as `--kb-popper-available-width` and `--kb-popper-available-height`. | -| hideWhenDetached | `boolean`
    Whether to hide the menu content when the trigger element becomes occluded. | -| detachedPadding | `number`
    The minimum padding in order to consider the trigger element occluded. | -| arrowPadding | `number`
    The minimum padding between the arrow and the menu content corner. | -| overflowPadding | `number`
    The minimum padding between the menu content and the viewport edge. This will be exposed to CSS as `--kb-popper-overflow-padding`. | - -### ContextMenu.Trigger - -| Prop | Description | -| --- | --- | -| disabled | `boolean`
    Whether the context menu trigger is disabled or not. | - -| Data attribute | Description | -| --- | --- | -| data-expanded | Present when the menu is open. | -| data-closed | Present when the menu is close. | -| data-disabled | Present when the trigger is disabled. | - -`ContextMenu.Icon`, `ContextMenu.Content`, `ContextMenu.SubTrigger` and `ContextMenu.SubContent` share the same `data-expanded` attribute. - -### ContextMenu.Content - -The popper positioner will copy the same `z-index` as the `ContextMenu.Content`. - -| Prop | Description | -| --- | --- | -| onOpenAutoFocus | `(event: Event) => void`
    Event handler called when focus moves into the component after opening. It can be prevented by calling `event.preventDefault`. | -| onCloseAutoFocus | `(event: Event) => void`
    Event handler called when focus moves to the trigger after closing. It can be prevented by calling `event.preventDefault`. | -| onEscapeKeyDown | `(event: KeyboardEvent) => void`
    Event handler called when the escape key is down. It can be prevented by calling `event.preventDefault`. | -| onPointerDownOutside | `(event: PointerDownOutsideEvent) => void`
    Event handler called when a pointer event occurs outside the bounds of the component. It can be prevented by calling `event.preventDefault`. | -| onFocusOutside | `(event: FocusOutsideEvent) => void`
    Event handler called when the focus moves outside the bounds of the component. It can be prevented by calling `event.preventDefault`. | -| onInteractOutside | `(event: InteractOutsideEvent) => void`
    Event handler called when an interaction (pointer or focus event) happens outside the bounds of the component. It can be prevented by calling `event.preventDefault`. | - -### ContextMenu.Arrow - -| Prop | Description | -| --- | --- | -| size | `number`
    The size of the arrow. | - -### ContextMenu.Item - -| Prop | Description | -| --- | --- | -| textValue | `string`
    Optional text used for typeahead purposes. By default, the typeahead behavior will use the .textContent of the `ContextMenu.ItemLabel` part if provided, or fallback to the .textContent of the `ContextMenu.Item`. Use this when the content is complex, or you have non-textual content inside. | -| disabled | `boolean`
    Whether the item is disabled or not. | -| closeOnSelect | `boolean`
    Whether the menu should close when the item is activated. | -| onSelect | `() => void`
    Event handler called when the user selects an item (via mouse or keyboard). | - -| Data attribute | Description | -| --- | --- | -| data-disabled | Present when the item is disabled. | -| data-highlighted | Present when the item is highlighted. | - -`ContextMenu.ItemLabel`, `ContextMenu.ItemDescription` and `ContextMenu.ItemIndicator` shares the same data-attributes. - -### ContextMenu.ItemIndicator - -| Prop | Description | -| --- | --- | -| forceMount | `boolean`
    Used to force mounting when more control is needed. Useful when controlling animation with SolidJS animation libraries. | - -### ContextMenu.RadioGroup - -| Prop | Description | -| --- | --- | -| value | `string`
    The controlled value of the menu radio item to check. | -| defaultValue | `string`
    The value of the menu radio item that should be checked when initially rendered. Useful when you do not need to control the state of the radio group. | -| onChange | `(value: string) => void`
    Event handler called when the value changes. | -| disabled | `boolean`
    Whether the radio group is disabled or not. | - -### ContextMenu.RadioItem - -| Prop | Description | -| --- | --- | -| value | `string`
    The value of the menu item radio. | -| textValue | `string`
    Optional text used for typeahead purposes. By default, the typeahead behavior will use the .textContent of the `ContextMenu.ItemLabel` part if provided, or fallback to the .textContent of the `ContextMenu.Item`. Use this when the content is complex, or you have non-textual content inside. | -| disabled | `boolean`
    Whether the item is disabled or not. | -| closeOnSelect | `boolean`
    Whether the menu should close when the item is checked. | -| onSelect | `() => void`
    Event handler called when the user selects an item (via mouse or keyboard). | - -| Data attribute | Description | -| --- | --- | -| data-disabled | Present when the item is disabled. | -| data-checked | Present when the item is checked. | -| data-highlighted | Present when the item is highlighted. | - -### ContextMenu.CheckboxItem - -| Prop | Description | -| --- | --- | -| checked | `boolean`
    The controlled checked state of the item. | -| defaultChecked | `boolean`
    The default checked state when initially rendered. Useful when you do not need to control the checked state. | -| onChange | `(checked: boolean) => void`
    Event handler called when the checked state of the item changes. | -| textValue | `string`
    Optional text used for typeahead purposes. By default, the typeahead behavior will use the .textContent of the `ContextMenu.ItemLabel` part if provided, or fallback to the .textContent of the `ContextMenu.Item`. Use this when the content is complex, or you have non-textual content inside. | -| indeterminate | `boolean`
    Whether the item is in an indeterminate state. | -| disabled | `boolean`
    Whether the item is disabled or not. | -| closeOnSelect | `boolean`
    Whether the menu should close when the item is checked/unchecked. | -| onSelect | `() => void`
    Event handler called when the user selects an item (via mouse or keyboard). | - -| Data attribute | Description | -| --- | --- | -| data-disabled | Present when the item is disabled. | -| data-indeterminate | Present when the item is in an indeterminate state. | -| data-checked | Present when the item is checked. | -| data-highlighted | Present when the item is highlighted. | - -### ContextMenu.Sub - -| Prop | Description | -| --- | --- | -| open | `boolean`
    The controlled open state of the sub menu. | -| defaultOpen | `boolean`
    The default open state when initially rendered. Useful when you do not need to control the open state. | -| onOpenChange | `(open: boolean) => void`
    Event handler called when the open state of the sub menu changes. | - -`ContextMenu.Sub` also accepts the following props to customize the placement of the `ContextMenu.SubContent`. - -| Prop | Description | -| --- | --- | -| getAnchorRect | `(anchor?: HTMLElement) => AnchorRect | undefined`
    Function that returns the trigger element's DOMRect. | -| gutter | `number`
    The distance between the sub menu content and the trigger element. By default, it's 0 plus half of the arrow offset, if it exists. | -| shift | `number`
    The skidding of the sub menu content along the trigger element. | -| slide | `boolean`
    Whether the sub menu content should slide when it overflows. | -| overlap | `boolean`
    Whether the sub menu content can overlap the trigger element when it overflows. | -| fitViewport | `boolean`
    Whether the sub menu content should fit the viewport. If this is set to true, the sub menu content will have `maxWidth` and `maxHeight` set to the viewport size. This will be exposed to CSS as `--kb-popper-available-width` and `--kb-popper-available-height`. | -| hideWhenDetached | `boolean`
    Whether to hide the sub menu content when the trigger element becomes occluded. | -| detachedPadding | `number`
    The minimum padding in order to consider the trigger element occluded. | -| arrowPadding | `number`
    The minimum padding between the arrow and the sub menu content corner. | -| overflowPadding | `number`
    The minimum padding between the sub menu content and the viewport edge. This will be exposed to CSS as `--kb-popper-overflow-padding`. | - -### ContextMenu.SubTrigger - -| Prop | Description | -| --- | --- | -| textValue | `string`
    Optional text used for typeahead purposes. By default, the typeahead behavior will use the .textContent of the `ContextMenu.SubTrigger`. Use this when the content is complex, or you have non-textual content inside. | -| disabled | `boolean`
    Whether the sub menu trigger is disabled or not. | - -| Data attribute | Description | -| --- | --- | -| data-disabled | Present when the item is disabled. | -| data-highlighted | Present when the item is highlighted. | - -### ContextMenu.SubContent - -| Prop | Description | -| --- | --- | -| onEscapeKeyDown | `(event: KeyboardEvent) => void`
    Event handler called when the escape key is down. It can be prevented by calling `event.preventDefault`. | -| onPointerDownOutside | `(event: PointerDownOutsideEvent) => void`
    Event handler called when a pointer event occurs outside the bounds of the component. It can be prevented by calling `event.preventDefault`. | -| onFocusOutside | `(event: FocusOutsideEvent) => void`
    Event handler called when the focus moves outside the bounds of the component. It can be prevented by calling `event.preventDefault`. | -| onInteractOutside | `(event: InteractOutsideEvent) => void`
    Event handler called when an interaction (pointer or focus event) happens outside the bounds of the component. It can be prevented by calling `event.preventDefault`. | - -## Rendered elements - -| Component | Default rendered element | -| --- | --- | -| `ContextMenu` | none | -| `ContextMenu.Trigger` | `div` | -| `ContextMenu.Icon` | `div` | -| `ContextMenu.Portal` | `Portal` | -| `ContextMenu.Content` | `div` | -| `ContextMenu.Arrow` | `div` | -| `ContextMenu.Separator` | `hr` | -| `ContextMenu.Group` | `div` | -| `ContextMenu.GroupLabel` | `span` | -| `ContextMenu.Sub` | none | -| `ContextMenu.SubTrigger` | `div` | -| `ContextMenu.SubContent` | `div` | -| `ContextMenu.Item` | `div` | -| `ContextMenu.ItemLabel` | `div` | -| `ContextMenu.ItemDescription` | `div` | -| `ContextMenu.ItemIndicator` | `div` | -| `ContextMenu.RadioGroup` | `div` | -| `ContextMenu.RadioItem` | `div` | -| `ContextMenu.CheckboxItem` | `div` | - -## Accessibility - -### Keyboard Interactions - -| Key | Description | -| --- | --- | -| `Space` | When focus is on an item, activates the item. | -| `Enter` | When focus is on an item, activates the item. | -| `ArrowDown` | When focus is on an item, moves focus to the next item. | -| `ArrowUp` | When focus is on an item, moves focus to the previous item. | -| `ArrowRight` / `ArrowLeft` | When focus is on a sub menu trigger, opens or closes the submenu depending on reading direction. | -| `Home` | When focus is on an item, moves focus to first item. | -| `End` | When focus is on an item, moves focus to last item. | -| `Esc` | Closes the context menu. | - -Previous[←Combobox](https://kobalte.dev/docs/core/components/combobox)Next[Dialog→](https://kobalte.dev/docs/core/components/dialog) \ No newline at end of file diff --git a/.firecrawl/kobalte.dev-docs-core-components-dropdown-menu.md b/.firecrawl/kobalte.dev-docs-core-components-dropdown-menu.md deleted file mode 100644 index fe2d7bf..0000000 --- a/.firecrawl/kobalte.dev-docs-core-components-dropdown-menu.md +++ /dev/null @@ -1,735 +0,0 @@ -# Dropdown Menu - -Displays a menu to the user —such as a set of actions or functions— triggered by a button. - -## Import - -``` -Copyts -import { DropdownMenu } from "@kobalte/core/dropdown-menu"; -// or -import { Root, Trigger, ... } from "@kobalte/core/dropdown-menu"; -// or (deprecated) -import { DropdownMenu } from "@kobalte/core"; -``` - -``` -Copyts -import { DropdownMenu } from "@kobalte/core/dropdown-menu"; -// or -import { Root, Trigger, ... } from "@kobalte/core/dropdown-menu"; -// or (deprecated) -import { DropdownMenu } from "@kobalte/core"; -``` - -## Features - -- Exposed to assistive technology as a button with a menu using the [WAI ARIA Menu Button](https://www.w3.org/WAI/ARIA/apg/patterns/menubutton/) design pattern. -- Supports modal and non-modal modes. -- Supports submenus. -- Supports items, labels, groups of items. -- Supports checkable items (single or multiple) with optional indeterminate state. -- Support disabled items. -- Complex item labeling support for accessibility. -- Keyboard opening and navigation support. -- Automatic scrolling support during keyboard navigation. -- Typeahead to allow focusing items by typing text. -- Optionally render a pointing arrow. -- Focus is fully managed. -- Can be controlled or uncontrolled. - -## Anatomy - -The dropdown menu consists of: - -- **DropdownMenu:** The root container for a dropdown menu. -- **DropdownMenu.Trigger:** The button that toggles the menu. -- **DropdownMenu.Icon:** A small icon often displayed next to the menu trigger as a visual affordance for the fact it can be open. -- **DropdownMenu.Portal:** Portals its children into the `body` when the menu is open. -- **DropdownMenu.Content:** Contains the content to be rendered when the menu is open. -- **DropdownMenu.Arrow:** An optional arrow element to render alongside the menu content. -- **DropdownMenu.Separator:** Used to visually separate items in the menu. -- **DropdownMenu.Group:** Used to group multiple items. Use in conjunction with `DropdownMenu.GroupLabel` to ensure good accessibility via automatic labelling. -- **DropdownMenu.GroupLabel:** Used to render the label of a group. It won't be focusable using arrow keys. -- **DropdownMenu.Sub:** Contains all the parts of a submenu. -- **DropdownMenu.SubTrigger:** An item that opens a submenu. Must be rendered inside `DropdownMenu.Sub`. -- **DropdownMenu.SubContent:** The component that pops out when a submenu is open. Must be rendered inside `DropdownMenu.Sub`. - -The menu item consists of: - -- **DropdownMenu.Item:** An item of the select. -- **DropdownMenu.ItemLabel:** An accessible label to be announced for the item. -- **DropdownMenu.ItemDescription:** An optional accessible description to be announced for the item. -- **DropdownMenu.ItemIndicator:** The visual indicator rendered when the item is checked. - -The checkable menu item consists of: - -- **DropdownMenu.RadioGroup:** Used to group multiple `DropdownMenu.RadioItem`s and manage the selection. -- **DropdownMenu.RadioItem:** An item that can be controlled and rendered like a radio. -- **DropdownMenu.CheckboxItem:** An item that can be controlled and rendered like a checkbox. - -``` -Copytsx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -``` - -``` -Copytsx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -``` - -## Example - -Git SettingsChevron - -index.tsxstyle.css - -``` -Copytsx -import { DropdownMenu } from "@kobalte/core/dropdown-menu"; -import { createSignal } from "solid-js"; -import { CheckIcon, ChevronDownIcon, ChevronRightIcon, DotFilledIcon } from "some-icon-library"; -import "./style.css"; - -function App() { - const [showGitLog, setShowGitLog] = createSignal(true); - const [showHistory, setShowHistory] = createSignal(false); - const [branch, setBranch] = createSignal("main"); - - return ( - - - Git Settings - - - - - - - - Commit - - - Push - - - Update Project - - - - GitHub - - - - - - Create Pull Request… - - - View Pull Requests - - - Sync Fork - - - - Open on GitHub - - - - - - - - - - - - Show Git Log - - - - - - Show History - - - - - - - Branches - - - - - - - main - - - - - - develop - - - - - - - - - ); -} -``` - -``` -Copytsx -import { DropdownMenu } from "@kobalte/core/dropdown-menu"; -import { createSignal } from "solid-js"; -import { CheckIcon, ChevronDownIcon, ChevronRightIcon, DotFilledIcon } from "some-icon-library"; -import "./style.css"; - -function App() { - const [showGitLog, setShowGitLog] = createSignal(true); - const [showHistory, setShowHistory] = createSignal(false); - const [branch, setBranch] = createSignal("main"); - - return ( - - - Git Settings - - - - - - - - Commit - - - Push - - - Update Project - - - - GitHub - - - - - - Create Pull Request… - - - View Pull Requests - - - Sync Fork - - - - Open on GitHub - - - - - - - - - - - - Show Git Log - - - - - - Show History - - - - - - - Branches - - - - - - - main - - - - - - develop - - - - - - - - - ); -} -``` - -## Usage - -### Default open - -An initial, uncontrolled open value can be provided using the `defaultOpen` prop. - -``` -Copytsx -... -``` - -``` -Copytsx -... -``` - -### Controlled open - -The `open` prop can be used to make the open state controlled. The `onOpenChange` event is fired when the user presses the trigger, an item or interact outside, and receives the new value. - -Open - -``` -Copytsx -import { createSignal } from "solid-js"; - -function ControlledExample() { - const [open, setOpen] = createSignal(false); - - return ( - - {open() ? "Close" : "Open"} - - ... - - - ); -} -``` - -``` -Copytsx -import { createSignal } from "solid-js"; - -function ControlledExample() { - const [open, setOpen] = createSignal(false); - - return ( - - {open() ? "Close" : "Open"} - - ... - - - ); -} -``` - -### Origin-aware animations - -We expose a CSS custom property `--kb-menu-content-transform-origin` which can be used to animate the content from its computed origin. - -``` -Copycss -/* style.css */ -.dropdown-menu__content, -.dropdown-menu__sub-content { - transform-origin: var(--kb-menu-content-transform-origin); - animation: contentHide 250ms ease-in forwards; -} - -.dropdown-menu__content[data-expanded], -.dropdown-menu__sub-content[data-expanded] { - animation: contentShow 250ms ease-out; -} - -@keyframes contentShow { - from { - opacity: 0; - transform: scale(0.96); - } - to { - opacity: 1; - transform: scale(1); - } -} - -@keyframes contentHide { - from { - opacity: 1; - transform: scale(1); - } - to { - opacity: 0; - transform: scale(0.96); - } -} -``` - -``` -Copycss -/* style.css */ -.dropdown-menu__content, -.dropdown-menu__sub-content { - transform-origin: var(--kb-menu-content-transform-origin); - animation: contentHide 250ms ease-in forwards; -} - -.dropdown-menu__content[data-expanded], -.dropdown-menu__sub-content[data-expanded] { - animation: contentShow 250ms ease-out; -} - -@keyframes contentShow { - from { - opacity: 0; - transform: scale(0.96); - } - to { - opacity: 1; - transform: scale(1); - } -} - -@keyframes contentHide { - from { - opacity: 1; - transform: scale(1); - } - to { - opacity: 0; - transform: scale(0.96); - } -} -``` - -## API Reference - -### DropdownMenu - -`DropdownMenu` is equivalent to the `Root` import from `@kobalte/core/dropdown-menu` (and deprecated `DropdownMenu.Root`). - -| Prop | Description | -| --- | --- | -| open | `boolean`
    The controlled open state of the menu. | -| defaultOpen | `boolean`
    The default open state when initially rendered. Useful when you do not need to control the open state. | -| onOpenChange | `(open: boolean) => void`
    Event handler called when the open state of the menu changes. | -| id | `string`
    A unique identifier for the component. The id is used to generate id attributes for nested components. If no id prop is provided, a generated id will be used. | -| modal | `boolean`
    Whether the menu should be the only visible content for screen readers, when set to `true`:
    \- interaction with outside elements will be disabled.
    \- scroll will be locked.
    \- focus will be locked inside the menu content.
    \- elements outside the menu content will not be visible for screen readers. | -| preventScroll | `boolean`
    Whether the scroll should be locked even if the menu is not modal. | -| forceMount | `boolean`
    Used to force mounting the menu (portal and content) when more control is needed. Useful when controlling animation with SolidJS animation libraries. | - -`DropdownMenu` also accepts the following props to customize the placement of the `DropdownMenu.Content`. - -| Prop | Description | -| --- | --- | -| getAnchorRect | `(anchor?: HTMLElement) => AnchorRect | undefined`
    Function that returns the trigger element's DOMRect. | -| placement | `Placement`
    The placement of the menu content. | -| gutter | `number`
    The distance between the menu content and the trigger element. By default, it's 0 plus half of the arrow offset, if it exists. | -| shift | `number`
    The skidding of the menu content along the trigger element. | -| flip | `boolean | string`
    Controls the behavior of the menu content when it overflows the viewport:
    \- If a `boolean`, specifies whether the menu content should flip to the opposite side when it overflows.
    \- If a `string`, indicates the preferred fallback placements when it overflows.
    The placements must be spaced-delimited, e.g. "top left". | -| slide | `boolean`
    Whether the menu content should slide when it overflows. | -| overlap | `boolean`
    Whether the menu content can overlap the trigger element when it overflows. | -| sameWidth | `boolean`
    Whether the menu content should have the same width as the trigger element. This will be exposed to CSS as `--kb-popper-anchor-width`. | -| fitViewport | `boolean`
    Whether the menu content should fit the viewport. If this is set to true, the menu content will have `maxWidth` and `maxHeight` set to the viewport size. This will be exposed to CSS as `--kb-popper-content-available-width` and `--kb-popper-content-available-height`. | -| hideWhenDetached | `boolean`
    Whether to hide the menu content when the trigger element becomes occluded. | -| detachedPadding | `number`
    The minimum padding in order to consider the trigger element occluded. | -| arrowPadding | `number`
    The minimum padding between the arrow and the menu content corner. | -| overflowPadding | `number`
    The minimum padding between the menu content and the viewport edge. This will be exposed to CSS as `--kb-popper-overflow-padding`. | - -### DropdownMenu.Trigger - -`DropdownMenu.Trigger` consists of [Button](https://kobalte.dev/docs/core/components/button). - -| Data attribute | Description | -| --- | --- | -| data-expanded | Present when the menu is open. | -| data-closed | Present when the menu is close. | - -`DropdownMenu.Icon`, `DropdownMenu.Content`, `DropdownMenu.SubTrigger` and `DropdownMenu.SubContent` share the same data-attributes. - -### DropdownMenu.Content - -The popper positioner will copy the same `z-index` as the `DropdownMenu.Content`. - -| Prop | Description | -| --- | --- | -| onOpenAutoFocus | `(event: Event) => void`
    Event handler called when focus moves into the component after opening. It can be prevented by calling `event.preventDefault`. | -| onCloseAutoFocus | `(event: Event) => void`
    Event handler called when focus moves to the trigger after closing. It can be prevented by calling `event.preventDefault`. | -| onEscapeKeyDown | `(event: KeyboardEvent) => void`
    Event handler called when the escape key is down. It can be prevented by calling `event.preventDefault`. | -| onPointerDownOutside | `(event: PointerDownOutsideEvent) => void`
    Event handler called when a pointer event occurs outside the bounds of the component. It can be prevented by calling `event.preventDefault`. | -| onFocusOutside | `(event: FocusOutsideEvent) => void`
    Event handler called when the focus moves outside the bounds of the component. It can be prevented by calling `event.preventDefault`. | -| onInteractOutside | `(event: InteractOutsideEvent) => void`
    Event handler called when an interaction (pointer or focus event) happens outside the bounds of the component. It can be prevented by calling `event.preventDefault`. | - -### DropdownMenu.Arrow - -| Prop | Description | -| --- | --- | -| size | `number`
    The size of the arrow. | - -### DropdownMenu.Item - -| Prop | Description | -| --- | --- | -| textValue | `string`
    Optional text used for typeahead purposes. By default, the typeahead behavior will use the .textContent of the `DropdownMenu.ItemLabel` part if provided, or fallback to the .textContent of the `DropdownMenu.Item`. Use this when the content is complex, or you have non-textual content inside. | -| disabled | `boolean`
    Whether the item is disabled or not. | -| closeOnSelect | `boolean`
    Whether the menu should close when the item is activated. | -| onSelect | `() => void`
    Event handler called when the user selects an item (via mouse or keyboard). | - -| Data attribute | Description | -| --- | --- | -| data-disabled | Present when the item is disabled. | -| data-highlighted | Present when the item is highlighted. | - -`DropdownMenu.ItemLabel`, `DropdownMenu.ItemDescription` and `DropdownMenu.ItemIndicator` shares the same data-attributes. - -### DropdownMenu.ItemIndicator - -| Prop | Description | -| --- | --- | -| forceMount | `boolean`
    Used to force mounting when more control is needed. Useful when controlling animation with SolidJS animation libraries. | - -### DropdownMenu.RadioGroup - -| Prop | Description | -| --- | --- | -| value | `string`
    The controlled value of the menu radio item to check. | -| defaultValue | `string`
    The value of the menu radio item that should be checked when initially rendered. Useful when you do not need to control the state of the radio group. | -| onChange | `(value: string) => void`
    Event handler called when the value changes. | -| disabled | `boolean`
    Whether the radio group is disabled or not. | - -### DropdownMenu.RadioItem - -| Prop | Description | -| --- | --- | -| value | `string`
    The value of the menu item radio. | -| textValue | `string`
    Optional text used for typeahead purposes. By default, the typeahead behavior will use the .textContent of the `DropdownMenu.ItemLabel` part if provided, or fallback to the .textContent of the `DropdownMenu.Item`. Use this when the content is complex, or you have non-textual content inside. | -| disabled | `boolean`
    Whether the item is disabled or not. | -| closeOnSelect | `boolean`
    Whether the menu should close when the item is checked. | -| onSelect | `() => void`
    Event handler called when the user selects an item (via mouse or keyboard). | - -| Data attribute | Description | -| --- | --- | -| data-disabled | Present when the item is disabled. | -| data-checked | Present when the item is checked. | -| data-highlighted | Present when the item is highlighted. | - -### DropdownMenu.CheckboxItem - -| Prop | Description | -| --- | --- | -| checked | `boolean`
    The controlled checked state of the item. | -| defaultChecked | `boolean`
    The default checked state when initially rendered. Useful when you do not need to control the checked state. | -| onChange | `(checked: boolean) => void`
    Event handler called when the checked state of the item changes. | -| textValue | `string`
    Optional text used for typeahead purposes. By default, the typeahead behavior will use the .textContent of the `DropdownMenu.ItemLabel` part if provided, or fallback to the .textContent of the `DropdownMenu.Item`. Use this when the content is complex, or you have non-textual content inside. | -| indeterminate | `boolean`
    Whether the item is in an indeterminate state. | -| disabled | `boolean`
    Whether the item is disabled or not. | -| closeOnSelect | `boolean`
    Whether the menu should close when the item is checked/unchecked. | -| onSelect | `() => void`
    Event handler called when the user selects an item (via mouse or keyboard). | - -| Data attribute | Description | -| --- | --- | -| data-disabled | Present when the item is disabled. | -| data-indeterminate | Present when the item is in an indeterminate state. | -| data-checked | Present when the item is checked. | -| data-highlighted | Present when the item is highlighted. | - -### DropdownMenu.Sub - -| Prop | Description | -| --- | --- | -| open | `boolean`
    The controlled open state of the sub menu. | -| defaultOpen | `boolean`
    The default open state when initially rendered. Useful when you do not need to control the open state. | -| onOpenChange | `(open: boolean) => void`
    Event handler called when the open state of the sub menu changes. | - -`DropdownMenu.Sub` also accepts the following props to customize the placement of the `DropdownMenu.SubContent`. - -| Prop | Description | -| --- | --- | -| getAnchorRect | `(anchor?: HTMLElement) => AnchorRect | undefined`
    Function that returns the trigger element's DOMRect. | -| gutter | `number`
    The distance between the sub menu content and the trigger element. By default, it's 0 plus half of the arrow offset, if it exists. | -| shift | `number`
    The skidding of the sub menu content along the trigger element. | -| slide | `boolean`
    Whether the sub menu content should slide when it overflows. | -| overlap | `boolean`
    Whether the sub menu content can overlap the trigger element when it overflows. | -| fitViewport | `boolean`
    Whether the sub menu content should fit the viewport. If this is set to true, the sub menu content will have `maxWidth` and `maxHeight` set to the viewport size. This will be exposed to CSS as `--kb-popper-content-available-width` and `--kb-popper-content-available-height`. | -| hideWhenDetached | `boolean`
    Whether to hide the sub menu content when the trigger element becomes occluded. | -| detachedPadding | `number`
    The minimum padding in order to consider the trigger element occluded. | -| arrowPadding | `number`
    The minimum padding between the arrow and the sub menu content corner. | -| overflowPadding | `number`
    The minimum padding between the sub menu content and the viewport edge. This will be exposed to CSS as `--kb-popper-overflow-padding`. | - -### DropdownMenu.SubTrigger - -| Prop | Description | -| --- | --- | -| textValue | `string`
    Optional text used for typeahead purposes. By default, the typeahead behavior will use the .textContent of the `DropdownMenu.SubTrigger`. Use this when the content is complex, or you have non-textual content inside. | -| disabled | `boolean`
    Whether the sub menu trigger is disabled or not. | - -| Data attribute | Description | -| --- | --- | -| data-disabled | Present when the item is disabled. | -| data-highlighted | Present when the item is highlighted. | - -### DropdownMenu.SubContent - -| Prop | Description | -| --- | --- | -| onEscapeKeyDown | `(event: KeyboardEvent) => void`
    Event handler called when the escape key is down. It can be prevented by calling `event.preventDefault`. | -| onPointerDownOutside | `(event: PointerDownOutsideEvent) => void`
    Event handler called when a pointer event occurs outside the bounds of the component. It can be prevented by calling `event.preventDefault`. | -| onFocusOutside | `(event: FocusOutsideEvent) => void`
    Event handler called when the focus moves outside the bounds of the component. It can be prevented by calling `event.preventDefault`. | -| onInteractOutside | `(event: InteractOutsideEvent) => void`
    Event handler called when an interaction (pointer or focus event) happens outside the bounds of the component. It can be prevented by calling `event.preventDefault`. | - -## Rendered elements - -| Component | Default rendered element | -| --- | --- | -| `DropdownMenu` | none | -| `DropdownMenu.Trigger` | `button` | -| `DropdownMenu.Icon` | `span` | -| `DropdownMenu.Portal` | `Portal` | -| `DropdownMenu.Content` | `div` | -| `DropdownMenu.Arrow` | `div` | -| `DropdownMenu.Separator` | `hr` | -| `DropdownMenu.Group` | `div` | -| `DropdownMenu.GroupLabel` | `span` | -| `DropdownMenu.Sub` | none | -| `DropdownMenu.SubTrigger` | `div` | -| `DropdownMenu.SubContent` | `div` | -| `DropdownMenu.Item` | `div` | -| `DropdownMenu.ItemLabel` | `div` | -| `DropdownMenu.ItemDescription` | `div` | -| `DropdownMenu.ItemIndicator` | `div` | -| `DropdownMenu.RadioGroup` | `div` | -| `DropdownMenu.RadioItem` | `div` | -| `DropdownMenu.CheckboxItem` | `div` | - -## Accessibility - -### Keyboard Interactions - -| Key | Description | -| --- | --- | -| `Space` | When focus is on the trigger, opens the menu and focuses the first item.
    When focus is on an item, activates the item. | -| `Enter` | When focus is on the trigger, opens the menu and focuses the first item.
    When focus is on an item, activates the item. | -| `ArrowDown` | When focus is on the trigger, opens the menu and focuses the first item.
    When focus is on an item, moves focus to the next item. | -| `ArrowUp` | When focus is on the trigger, opens the menu and focuses the last item.
    When focus is on an item, moves focus to the previous item. | -| `ArrowRight` / `ArrowLeft` | When focus is on a sub menu trigger, opens or closes the submenu depending on reading direction. | -| `Home` | When focus is on an item, moves focus to first item. | -| `End` | When focus is on an item, moves focus to last item. | -| `Esc` | Closes the menu and moves focus to the trigger. | - -Previous[←Dialog](https://kobalte.dev/docs/core/components/dialog)Next[File Field→](https://kobalte.dev/docs/core/components/file-field) \ No newline at end of file diff --git a/.firecrawl/kobalte.dev-docs-core-components-hover-card.md b/.firecrawl/kobalte.dev-docs-core-components-hover-card.md deleted file mode 100644 index 63a23cb..0000000 --- a/.firecrawl/kobalte.dev-docs-core-components-hover-card.md +++ /dev/null @@ -1,331 +0,0 @@ -# Hover Card - -Allows sighted users to preview content available behind a link. - -## Import - -``` -Copyts -import { HoverCard } from "@kobalte/core/hover-card"; -// or -import { Root, Trigger, ... } from "@kobalte/core/hover-card"; -// or (deprecated) -import { HoverCard } from "@kobalte/core"; -``` - -``` -Copyts -import { HoverCard } from "@kobalte/core/hover-card"; -// or -import { Root, Trigger, ... } from "@kobalte/core/hover-card"; -// or (deprecated) -import { HoverCard } from "@kobalte/core"; -``` - -## Features - -- Opens on hover only. -- Supports custom open and close delays. -- Optionally render a pointing arrow. -- Ignored by screen readers. -- Can be controlled or uncontrolled. - -## Anatomy - -The hovercard consists of: - -- **HoverCard:** The root container for a hovercard. -- **HoverCard.Trigger:** The link that opens the hovercard. -- **HoverCard.Portal:** Portals its children into the `body` when the hovercard is open. -- **HoverCard.Content:** Contains the content to be rendered when the hovercard is open. -- **HoverCard.Arrow:** An optional arrow element to render alongside the hovercard. - -``` -Copytsx - - - - - - - - -``` - -``` -Copytsx - - - - - - - - -``` - -## Example - -[@MLFabien](https://twitter.com/mlfabien) - -index.tsxstyle.css - -``` -Copytsx -import { HoverCard } from "@kobalte/core/hover-card"; -import "./style.css"; - -function App() { - return ( - - - @MLFabien - - - - - Fabien MARIE-LOUISE -

    Fabien MARIE-LOUISE

    -

    - Developer and UI Design enthusiast. Building UI related stuffs for @solid_js -

    -
    -
    -
    - ); -} -``` - -``` -Copytsx -import { HoverCard } from "@kobalte/core/hover-card"; -import "./style.css"; - -function App() { - return ( - - - @MLFabien - - - - - Fabien MARIE-LOUISE -

    Fabien MARIE-LOUISE

    -

    - Developer and UI Design enthusiast. Building UI related stuffs for @solid_js -

    -
    -
    -
    - ); -} -``` - -## Usage - -### Default open - -An initial, uncontrolled open value can be provided using the `defaultOpen` prop. - -``` -Copytsx -... -``` - -``` -Copytsx -... -``` - -### Controlled open - -The `open` prop can be used to make the open state controlled. The `onOpenChange` event is fired when the user pointer enter or leave the trigger, and receives the new value. - -``` -Copytsx -import { createSignal } from "solid-js"; - -function ControlledExample() { - const [open, setOpen] = createSignal(false); - - return ( - - ... - - ); -} -``` - -``` -Copytsx -import { createSignal } from "solid-js"; - -function ControlledExample() { - const [open, setOpen] = createSignal(false); - - return ( - - ... - - ); -} -``` - -### Origin-aware animations - -We expose a CSS custom property `--kb-hovercard-content-transform-origin` which can be used to animate the content from its computed origin. - -``` -Copycss -/* style.css */ -.hovercard__content { - transform-origin: var(--kb-hovercard-content-transform-origin); - animation: contentHide 250ms ease-in forwards; -} - -.hovercard__content[data-expanded] { - animation: contentShow 250ms ease-out; -} - -@keyframes contentShow { - from { - opacity: 0; - transform: scale(0.96); - } - to { - opacity: 1; - transform: scale(1); - } -} - -@keyframes contentHide { - from { - opacity: 1; - transform: scale(1); - } - to { - opacity: 0; - transform: scale(0.96); - } -} -``` - -``` -Copycss -/* style.css */ -.hovercard__content { - transform-origin: var(--kb-hovercard-content-transform-origin); - animation: contentHide 250ms ease-in forwards; -} - -.hovercard__content[data-expanded] { - animation: contentShow 250ms ease-out; -} - -@keyframes contentShow { - from { - opacity: 0; - transform: scale(0.96); - } - to { - opacity: 1; - transform: scale(1); - } -} - -@keyframes contentHide { - from { - opacity: 1; - transform: scale(1); - } - to { - opacity: 0; - transform: scale(0.96); - } -} -``` - -## API Reference - -### HoverCard - -`HoverCard` is equivalent to the `Root` import from `@kobalte/core/hover-card` (and deprecated `HoverCard.Root`). - -| Prop | Description | -| --- | --- | -| open | `boolean`
    The controlled open state of the hovercard. | -| defaultOpen | `boolean`
    The default open state when initially rendered. Useful when you do not need to control the open state. | -| onOpenChange | `(open: boolean) => void`
    Event handler called when the open state of the hovercard changes. | -| openDelay | `number`
    The duration from when the mouse enters the trigger until the hovercard opens. | -| closeDelay | `number`
    The duration from when the mouse leaves the trigger or content until the hovercard closes. | -| ignoreSafeArea | `boolean`
    Whether to close the hovercard even if the user cursor is inside the safe area between the trigger and hovercard. | -| id | `string`
    A unique identifier for the component. The id is used to generate id attributes for nested components. If no id prop is provided, a generated id will be used. | -| forceMount | `boolean`
    Used to force mounting the hovercard (portal and content) when more control is needed. Useful when controlling animation with SolidJS animation libraries. | - -`HoverCard` also accepts the following props to customize the placement of the `HoverCard.Content`. - -| Prop | Description | -| --- | --- | -| getAnchorRect | `(anchor?: HTMLElement) => AnchorRect | undefined`
    Function that returns the anchor element's DOMRect. | -| placement | `Placement`
    The placement of the hovercard. | -| gutter | `number`
    The distance between the hovercard and the trigger element. By default, it's 0 plus half of the arrow offset, if it exists. | -| shift | `number`
    The skidding of the hovercard along the trigger element. | -| flip | `boolean | string`
    Controls the behavior of the hovercard when it overflows the viewport:
    \- If a `boolean`, specifies whether the hovercard should flip to the opposite side when it overflows.
    \- If a `string`, indicates the preferred fallback placements when it overflows.
    The placements must be spaced-delimited, e.g. "top left". | -| slide | `boolean`
    Whether the hovercard should slide when it overflows. | -| overlap | `boolean`
    Whether the hovercard can overlap the trigger element when it overflows. | -| sameWidth | `boolean`
    Whether the hovercard should have the same width as the trigger element. This will be exposed to CSS as `--kb-popper-anchor-width`. | -| fitViewport | `boolean`
    Whether the hovercard should fit the viewport. If this is set to true, the hovercard content will have `maxWidth` and `maxHeight` set to the viewport size. This will be exposed to CSS as `--kb-popper-available-width` and `--kb-popper-available-height`. | -| hideWhenDetached | `boolean`
    Whether to hide the hovercard when the trigger element becomes occluded. | -| detachedPadding | `number`
    The minimum padding in order to consider the trigger element occluded. | -| arrowPadding | `number`
    The minimum padding between the arrow and the hovercard corner. | -| overflowPadding | `number`
    The minimum padding between the hovercard and the viewport edge. This will be exposed to CSS as `--kb-popper-overflow-padding`. | - -### HoverCard.Content - -The popper positioner will copy the same `z-index` as the `HoverCard.Content`. - -### HoverCard.Trigger - -`HoverCard.Trigger` consists of [Link](https://kobalte.dev/docs/core/components/link). - -| Data attribute | Description | -| --- | --- | -| data-expanded | Present when the hovercard is open. | -| data-closed | Present when the hovercard is close. | - -`HoverCard.Content` share the same data-attributes. - -## Rendered elements - -| Component | Default rendered element | -| --- | --- | -| `HoverCard` | none | -| `HoverCard.Trigger` | `a` | -| `HoverCard.Portal` | `Portal` | -| `HoverCard.Content` | `div` | -| `HoverCard.Arrow` | `div` | - -## Accessibility - -### Keyboard Interactions - -The hover card is intended for mouse users only so will not respond to keyboard navigation. - -Previous[←File Field](https://kobalte.dev/docs/core/components/file-field)Next[Image→](https://kobalte.dev/docs/core/components/image) \ No newline at end of file diff --git a/.firecrawl/kobalte.dev-docs-core-components-i18n-provider.md b/.firecrawl/kobalte.dev-docs-core-components-i18n-provider.md deleted file mode 100644 index 05e51d3..0000000 --- a/.firecrawl/kobalte.dev-docs-core-components-i18n-provider.md +++ /dev/null @@ -1,97 +0,0 @@ -# I18nProvider - -Provides the locale for the application to all child components. - -## Import - -``` -Copytsx -import { I18nProvider, useLocale } from "@kobalte/core/i18n"; -// or (deprecated) -import { I18nProvider, useLocale } from "@kobalte/core"; -``` - -``` -Copytsx -import { I18nProvider, useLocale } from "@kobalte/core/i18n"; -// or (deprecated) -import { I18nProvider, useLocale } from "@kobalte/core"; -``` - -## Usage - -`I18nProvider` allows you to override the default locale as determined by the browser/system setting with a locale defined by your application (e.g. application setting). - -This should be done by wrapping your entire application in the provider, which will cause all child elements to receive the new locale information via the `useLocale` primitive. - -``` -Copytsx -import { I18nProvider } from "@kobalte/core/i18n"; - - - -; -``` - -``` -Copytsx -import { I18nProvider } from "@kobalte/core/i18n"; - - - -; -``` - -### The `useLocale` primitive - -`useLocale` allows components to access the current locale and interface layout direction. It should be used in the root of your app to define the lang and dir attributes so that the browser knows which language and direction the user interface should be rendered in. - -``` -Copytsx -import { useLocale } from "@kobalte/core/i18n"; - -function YourApp() { - const { locale, direction } = useLocale(); - - return ( -
    - {/* your app here */} -
    - ); -} -``` - -``` -Copytsx -import { useLocale } from "@kobalte/core/i18n"; - -function YourApp() { - const { locale, direction } = useLocale(); - - return ( -
    - {/* your app here */} -
    - ); -} -``` - -## API reference - -### I18nProvider - -| Prop | Description | -| --- | --- | -| locale | `string`
    The locale to apply to the children. | -| children | `JSX.Element`
    The contents that should have the locale applied. | - -### useLocale - -The `useLocale` primitive returns the follows properties. - -| Name | Description | -| --- | --- | -| locale | `Accessor`
    The [BCP47](https://www.ietf.org/rfc/bcp/bcp47.txt) language code for the locale. | -| direction | `Accessor`
    The writing direction for the locale. | - -Previous[←Tooltip](https://kobalte.dev/docs/core/components/tooltip)Next→ \ No newline at end of file diff --git a/.firecrawl/kobalte.dev-docs-core-components-image.md b/.firecrawl/kobalte.dev-docs-core-components-image.md deleted file mode 100644 index e0c0dd5..0000000 --- a/.firecrawl/kobalte.dev-docs-core-components-image.md +++ /dev/null @@ -1,160 +0,0 @@ -# Image - -An image element with an optional fallback for loading and error status. - -## Import - -``` -Copyts -import { Image } from "@kobalte/core/image"; -// or -import { Root, Img, ... } from "@kobalte/core/image"; -// or (deprecated) -import { Image } from "@kobalte/core"; -``` - -``` -Copyts -import { Image } from "@kobalte/core/image"; -// or -import { Root, Img, ... } from "@kobalte/core/image"; -// or (deprecated) -import { Image } from "@kobalte/core"; -``` - -## Features - -- Automatic and manual control over when the image renders. -- Fallback part accepts any children. -- Optionally delay fallback rendering to avoid content flashing. - -## Anatomy - -The image consists of: - -- **Image:** The root container for an image. -- **Image.Img:** The image to render. By default, it will only render when it has loaded. -- **Image.Fallback:** An element that renders when the image hasn't loaded. This means whilst it's loading, or if there was an error. - -``` -Copytsx - - - - -``` - -``` -Copytsx - - - - -``` - -## Example - -![Nicole Steeves](https://randomuser.me/api/portraits/women/44.jpg)MD - -index.tsxstyle.css - -``` -Copytsx -import { Image } from "@kobalte/core/image"; -import "./style.css"; - -function App() { - return ( - <> - - - NS - - - MD - - - ); -} -``` - -``` -Copytsx -import { Image } from "@kobalte/core/image"; -import "./style.css"; - -function App() { - return ( - <> - - - NS - - - MD - - - ); -} -``` - -## Usage - -### Avoid flash during loading - -By default `Image.Fallback` will render when the image hasn't loaded. This means whilst it's loading, or if there was an error. - -If you notice a flash during loading, use the `fallbackDelay` prop to delay its rendering, so it only renders for those with slower internet connections. - -``` -Copytsx - - - NS - -``` - -``` -Copytsx - - - NS - -``` - -## API Reference - -### Image - -`Image` is equivalent to the `Root` import from `@kobalte/core/image` (and deprecated `Image.Root`). - -| Prop | Description | -| --- | --- | -| fallbackDelay | `number`
    The delay (in ms) before displaying the image fallback. Useful if you notice a flash during loading for delaying rendering, so it only appears for those with slower internet connections. | -| onLoadingStatusChange | `(status: "idle" | "loading" | "loaded" | "error") => void`
    A callback providing information about the loading status of the image. This is useful in case you want to control more precisely what to render as the image is loading. | - -## Rendered elements - -| Component | Default rendered element | -| --- | --- | -| `Image` | `span` | -| `Image.Img` | `img` | -| `Image.Fallback` | `span` | - -Previous[←Hover Card](https://kobalte.dev/docs/core/components/hover-card)Next[Link→](https://kobalte.dev/docs/core/components/link) \ No newline at end of file diff --git a/.firecrawl/kobalte.dev-docs-core-components-link.md b/.firecrawl/kobalte.dev-docs-core-components-link.md deleted file mode 100644 index 087c36b..0000000 --- a/.firecrawl/kobalte.dev-docs-core-components-link.md +++ /dev/null @@ -1,131 +0,0 @@ -# Link - -Allows a user to navigate to another page or resource within a web page or application. - -## Import - -``` -Copyts -import { Link } from "@kobalte/core/link"; -// or -import { Root } from "@kobalte/core/link"; -// or (deprecated) -import { Link } from "@kobalte/core"; -``` - -``` -Copyts -import { Link } from "@kobalte/core/link"; -// or -import { Root } from "@kobalte/core/link"; -// or (deprecated) -import { Link } from "@kobalte/core"; -``` - -## Features - -- Native HTML `
    ` element support. -- Custom element type support via the [WAI ARIA Link](https://www.w3.org/WAI/ARIA/apg/patterns/link/) design pattern. -- Support for disabled links. - -## Anatomy - -The link consists of: - -- **Link:** The root container for a link. - -``` -Copytsx - -``` - -``` -Copytsx - -``` - -## Example - -[Kobalte](https://kobalte.dev/) - -index.tsxstyle.css - -``` -Copytsx -import { Link } from "@kobalte/core/link"; -import "./style.css"; - -function App() { - return ( - - Kobalte - - ); -} -``` - -``` -Copytsx -import { Link } from "@kobalte/core/link"; -import "./style.css"; - -function App() { - return ( - - Kobalte - - ); -} -``` - -## Usage - -### Disabled state - -Use the `disabled` prop to disable a link while keeping it accessible for screen readers. - -Kobalte - -``` -Copytsx - - Kobalte - -``` - -``` -Copytsx - - Kobalte - -``` - -## API Reference - -### Link - -`Link` is equivalent to the `Root` import from `@kobalte/core/link` (and deprecated `Link.Root`). - -| Prop | Description | -| --- | --- | -| disabled | `boolean`
    Whether the link is disabled. Native navigation will be disabled, and the link will be exposed as disabled to assistive technology. | - -| Data attribute | Description | -| --- | --- | -| data-disabled | Present when the link is disabled. | - -## Rendered elements - -| Component | Default rendered element | -| --- | --- | -| `Link` | `a` | - -## Accessibility - -### Keyboard Interactions - -| Key | Description | -| --- | --- | -| `Enter` | Activates the link. | - -Previous[←Image](https://kobalte.dev/docs/core/components/image)Next[Menubar→](https://kobalte.dev/docs/core/components/menubar) \ No newline at end of file diff --git a/.firecrawl/kobalte.dev-docs-core-components-meter.md b/.firecrawl/kobalte.dev-docs-core-components-meter.md deleted file mode 100644 index f5ae214..0000000 --- a/.firecrawl/kobalte.dev-docs-core-components-meter.md +++ /dev/null @@ -1,221 +0,0 @@ -# Meter - -Displays numeric value that varies within a defined range - -## Import - -``` -Copyts -import { Meter } from "@kobalte/core/meter"; -// or -import { Root, Label, ... } from "@kobalte/core/meter"; -``` - -``` -Copyts -import { Meter } from "@kobalte/core/meter"; -// or -import { Root, Label, ... } from "@kobalte/core/meter"; -``` - -## Features - -- Exposed to assistive technology as a meter via ARIA. -- Labeling support for accessibility. -- Internationalized number formatting as a percentage or value. - -## Anatomy - -The meter consists of: - -- **Meter:** The root container for a meter. -- **Meter.Label:** An accessible label that gives the user information on the meter. -- **Meter.ValueLabel:** The accessible label text representing the current value in a human-readable format. -- **Meter.Track:** The component that visually represents the meter track. -- **Meter.Fill:** The component that visually represents the meter value. - -``` -Copytsx - - - - - - - -``` - -``` -Copytsx - - - - - - - -``` - -## Example - -Battery Level: - -80% - -index.tsxstyle.css - -``` -Copytsx -import { Meter } from "@kobalte/core/meter"; -import "./style.css"; - -function App() { - return ( - -
    - Battery Level: - -
    - - - -
    - ); -} -``` - -``` -Copytsx -import { Meter } from "@kobalte/core/meter"; -import "./style.css"; - -function App() { - return ( - -
    - Battery Level: - -
    - - - -
    - ); -} -``` - -## Usage - -### Custom value scale - -By default, the `value` prop represents the current value of meter, as the minimum and maximum values default to 0 and 100, respectively. Alternatively, a different scale can be used by setting the `minValue` and `maxValue` props. - -Disk Space Usage: - -40% - -``` -Copytsx - -
    - Disk Space Usage: - -
    - - - -
    -``` - -``` -Copytsx - -
    - Disk Space Usage: - -
    - - - -
    -``` - -### Custom value label - -The `getValueLabel` prop allows the formatted value used in `Meter.ValueLabel` and ARIA to be replaced with a custom string. It receives the current value, min and max values as parameters. - -Processing... - -3 of 10 tasks completed - -``` -Copytsx - `${value} of ${max} tasks completed`} - class="meter" -> -
    - Processing... - -
    - - - -
    -``` - -``` -Copytsx - `${value} of ${max} tasks completed`} - class="meter" -> -
    - Processing... - -
    - - - -
    -``` - -### Meter fill width - -We expose a CSS custom property `--kb-meter-fill-width` which corresponds to the percentage of meterion (ex: 80%). If you are building a linear meter, you can use it to set the width of the `Meter.Fill` component in CSS. - -## API Reference - -### Meter - -`Meter` is equivalent to the `Root` import from `@kobalte/core/meter`. - -| Prop | Description | -| --- | --- | -| value | `number`
    The meter value. | -| minValue | `number`
    The minimum meter value. | -| maxValue | `number`
    The maximum meter value. | -| getValueLabel | `(params: { value: number; min: number; max: number }) => string`
    A function to get the accessible label text representing the current value in a human-readable format. If not provided, the value label will be read as a percentage of the max value. | - -| Data attribute | Description | -| --- | --- | - -`Meter.Label`, `Meter.ValueLabel`, `Meter.Track` and `Meter.Fill` shares the same data-attributes. - -## Rendered elements - -| Component | Default rendered element | -| --- | --- | -| `Meter` | `div` | -| `Meter.Label` | `span` | -| `Meter.ValueLabel` | `div` | -| `Meter.Track` | `div` | -| `Meter.Fill` | `div` | - -Previous[←Menubar](https://kobalte.dev/docs/core/components/menubar)Next[Navigation Menu→](https://kobalte.dev/docs/core/components/navigation-menu) \ No newline at end of file diff --git a/.firecrawl/kobalte.dev-docs-core-components-number-field.md b/.firecrawl/kobalte.dev-docs-core-components-number-field.md deleted file mode 100644 index c327d1b..0000000 --- a/.firecrawl/kobalte.dev-docs-core-components-number-field.md +++ /dev/null @@ -1,549 +0,0 @@ -# Number Field - -A number input that allow users to input custom number entries with a keyboard. - -## Import - -``` -Copyts -import { NumberField } from "@kobalte/core/number-field"; -// or -import { Root, Label, ... } from "@kobalte/core/number-field"; -// or (deprecated) -import { NumberField } from "@kobalte/core"; -``` - -``` -Copyts -import { NumberField } from "@kobalte/core/number-field"; -// or -import { Root, Label, ... } from "@kobalte/core/number-field"; -// or (deprecated) -import { NumberField } from "@kobalte/core"; -``` - -## Features - -- Follows the [WAI ARIA Spinbutton](https://www.w3.org/WAI/ARIA/apg/patterns/spinbutton/) design pattern. -- Built with a native `` element. -- Visual and ARIA labeling support. -- Required and invalid states exposed to assistive technology via ARIA. -- Support for description and error message help text linked to the input via ARIA. -- Syncs with form reset events. -- Can be controlled or uncontrolled. -- Supports increment and decrement buttons. -- Format and localize input number and raw input. -- Supports mouse wheel event and all keyboard events. -- Supports browser autofill. - -## Anatomy - -The number field consists of: - -- **NumberField**: The root container for the number field. -- **NumberField.Label**: The label that gives the user information on the number field. -- **NumberField.Input**: The native HTML input of the number field, used for display number. -- **NumberField.HiddenInput**: The native HTML input of the number field, used for raw number form submition. -- **NumberField.IncrementTrigger**: The increment button of the number field. -- **NumberField.DecrementTrigger**: The increment button of the number field. -- **NumberField.Description**: The description that gives the user more information on the number field. -- **NumberField.ErrorMessage**: The error message that gives the user information about how to fix a validation error on number field. - -``` -Copytsx - - - - - - - - - -``` - -``` -Copytsx - - - - - - - - - -``` - -## Example - -Quantity - -ArrowArrow - -index.tsxstyle.css - -``` -Copytsx -import { NumberField } from "@kobalte/core/number-field"; -import "./style.css"; - -function App() { - return ( - - - Quantity - -
    - - - -
    -
    - ); -} -``` - -``` -Copytsx -import { NumberField } from "@kobalte/core/number-field"; -import "./style.css"; - -function App() { - return ( - - - Quantity - -
    - - - -
    -
    - ); -} -``` - -## Usage - -### Default value - -An initial, uncontrolled value can be provided using the `defaultValue` prop. - -Quantity - -ArrowArrow - -``` -Copytsx - - Quantity -
    - - - -
    -
    -``` - -``` -Copytsx - - Quantity -
    - - - -
    -
    -``` - -### Controlled value - -The `value` and `rawValue` props can be used to make the value controlled. -It is recommended to only use the `rawValue` as it is of type `number`. -The `onChange` event is fired when the user type into the input and receive the new value. -The `onRawValueChange` prop is called when the value changes and receives a `number`. - -Quantity - -ArrowArrow - -Quantity: 40. Raw: 40. - -``` -Copytsx -import { createSignal } from "solid-js"; - -function ControlledExample() { - const [value, setValue] = createSignal("40"); - const [rawValue, setRawValue] = createSignal(); - - return ( - <> - - Quantity -
    - - - -
    -
    -

    - Quantity: {value()}. Raw: {rawValue()}. -

    - - ); -} -``` - -``` -Copytsx -import { createSignal } from "solid-js"; - -function ControlledExample() { - const [value, setValue] = createSignal("40"); - const [rawValue, setRawValue] = createSignal(); - - return ( - <> - - Quantity -
    - - - -
    -
    -

    - Quantity: {value()}. Raw: {rawValue()}. -

    - - ); -} -``` - -### Description - -The `NumberField.Description` component can be used to associate additional help text with a number field. - -Quantity - -ArrowArrow - -Choose a quantity. - -``` -Copytsx - - Quantity -
    - - - -
    - Choose a quantity. -
    -``` - -``` -Copytsx - - Quantity -
    - - - -
    - Choose a quantity. -
    -``` - -### Error message - -The `NumberField.ErrorMessage` component can be used to help the user fix a validation error. It should be combined with the `validationState` prop to semantically mark the text field as invalid for assistive technologies. - -By default, it will render only when the `validationState` prop is set to `invalid`, use the `forceMount` prop to always render the error message (ex: for usage with animation libraries). - -Quantity - -ArrowArrow - -Hmm, I prefer 40. - -``` -Copytsx -import { createSignal } from "solid-js"; - -function ErrorMessageExample() { - const [rawValue, setRawValue] = createSignal(); - - return ( - - Quantity -
    - - - -
    - Hmm, I prefer 40. -
    - ); -} -``` - -``` -Copytsx -import { createSignal } from "solid-js"; - -function ErrorMessageExample() { - const [rawValue, setRawValue] = createSignal(); - - return ( - - Quantity -
    - - - -
    - Hmm, I prefer 40. -
    - ); -} -``` - -### HTML forms - -The number field `name` prop along with `` can be used for integration with HTML forms. Only the raw value is passed to the form. - -If the formatted value is wanted (unrecommended) set the `name` attribute on ``. - -Quantity - -ArrowArrow - -ResetSubmit - -``` -Copytsx -function HTMLFormExample() { - const onSubmit = (e: SubmitEvent) => { - // handle form submission. - }; - - return ( -
    - - Quantity - -
    - - - -
    -
    -
    - - -
    -
    - ); -} -``` - -``` -Copytsx -function HTMLFormExample() { - const onSubmit = (e: SubmitEvent) => { - // handle form submission. - }; - - return ( -
    - - Quantity - -
    - - - -
    -
    -
    - - -
    -
    - ); -} -``` - -### Triggers - -The number field supports optional increment/decrement triggers that are easily customizable. - -Quantity - --+ - -``` -Copytsx - - Quantity -
    - - - - + -
    -
    -``` - -``` -Copytsx - - Quantity -
    - - - - + -
    -
    -``` - -### Format - -The value of the number field component can be formatted based on the [locale with the `I18NProvider`](https://kobalte.dev/docs/core/components/i18n-provider) and `formatOptions`. For more information see [React Spectrum NumberField](https://react-spectrum.adobe.com/react-spectrum/NumberField.html). - -Price - -ArrowArrow - -``` -Copytsx - - Price -
    - - - -
    -
    -``` - -``` -Copytsx - - Price -
    - - - -
    -
    -``` - -### Autofill - -The number field supports autofill through `NumberField.HiddenInput`. - -``` -Copytsx - - Quantity - -
    - - - -
    -
    -``` - -``` -Copytsx - - Quantity - -
    - - - -
    -
    -``` - -## API Reference - -### NumberField - -`NumberField` is equivalent to the `Root` import from `@kobalte/core/number-field` (and deprecated `NumberField.Root`). - -| Prop | Description | -| --- | --- | -| value | `string | number`
    The controlled formatted value of the number field. | -| defaultValue | `string | number`
    The default value when initially rendered. Useful when you do not need to control the value. | -| onChange | `(value: string) => void`
    Event handler called when the value of the NumberField changes as a formatted value. | -| rawValue | `number`
    The controlled raw value of the number field. | -| onRawValueChange | `(value: number) => void`
    Event handler called when the value of the NumberField changes as a number. | -| minValue | `number`
    The smallest value allowed in the number field, defaults to `Number.MIN_SAFE_INTEGER`. | -| maxValue | `number`
    The largest value allowed in the number field, defaults to `Number.MAX_SAFE_INTEGER`. | -| step | `number`
    Increment/Decrement step when using the triggers or the arrows on keyboard in the number field. | -| largeStep | `number`
    Increment/Decrement step when using the Page UP/Down keys in the number field, defaults `10 * step`. | -| changeOnWheel | `boolean`
    Whether to increment/decrement on wheel scroll inside the number field. | -| format | `boolean`
    Whether to format the input value. | -| formatOptions | [`Intl.NumberFormatOptions`](https://github.com/microsoft/TypeScript/blob/353ccb7688351ae33ccf6e0acb913aa30621eaf4/src/lib/es2020.intl.d.ts#L243-L251)
    Formating options for the value of the number field. | -| allowedInput | `RegExp`
    Allowed input characters in the number field (only prevents onInput, not paste), defaults to locale and format characters. | -| name | `string`
    The name of the NumberField.HiddenInput of the number field, used when submitting an HTML form. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefname). | -| validationState | `'valid' | 'invalid'`
    Whether the number field should display its "valid" or "invalid" visual styling. | -| required | `boolean`
    Whether the user must fill the number field before the owning form can be submitted. | -| disabled | `boolean`
    Whether the number field is disabled. | -| readOnly | `boolean`
    Whether the number field items can be selected but not changed by the user. | - -| Data attribute | Description | -| --- | --- | -| data-valid | Present when the number field is valid according to the validation rules. | -| data-invalid | Present when the number field is invalid according to the validation rules. | -| data-required | Present when the user must fill the number field before the owning form can be submitted. | -| data-disabled | Present when the number field is disabled. | -| data-readonly | Present when the number field is read only. | - -`NumberField.Label`, `NumberField.Input`, `NumberField.HiddenInput`, `NumberField.Description` and `NumberField.ErrorMesssage` share the same data-attributes. - -### NumberField.ErrorMessage - -| Prop | Description | -| --- | --- | -| forceMount | `boolean`
    Used to force mounting when more control is needed. Useful when controlling animation with SolidJS animation libraries. | - -## Rendered elements - -| Component | Default rendered element | -| --- | --- | -| `NumberField` | `div` | -| `NumberField.Label` | `label` | -| `NumberField.Input` | `input` | -| `NumberField.HiddenInput` | `input` | -| `NumberField.IncrementTrigger` | `button` | -| `NumberField.DecrementTrigger` | `button` | -| `NumberField.Description` | `div` | -| `NumberField.ErrorMessage` | `div` | - -Previous[←Navigation Menu](https://kobalte.dev/docs/core/components/navigation-menu)Next[Pagination→](https://kobalte.dev/docs/core/components/pagination) \ No newline at end of file diff --git a/.firecrawl/kobalte.dev-docs-core-components-pagination.md b/.firecrawl/kobalte.dev-docs-core-components-pagination.md deleted file mode 100644 index c2b44c4..0000000 --- a/.firecrawl/kobalte.dev-docs-core-components-pagination.md +++ /dev/null @@ -1,368 +0,0 @@ -# Pagination - -Allows the user to select a specific page from a range of pages. - -## Import - -``` -Copyts -import { Pagination } from "@kobalte/core/pagination"; -// or -import { Root, Item, ... } from "@kobalte/core/pagination"; -// or (deprecated) -import { Pagination } from "@kobalte/core"; -``` - -``` -Copyts -import { Pagination } from "@kobalte/core/pagination"; -// or -import { Root, Item, ... } from "@kobalte/core/pagination"; -// or (deprecated) -import { Pagination } from "@kobalte/core"; -``` - -## Features - -- Labeling support for accessibility. -- Tab focus management. -- Can be controlled or uncontrolled. -- Customizable appearance. - -## Anatomy - -The pagination consists of: - -- **Pagination:** The root container for the pagination component. -- **Pagination.Item:** An item of the pagination. -- **Pagination.Ellipsis:** Ellipsis item of the pagination. -- **Pagination.Previous:** Previous button of the pagination. -- **Pagination.Next:** Next button of the pagination. -- **Pagination.Items:** Contains the list of items and allows a user to select one of them. - -``` -Copytsx - - - - - -``` - -``` -Copytsx - - - - - -``` - -## Example - -index.tsxstyle.css - -``` -Copytsx -import { Pagination } from "@kobalte/core/pagination"; -import "./style.css"; - -function App() { - return ( - ( - {props.page} - )} - ellipsisComponent={() => ( - ... - )} - > - Previous - - Next - - ); -} -``` - -``` -Copytsx -import { Pagination } from "@kobalte/core/pagination"; -import "./style.css"; - -function App() { - return ( - ( - {props.page} - )} - ellipsisComponent={() => ( - ... - )} - > - Previous - - Next - - ); -} -``` - -## Usage - -### Default value - -An initial, uncontrolled page can be provided using the `defaultPage` prop, which accepts a number smaller or equal to the `count` and starts at 1. - -``` -Copytsx - {props.page}} - ellipsisComponent={() => ...} -> - Previous - - Next - -``` - -``` -Copytsx - {props.page}} - ellipsisComponent={() => ...} -> - Previous - - Next - -``` - -### Controlled value - -The `page` prop, which accepts a page number, can be used to make the value controlled. The `onPageChange` event is fired when the user selects an item, and receives the new page number. - -``` -Copytsx -import { createSignal } from "solid-js"; - -export function ControlledExample() { - const [page, setPage] = createSignal(4); - - return ( - {props.page}} - ellipsisComponent={() => ...} - > - Previous - - Next - - ); -} -``` - -``` -Copytsx -import { createSignal } from "solid-js"; - -export function ControlledExample() { - const [page, setPage] = createSignal(4); - - return ( - {props.page}} - ellipsisComponent={() => ...} - > - Previous - - Next - - ); -} -``` - -### Next / Previous buttons example - -The appearance can be customized by omitting the Next and Previous Button. - -``` -Copytsx - {props.page}} - ellipsisComponent={() => ...} -> - - -``` - -``` -Copytsx - {props.page}} - ellipsisComponent={() => ...} -> - - -``` - -### First / Last item example - -The First and Last item can be hidden instead of displaying at all times. - -``` -Copytsx - {props.page}} - ellipsisComponent={() => ...} -> - Previous - - Next - -``` - -``` -Copytsx - {props.page}} - ellipsisComponent={() => ...} -> - Previous - - Next - -``` - -### Siblings example - -The number of items around the current page item can be customized. - -``` -Copytsx - {props.page}} - ellipsisComponent={() => ...} -> - Previous - - Next - -``` - -``` -Copytsx - {props.page}} - ellipsisComponent={() => ...} -> - Previous - - Next - -``` - -### Fixed Items example - -The total number of items can be fixed to avoid content shift. If ellipsis are disabled (by returning an empty component) use `fixedItems="no-ellipsis"` instead. - -``` -Copytsx - {props.page}} - ellipsisComponent={() => ...} -> - Previous - - Next - -``` - -``` -Copytsx - {props.page}} - ellipsisComponent={() => ...} -> - Previous - - Next - -``` - -## API Reference - -### Pagination - -`Pagination` is equivalent to the `Root` import from `@kobalte/core/pagination` (and deprecated `Pagination.Root`). - -| Prop | Description | -| --- | --- | -| page | `number`
    The controlled page number of the pagination. (1-indexed) | -| defaultPage | `string`
    The default page number when initially rendered. (1-indexed) | -| onPageChange | `(page: number) => void`
    Event handler called when the page number changes. | -| count | `number`
    The number of pages for the pagination. | -| siblingCount | `number`
    The number of siblings to show around the current page item. | -| showFirst | `boolean`
    Whether to always show the first page item. | -| showLast | `boolean`
    Whether to always show the last page item. | -| fixedItems | `boolean | "no-ellipsis"`
    Whether to always show the same number of items (to avoid content shift). Special value: `"no-ellipsis"` does not count the ellipsis as an item (used when ellipsis are disabled). | -| itemComponent | `Component<{page: number}>`
    The component to render as an item in the `Pagination.Items`. | -| ellipsisComponent | `Component`
    The component to render as an ellipsis item in the `Pagination.Items`. | -| disabled | `boolean`
    Whether the pagination is disabled. | - -| Data attribute | Description | -| --- | --- | -| data-disabled | Present when the pagination is disabled. | - -### Pagination.Item - -| Prop | Description | -| --- | --- | -| page | `number`
    The page number to render. | - -| Data attribute | Description | -| --- | --- | -| data-current | Present when the item is the current page. | - -## Rendered elements - -| Component | Default rendered element | -| --- | --- | -| `Pagination` | `div` | -| `Pagination.Item` | `button` | -| `Pagination.Ellipsis` | `div` | -| `Pagination.Previous` | `button` | -| `Pagination.Next` | `button` | -| `Pagination.Items` | none | - -Previous[←Number Field](https://kobalte.dev/docs/core/components/number-field)Next[Popover→](https://kobalte.dev/docs/core/components/popover) \ No newline at end of file diff --git a/.firecrawl/kobalte.dev-docs-core-components-progress.md b/.firecrawl/kobalte.dev-docs-core-components-progress.md deleted file mode 100644 index 604ff9a..0000000 --- a/.firecrawl/kobalte.dev-docs-core-components-progress.md +++ /dev/null @@ -1,230 +0,0 @@ -# Progress - -Show either determinate or indeterminate progress of an operation over time. - -## Import - -``` -Copyts -import { Progress } from "@kobalte/core/progress"; -// or -import { Root, Label, ... } from "@kobalte/core/progress"; -// or (deprecated) -import { Progress } from "@kobalte/core"; -``` - -``` -Copyts -import { Progress } from "@kobalte/core/progress"; -// or -import { Root, Label, ... } from "@kobalte/core/progress"; -// or (deprecated) -import { Progress } from "@kobalte/core"; -``` - -## Features - -- Exposed to assistive technology as a progress bar via ARIA. -- Labeling support for accessibility. -- Internationalized number formatting as a percentage or value. -- Determinate and indeterminate progress support. - -## Anatomy - -The progress consists of: - -- **Progress:** The root container for a progress bar. -- **Progress.Label:** An accessible label that gives the user information on the progress. -- **Progress.ValueLabel:** The accessible label text representing the current value in a human-readable format. -- **Progress.Track:** The component that visually represents the progress track. -- **Progress.Fill:** The component that visually represents the progress value. - -``` -Copytsx - - - - - - - -``` - -``` -Copytsx - - - - - - - -``` - -## Example - -Loading... - -80% - -index.tsxstyle.css - -``` -Copytsx -import { Progress } from "@kobalte/core/progress"; -import "./style.css"; - -function App() { - return ( - -
    - Loading... - -
    - - - -
    - ); -} -``` - -``` -Copytsx -import { Progress } from "@kobalte/core/progress"; -import "./style.css"; - -function App() { - return ( - -
    - Loading... - -
    - - - -
    - ); -} -``` - -## Usage - -### Custom value scale - -By default, the `value` prop represents the current percentage of progress, as the minimum and maximum values default to 0 and 100, respectively. Alternatively, a different scale can be used by setting the `minValue` and `maxValue` props. - -Loading... - -50% - -``` -Copytsx - -
    - Loading... - -
    - - - -
    -``` - -``` -Copytsx - -
    - Loading... - -
    - - - -
    -``` - -### Custom value label - -The `getValueLabel` prop allows the formatted value used in `Progress.ValueLabel` and ARIA to be replaced with a custom string. It receives the current value, min and max values as parameters. - -Processing... - -3 of 10 tasks completed - -``` -Copytsx - `${value} of ${max} tasks completed`} - class="progress" -> -
    - Processing... - -
    - - - -
    -``` - -``` -Copytsx - `${value} of ${max} tasks completed`} - class="progress" -> -
    - Processing... - -
    - - - -
    -``` - -### Progress bar fill width - -We expose a CSS custom property `--kb-progress-fill-width` which corresponds to the percentage of progression (ex: 80%). If you are building a linear progress bar, you can use it to set the width of the `Progress.Fill` component in CSS. - -## API Reference - -### Progress - -`Progress` is equivalent to the `Root` import from `@kobalte/core/progress` (and deprecated `Progress.Root`). - -| Prop | Description | -| --- | --- | -| value | `number`
    The progress value. | -| minValue | `number`
    The minimum progress value. | -| maxValue | `number`
    The maximum progress value. | -| indeterminate | `boolean`
    Whether the progress is in an indeterminate state. | -| getValueLabel | `(params: { value: number; min: number; max: number }) => string`
    A function to get the accessible label text representing the current value in a human-readable format. If not provided, the value label will be read as a percentage of the max value. | - -| Data attribute | Description | -| --- | --- | -| data-progress='loading' | Present when the progress is not complete (`value` < `maxValue`). | -| data-progress='complete' | Present when the progress is complete (`value` === `maxValue`). | -| data-indeterminate | Present when the progress is in an indeterminate state. | - -`Progress.Label`, `Progress.ValueLabel`, `Progress.Track` and `Progress.Fill` shares the same data-attributes. - -## Rendered elements - -| Component | Default rendered element | -| --- | --- | -| `Progress` | `div` | -| `Progress.Label` | `span` | -| `Progress.ValueLabel` | `div` | -| `Progress.Track` | `div` | -| `Progress.Fill` | `div` | - -Previous[←Popover](https://kobalte.dev/docs/core/components/popover)Next[Radio Group→](https://kobalte.dev/docs/core/components/radio-group) \ No newline at end of file diff --git a/.firecrawl/kobalte.dev-docs-core-components-radio-group.md b/.firecrawl/kobalte.dev-docs-core-components-radio-group.md deleted file mode 100644 index 37ee204..0000000 --- a/.firecrawl/kobalte.dev-docs-core-components-radio-group.md +++ /dev/null @@ -1,507 +0,0 @@ -# Radio Group - -A set of checkable buttons, known as radio buttons, where no more than one of the buttons can be checked at a time. - -## Import - -``` -Copyts -import { RadioGroup } from "@kobalte/core/radio-group"; -// or -import { Root, Label, ... } from "@kobalte/core/radio-group"; -// or (deprecated) -import { RadioGroup } from "@kobalte/core"; -``` - -``` -Copyts -import { RadioGroup } from "@kobalte/core/radio-group"; -// or -import { Root, Label, ... } from "@kobalte/core/radio-group"; -// or (deprecated) -import { RadioGroup } from "@kobalte/core"; -``` - -## Features - -- Follow the [WAI ARIA Radio Group](https://www.w3.org/WAI/ARIA/apg/patterns/radiobutton/) design pattern. -- Each radio is built with a native HTML `` element, which is visually hidden to allow custom styling. -- Syncs with form reset events. -- Group and radio labeling support for assistive technology. -- Can be controlled or uncontrolled. - -## Anatomy - -The radio group consists of: - -- **RadioGroup**: The root container for the radio group. -- **RadioGroup.Label**: The label that gives the user information on the radio group. -- **RadioGroup.Description**: The description that gives the user more information on the radio group. -- **RadioGroup.ErrorMessage**: The error message that gives the user information about how to fix a validation error on the radio group. - -The radio item consists of: - -- **RadioGroup.Item**: The root container for a radio button. -- **RadioGroup.ItemInput**: The native html input that is visually hidden in the radio button. -- **RadioGroup.ItemControl**: The element that visually represents a radio button. -- **RadioGroup.ItemIndicator**: The visual indicator rendered when the radio button is in a checked state. -- **RadioGroup.ItemLabel**: The label that gives the user information on the radio button. -- **RadioGroup.ItemDescription**: The description that gives the user more information on the radio button. - -``` -Copytsx - - - - - - - - - - - - - -``` - -``` -Copytsx - - - - - - - - - - - - - -``` - -## Example - -Favorite fruit - -Apple - -Orange - -Watermelon - -index.tsxstyle.css - -``` -Copytsx -import { RadioGroup } from "@kobalte/core/radio-group"; -import "./style.css"; - -function App() { - return ( - - Favorite fruit - - - ); -} -``` - -``` -Copytsx -import { RadioGroup } from "@kobalte/core/radio-group"; -import "./style.css"; - -function App() { - return ( - - Favorite fruit - - - ); -} -``` - -## Usage - -### Default value - -An initial, uncontrolled value can be provided using the `defaultValue` prop, which accepts a value corresponding with the `value` prop of each radio. - -Favorite fruit - -Apple - -Orange - -Watermelon - -``` -Copytsx - - Favorite fruit -
    - - {fruit => ...} - -
    -
    -``` - -``` -Copytsx - - Favorite fruit -
    - - {fruit => ...} - -
    -
    -``` - -The `role="presentation"` is required for all non content elements between the `RadioGroup` and `RadioGroup.Item` due to a bug in Chromium based browsers that incorrectly parse semantics and break screen readers. - -### Controlled value - -The `value` prop, which accepts a value corresponding with the `value` prop of each radio, can be used to make the value controlled. The `onChange` event is fired when the user selects a radio, and receives the new value. - -Favorite fruit - -Apple - -Orange - -Watermelon - -Your favorite fruit is: Orange. - -``` -Copytsx -import { createSignal } from "solid-js"; - -function ControlledExample() { - const [value, setValue] = createSignal("Orange"); - - return ( - <> - - Favorite fruit -
    - - {fruit => ...} - -
    -
    -

    Your favorite fruit is: {value()}.

    - - ); -} -``` - -``` -Copytsx -import { createSignal } from "solid-js"; - -function ControlledExample() { - const [value, setValue] = createSignal("Orange"); - - return ( - <> - - Favorite fruit -
    - - {fruit => ...} - -
    -
    -

    Your favorite fruit is: {value()}.

    - - ); -} -``` - -### Description - -The `RadioGroup.Description` component can be used to associate additional help text with a radio group. - -Favorite fruit - -Apple - -Orange - -Watermelon - -Choose the fruit you like the most. - -``` -Copytsx - - Favorite fruit -
    - - {fruit => ...} - -
    - Choose the fruit you like the most. -
    -``` - -``` -Copytsx - - Favorite fruit -
    - - {fruit => ...} - -
    - Choose the fruit you like the most. -
    -``` - -### Error message - -The `RadioGroup.ErrorMessage` component can be used to help the user fix a validation error. It should be combined with the `validationState` prop to semantically mark the radio group as invalid for assistive technologies. - -By default, it will render only when the `validationState` prop is set to `invalid`, use the `forceMount` prop to always render the error message (ex: for usage with animation libraries). - -Favorite fruit - -Apple - -Orange - -Watermelon - -Hmm, I prefer apples. - -``` -Copytsx -import { createSignal } from "solid-js"; - -function ErrorMessageExample() { - const [value, setValue] = createSignal("Orange"); - - return ( - - Favorite fruit -
    - - {fruit => ...} - -
    - Hmm, I prefer apples. -
    - ); -} -``` - -``` -Copytsx -import { createSignal } from "solid-js"; - -function ErrorMessageExample() { - const [value, setValue] = createSignal("Orange"); - - return ( - - Favorite fruit -
    - - {fruit => ...} - -
    - Hmm, I prefer apples. -
    - ); -} -``` - -### HTML forms - -The radio group `name` prop, paired with the radio `value` prop, can be used for integration with HTML forms. - -Favorite fruit - -Apple - -Orange - -Watermelon - -ResetSubmit - -``` -Copytsx -function HTMLFormExample() { - const onSubmit = (e: SubmitEvent) => { - // handle form submission. - }; - - return ( -
    - - Favorite fruit -
    - - {fruit => ...} - -
    -
    -
    - - -
    -
    - ); -} -``` - -``` -Copytsx -function HTMLFormExample() { - const onSubmit = (e: SubmitEvent) => { - // handle form submission. - }; - - return ( -
    - - Favorite fruit -
    - - {fruit => ...} - -
    -
    -
    - - -
    -
    - ); -} -``` - -## API Reference - -### RadioGroup - -`RadioGroup` is equivalent to the `Root` import from `@kobalte/core/radio-group` (and deprecated `RadioGroup.Root`). - -| Prop | Description | -| --- | --- | -| value | `string`
    The controlled value of the radio button to check. | -| defaultValue | `string`
    The value of the radio button that should be checked when initially rendered. Useful when you do not need to control the state of the radio buttons. | -| onChange | `(value: string) => void`
    Event handler called when the value changes. | -| orientation | `'horizontal' | 'vertical'`
    The axis the radio group items should align with. | -| name | `string`
    The name of the radio group. Submitted with its owning form as part of a name/value pair. | -| validationState | `'valid' | 'invalid'`
    Whether the radio group should display its "valid" or "invalid" visual styling. | -| required | `boolean`
    Whether the user must check a radio group item before the owning form can be submitted. | -| disabled | `boolean`
    Whether the radio group is disabled. | -| readOnly | `boolean`
    Whether the radio group items can be selected but not changed by the user. | - -| Data attribute | Description | -| --- | --- | -| data-valid | Present when the radio group is valid according to the validation rules. | -| data-invalid | Present when the radio group is invalid according to the validation rules. | -| data-required | Present when the user must check a radio group item before the owning form can be submitted. | -| data-disabled | Present when the radio group is disabled. | -| data-readonly | Present when the radio group is read only. | - -`RadioGroup.Label`, `RadioGroup.Description` and `RadioGroup.ErrorMesssage` shares the same data-attributes. - -### RadioGroup.ErrorMessage - -| Prop | Description | -| --- | --- | -| forceMount | `boolean`
    Used to force mounting when more control is needed. Useful when controlling animation with SolidJS animation libraries. | - -### RadioGroup.Item - -| Prop | Description | -| --- | --- | -| value | `string`
    The value of the radio button, used when submitting an HTML form. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/radio#Value). | -| disabled | `boolean`
    Whether the radio button is disabled or not. | - -| Data attribute | Description | -| --- | --- | -| data-valid | Present when the parent radio group is valid according to the validation rules. | -| data-invalid | Present when the parent radio group is invalid according to the validation rules. | -| data-checked | Present when the radio is checked. | -| data-disabled | Present when the radio is disabled. | - -`RadioGroup.ItemInput`, `RadioGroup.ItemControl`, `RadioGroup.ItemIndicator` and `RadioGroup.ItemLabel` shares the same data-attributes. - -### RadioGroup.ItemIndicator - -| Prop | Description | -| --- | --- | -| forceMount | `boolean`
    Used to force mounting when more control is needed. Useful when controlling animation with SolidJS animation libraries. | - -## Rendered elements - -| Component | Default rendered element | -| --- | --- | -| `RadioGroup` | `div` | -| `RadioGroup.Label` | `span` | -| `RadioGroup.Description` | `div` | -| `RadioGroup.ErrorMessage` | `div` | -| `RadioGroup.Item` | `div` | -| `RadioGroup.ItemInput` | `input` | -| `RadioGroup.ItemControl` | `div` | -| `RadioGroup.ItemIndicator` | `div` | -| `RadioGroup.ItemLabel` | `label` | -| `RadioGroup.ItemDescription` | `div` | - -## Accessibility - -### Keyboard Interactions - -| Key | Description | -| --- | --- | -| `Tab` | Moves focus to either the checked radio button or the first radio button in the group. | -| `Space` | When focus is on an unchecked radio button, checks it. | -| `ArrowDown` | Moves focus and checks the next radio button in the group. | -| `ArrowRight` | Moves focus and checks the next radio button in the group. | -| `ArrowUp` | Moves focus and checks the previous radio button in the group. | -| `ArrowLeft` | Moves focus and checks the previous radio button in the group. | - -Previous[←Progress](https://kobalte.dev/docs/core/components/progress)Next[Rating Group→](https://kobalte.dev/docs/core/components/rating-group) \ No newline at end of file diff --git a/.firecrawl/kobalte.dev-docs-core-components-separator.md b/.firecrawl/kobalte.dev-docs-core-components-separator.md deleted file mode 100644 index 937c280..0000000 --- a/.firecrawl/kobalte.dev-docs-core-components-separator.md +++ /dev/null @@ -1,110 +0,0 @@ -# Separator - -Visually or semantically separates content. - -## Import - -``` -Copyts -import { Separator } from "@kobalte/core/separator"; -// or -import { Root } from "@kobalte/core/separator"; -// or (deprecated) -import { Separator } from "@kobalte/core"; -``` - -``` -Copyts -import { Separator } from "@kobalte/core/separator"; -// or -import { Root } from "@kobalte/core/separator"; -// or (deprecated) -import { Separator } from "@kobalte/core"; -``` - -## Features - -- Native HTML `
    ` element support. -- Custom element type support via the [WAI ARIA Separator](https://w3c.github.io/aria/#separator) role. -- Support for horizontal and vertical orientation. - -## Anatomy - -The separator consists of: - -- **Separator:** The root container for a separator. - -``` -Copytsx - -``` - -``` -Copytsx - -``` - -## Example - -Content above - -* * * - -Content below - -index.tsxstyle.css - -``` -Copytsx -import { Separator } from "@kobalte/core/separator"; -import "./style.css"; - -function App() { - return ( -
    - Content above - - Content below -
    - ); -} -``` - -``` -Copytsx -import { Separator } from "@kobalte/core/separator"; -import "./style.css"; - -function App() { - return ( -
    - Content above - - Content below -
    - ); -} -``` - -## API Reference - -### Separator - -`Separator` is equivalent to the `Root` import from `@kobalte/core/separator` (and deprecated `Separator.Root`). - -| Prop | Description | -| --- | --- | -| orientation | `'horizontal' | 'vertical'`
    The orientation of the separator. | - -| Data attribute | Description | -| --- | --- | -| data-orientation='horizontal' | Present when the separator has horizontal orientation. | -| data-orientation='vertical' | Present when the separator has vertical orientation. | - -## Rendered elements - -| Component | Default rendered element | -| --- | --- | -| `Separator` | `hr` | - -Previous[←Select](https://kobalte.dev/docs/core/components/select)Next[Skeleton→](https://kobalte.dev/docs/core/components/skeleton) \ No newline at end of file diff --git a/.firecrawl/kobalte.dev-docs-core-components-skeleton.md b/.firecrawl/kobalte.dev-docs-core-components-skeleton.md deleted file mode 100644 index aab15c1..0000000 --- a/.firecrawl/kobalte.dev-docs-core-components-skeleton.md +++ /dev/null @@ -1,244 +0,0 @@ -# Skeleton - -Visually indicates content loading - -## Import - -``` -Copyts -import { Skeleton } from "@kobalte/core/skeleton"; -// or -import { Root } from "@kobalte/core/skeleton"; -// or (deprecated) -import { Skeleton } from "@kobalte/core"; -``` - -``` -Copyts -import { Skeleton } from "@kobalte/core/skeleton"; -// or -import { Root } from "@kobalte/core/skeleton"; -// or (deprecated) -import { Skeleton } from "@kobalte/core"; -``` - -## Features - -- Support for custom width and height. -- Support for circle skeleton. -- Can toggle visiblity and animation properties. - -## Anatomy - -The skeleton consists of: - -- **Skeleton:** The root container for a skeleton. - -``` -Copytsx - -``` - -``` -Copytsx - -``` - -## Example - -A UI toolkit for building accessible web apps and design systems with SolidJS. - -index.tsxstyle.css - -``` -Copytsx -import { Skeleton } from "@kobalte/core/skeleton"; -import "./style.css"; - -function App() { - return ( - -

    - A UI toolkit for building accessible web apps and design systems with SolidJS. -

    -
    - ); -} -``` - -``` -Copytsx -import { Skeleton } from "@kobalte/core/skeleton"; -import "./style.css"; - -function App() { - return ( - -

    - A UI toolkit for building accessible web apps and design systems with SolidJS. -

    -
    - ); -} -``` - -## Usage - -### Multiple skeletons - -![Nicole Steeves](https://pbs.twimg.com/profile_images/1509139491671445507/pzWYjlYN_400x400.jpg) - -Kobalte - -A UI toolkit for building accessible web apps and design systems with SolidJS. - -index.tsxstyle.css - -``` -Copytsx -import { Skeleton } from "@kobalte/core/skeleton"; -import { Image } from "@kobalte/core/image"; -import "./style.css"; - -function App() { - return ( -
    -
    - - - - - - - Kobalte - -
    - -

    - A UI toolkit for building accessible web apps and design systems with SolidJS. -

    -
    -
    - ); -} -``` - -``` -Copytsx -import { Skeleton } from "@kobalte/core/skeleton"; -import { Image } from "@kobalte/core/image"; -import "./style.css"; - -function App() { - return ( -
    -
    - - - - - - - Kobalte - -
    - -

    - A UI toolkit for building accessible web apps and design systems with SolidJS. -

    -
    -
    - ); -} -``` - -### Toggle example - -Show content - -A UI toolkit for building accessible web apps and design systems with SolidJS. - -index.tsxstyle.css - -``` -Copytsx -import { Skeleton } from "@kobalte/core/skeleton"; -import { ToggleButton } from "@kobalte/core/toggle-button"; -import "./style.css"; - -function App() { - const [visible, setVisible] = createSignal(true); - return ( -
    - - Skeleton {visible() ? "Visible" : "Not Visible"} - - -

    - A UI toolkit for building accessible web apps and design systems with SolidJS. -

    -
    -
    - ); -} -``` - -``` -Copytsx -import { Skeleton } from "@kobalte/core/skeleton"; -import { ToggleButton } from "@kobalte/core/toggle-button"; -import "./style.css"; - -function App() { - const [visible, setVisible] = createSignal(true); - return ( -
    - - Skeleton {visible() ? "Visible" : "Not Visible"} - - -

    - A UI toolkit for building accessible web apps and design systems with SolidJS. -

    -
    -
    - ); -} -``` - -## API Reference - -### Skeleton - -`Skeleton` is equivalent to the `Root` import from `@kobalte/core/skeleton` (and deprecated `Skeleton.Root`). - -| Prop | Description | -| --- | --- | -| visible | `boolean`
    The visible state of the Skeleton. Sets the `data-visible` data attribute. | -| animate | `boolean`
    Whether the skeleton should animate. Sets the `data-animate` data attribute. | -| width | `number`
    The width of the skeleton in px. Defaults to 100%. | -| height | `number`
    The height of the skeleton in px. Defaults to auto. | -| radius | `number`
    Roundness of the skeleton in px. Sets border-radius. | -| circle | `boolean`
    Whether the skeleton should be a circle. Sets border-radius and width to the height. | -| children | `JSX.Element`
    The children of the Skeleton. | - -| Data attribute | Description | -| --- | --- | -| data-visible | Present when the Skeleton is visible. | -| data-animate | Present when the Skeleton can animate. | - -## Rendered elements - -| Component | Default rendered element | -| --- | --- | -| `Skeleton` | `div` | - -Previous[←Separator](https://kobalte.dev/docs/core/components/separator)Next[Slider→](https://kobalte.dev/docs/core/components/slider) \ No newline at end of file diff --git a/.firecrawl/kobalte.dev-docs-core-components-slider.md b/.firecrawl/kobalte.dev-docs-core-components-slider.md deleted file mode 100644 index d38060e..0000000 --- a/.firecrawl/kobalte.dev-docs-core-components-slider.md +++ /dev/null @@ -1,638 +0,0 @@ -# Slider - -An input where the user selects a value from within a given range. - -## Import - -``` -Copyts -import { Slider } from "@kobalte/core/slider"; -// or -import { Root, Track, ... } from "@kobalte/core/slider"; -// or (deprecated) -import { Slider } from "@kobalte/core"; -``` - -``` -Copyts -import { Slider } from "@kobalte/core/slider"; -// or -import { Root, Track, ... } from "@kobalte/core/slider"; -// or (deprecated) -import { Slider } from "@kobalte/core"; -``` - -## Features - -- Follow the [WAI ARIA Slider](https://www.w3.org/WAI/ARIA/apg/patterns/slider-multithumb/) design pattern. -- Can be controlled or uncontrolled. -- Support for multiple thumbs. -- Support a minimum step between thumbs. -- Support click or touch on track to change value. -- Support right or left direction. -- Support for custom value label. - -## Anatomy - -The slider consists of: - -- **Slider:** The root container for the slider. -- **Slider.Track:** The component that visually represents the slider track. -- **Slider.Fill:** The component that visually represents the slider value. -- **Slider.Thumb:** The thumb that is used to visually indicate a value in the slider. -- **Slider.Input:** The native html input that is visually hidden in the slider thumb. -- **Slider.Label:** The label that gives the user information on the slider. -- **Slider.ValueLabel:** The accessible label text representing the current value in a human-readable format. -- **Slider.Description**: The description that gives the user more information on the slider. -- **Slider.ErrorMessage**: The error message that gives the user information about how to fix a validation error on the slider. - -``` -Copytsx - - - - - - - - - - - - -``` - -``` -Copytsx - - - - - - - - - - - - -``` - -## Example - -Label - -0 - -index.tsxstyle.css - -``` -Copytsx -import { Slider } from "@kobalte/core/slider"; -import "./style.css"; - -function App() { - return ( - -
    - Label - -
    - - - - - - -
    - ); -} -``` - -``` -Copytsx -import { Slider } from "@kobalte/core/slider"; -import "./style.css"; - -function App() { - return ( - -
    - Label - -
    - - - - - - -
    - ); -} -``` - -## Usage - -### Multiple Thumbs - -Label - -0, 20 - -index.tsxstyle.css - -``` -Copytsx -import { Slider } from "@kobalte/core/slider"; -import "./style.css"; - -function App() { - return ( - -
    - Label - -
    - - - - - - - - - -
    - ); -} -``` - -``` -Copytsx -import { Slider } from "@kobalte/core/slider"; -import "./style.css"; - -function App() { - return ( - -
    - Label - -
    - - - - - - - - - -
    - ); -} -``` - -### Modify step size - -Step size 8 - -0 - -Step size 10 - -0 - -Step size 20 - -0 - -index.tsxstyle.css - -``` -Copytsx -import { Slider } from "@kobalte/core/slider"; -import "./style.css"; - -function App() { - return ( - <> - -
    - Step size 8 - -
    - - - - - - - - - -
    - -
    - Step size 10 - -
    - - - - - - - - - -
    - -
    - Step size 20 - -
    - - - - - - - - - -
    - - ); -} -``` - -``` -Copytsx -import { Slider } from "@kobalte/core/slider"; -import "./style.css"; - -function App() { - return ( - <> - -
    - Step size 8 - -
    - - - - - - - - - -
    - -
    - Step size 10 - -
    - - - - - - - - - -
    - -
    - Step size 20 - -
    - - - - - - - - - -
    - - ); -} -``` - -### Steps between thumbs - -Label - -10, 20 - -index.tsxstyle.css - -``` -Copytsx -import { Slider } from "@kobalte/core/slider"; -import "./style.css"; - -function App() { - return ( - -
    - Label - -
    - - - - - - - - - -
    - ); -} -``` - -``` -Copytsx -import { Slider } from "@kobalte/core/slider"; -import "./style.css"; - -function App() { - return ( - -
    - Label - -
    - - - - - - - - - -
    - ); -} -``` - -### Vertical Slider - -Label - -0 - -index.tsxstyle.css - -``` -Copytsx -import { Slider } from "@kobalte/core/slider"; -import "./style.css"; - -function App() { - return ( - -
    - Label - -
    - - - - - - -
    - ); -} -``` - -``` -Copytsx -import { Slider } from "@kobalte/core/slider"; -import "./style.css"; - -function App() { - return ( - -
    - Label - -
    - - - - - - -
    - ); -} -``` - -### Custom Value Label - -Money - -$20 - $500 - -index.tsxstyle.css - -``` -Copytsx -import { Slider } from "@kobalte/core/slider"; -import "./style.css"; - -function App() { - return ( - `$${params.values[0]} - $${params.values[1]}`} - > -
    - Money - -
    - - - - - - - - - -
    - ); -} -``` - -``` -Copytsx -import { Slider } from "@kobalte/core/slider"; -import "./style.css"; - -function App() { - return ( - `$${params.values[0]} - $${params.values[1]}`} - > -
    - Money - -
    - - - - - - - - - -
    - ); -} -``` - -### Controlled Value - -Label - -40 - -index.tsxstyle.css - -``` -Copytsx -import { createSignal } from 'solid-js' -import { Slider } from "@kobalte/core/slider"; -import "./style.css"; - -function App() { - const [values, setValues] = createSignal([40]) - - return ( - -
    - Label - -
    - - - - - - -
    - ); -} -``` - -``` -Copytsx -import { createSignal } from 'solid-js' -import { Slider } from "@kobalte/core/slider"; -import "./style.css"; - -function App() { - const [values, setValues] = createSignal([40]) - - return ( - -
    - Label - -
    - - - - - - -
    - ); -} -``` - -## API Reference - -### Slider - -`Slider` is equivalent to the `Root` import from `@kobalte/core/slider` (and deprecated `Slider.Root`). - -| Prop | Description | -| --- | --- | -| value | `number[]`
    The controlled values of the slider. Must be used in conjunction with `onChange`. | -| defaultValue | `number[]`
    The value of the slider when initially rendered. Use when you do not need to control the state of the slider. | -| onChange | `(value: number[]) => void`
    Event handler called when the value changes. | -| onChangeEnd | `(value: number[]) => void`
    Event handler called when the value changes at the end of an interaction. | -| inverted | `boolean`
    Whether the slider is visually inverted. Defaults to false. | -| minValue | `number`
    The minimum slider value. Defaults to 0 | -| maxValue | `number`
    The maximum slider value. Defaults to 100 | -| step | `number`
    The stepping interval. Defaults to 1 | -| minStepsBetweenThumbs | `number`
    The minimum permitted steps between thumbs. Defaults to 0 | -| getValueLabel | `(params: GetValueLabelParams) => string`
    A function to get the accessible label text representing the current value in a human-readable format. If not provided, the value label will be read as a percentage of the max value. | -| orientation | `'horizontal' | 'vertical'`
    The orientation of the slider. | -| name | `string`
    The name of the slider, used when submitting an HTML form. | -| validationState | `'valid' | 'invalid'`
    Whether the slider should display its "valid" or "invalid" visual styling. | -| required | `boolean`
    Whether the user must check a radio group item before the owning form can be submitted. | -| disabled | `boolean`
    Whether the radio group is disabled. | -| readOnly | `boolean`
    Whether the radio group items can be selected but not changed by the user. | - -| Data attribute | Description | -| --- | --- | -| data-orientation='horizontal' | Present when the slider has horizontal orientation. | -| data-orientation='vertical' | Present when the slider has vertical orientation. | -| data-valid | Present when the slider is valid according to the validation rules. | -| data-invalid | Present when the slider is invalid according to the validation rules. | -| data-required | Present when the user must slider an item before the owning form can be submitted. | -| data-disabled | Present when the slider is disabled. | -| data-readonly | Present when the slider is read only. | - -`Slider.ValueLabel`, `Slider.Fill`, `Slider.Input`, `Slider.Thumb` and `Slider.Track` share the same data-attributes. - -## Rendered elements - -| Component | Default rendered element | -| --- | --- | -| `Slider` | `div` | -| `Slider.Track` | `div` | -| `Slider.Fill` | `div` | -| `Slider.Thumb` | `span` | -| `Slider.Input` | `input` | -| `Slider.ValueLabel` | `div` | -| `Slider.Description` | `div` | -| `Slider.ErrorMessage` | `div` | - -## Accessibility - -### Keyboard Interactions - -| Key | Description | -| --- | --- | -| `PageUp` | Increases the value of the focused thumb by a larger `step`. | -| `PageDown` | Decreases the value of the focused thumb by a larger `step`. | -| `ArrowDown` | Decreases the value of the focused thumb by the `step` amount. | -| `ArrowUp` | Increases the value of the focused thumb by the `step` amount. | -| `ArrowRight` | Increments/decrements by the `step` value depending on `orientation`. | -| `ArrowLeft` | Increments/decrements by the `step` value depending on `orientation`. | -| `Home` | Sets the value of the first thumb to the minimum value. | -| `End` | Sets the value of the last thumb to the maximum value. | - -Previous[←Skeleton](https://kobalte.dev/docs/core/components/skeleton)Next[Switch→](https://kobalte.dev/docs/core/components/switch) \ No newline at end of file diff --git a/.firecrawl/kobalte.dev-docs-core-components-switch.md b/.firecrawl/kobalte.dev-docs-core-components-switch.md deleted file mode 100644 index 90c8781..0000000 --- a/.firecrawl/kobalte.dev-docs-core-components-switch.md +++ /dev/null @@ -1,373 +0,0 @@ -# Switch - -A control that allows users to choose one of two values: on or off. - -## Import - -``` -Copyts -import { Switch } from "@kobalte/core/switch"; -// or -import { Root, Input, ... } from "@kobalte/core/switch"; -// or (deprecated) -import { Switch } from "@kobalte/core"; -``` - -``` -Copyts -import { Switch } from "@kobalte/core/switch"; -// or -import { Root, Input, ... } from "@kobalte/core/switch"; -// or (deprecated) -import { Switch } from "@kobalte/core"; -``` - -## Features - -- Follow the [WAI ARIA Switch](https://www.w3.org/WAI/ARIA/apg/patterns/switch/) design pattern. -- Built with a native HTML `` element, which is visually hidden to allow custom styling. -- Syncs with form reset events. -- Labeling support for assistive technology. -- Support for description and error message help text linked to the input via ARIA. -- Can be controlled or uncontrolled. - -## Anatomy - -The switch consists of: - -- **Switch:** The root container for a switch. -- **Switch.Input:** The native html input that is visually hidden in the switch. -- **Switch.Control:** The element that visually represents a switch. -- **Switch.Thumb:** The thumb that is used to visually indicate whether the switch is on or off. -- **Switch.Label:** The label that gives the user information on the switch. -- **Switch.Description**: The description that gives the user more information on the switch. -- **Switch.ErrorMessage**: The error message that gives the user information about how to fix a validation error on the switch. - -``` -Copytsx - - - - - - - - - -``` - -``` -Copytsx - - - - - - - - - -``` - -## Example - -Airplane mode - -index.tsxstyle.css - -``` -Copytsx -import { Switch } from "@kobalte/core/switch"; -import "./style.css"; - -function App() { - return ( - - Airplane mode - - - - - - ); -} -``` - -``` -Copytsx -import { Switch } from "@kobalte/core/switch"; -import "./style.css"; - -function App() { - return ( - - Airplane mode - - - - - - ); -} -``` - -## Usage - -### Default checked - -An initial, uncontrolled value can be provided using the `defaultChecked` prop. - -Airplane mode - -``` -Copytsx -... -``` - -``` -Copytsx -... -``` - -### Controlled checked - -The `checked` prop can be used to make the checked state controlled. The `onChange` event is fired when the user toggle the switch, and receives the new value. - -Airplane mode - -Airplane mode is inactive. - -``` -Copytsx -import { createSignal } from "solid-js"; - -export function ControlledExample() { - const [checked, setChecked] = createSignal(false); - - return ( - <> - - ... - -

    Airplane mode is {checked() ? "active" : "inactive"}.

    - - ); -} -``` - -``` -Copytsx -import { createSignal } from "solid-js"; - -export function ControlledExample() { - const [checked, setChecked] = createSignal(false); - - return ( - <> - - ... - -

    Airplane mode is {checked() ? "active" : "inactive"}.

    - - ); -} -``` - -### Description - -The `Switch.Description` component can be used to associate additional help text with a switch. - -Airplane mode - -Disable all network connections. - -``` -Copytsx - - Airplane mode - Disable all network connections. - - - - - -``` - -``` -Copytsx - - Airplane mode - Disable all network connections. - - - - - -``` - -### Error message - -The `Switch.ErrorMessage` component can be used to help the user fix a validation error. It should be combined with the `validationState` prop to semantically mark the switch as invalid for assistive technologies. - -By default, it will render only when the `validationState` prop is set to `invalid`, use the `forceMount` prop to always render the error message (ex: for usage with animation libraries). - -Airplane mode - -You must enable airplane mode. - -``` -Copytsx -import { createSignal } from "solid-js"; - -function ErrorMessageExample() { - const [checked, setChecked] = createSignal(false); - - return ( - - Airplane mode - You must enable airplane mode. - - - - - - ); -} -``` - -``` -Copytsx -import { createSignal } from "solid-js"; - -function ErrorMessageExample() { - const [checked, setChecked] = createSignal(false); - - return ( - - Airplane mode - You must enable airplane mode. - - - - - - ); -} -``` - -### HTML forms - -The `name` and `value` props can be used for integration with HTML forms. - -Airplane mode - -ResetSubmit - -``` -Copytsx -function HTMLFormExample() { - const onSubmit = (e: SubmitEvent) => { - // handle form submission. - }; - return ( -
    - - ... - -
    - - -
    -
    - ); -} -``` - -``` -Copytsx -function HTMLFormExample() { - const onSubmit = (e: SubmitEvent) => { - // handle form submission. - }; - return ( -
    - - ... - -
    - - -
    -
    - ); -} -``` - -## API Reference - -### Switch - -`Switch` is equivalent to the `Root` import from `@kobalte/core/switch` (and deprecated `Switch.Root`). - -| Prop | Description | -| --- | --- | -| checked | `boolean`
    The controlled checked state of the switch. | -| defaultChecked | `boolean`
    The default checked state when initially rendered. Useful when you do not need to control the checked state. | -| onChange | `(checked: boolean) => void`
    Event handler called when the checked state of the switch changes. | -| name | `string`
    The name of the switch, used when submitting an HTML form. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefname). | -| value | `string`
    The value of the switch, used when submitting an HTML form. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefvalue). | -| validationState | `'valid' | 'invalid'`
    Whether the switch should display its "valid" or "invalid" visual styling. | -| required | `boolean`
    Whether the user must check the switch before the owning form can be submitted. | -| disabled | `boolean`
    Whether the switch is disabled. | -| readOnly | `boolean`
    Whether the switch can be checked but not changed by the user. | - -| Render Prop | Description | -| --- | --- | -| checked | `Accessor`
    Whether the switch is checked or not. | - -| Data attribute | Description | -| --- | --- | -| data-valid | Present when the switch is valid according to the validation rules. | -| data-invalid | Present when the switch is invalid according to the validation rules. | -| data-required | Present when the switch is required. | -| data-disabled | Present when the switch is disabled. | -| data-readonly | Present when the switch is read only. | -| data-checked | Present when the switch is checked. | - -`Switch.Input`, `Switch.Control`, `Switch.Thumb`, `Switch.Label`, `Switch.Description` and `Switch.ErrorMessage` shares the same data-attributes. - -### Switch.ErrorMessage - -| Prop | Description | -| --- | --- | -| forceMount | `boolean`
    Used to force mounting when more control is needed. Useful when controlling animation with SolidJS animation libraries. | - -## Rendered elements - -| Component | Default rendered element | -| --- | --- | -| `Switch` | `div` | -| `Switch.Input` | `input` | -| `Switch.Control` | `div` | -| `Switch.Indicator` | `div` | -| `Switch.Label` | `label` | -| `Switch.Description` | `div` | -| `Switch.ErrorMessage` | `div` | - -## Accessibility - -### Keyboard Interactions - -| Key | Description | -| --- | --- | -| `Space` | Toggles the switch on and off. | - -Previous[←Slider](https://kobalte.dev/docs/core/components/slider)Next[Tabs→](https://kobalte.dev/docs/core/components/tabs) \ No newline at end of file diff --git a/.firecrawl/kobalte.dev-docs-core-components-tabs.md b/.firecrawl/kobalte.dev-docs-core-components-tabs.md deleted file mode 100644 index 3b60623..0000000 --- a/.firecrawl/kobalte.dev-docs-core-components-tabs.md +++ /dev/null @@ -1,631 +0,0 @@ -# Tabs - -A set of layered sections of content, known as tab panels, that display one panel of content at a time. - -## Import - -``` -Copyts -import { Tabs } from "@kobalte/core/tabs"; -// or -import { Root, List, ... } from "@kobalte/core/tabs"; -// or (deprecated) -import { Tabs } from "@kobalte/core"; -``` - -``` -Copyts -import { Tabs } from "@kobalte/core/tabs"; -// or -import { Root, List, ... } from "@kobalte/core/tabs"; -// or (deprecated) -import { Tabs } from "@kobalte/core"; -``` - -## Features - -- Follow the [WAI ARIA Tabs](https://www.w3.org/WAI/ARIA/apg/patterns/tabs/) design pattern, semantically linking tabs and their associated tab panels. -- Support for LTR and RTL keyboard navigation. -- Support for disabled tabs. -- Supports horizontal/vertical orientation. -- Supports automatic/manual activation. -- Focus management for tab panels without any focusable children. -- Can be controlled or uncontrolled. - -## Anatomy - -The tabs consist of: - -- **Tabs:** The root container for tabs and tab contents. -- **Tabs.List:** Contains the tabs that are aligned along the edge of the active tab content. -- **Tabs.Trigger:** The button that activates its associated tab content. -- **Tabs.Indicator:** The visual indicator displayed at the bottom of the tab list to indicate the selected tab. -- **Tabs.Content:** Contains the content associated with a tab trigger. - -``` -Copytsx - - - - - - - -``` - -``` -Copytsx - - - - - - - -``` - -## Example - -ProfileDashboardSettingsContact - -Profile details - -index.tsxstyle.css - -``` -Copytsx -import { Tabs } from "@kobalte/core/tabs"; -import "./style.css"; - -function App() { - return ( - - - Profile - Dashboard - Settings - Contact - - - Profile details - Dashboard details - Settings details - Contact details - - ); -} -``` - -``` -Copytsx -import { Tabs } from "@kobalte/core/tabs"; -import "./style.css"; - -function App() { - return ( - - - Profile - Dashboard - Settings - Contact - - - Profile details - Dashboard details - Settings details - Contact details - - ); -} -``` - -## Usage - -### Default value - -A default selected tab can be provided using the `defaultValue` prop, which should correspond to the `value` prop provided to each tab. - -ProfileDashboardSettingsContact - -Dashboard details - -``` -Copytsx - - - Profile - Dashboard - Settings - Contact - - - Profile details - Dashboard details - Settings details - Contact details - -``` - -``` -Copytsx - - - Profile - Dashboard - Settings - Contact - - - Profile details - Dashboard details - Settings details - Contact details - -``` - -### Controlled value - -Selected tab can be controlled using the `value` prop, paired with the `onChange` event. The `value` prop from the selected tab will be passed into the callback when the tab is selected, allowing you to update state accordingly. - -ProfileDashboardSettingsContact - -Settings details - -Selected tab: settings - -``` -Copytsx -import { createSignal } from "solid-js"; - -function ControlledExample() { - const [selectedTab, setSelectedTab] = createSignal("settings"); - - return ( - <> - - - Profile - Dashboard - Settings - Contact - - - Profile details - Dashboard details - Settings details - Contact details - -

    Selected tab: {selectedTab()}

    - - ); -} -``` - -``` -Copytsx -import { createSignal } from "solid-js"; - -function ControlledExample() { - const [selectedTab, setSelectedTab] = createSignal("settings"); - - return ( - <> - - - Profile - Dashboard - Settings - Contact - - - Profile details - Dashboard details - Settings details - Contact details - -

    Selected tab: {selectedTab()}

    - - ); -} -``` - -### Focusable content - -When the tab content doesn't contain any focusable content, the entire content is given a `tabIndex=0` so that the content can be navigated to with the keyboard. - -When the tab content contains focusable content, such as an ``, then the `tabIndex` is omitted because the content itself can receive focus. - -This example uses the same Tabs components from above. Try navigating from the tabs to each content using the keyboard. - -ProfileDashboardSettingsContact - -``` -Copytsx -function FocusableContentExample() { - return ( - - - Profile - Dashboard - Settings - Contact - - - - - - Dashboard details - Settings details - Contact details - - ); -} -``` - -``` -Copytsx -function FocusableContentExample() { - return ( - - - Profile - Dashboard - Settings - Contact - - - - - - Dashboard details - Settings details - Contact details - - ); -} -``` - -### Dynamic tabs - -Tabs can be added/removed dynamically by using a signal and SolidJS `For`. - -Add tabRemove tab - -Tab 1Tab 2Tab 3 - -Tab body 1 - -``` -Copytsx -import { createSignal } from "solid-js"; - -function DynamicContentExample() { - const [tabs, setTabs] = createSignal([\ - { id: "1", title: "Tab 1", content: "Tab body 1" },\ - { id: "2", title: "Tab 2", content: "Tab body 2" },\ - { id: "3", title: "Tab 3", content: "Tab body 3" },\ - ]); - - const addTab = () => { - setTabs(prev => [\ - ...prev,\ - {\ - id: String(prev.length + 1),\ - title: `Tab ${prev.length + 1}`,\ - content: `Tab Body ${prev.length + 1}`,\ - },\ - ]); - }; - - const removeTab = () => { - if (tabs().length > 1) { - setTabs(prev => prev.slice(0, -1)); - } - }; - - return ( - <> - - - - - {tab => {tab.title}} - - - {tab => {tab.content}} - - - ); -} -``` - -``` -Copytsx -import { createSignal } from "solid-js"; - -function DynamicContentExample() { - const [tabs, setTabs] = createSignal([\ - { id: "1", title: "Tab 1", content: "Tab body 1" },\ - { id: "2", title: "Tab 2", content: "Tab body 2" },\ - { id: "3", title: "Tab 3", content: "Tab body 3" },\ - ]); - - const addTab = () => { - setTabs(prev => [\ - ...prev,\ - {\ - id: String(prev.length + 1),\ - title: `Tab ${prev.length + 1}`,\ - content: `Tab Body ${prev.length + 1}`,\ - },\ - ]); - }; - - const removeTab = () => { - if (tabs().length > 1) { - setTabs(prev => prev.slice(0, -1)); - } - }; - - return ( - <> - - - - - {tab => {tab.title}} - - - {tab => {tab.content}} - - - ); -} -``` - -### Activation mode - -By default, pressing the arrow keys while focus is on a Tab will switch selection to the adjacent Tab in that direction, updating the content displayed accordingly. - -If you would like to prevent selection change from happening automatically you can set the `activationMode` prop to `manual`. This will prevent tab selection from changing on arrow key press, requiring a subsequent `Enter` or `Space` key press to confirm tab selection. - -ProfileDashboardSettingsContact - -Profile details - -``` -Copytsx - - - Profile - Dashboard - Settings - Contact - - - Profile details - Dashboard details - Settings details - Contact details - -``` - -``` -Copytsx - - - Profile - Dashboard - Settings - Contact - - - Profile details - Dashboard details - Settings details - Contact details - -``` - -### Orientation - -By default, tabs are horizontally oriented. The `orientation` prop can be set to `vertical` to change this. This affects keyboard navigation. You are responsible for styling your tabs accordingly. - -ProfileDashboardSettingsContact - -Profile details - -``` -Copytsx - - - Profile - Dashboard - Settings - Contact - - - Profile details - Dashboard details - Settings details - Contact details - -``` - -``` -Copytsx - - - Profile - Dashboard - Settings - Contact - - - Profile details - Dashboard details - Settings details - Contact details - -``` - -### Disabled - -All tabs can be disabled using the `disabled` prop. - -ProfileDashboardSettingsContact - -Profile details - -``` -Copytsx - - - Profile - Dashboard - Settings - Contact - - - Profile details - Dashboard details - Settings details - Contact details - -``` - -``` -Copytsx - - - Profile - Dashboard - Settings - Contact - - - Profile details - Dashboard details - Settings details - Contact details - -``` - -Individual tab can be disabled using the `disabled` prop on the tab itself. - -ProfileDashboardSettingsContact - -Profile details - -``` -Copytsx - - - Profile - Dashboard - - Settings - - Contact - - - Profile details - Dashboard details - Settings details - Contact details - -``` - -``` -Copytsx - - - Profile - Dashboard - - Settings - - Contact - - - Profile details - Dashboard details - Settings details - Contact details - -``` - -## API Reference - -### Tabs - -`Tabs` is equivalent to the `Root` import from `@kobalte/core/tabs` (and deprecated `Tabs.Root`). - -| Prop | Description | -| --- | --- | -| value | `string`
    The controlled value of the tab to activate. | -| defaultValue | `string`
    The value of the tab that should be active when initially rendered. Useful when you do not need to control the state. | -| onChange | `(value: string) => void`
    Event handler called when the value changes. | -| orientation | `'horizontal' | 'vertical'`
    The orientation of the tabs. | -| activationMode | `'automatic' | 'manual'`
    Whether tabs are activated automatically on focus or manually. | -| disabled | `boolean`
    Whether the tabs are disabled. | - -| Data attribute | Description | -| --- | --- | -| data-orientation='horizontal' | Present when the separator has horizontal orientation. | -| data-orientation='vertical' | Present when the separator has vertical orientation. | - -`Tabs.List`, `Tabs.Trigger`, `Tabs.Indicator` and `Tabs.Content` share the same data-attributes. - -### Tabs.Trigger - -| Prop | Description | -| --- | --- | -| value | `string`
    The unique key that associates the tab with a tab panel. | -| disabled | `boolean`
    Whether the tab should be disabled. | - -| Data attribute | Description | -| --- | --- | -| data-selected | Present when the trigger is selected. | -| data-disabled | Present when the trigger is disabled. | -| data-highlighted | Present when the trigger is highlighted. | - -### Tabs.Content - -| Prop | Description | -| --- | --- | -| value | `string`
    The unique key that associates the tab panel with a tab. | -| forceMount | `boolean`
    Used to force mounting when more control is needed. Useful when controlling animation with SolidJS animation libraries. | - -| Data attribute | Description | -| --- | --- | -| data-selected | Present when the associated trigger is selected. | - -## Rendered elements - -| Component | Default rendered element | -| --- | --- | -| `Tabs` | `div` | -| `Tabs.List` | `div` | -| `Tabs.Trigger` | `button` | -| `Tabs.Indicator` | `div` | -| `Tabs.Content` | `div` | - -## Accessibility - -### Keyboard Interactions - -| Key | Description | -| --- | --- | -| `Tab` | When focus moves onto the tabs, focuses the active trigger.
    When a trigger is focused, moves focus to the active content. | -| `ArrowDown` | Moves focus to the next trigger in vertical orientation and activates its associated content. | -| `ArrowRight` | Moves focus to the next trigger in horizontal orientation and activates its associated content. | -| `ArrowUp` | Moves focus to the previous trigger in vertical orientation and activates its associated content. | -| `ArrowLeft` | Moves focus to the previous trigger in horizontal orientation and activates its associated content. | -| `Home` | Moves focus to the first trigger and activates its associated content. | -| `End` | Moves focus to the last trigger and activates its associated content. | -| `Enter` | In manual mode, when a trigger is focused, moves focus to its associated content. | -| `Space` | In manual mode, when a trigger is focused, moves focus to its associated content. | - -Previous[←Switch](https://kobalte.dev/docs/core/components/switch)Next[Text Field→](https://kobalte.dev/docs/core/components/text-field) \ No newline at end of file diff --git a/.firecrawl/kobalte.dev-docs-core-components-text-field.md b/.firecrawl/kobalte.dev-docs-core-components-text-field.md deleted file mode 100644 index ddb2bd3..0000000 --- a/.firecrawl/kobalte.dev-docs-core-components-text-field.md +++ /dev/null @@ -1,394 +0,0 @@ -# Text Field - -A text input that allow users to input custom text entries with a keyboard. - -## Import - -``` -Copyts -import { TextField } from "@kobalte/core/text-field"; -// or -import { Root, Label, ... } from "@kobalte/core/text-field"; -// or (deprecated) -import { TextField } from "@kobalte/core"; -``` - -``` -Copyts -import { TextField } from "@kobalte/core/text-field"; -// or -import { Root, Label, ... } from "@kobalte/core/text-field"; -// or (deprecated) -import { TextField } from "@kobalte/core"; -``` - -## Features - -- Built with a native `` or `