This is the full developer documentation for Yamada UI v2. # Accessibility --- title: Accessibility description: "Yamada UI follow the WAI-ARIA authoring practices guidelines and are tested in a wide selection of modern browsers and commonly used assistive technologies." --- # Accessibility Yamada UI follow the WAI-ARIA authoring practices guidelines and are tested in a wide selection of modern browsers and commonly used assistive technologies. We take care of many of the difficult implementation details related to accessibility, including `aria` and `role` attributes, focus management, and keyboard navigation. That means that users should be able to use our components as-is in most contexts and rely on functionality to follow the expected accessibility design patterns. ## WAI-ARIA [WAI-ARIA](https://www.w3.org/TR/wai-aria-1.2) is developed by [W3C](https://www.w3.org) and defines the semantics of many common UI patterns seen in Yamada UI. This is designed to give meaning to controls built without using the browser-provided elements. For example, if you were to create a button using `div` instead of `button`, there are attributes that you would need to add to `div` to inform screen readers and speech recognition tools that it is a button. In addition to semantics, there are also expected behaviors for different types of components. `button` is an example of a component that needs to be reimplemented using JavaScript because it has interactions that do not exist on `div`. [WAI-ARIA authoring practices](https://www.w3.org/WAI/ARIA/apg) provides additional guidance for implementing the behaviors of many of the controls that come with Yamada UI. ## Accessible Label Many components are designed to provide semantic meaning and context to the corresponding input or select elements. For components that Yamada UI does not provide, [WAI-ARIA provides a specification](https://www.w3.org/TR/wai-aria-1.2/#namecalculation) that provides a specification for providing accessible names and descriptions for those components. Yamada UI is as abstracted as possible and simplifies the labeling of components. [Field.Label](https://yamada-ui.com/docs/components/field.md) is designed to work with many of our components. Ultimately, it is your responsibility to provide labels so that users have the appropriate context when navigating your application. ## Keyboard Navigation [Tabs](https://yamada-ui.com/docs/components/tabs.md) and [Modal](https://yamada-ui.com/docs/components/modal.md) are examples of complex components that require users to interact with content using keyboard and other non-mouse input modalities. Yamada UI provides basic keyboard support following the [WAI-ARIA authoring practices](https://www.w3.org/WAI/ARIA/apg). ## Focus Management Proper keyboard navigation and proper labeling are closely related to focus management. It is often helpful to move focus in response to an action when a user interacts with an element, and the result of that interaction changes something in the application, and the next focus should logically function according to the new context of the application. For users who use screen readers, moving focus is often accompanied by an announcement that conveys the new context, which is essential for proper labeling. Many of Yamada UI's components move focus based on the actions that users typically perform on the components. # Learn the Advanced --- title: Learn the Advanced description: "Learn the theme, loading, notice, and animation of Yamada UI." --- # Learn the Advanced Learn the theme, loading, notice, and animation of Yamada UI. This guide will help you understand the concepts of Yamada UI. We recommend reading this guide before you start developing with Yamada UI. :::tip This guide is basic and is intended to give you a sense of the **fun** of developing with Yamada UI. Therefore, it does not explain each concept and feature in depth. If you want to know more, please check the links within the page. ::: ## Theme Yamada UI has the same concept as other UI libraries, which is theme. Theme is an object that can be changed and has [colors](https://yamada-ui.com/docs/theming/tokens/colors.md), [spaces](https://yamada-ui.com/docs/theming/tokens/spaces.md), [font sizes](https://yamada-ui.com/docs/theming/tokens/font-sizes.md), and many other tokens defined. [Breakpoints](https://yamada-ui.com/docs/theming/breakpoints.md) and [color modes](https://yamada-ui.com/docs/theming/color-mode.md) used in applications can also be easily changed. Also, [theme switching](https://yamada-ui.com/docs/theming/switching-themes.md) that is not implemented in other UI libraries is supported. ```tsx const { themeScheme, changeThemeScheme } = useTheme() return ( The current scheme is "{themeScheme}" Primary Secondary Primary Secondary ) ``` :::note If you want to know more about the theme, please check [this](https://yamada-ui.com/docs/theming.md). ::: ### Layer Styles Layer styles are tokens used to reuse visual styles across the project. ```tsx preview {(token, index) => ( {toTitleCase(token)} )} ``` :::note If you want to know more about the layer styles, please check [this](https://yamada-ui.com/docs/styling/layer-styles.md). ::: ### Text Styles Text styles are tokens used to reuse text styles across the project. ```tsx Mono ``` :::note If you want to know more about the text styles, please check [this](https://yamada-ui.com/docs/styling/text-styles.md). ::: ## Loading Yamada UI supports loading animations needed for applications. To execute the loading animation, use [useLoading](https://yamada-ui.com/docs/hooks/use-loading.md). [useLoading](https://yamada-ui.com/docs/hooks/use-loading.md) returns instances of `screen`, `page`, and `background`. The instances include several methods. - `start`: Start the loading animation. - `update`: Update the loading animation. - `finish`: Finish the loading animation. - `force`: Force update the loading animation. ```tsx const { screen, page, background } = useLoading() const onLoadingScreen = async () => { try { screen.start() await wait(3000) } finally { screen.finish() } } const onLoadingPage = async () => { try { page.start() await wait(3000) } finally { page.finish() } } const onLoadingBackground = async () => { try { background.start() await wait(3000) } finally { background.finish() } } return ( ) ``` ### Use useAsyncCallback When executing asynchronous callbacks in applications, [useAsyncCallback](https://yamada-ui.com/docs/hooks/use-async-callback.md) is useful to indicate whether a button or other elements are loading. ```tsx const [loading, onClick] = useAsyncCallback(async () => { await wait(3000) }, []) return ( ) ``` `screen` and `page` can also be executed together. ```tsx const [loading, onClick] = useAsyncCallback( async () => { await wait(3000) }, [], { loading: "page" }, ) return ( ) ``` :::note If you want to know more about the loading animation, please check [this](https://yamada-ui.com/docs/hooks/use-loading.md). ::: ## Notice Yamada UI supports notices needed for applications. To display the notice, use [useNotice](https://yamada-ui.com/docs/hooks/use-notice.md). [useNotice](https://yamada-ui.com/docs/hooks/use-notice.md) returns an instance that displays and controls the notice. ```tsx const notice = useNotice() return ( ) ``` :::note If you want to know more about the notice, please check [this](https://yamada-ui.com/docs/hooks/use-notice.md). ::: ## Animation Yamada UI provides components specialized in CSS animations and animations. ### CSS Animation [@keyframes](https://developer.mozilla.org/ja/docs/Web/CSS/@keyframes) to apply intermediate states of animations, use `_keyframes`. ```tsx Box ``` Also, you can apply common keyframes throughout your application by using [theme](https://yamada-ui.com/docs/theming.md) [keyframes](https://yamada-ui.com/docs/theming/tokens/keyframes.md). Set the value to `animationName` or `_keyframes`. ```tsx Box ``` :::note If you want to know more about the animation, please check [this](https://yamada-ui.com/docs/styling/animation.md). ::: ### Motion Yamada UI provides a convenient component that extends the Yamada UI [Style Props](https://yamada-ui.com/docs/styling/style-props.md) to [Motion](https://motion.dev). ```tsx
``` [Motion](https://yamada-ui.com/docs/components/motion.md) supports gesture animations. - `whileHover`: The animation executed when the pointer is moved over the component. - `whileTap`: The animation executed when the pointer is clicked or tapped on the component. - `whileFocus`: The animation executed when the component is focused. ```tsx Click me! ``` :::note If you want to know more about the `Motion` component, please check [this](https://yamada-ui.com/docs/components/motion.md). ::: ## Congratulations! Congratulations!🎉 This means you've become a **Wonderful Yamada**🥳 ## Learn more Want to learn more about Yamada UI?😎 - [Learn the Theme](https://yamada-ui.com/docs/theming.md): Yamada UI's theme is customizable and ensures consistency in the application's design. - [Explore the Components](https://yamada-ui.com/docs/components.md): Yamada UI provides over 130 flexible components. All components support animations and dark mode. - [Learn the Styling](https://yamada-ui.com/docs/styling.md): All components are designed to be styled using props. - [Explore the Source Code](https://github.com/yamada-ui/yamada-ui): Yamada UI's package and documentation site are open source. If you like Yamada UI, please star it. # Learn the Basics --- title: Learn the Basics description: "Read a 3-minute tutorial to learn the basics of Yamada UI's components, styling, responsive design, and color mode." --- # Learn the Basics Read a 3-minute tutorial to learn the basics of Yamada UI's components, styling, responsive design, and color mode. This guide will help you understand the concepts of Yamada UI. We recommend reading this guide before you start developing with Yamada UI. :::tip This guide is basic and is intended to give you a sense of the **fun** of developing with Yamada UI. Therefore, it does not explain each concept and feature in depth. If you want to know more, please check the links within the page. ::: ## Components Yamada UI provides components in two ways. One is a new method of downloading components locally from [CLI](https://yamada-ui.com/docs/components/cli.md). The other is the traditional method of importing components from modules. ### Download The cases for downloading components locally from [CLI](https://yamada-ui.com/docs/components/cli.md) are as follows. - Customize the [variant](https://yamada-ui.com/docs/components/styled.md#variant-style) or [size](https://yamada-ui.com/docs/components/styled.md#size-style) styles of the component. - Customize the initial value or logic of the component. - Fix a bug in the component's style or logic by directly modifying it. ```bash pnpm yamada-cli add button ``` ```bash npm yamada-cli add button ``` ```bash yarn yamada-cli add button ``` ```bash bun yamada-cli add button ``` :::note Yamada UI updates the components, you can easily update the components by checking the [Check Differences](https://yamada-ui.com/docs/components/cli.md#check-differences) or [Update Components](https://yamada-ui.com/docs/components/cli.md#update-components) in [CLI](https://yamada-ui.com/docs/components/cli.md). If your changes conflict with the updates, they will be displayed in the same way as the [HOW CONFLICTS ARE PRESENTED](https://git-scm.com/docs/git-merge#_how_conflicts_are_presented) of [Git](https://git-scm.com), and you can easily resolve them. ::: ### Import If you want to use the component without making any changes, you can simply import the component from the module. ```tsx import { Button } from "@yamada-ui/react" ``` ```tsx import { Button } from "@/components/ui" ``` ```tsx import { Button } from "@workspaces/ui" ``` :::note If you want to know more about the components, please check [this](https://yamada-ui.com/docs/components.md). ::: ## Styling [Style Props](https://yamada-ui.com/docs/styling/style-props.md) is a prop that applies styles to elements using props. Style Props follows the [CSS properties](https://developer.mozilla.org/ja/docs/Web/CSS/Properties) and provides all properties in camelCase. ```tsx Box ``` :::note [Style Props](https://yamada-ui.com/docs/styling/style-props.md) uses [@mdn/browser-compat-data](https://github.com/mdn/browser-compat-data). When the library is updated, Style Props is also updated periodically. ::: ### Conditional Styles Conditional styles allow you to apply styles to [pseudo-elements](https://yamada-ui.com/docs/styling/style-props.md#pseudo-elements), [pseudo-classes](https://yamada-ui.com/docs/styling/style-props.md#pseudo-classes), and [selectors](https://yamada-ui.com/docs/styling/style-props.md#selectors). ```tsx Hover me ``` :::note If you want to know more about the styling, please check [this](https://yamada-ui.com/docs/styling.md). ::: ### Color Schemes Color schemes generate a color context for the component based on the values. This improves consistency in colors. ```tsx Solid Subtle ``` Color schemes inherit the color scheme of the parent element. ```tsx Provided by Parent Child ``` :::note If you want to know more about the color schemes, please check [this](https://yamada-ui.com/docs/styling/color-scheme.md). ::: ## Responsive Design Responsive design refers to the breakpoints defined in the theme. Yamada UI has a default theme, and [breakpoints](https://yamada-ui.com/docs/theming/tokens/breakpoints.md) are defined. To apply responsive design to [Style Props](https://yamada-ui.com/docs/styling/style-props.md), set an object with the breakpoints as the key. - The keys of the object define the keys set in the theme's [breakpoints](https://yamada-ui.com/docs/theming/tokens/breakpoints.md). - The values of the object define the values of the styles set by the key. ```tsx Box ``` :::note If you want to know more about the responsive design, please check [this](https://yamada-ui.com/docs/styling/responsive-design.md). ::: ## Color Mode Yamada UI has built-in support for managing the application's color mode, allowing you to easily switch between light and dark modes. All provided components also support dark mode. To apply color mode to [Style Props](https://yamada-ui.com/docs/styling/style-props.md), set an array. - Set the value for light mode as the first element. - Set the value for dark mode as the last element. ```tsx Box ``` :::note If you want to know more about the color mode, please check [this](https://yamada-ui.com/docs/styling/color-mode.md). ::: ## Congratulations! Congratulations!🎉 This means you've become a **Regular Yamada**🥳 To the **Regular Yamada**, I'd like to give you this word. "Next, I'm waiting for you in [Learn the Advanced](https://yamada-ui.com/docs/get-started/advanced.md)///"😘 ## Learn more Want to learn more about Yamada UI?😎 - [Learn the Advanced](https://yamada-ui.com/docs/get-started/advanced.md): Learn the applications of styling, responsiveness, dark mode, and animations of Yamada UI. - [Explore the Components](https://yamada-ui.com/docs/components.md): Yamada UI provides over 130 flexible components. All components support animations and dark mode. - [Learn the Styling](https://yamada-ui.com/docs/styling.md): All components are designed to be styled using props. - [Explore the Source Code](https://github.com/yamada-ui/yamada-ui): Yamada UI's package and documentation site are open source. If you like Yamada UI, please star it. # CLI --- title: CLI description: "Learn how to generate components and theme using CLI commands." --- # CLI Learn how to generate components and theme using CLI commands. ## Installation To use CLI, you need to install `@yamada-ui/cli` in your project. ```bash pnpm add -D @yamada-ui/cli ``` ```bash npm i -D @yamada-ui/cli ``` ```bash yarn add -D @yamada-ui/cli ``` ```bash bun add -D @yamada-ui/cli ``` ## Commands ### init When you run the `init` command, the necessary files and folders for your project will be created. ```bash pnpm yamada-cli init ``` ```bash npm yamada-cli init ``` ```bash yarn yamada-cli init ``` ```bash bun yamada-cli init ``` ```bash Usage: pnpm yamada-cli init [options] initialize your project and install dependencies. Options: --cwd current working directory. -c, --config path to the config file. (default: "ui.json") -o, --overwrite overwrite existing files. (default: false) -t, --tag tag for the registries (e.g. dev, next). -j, --jsx use jsx instead of tsx. (default: false) -y, --yes skip all confirmation prompts. (default: false) -m, --monorepo enable monorepo mode. --no-monorepo disable monorepo mode. -p, --package-name package name. -s, --src use `src/` directory when choice is monorepo. -i, --install install dependencies when choice is monorepo. --no-install do not install dependencies when choice is monorepo. -f, --format use Prettier. --no-format do not use Prettier. -l, --lint use ESLint. --no-lint do not use ESLint. --outdir output directory path. -h, --help display help for command ``` After running the `init` command, you will see the following prompts. ```txt Would you like to use monorepo? (recommended) … No / Yes What is the path to the monorepo? … ./workspaces/ui What is the package name? … @workspaces/ui Would you like your code inside a `src/` directory? … No / Yes Would you like to use Prettier? … No / Yes Would you like to use ESLint? … No / Yes ``` After the prompts, the config and required dependencies will be installed. ### add When you run the `add` command, the specified component and its dependencies will be added to your project. ```bash pnpm yamada-cli add box ``` ```bash npm yamada-cli add box ``` ```bash yarn yamada-cli add box ``` ```bash bun yamada-cli add box ``` :::note All components that the specified component depends on will also be added. ::: If you don't specify a component, all available components will be added. ```bash pnpm yamada-cli add ``` ```bash npm yamada-cli add ``` ```bash yarn yamada-cli add ``` ```bash bun yamada-cli add ``` ```bash Usage: pnpm yamada-cli add [options] [components...] add a component to your project. Arguments: components components to add. Options: --cwd current working directory. -c, --config path to the config file. (default: "ui.json") -o, --overwrite overwrite existing files. (default: false) -s, --sequential run tasks sequentially. (default: false) -y, --yes skip all confirmation prompts. (default: false) -i, --install install dependencies. --no-install do not install dependencies. -f, --format format the output files. --no-format do not format the output files. -l, --lint lint the output files. --no-lint do not lint the output files. -t, --tag tag for the registries (e.g. dev, next). -h, --help display help for command ``` ### diff When you run the `diff` command, you can check the difference between the local and remote components. ```bash pnpm yamada-cli diff box ``` ```bash npm yamada-cli diff box ``` ```bash yarn yamada-cli diff box ``` ```bash bun yamada-cli diff box ``` If you don't specify a component, you can check the difference for all components in your project. ```bash pnpm yamada-cli diff ``` ```bash npm yamada-cli diff ``` ```bash yarn yamada-cli diff ``` ```bash bun yamada-cli diff ``` ```bash Usage: pnpm yamada-cli diff [options] [component] check for updates against the registry. Arguments: component component to check. Options: --cwd current working directory. -c, --config path to the config file. (default: "ui.json") -s, --sequential run tasks sequentially. (default: false) -d, --detail show detailed changes. (default: false) -y, --yes skip all confirmation prompts. (default: false) -u, --update update files when there are file diff. --no-update do not update files when there are file diff. -i, --install install dependencies when updating files. --no-install do not install dependencies when updating files. -t, --tag tag for the registries (e.g. dev, next). -h, --help display help for command ``` ### update When you run the `update` command, the specified component will be updated. ```bash pnpm yamada-cli update box ``` ```bash npm yamada-cli update box ``` ```bash yarn yamada-cli update box ``` ```bash bun yamada-cli update box ``` If you don't specify a component, all components in your project will be updated. ```bash pnpm yamada-cli update ``` ```bash npm yamada-cli update ``` ```bash yarn yamada-cli update ``` ```bash bun yamada-cli update ``` ```bash Usage: pnpm yamada-cli update [options] [components...] update components in your project. Arguments: components components to update. Options: --cwd current working directory. -c, --config path to the config file. (default: "ui.json") -s, --sequential run tasks sequentially. (default: false) -F, --force force update, overwriting local changes. (default: false) -y, --yes skip all confirmation prompts. (default: false) -i, --install install dependencies. --no-install do not install dependencies. -f, --format format the output files. --no-format do not format the output files. -l, --lint lint the output files. --no-lint do not lint the output files. -t, --tag tag for the registries (e.g. dev, next). -h, --help display help for command ``` ### theme When you run the `theme` command, the theme will be generated at the specified path. ```bash pnpm yamada-cli theme ``` ```bash npm yamada-cli theme ``` ```bash yarn yamada-cli theme ``` ```bash bun yamada-cli theme ``` :::note If you don't specify a path, the theme will be generated in `./theme`. ::: ```bash Usage: pnpm yamada-cli theme [options] [path] generate theme to your project. Arguments: path path to the theme directory. Options: --cwd current working directory. -c, --config path to the config file. (default: "ui.json") -o, --overwrite overwrite existing directory. (default: false) -j, --js use js instead of ts. -y, --yes skip all confirmation prompts. (default: false) -p, --package-name package name (for monorepo). -s, --src use src/ directory. --no-src do not use src/ directory. -i, --install install dependencies when choice is monorepo. --no-install do not install dependencies when choice is monorepo. -f, --format format the output files. --no-format do not format the output files. -l, --lint lint the output files. --no-lint do not lint the output files. -t, --tag tag for the registries (e.g. dev, next). -h, --help display help for command ``` ### tokens When you run the `tokens` command, you can update the customized theme typings. This typings are used for [Style Props](https://yamada-ui.com/docs/styling/style-props.md). ```bash pnpm yamada-cli tokens ``` ```bash npm yamada-cli tokens ``` ```bash yarn yamada-cli tokens ``` ```bash bun yamada-cli tokens ``` :::note If you don't specify a path, the `theme.path` will be used. ::: ```bash Usage: pnpm yamada-cli tokens [options] [path] generate theme typings. Arguments: path path to the theme file. Options: --cwd current working directory. -c, --config path to the config file. (default: "ui.json") -o, --out output path. -f, --format format the output file. --no-format do not format the output file. -l, --lint lint the output file. --no-lint do not lint the output file. --internal generate internal tokens. (default: false) -h, --help display help for command ``` ## Configuration After running the `init` command, a `ui.json` will be generated in your project. You can customize it in various ways. | Property | Default | Description | | ------------------------- | -------------- | ------------------------------------------------------------------------------------------------------------ | | `path` | `./ui` | The path to the workspace. | | `monorepo` | `false` | Whether to use a monorepo. | | `jsx` | `false` | Whether to use JSX. | | `theme.path` | `./theme` | The path to the theme directory. | | `components.path` | `./components` | The path to the components directory. | | `components.overwrite` | `true` | Whether to update the local references of existing components when components are added. | | `components.dependents` | `true` | Whether to add dependents of components when components are added. | | `components.dependencies` | `false` | Whether to add dependencies of components when components are added. | | `hooks.path` | `./hooks` | The path to the hooks directory. | | `hooks.overwrite` | `false` | Whether to update the local references of existing hooks when components are added. | | `hooks.dependents` | `true` | Whether to add dependents of hooks when hooks are added. | | `hooks.dependencies` | `false` | Whether to add dependencies of hooks when hooks are added. | | `providers.path` | `./providers` | The path to the providers directory. | | `providers.overwrite` | `false` | Whether to update the local references of existing providers when components are added. | | `providers.dependents` | `true` | Whether to add dependents of providers when providers are added. | | `providers.dependencies` | `false` | Whether to add dependencies of providers when providers are added. | | `format.configPath` | - | The path to the config file for [Prettier](https://prettier.io). | | `format.enabled` | `false` | Whether to run the `--write` option of [Prettier](https://prettier.io) when components are added or updated. | | `lint.enabled` | `false` | Whether to run the `--fix` option of [ESLint](https://eslint.org) when components are added or updated. | # Get Started --- title: Get Started description: "How to install and use Yamada UI in your project." --- # Get Started How to install and use Yamada UI in your project. ## Pick your framework - [Next.js (App)](https://yamada-ui.com/docs/get-started/frameworks/next-app.md): A guide for installing and using Yamada UI with Next.js app directory. - [Next.js (Pages)](https://yamada-ui.com/docs/get-started/frameworks/next-pages.md): A guide for installing and using Yamada UI with Next.js pages directory. - [Vite](https://yamada-ui.com/docs/get-started/frameworks/vite.md): A guide for installing and using Yamada UI with Vite.js projects. - [React Router](https://yamada-ui.com/docs/get-started/frameworks/react-router.md): A guide for installing and using Yamada UI with React Router projects. - [TanStack Start](https://yamada-ui.com/docs/get-started/frameworks/tanstack-start.md): A guide for installing and using Yamada UI with TanStack Start projects. - [TanStack Router](https://yamada-ui.com/docs/get-started/frameworks/tanstack-router.md): A guide for installing and using Yamada UI with TanStack Router projects. ## Installation To install Yamada UI in your project, you can either set it up using the [CLI](https://yamada-ui.com/docs/get-started/cli.md) or install it via [npm](https://www.npmjs.com). :::warning Yamada UI is compatible with React 19. If you are using React 18 or earlier, please upgrade to React 19. ::: ### CLI #### Setup Running the command will create the necessary files and folders in your project. ```bash pnpm dlx @yamada-ui/cli init ``` ```bash npx @yamada-ui/cli init ``` ```bash yarn dlx @yamada-ui/cli init ``` ```bash bunx @yamada-ui/cli init ``` #### Install the package Install `@workspaces/ui` to your application. ```bash pnpm add "@workspaces/ui@workspace:*" ``` ```bash npm install "@workspaces/ui@workspace:*" ``` ```bash yarn add "@workspaces/ui@workspace:*" ``` ```bash bun add "@workspaces/ui@workspace:*" ``` #### Add provider After installing, add `UIProvider` to the root of your application. ```tsx import { UIProvider } from "@workspaces/ui" const App = () => { return ( ) } ``` #### Use components After adding `UIProvider`, you can use the components in your application. ```tsx import { Button } from "@workspaces/ui" const App = () => { return } ``` That's it! You've successfully set up Yamada UI. ### npm #### Install the package Yamada UI can be installed with `@yamada-ui/react` only, and all components and hooks can be used. ```bash pnpm add @yamada-ui/react ``` ```bash npm install @yamada-ui/react ``` ```bash yarn add @yamada-ui/react ``` ```bash bun add @yamada-ui/react ``` #### Add provider After installing, add `UIProvider` to the root of your application. ```tsx import { UIProvider } from "@yamada-ui/react" const App = () => { return ( ) } ``` #### Use components After adding `UIProvider`, you can use the components in your application. ```tsx import { Button } from "@yamada-ui/react" const App = () => { return } ``` That's it! You've successfully set up Yamada UI. # Legacy Documentation --- title: Legacy Documentation description: "New features and improvements from v1.x to v2.x." --- # Legacy Documentation New features and improvements from v1.x to v2.x. This is the documentation for Yamada UI v2.x. If you are looking for the documentation for v1.x, please see [this link](https://v1.yamada-ui.com). # LLMs.txt --- title: LLMs.txt description: "Learn how to use tools like Cursor, Windsurf, GitHub Copilot, ChatGPT, and Claude to understand Yamada UI." --- # LLMs.txt Learn how to use tools like Cursor, Windsurf, GitHub Copilot, ChatGPT, and Claude to understand Yamada UI. Yamada UI's documentation supports [LLMs.txt](https://llmstxt.org) to make it available for large language models. ## Files - [/llms.txt](https://yamada-ui.com/llms.txt): The documentation site map. - [/llms-full.txt](https://yamada-ui.com/llms-full.txt): All documentation. - [/llms/get-started.txt](https://yamada-ui.com/llms/get-started.txt): Only the documentation for the Get Started. - [/llms/components.txt](https://yamada-ui.com/llms/components.txt): Only the documentation for the Components. - [/llms/hooks.txt](https://yamada-ui.com/llms/hooks.txt): Only the documentation for the Hooks. - [/llms/styling.txt](https://yamada-ui.com/llms/styling.txt): Only the documentation for the Styling. - [/llms/theming.txt](https://yamada-ui.com/llms/theming.txt): Only the documentation for the Theming. ## Usage ### Cursor Use the [@Docs](https://cursor.com/docs/context/symbols#docs) of [Cursor](https://cursor.com) to add [llms.txt](https://yamada-ui.com/llms.txt) or [llms-full.txt](https://yamada-ui.com/llms-full.txt) to your project. # Migration --- title: Migration description: "New features and improvements from v1.x to v2.x." --- # Migration New features and improvements from v1.x to v2.x. ## New Features ### Setup Using [CLI](https://yamada-ui.com/docs/get-started/cli.md), you can easily set up Yamada UI in your project. ```bash pnpm yamada-cli init ``` ```bash npm yamada-cli init ``` ```bash yarn yamada-cli init ``` ```bash bun yamada-cli init ``` `init` command will display the following prompts. ```txt Would you like to use monorepo? (recommended) … No / Yes What is the path to the monorepo? … ./workspaces/ui What is the package name? … @workspaces/ui Would you like your code inside a `src/` directory? … No / Yes Would you like to use Prettier? … No / Yes Would you like to use ESLint? … No / Yes ``` ### Download From v2.x onwards, there are two ways to use components and hooks. One is the new method of downloading components and hooks locally via the [CLI](https://yamada-ui.com/docs/components/cli.md), and the other is the conventional method of importing them from the module. By downloading the source code, you can customize the initial value or logic of the component or hook, and if there is a bug in the logic, you can fix it directly. ```bash pnpm yamada-cli add button ``` ```bash npm yamada-cli add button ``` ```bash yarn yamada-cli add button ``` ```bash bun yamada-cli add button ``` :::note By downloading the source code and customizing it, you can easily update the source code by checking the [Check Differences](https://yamada-ui.com/docs/components/cli.md#check-differences) or [Update Components](https://yamada-ui.com/docs/components/cli.md#update-components) in [CLI](https://yamada-ui.com/docs/components/cli.md). If your changes conflict with the updates, they will be displayed in the same way as the [HOW CONFLICTS ARE PRESENTED](https://git-scm.com/docs/git-merge#_how_conflicts_are_presented) of [Git](https://git-scm.com), and you can easily resolve them. ::: ### Namespace Import You can now import components using namespaces. ```tsx ``` :::note You can still import components individually, but there are components whose names have changed due to the namespace. For example, in the case of `Accordion`, it has been changed to `AccordionRoot`. ::: ### createComponent Using [createComponent](https://yamada-ui.com/docs/components/create-component.md), you can create components that support conditional styles such as variants. ```tsx const componentStyle = defineComponentStyle({ base: {/* base style */}, variants: {/* variant style */}, sizes: {/* size style */}, props: {/* props style */}, compounds: {/* compound style */}, defaultProps: {/* default props */}, }) type ComponentStyle = typeof componentStyle export interface ComponentProps extends HTMLStyledProps<"div">, ThemeProps {} const { component, ComponentContext, PropsContext: ComponentPropsContext, useComponentContext, usePropsContext: useComponentPropsContext, withContext, useComponentProps, } = createComponent("component", componentStyle) export { ComponentPropsContext, useComponentPropsContext } ``` ```tsx export const Component = withContext("div")() ``` ### mergeProps Using `mergeProps`, you can easily merge props while preventing props from disappearing. Previously, you had to create components while considering the provided props. Using `mergeProps`, you can focus on creating components without considering the provided props. **Before** ```tsx export const Component: FC = ({ ref: forwardedRef, className, onClick: onClickProp, ...rest }) => { const ref = useRef(null) const onClick = useCallback(() => {}, []) return ( ) } ``` **After** ```tsx export const Component: FC = (props) => { const ref = useRef(null) const onClick = useCallback(() => {}, []) return } ``` ### PropsContext Using the `PropsContext` provided by each component, you can set the props of the components in the child elements in bulk. ```tsx const value = useMemo(() => ({ variant: "outline" }), []) return ( ) ``` In the above example, the `Badge` in the child elements of `BadgePropsContext` will all have `variant` set to `"outline"`. ### Polymorphism In addition to the traditional `as`, `asChild` has been added. `as` is used to change the element of the component itself, while `asChild` is used to incorporate the functionality and style of the component into the child elements. **as** ```tsx ``` **asChild** ```tsx ``` ### Cascade Layers Using the [Cascade Layers](https://developer.mozilla.org/en-US/docs/Web/CSS/@layer) of CSS, [Theme](https://yamada-ui.com/docs/theming.md) and [Style Props](https://yamada-ui.com/docs/styling/style-props.md) now have priority. Please refer to [Cascade Layers](https://yamada-ui.com/docs/styling/cascade-layers.md) for more details. ### Focus Ring [Style Props](https://yamada-ui.com/docs/styling/style-props.md) has been added [Focus Ring](https://yamada-ui.com/docs/styling/focus-ring.md). Focus Ring is a style used to identify the focused element. Please refer to [Focus Ring](https://yamada-ui.com/docs/styling/focus-ring.md) for more details. ```tsx ``` ```tsx ``` ### Interpolation [Style Props](https://yamada-ui.com/docs/styling/style-props.md) now allows you to easily reference [CSS Custom Properties](https://yamada-ui.com/docs/styling/css-custom-properties.md) using its values. Please refer to [Interpolation](https://yamada-ui.com/docs/styling/interpolation.md) for more details. ```tsx ``` ### CSS Custom Properties [Style Props](https://yamada-ui.com/docs/styling/style-props.md) now allows you to easily set [CSS Custom Properties](https://developer.mozilla.org/en-US/docs/Web/CSS/var). Please refer to [CSS Custom Properties](https://yamada-ui.com/docs/styling/css-custom-properties.md) for more details. ```tsx ``` You can also reference the tokens of [Theme](https://yamada-ui.com/docs/theming.md). ```tsx ``` ### CSS Value Functions [Style Props](https://yamada-ui.com/docs/styling/style-props.md) now allows you to use [CSS Value Functions](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Values_and_Units/CSS_Value_Functions) and reference the corresponding [Theme](https://yamada-ui.com/docs/theming.md) tokens. Please refer to [CSS Value Functions](https://yamada-ui.com/docs/styling/css-value-functions.md) for more details. ```tsx ``` ```tsx ``` ### At-rules [Style Props](https://yamada-ui.com/docs/styling/style-props.md) has been added [At-rules](https://developer.mozilla.org/en-US/docs/Web/CSS/At-rule). Please refer to [At-rules](https://yamada-ui.com/docs/styling/at-rules.md) for more details. ```tsx ``` [Container Queries](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_containment/Container_queries) are also supported. ```tsx ``` ### Internationalization To improve accessibility, we have supported 30 or more languages, including strings embedded in all components, date and number formats. Please refer to [Internationalization](https://yamada-ui.com/docs/components/internationalization.md) for more details. ### Icons New icons have been added. Please refer to [Icons](https://yamada-ui.com/icons.md) for more details. ### Style Props New CSS properties have been added. Please refer to [Style Props](https://yamada-ui.com/docs/styling/style-props.md) for more details. ### Theme - New [keyframes](https://yamada-ui.com/docs/theming/tokens/keyframes.md), [aspectRatios](https://yamada-ui.com/docs/theming/tokens/aspect-ratios.md), [easings](https://yamada-ui.com/docs/theming/tokens/easings.md), and [durations](https://yamada-ui.com/docs/theming/tokens/durations.md) have been added to the theme tokens. - `"mono"` has been added to the [Color Schemes](https://yamada-ui.com/docs/theming/tokens/color-schemes.md). - New tokens have been added to the [Layer Styles](https://yamada-ui.com/docs/theming/styles/layer-styles.md). - New tokens have been added to the [Text Styles](https://yamada-ui.com/docs/theming/styles/text-styles.md). - New tokens have been added to the [Colors](https://yamada-ui.com/docs/theming/tokens/colors.md). - You can now set `className` in the style object of the components. ## Improvements ### styled [ui](https://v1.yamada-ui.com/styled-system/ui) has been renamed to [styled](https://yamada-ui.com/docs/components/styled.md). Also, since only the base style of the component could be set until now, it is now possible to set styles that vary depending on conditions, such as `variants` and `sizes`. **Before** ```tsx const Button = styled("button", { base: { alignItems: "center", appearance: "none", cursor: "pointer", display: "inline-flex", fontWeight: "medium", justifyContent: "center", overflow: "hidden", position: "relative", rounded: "l2", transitionDuration: "moderate", transitionProperty: "common", userSelect: "none", verticalAlign: "middle", whiteSpace: "nowrap", _readOnly: { layerStyle: "readOnly" }, _disabled: { layerStyle: "disabled" }, }, }) ``` **After** ```tsx const Button = styled("button", { base: { alignItems: "center", appearance: "none", cursor: "pointer", display: "inline-flex", fontWeight: "medium", justifyContent: "center", overflow: "hidden", position: "relative", rounded: "l2", transitionDuration: "moderate", transitionProperty: "common", userSelect: "none", verticalAlign: "middle", whiteSpace: "nowrap", _readOnly: { layerStyle: "readOnly" }, _disabled: { layerStyle: "disabled" }, }, variants: { outline: { layerStyle: "outline", _hover: { layerStyle: "outline.hover" }, }, solid: { layerStyle: "solid", _hover: { layerStyle: "solid.hover" }, }, subtle: { layerStyle: "subtle", _hover: { layerStyle: "subtle.hover" }, }, }, }) ``` ### Conditional Styles Conditional style setting has been simplified. The traditional setting can still be used. **Before** ```tsx ``` **After** ```tsx ``` ### Color Scheme Previously, the [Color Scheme](https://yamada-ui.com/docs/styling/color-scheme.md) was set as props for each component. By integrating `colorScheme` into [Style Props](https://yamada-ui.com/docs/styling/style-props.md), it is now available for components other than components. ```tsx ``` Also, since `colorScheme` uses [CSS Custom Properties](https://yamada-ui.com/docs/styling/css-custom-properties.md) to generate a context, it is now also applied to the child elements. ```tsx ``` ### Animation Previously, the [Animation](https://yamada-ui.com/docs/styling/animation.md) used the [useAnimation](https://yamada-ui.com/docs/hooks/use-animation.md) hook. Now, you can set it directly from [Style Props](https://yamada-ui.com/docs/styling/style-props.md). **Before** ```tsx const animation = useAnimation({ _keyframes: { from: { translate: "0 0" }, to: { translate: "100% 0" }, }, duration: "1s", iterationCount: "infinite", timingFunction: "linear", }) return ``` **After** ```tsx ``` ### Components - The styles of each component have been adjusted. - The slot names of each component have been adjusted. - The class names of each component have been adjusted. - The naming convention of all boolean properties (`isOpen`, `isDisabled`, etc.) in the props of each component has been changed. For example, `isOpen` has been changed to `open`. :::note The improvement points of each component are described in the documentation of each component. ::: ### Style Props - `color-mix` has been supported. If the browser does not support `color-mix`, the fallback value will be applied. - `blur` and `brightness` can now be applied without setting `filter="auto"`. - `backdropBlur` and `backdropBrightness` can now be applied without setting `backdropFilter="auto"`. - `translateX` and `skewX` can now be applied without setting `transform="auto"` or `transform="auto-3d"`. ### Theme - [CSS Value Functions](https://yamada-ui.com/docs/styling/css-value-functions.md) can now be used for tokens. - [Interpolation](https://yamada-ui.com/docs/styling/interpolation.md) can now be used for tokens. - [Theme](https://yamada-ui.com/docs/theming.md) can now be defined using `defineTheme`. - Tokens can now be defined using `defineTokens`. - Semantic tokens can now be defined using `defineSemanticTokens`. - Styles can now be defined using `defineStyles`. - [Config](https://yamada-ui.com/docs/theming/configuration/overview.md) can now be defined using `defineConfig`. - The slot names of the components have been adjusted and changed. - The global styles have been adjusted. - The reset styles have been adjusted. - The values of the tokens have been adjusted. ## Removed Features ### Packages [Tree Shaking](https://developer.mozilla.org/en-US/docs/Glossary/Tree_shaking) considerations have made it unnecessary to divide each package, and since there is a possibility that other choices than [React](https://react.dev) will become available in future Yamada UI projects, these packages have been deprecated. - [@yamada-ui/input](https://www.npmjs.com/package/@yamada-ui/input) has been deprecated. Use [@yamada-ui/react](https://www.npmjs.com/package/@yamada-ui/react) instead. - [@yamada-ui/use-disclosure](https://www.npmjs.com/package/@yamada-ui/use-disclosure) has been deprecated. Use [@yamada-ui/react](https://www.npmjs.com/package/@yamada-ui/react) instead. - [@yamada-ui/providers](https://www.npmjs.com/package/@yamada-ui/providers) has been deprecated. Use [@yamada-ui/react](https://www.npmjs.com/package/@yamada-ui/react) instead. - [@yamada-ui/theme](https://www.npmjs.com/package/@yamada-ui/theme) has been deprecated. Use [@yamada-ui/react](https://www.npmjs.com/package/@yamada-ui/react) instead. - [@yamada-ui/theme-tools](https://www.npmjs.com/package/@yamada-ui/theme-tools) has been deprecated. Use [@yamada-ui/react](https://www.npmjs.com/package/@yamada-ui/react) instead. - [@yamada-ui/next](https://www.npmjs.com/package/@yamada-ui/next) has been deprecated. ### Style Props - `fallback` has been removed. - `keyframes` has been removed. Use `_keyframes` instead. - `isTruncated` has been removed. Use `truncated` instead. ### Theme - `transitions` has been removed. Use [easings](https://yamada-ui.com/docs/theming/tokens/easings.md) and [durations](https://yamada-ui.com/docs/theming/tokens/durations.md) instead. - `semantics` has been removed. Use `semanticTokens` instead. - `components` has been removed. Use [CLI](https://yamada-ui.com/docs/components/cli.md) to style components. - `extendBaseTheme` has been removed. Use `extendTheme` instead. - `extendStyle` has been removed. Use `extendTheme` instead. - `extendToken` has been removed. Use `extendTheme` instead. - `extendComponent` has been removed. - `extendComponentSize` has been removed. - `extendComponentVariant` has been removed. - `extendComponentDefaultProps` has been removed. - `withDefaultSize` has been removed. - `withDefaultVariant` has been removed. - `withDefaultColorScheme` has been removed. - `withDefaultProps` has been removed. - `generate` has been removed. ### Other - `forwardRef` has been removed. Use [forwardRef](https://react.dev/reference/react/forwardRef) instead. - `memo` has been removed. Use [memo](https://react.dev/reference/react/memo) instead. - `ui` has been removed. Use [styled](https://yamada-ui.com/docs/components/styled.md) instead. - `sx` and `__css` have been removed. Use `css` instead. ## Added Components ### Mark [Mark](https://yamada-ui.com/docs/components/mark.md) has been added. ### ClientOnly [ClientOnly](https://yamada-ui.com/docs/components/client-only.md) has been added. ### Format.Datetime [Format.Datetime](https://yamada-ui.com/docs/components/format.md#日付) has been added. ### Show [Show](https://yamada-ui.com/docs/components/show.md) has been added. ### Slot [Slot](https://yamada-ui.com/docs/components/slot.md) has been added. ### Steps [Steps](https://yamada-ui.com/docs/components/steps.md) has been added. ### Group [Group](https://yamada-ui.com/docs/components/group.md) has been added. ### Timeline [Timeline](https://yamada-ui.com/docs/components/timeline.md) has been added. ## Removed Components ### FontAwesomeIcon [FontAwesomeIcon](https://v1.yamada-ui.com/components/media-and-icons/fontawesome) has been removed. ### NativeImage [NativeImage](https://v1.yamada-ui.com/components/media-and-icons/native-image) has been removed. Use [Image](https://yamada-ui.com/docs/components/image.md) instead. ### Dialog [Dialog](https://v1.yamada-ui.com/components/overlay/dialog) has been removed. Use [Modal](https://yamada-ui.com/docs/components/modal.md#use-props) instead. ### ContextMenu [ContextMenu](https://v1.yamada-ui.com/components/navigation/context-menu) has been removed. Use [Menu.ContextTrigger](https://yamada-ui.com/docs/components/menu.md#use-context-menu) instead. ### FormControl [FormControl](https://v1.yamada-ui.com/components/forms/form-control) has been removed. Use [Field](https://yamada-ui.com/docs/components/field.md) instead. ### MultiAutocomplete [MultiAutocomplete](https://v1.yamada-ui.com/components/forms/multi-autocomplete) has been removed. Use `multiple` of [Autocomplete](https://yamada-ui.com/docs/components/autocomplete.md#enable-multiple-selection) instead. ### MultiDatePicker [MultiDatePicker](https://v1.yamada-ui.com/components/forms/multi-date-picker) has been removed. Use `multiple` of [DatePicker](https://yamada-ui.com/docs/components/date-picker.md#enable-multiple-selection) instead. ### RangeDatePicker [RangeDatePicker](https://v1.yamada-ui.com/components/forms/range-date-picker) has been removed. Use `range` of [DatePicker](https://yamada-ui.com/docs/components/date-picker.md#enable-range-selection) instead. ### MultiSelect [MultiSelect](https://v1.yamada-ui.com/components/forms/multi-select) has been removed. Use `multiple` of [Select](https://yamada-ui.com/docs/components/select.md#enable-multiple-selection) instead. ### YearPicker [YearPicker](https://v1.yamada-ui.com/components/forms/year-picker) has been removed. ### MonthPicker [MonthPicker](https://v1.yamada-ui.com/components/forms/month-picker) has been removed. ### RangeSlider [RangeSlider](https://v1.yamada-ui.com/components/forms/range-slider) has been removed. Use `value` or `defaultValue` of [Slider](https://yamada-ui.com/docs/components/slider.md#enable-range-selection) with an array instead. ### Markdown [Markdown](https://v1.yamada-ui.com/components/data-display/markdown) has been removed. ### Stepper [Stepper](https://v1.yamada-ui.com/components/navigation/stepper) has been removed. Use [Steps](https://yamada-ui.com/docs/components/steps.md) instead. ### Divider [Divider](https://v1.yamada-ui.com/components/layouts/divider) has been removed. Use [Separator](https://yamada-ui.com/docs/components/separator.md) instead. ### PagingTable [PagingTable](https://v1.yamada-ui.com/components/data-display/paging-table) has been removed. Use `enablePagination` of [Table](https://yamada-ui.com/docs/components/table.md#enable-pagination) instead. ## Added Hooks ### useCounter [useCounter](https://yamada-ui.com/docs/hooks/use-counter.md) has been added. ### useDescendants [useDescendants](https://yamada-ui.com/docs/hooks/use-descendants.md) has been added. ### useEyeDropper [useEyeDropper](https://yamada-ui.com/docs/hooks/use-eye-dropper.md) has been added. ### useFocusOnShow [useFocusOnShow](https://yamada-ui.com/docs/hooks/use-focus-on-show.md) has been added. ### useFormatDateTime [useFormatDateTime](https://yamada-ui.com/docs/hooks/use-format-date-time.md) has been added. ### useOnline [useOnline](https://yamada-ui.com/docs/hooks/use-online.md) has been added. ## Removed Hooks ### useToken [useToken](https://v1.yamada-ui.com/hooks/use-token) has been removed. # CLI --- title: CLI description: "Learn how to generate components using CLI commands." --- # CLI Learn how to generate components using CLI commands. ## Usage :::warning Before running the following commands, you need to install `@yamada-ui/cli` and execute the `init` command. For more details, please see [here](https://yamada-ui.com/docs/get-started/cli.md). ::: ### Add Components When you run the `add` command, the specified component and its dependencies will be added to your project. ```bash pnpm yamada-cli add box ``` ```bash npm yamada-cli add box ``` ```bash yarn yamada-cli add box ``` ```bash bun yamada-cli add box ``` :::note All components that the specified component depends on will also be added. ::: If you don't specify a component, all available components will be added. ```bash pnpm yamada-cli add ``` ```bash npm yamada-cli add ``` ```bash yarn yamada-cli add ``` ```bash bun yamada-cli add ``` ```bash Usage: pnpm yamada-cli add [options] [components...] add a component to your project. Arguments: components components to add. Options: --cwd current working directory. -c, --config path to the config file. (default: "ui.json") -o, --overwrite overwrite existing files. (default: false) -s, --sequential run tasks sequentially. (default: false) -y, --yes skip all confirmation prompts. (default: false) -i, --install install dependencies. --no-install do not install dependencies. -f, --format format the output files. --no-format do not format the output files. -l, --lint lint the output files. --no-lint do not lint the output files. -t, --tag tag for the registries (e.g. dev, next). -h, --help display help for command ``` ### Check Differences When you run the `diff` command, you can check the difference between the local and remote components. ```bash pnpm yamada-cli diff box ``` ```bash npm yamada-cli diff box ``` ```bash yarn yamada-cli diff box ``` ```bash bun yamada-cli diff box ``` If you don't specify a component, you can check the difference for all components in your project. ```bash pnpm yamada-cli diff ``` ```bash npm yamada-cli diff ``` ```bash yarn yamada-cli diff ``` ```bash bun yamada-cli diff ``` ```bash Usage: pnpm yamada-cli diff [options] [component] check for updates against the registry. Arguments: component component to check. Options: --cwd current working directory. -c, --config path to the config file. (default: "ui.json") -s, --sequential run tasks sequentially. (default: false) -d, --detail show detailed changes. (default: false) -y, --yes skip all confirmation prompts. (default: false) -u, --update update files when there are file diff. --no-update do not update files when there are file diff. -i, --install install dependencies when updating files. --no-install do not install dependencies when updating files. -t, --tag tag for the registries (e.g. dev, next). -h, --help display help for command ``` ### Update Components When you run the `update` command, the specified component will be updated. ```bash pnpm yamada-cli update box ``` ```bash npm yamada-cli update box ``` ```bash yarn yamada-cli update box ``` ```bash bun yamada-cli update box ``` If you don't specify a component, all components in your project will be updated. ```bash pnpm yamada-cli update ``` ```bash npm yamada-cli update ``` ```bash yarn yamada-cli update ``` ```bash bun yamada-cli update ``` ```bash Usage: pnpm yamada-cli update [options] [components...] update components in your project. Arguments: components components to update. Options: --cwd current working directory. -c, --config path to the config file. (default: "ui.json") -s, --sequential run tasks sequentially. (default: false) -F, --force force update, overwriting local changes. (default: false) -y, --yes skip all confirmation prompts. (default: false) -i, --install install dependencies. --no-install do not install dependencies. -f, --format format the output files. --no-format do not format the output files. -l, --lint lint the output files. --no-lint do not lint the output files. -t, --tag tag for the registries (e.g. dev, next). -h, --help display help for command ``` # createComponent --- title: createComponent description: "The `createComponent` function create a component that supports conditional styles such as variants. You can also easily create slot components by using the `createSlotComponent` function." --- # createComponent The `createComponent` function create a component that supports conditional styles such as variants. You can also easily create slot components by using the `createSlotComponent` function. ## Overview `createComponent` creates a component that supports conditional styles such as variants. The created component can be inherited, has high extensibility, and generates `className` and `displayName`, so you can also create components with consistent naming conventions in your project. ## Usage To create a single component, use [createComponent](#createcomponent), and to create a slot component, use [createSlotComponent](#createslotcomponent). ### createComponent To create a single component, use `createComponent`. ```tsx import type { HTMLStyledProps, ThemeProps } from "@yamada-ui/react" import { createComponent, defineComponentStyle } from "@yamada-ui/react" ``` ```tsx import type { HTMLStyledProps, ThemeProps } from "@/components/ui" import { createComponent, defineComponentStyle } from "@/components/ui" ``` ```tsx import type { HTMLStyledProps, ThemeProps } from "@workspaces/ui" import { createComponent, defineComponentStyle } from "@workspaces/ui" ``` ```tsx const componentStyle = defineComponentStyle({ base: {/* base style */}, variants: {/* variant style */}, sizes: {/* size style */}, props: {/* props style */}, compounds: {/* compound style */}, defaultProps: {/* default props */}, }) type ComponentStyle = typeof componentStyle export interface ComponentProps extends HTMLStyledProps<"div">, ThemeProps {} const { component, ComponentContext, PropsContext: ComponentPropsContext, useComponentContext, usePropsContext: useComponentPropsContext, withContext, useComponentProps, } = createComponent("component", componentStyle) export { ComponentPropsContext, useComponentPropsContext } ``` :::note `defineComponentStyle` is a function that defines the component style. This function has an important role in type completion. ::: - The first argument is the component name used for `className` and `displayName`. - The second argument is the component style. #### Create a component To create a component, use `withContext`. Set the argument to the HTML element name or function. `withContext` uses the provided style and `PropsContext` props. ```tsx export const Component = withContext("div")() ``` ```tsx export const Component = withContext((props) => { return })() ``` If you don't want to use the provided style and `PropsContext` props, or want to handle the logic, use `component`. ```tsx export const Component = component((props) => { const computedProps = useComponentProps(props) return })() ``` #### Calculate props `withContext` and `component` can perform multi-stage calculations on the provided props. ```tsx export const Component = withContext("button")( { "aria-label": "Default Label" }, ({ "aria-label": ariaLabel, ...rest }) => ({ ariaLabel: ariaLabel === "Default Label" ? "Changed Label" : ariaLabel, ...rest, }), ) ``` :::warning For objects, they are deeply merged. For functions, you need to return the provided props. If you don't return the provided props, the provided props will be lost. ::: #### Transfer props Style props are filtered after calculating the styling. If you also want to use it in the component logic, use `transferProps`. ```tsx export const Component = withContext( ({ size, ...rest }) => { return }, { transferProps: ["size"], }, )() ``` #### Inherit a component `createComponent` created components can be inherited. ```tsx import { Component } from "./component" ``` ```tsx const additionalComponentStyle = defineComponentStyle({ base: {/* base style */}, variants: {/* variant style */}, sizes: {/* size style */}, props: {/* props style */}, compounds: {/* compound style */}, defaultProps: {/* default props */}, }) type AdditionalComponentStyle = typeof additionalComponentStyle export interface AdditionalComponentProps extends HTMLStyledProps<"div">, ThemeProps {} const { ComponentContext, PropsContext: AdditionalComponentPropsContext, useComponentContext, usePropsContext: useAdditionalComponentPropsContext, useComponentProps, withContext, component, } = createComponent( "additional-component", additionalComponentStyle, ) export { AdditionalComponentPropsContext, useAdditionalComponentPropsContext } ``` ```tsx export const AdditionalComponent = withContext(Component)() ``` This creates an `AdditionalComponent` that inherits `Component`. The difference from the traditional component inheritance is that it can merge [ref](https://ja.react.dev/learn/referencing-values-with-refs), class names, styles, and [event handlers](https://ja.react.dev/learn/responding-to-events). ```tsx export const AdditionalComponent: FC = ({ className, ...rest }) => { const ref = useRef(null) const onClick = useCallback(() => {}, []) return ( ) } ``` In this case, if `ref` and `onClick` exist in the provided props, they will be overwritten. Depending on the logic, it may not work well. To solve this, you need to merge each value and logic for each component. ```tsx export const AdditionalComponent: FC = ({ ref: forwardedRef, className, onClick: onClickProp, ...rest }) => { const ref = useRef(null) const onClick = useCallback(() => {}, []) return ( ) } ``` By using `createComponent` to inherit a component, you can automatically merge event handlers such as `ref` and `onClick`. :::note If there is a style conflict, that is, each component has `variants`, the `variants` of the inherited component will take precedence. ::: ### createSlotComponent To create a slot component, use `createSlotComponent`. The functionality is the same as [createComponent](#createcomponent). ```tsx import type { HTMLStyledProps, ThemeProps } from "@yamada-ui/react" import { createSlotComponent, defineComponentSlotStyle } from "@yamada-ui/react" ``` ```tsx import type { HTMLStyledProps, ThemeProps } from "@/components/ui" import { createSlotComponent, defineComponentSlotStyle } from "@/components/ui" ``` ```tsx import type { HTMLStyledProps, ThemeProps } from "@workspaces/ui" import { createSlotComponent, defineComponentSlotStyle } from "@workspaces/ui" ``` ```tsx const componentStyle = defineComponentSlotStyle({ base: { root: {/* base root style */}, item: {/* base item style */}, }, variants: {/* variant style */}, sizes: {/* size style */}, props: {/* props style */}, compounds: {/* compound style */}, defaultProps: {/* default props */}, }) type ComponentStyle = typeof componentStyle export interface ComponentRootProps extends HTMLStyledProps<"div">, ThemeProps {} const { ComponentContext, PropsContext: ComponentPropsContext, StyleContext, useComponentContext, usePropsContext: useComponentPropsContext, useStyleContext, useClassNames, useRootComponentProps, useSlotComponentProps, withProvider, withContext, component, } = createSlotComponent( "component", componentStyle, ) export { ComponentPropsContext, useComponentPropsContext } ``` :::note `defineComponentSlotStyle` is a function that defines the component style. This function has an important role in type completion. ::: - The first argument is the component name prefix used for `className` and `displayName`. - The second argument is the component style. #### Create a component To create a component, use `withProvider` and `withContext`. Each sets the argument to the HTML element name or function for the first argument, and the slot name for the second argument. `withProvider` uses the provided style and `PropsContext` props to generate a context. `withContext` uses the context generated by `withProvider` to use the style based on the slot name. ```tsx export const RootComponent = withProvider("div", "root")() export const ItemComponent = withContext("div", "item")() ``` ```tsx export const RootComponent = withProvider((props) => { return }, "root")() export const ItemComponent = withContext((props) => { return }, "item")() ``` If you don't want to use the provided style and `PropsContext` props, or want to handle the logic, use `component`. ```tsx export const RootComponent = component((props) => { const [context, computedProps] = useRootComponentProps(props, "root") return ( ) }, "root")() export const ItemComponent = component((props) => { const computedProps = useSlotComponentProps(props, "item") return }, "item")() ``` #### Use modifiers To use modifiers, set the slot name to an array. ```tsx const componentStyle = defineComponentSlotStyle({ base: { root: {/* base root style */}, item: {/* base item style */}, start: {/* base start style */}, end: {/* base end style */}, }, }) ``` ```tsx export const StartItemComponent = withContext("div", ["item", "start"])() export const EndItemComponent = withContext("div", ["item", "end"])() ``` In this case, the style of `item` and `start` or `end` is set, and the class name is `"{prefix}-{name}__item--start"` or `"{prefix}-{name}__item--end"`. # Components --- title: Components description: "Yamada UI provides prebuilt components to help you build projects faster." --- # Components Yamada UI provides prebuilt components to help you build projects faster. ## Usage Yamada UI provides components in two ways. One is a new method of downloading components locally from [CLI](https://yamada-ui.com/docs/components/cli.md). The other is the traditional method of importing components from modules. ### Download The cases for downloading components locally from [CLI](https://yamada-ui.com/docs/components/cli.md) are as follows. - Customize the [variant](https://yamada-ui.com/docs/components/styled.md#variant-style) or [size](https://yamada-ui.com/docs/components/styled.md#size-style) styles of the component. - Customize the initial value or logic of the component. - Fix a bug in the component's style or logic by directly modifying it. ```bash pnpm yamada-cli add button ``` ```bash npm yamada-cli add button ``` ```bash yarn yamada-cli add button ``` ```bash bun yamada-cli add button ``` :::note Yamada UI updates the components, you can easily update the components by checking the [Check Differences](https://yamada-ui.com/docs/components/cli.md#check-differences) or [Update Components](https://yamada-ui.com/docs/components/cli.md#update-components) in [CLI](https://yamada-ui.com/docs/components/cli.md). If your changes conflict with the updates, they will be displayed in the same way as the [HOW CONFLICTS ARE PRESENTED](https://git-scm.com/docs/git-merge#_how_conflicts_are_presented) of [Git](https://git-scm.com), and you can easily resolve them. ::: ### Import If you want to use the component without making any changes, you can simply import the component from the module. ```tsx import { Button } from "@yamada-ui/react" ``` ```tsx import { Button } from "@/components/ui" ``` ```tsx import { Button } from "@workspaces/ui" ``` ## Components Here's a list of all the components available in the library. - [Accordion](https://yamada-ui.com/docs/components/accordion.md) - [ActionBar](https://yamada-ui.com/docs/components/action-bar.md) - [Airy](https://yamada-ui.com/docs/components/airy.md) - [Alert](https://yamada-ui.com/docs/components/alert.md) - [AlphaSlider](https://yamada-ui.com/docs/components/alpha-slider.md) - [AreaChart](https://yamada-ui.com/docs/components/area-chart.md) - [AspectRatio](https://yamada-ui.com/docs/components/aspect-ratio.md) - [Autocomplete](https://yamada-ui.com/docs/components/autocomplete.md) - [Avatar](https://yamada-ui.com/docs/components/avatar.md) - [Badge](https://yamada-ui.com/docs/components/badge.md) - [BarChart](https://yamada-ui.com/docs/components/bar-chart.md) - [Bleed](https://yamada-ui.com/docs/components/bleed.md) - [Blockquote](https://yamada-ui.com/docs/components/blockquote.md) - [Box](https://yamada-ui.com/docs/components/box.md) - [Breadcrumb](https://yamada-ui.com/docs/components/breadcrumb.md) - [Button](https://yamada-ui.com/docs/components/button.md) - [Calendar](https://yamada-ui.com/docs/components/calendar.md) - [Card](https://yamada-ui.com/docs/components/card.md) - [Carousel](https://yamada-ui.com/docs/components/carousel.md) - [Center](https://yamada-ui.com/docs/components/center.md) - [Chat](https://yamada-ui.com/docs/components/chat.md) - [Checkbox](https://yamada-ui.com/docs/components/checkbox.md) - [CheckboxCard](https://yamada-ui.com/docs/components/checkbox-card.md) - [CircleProgress](https://yamada-ui.com/docs/components/circle-progress.md) - [ClientOnly](https://yamada-ui.com/docs/components/client-only.md) - [CloseButton](https://yamada-ui.com/docs/components/close-button.md) - [Code](https://yamada-ui.com/docs/components/code.md) - [Collapse](https://yamada-ui.com/docs/components/collapse.md) - [ColorPicker](https://yamada-ui.com/docs/components/color-picker.md) - [ColorSelector](https://yamada-ui.com/docs/components/color-selector.md) - [ColorSwatch](https://yamada-ui.com/docs/components/color-swatch.md) - [ComposedChart](https://yamada-ui.com/docs/components/composed-chart.md) - [Container](https://yamada-ui.com/docs/components/container.md) - [DataList](https://yamada-ui.com/docs/components/data-list.md) - [DatePicker](https://yamada-ui.com/docs/components/date-picker.md) - [Dockable](https://yamada-ui.com/docs/components/dockable.md) - [DonutChart](https://yamada-ui.com/docs/components/donut-chart.md) - [Drawer](https://yamada-ui.com/docs/components/drawer.md) - [Dropzone](https://yamada-ui.com/docs/components/dropzone.md) - [Editable](https://yamada-ui.com/docs/components/editable.md) - [Em](https://yamada-ui.com/docs/components/em.md) - [EmptyState](https://yamada-ui.com/docs/components/empty-state.md) - [Fade](https://yamada-ui.com/docs/components/fade.md) - [FadeScale](https://yamada-ui.com/docs/components/fade-scale.md) - [Field](https://yamada-ui.com/docs/components/field.md) - [Fieldset](https://yamada-ui.com/docs/components/fieldset.md) - [FileButton](https://yamada-ui.com/docs/components/file-button.md) - [FileInput](https://yamada-ui.com/docs/components/file-input.md) - [Flex](https://yamada-ui.com/docs/components/flex.md) - [Flip](https://yamada-ui.com/docs/components/flip.md) - [Float](https://yamada-ui.com/docs/components/float.md) - [FocusLock](https://yamada-ui.com/docs/components/focus-lock.md) - [For](https://yamada-ui.com/docs/components/for.md) - [Form](https://yamada-ui.com/docs/components/form.md) - [Format](https://yamada-ui.com/docs/components/format.md) - [Grid](https://yamada-ui.com/docs/components/grid.md) - [Group](https://yamada-ui.com/docs/components/group.md) - [Heading](https://yamada-ui.com/docs/components/heading.md) - [Highlight](https://yamada-ui.com/docs/components/highlight.md) - [HStack](https://yamada-ui.com/docs/components/h-stack.md) - [HueSlider](https://yamada-ui.com/docs/components/hue-slider.md) - [Icon](https://yamada-ui.com/docs/components/icon.md) - [IconButton](https://yamada-ui.com/docs/components/icon-button.md) - [Image](https://yamada-ui.com/docs/components/image.md) - [Indicator](https://yamada-ui.com/docs/components/indicator.md) - [InfiniteScrollArea](https://yamada-ui.com/docs/components/infinite-scroll-area.md) - [Input](https://yamada-ui.com/docs/components/input.md) - [Kbd](https://yamada-ui.com/docs/components/kbd.md) - [LineChart](https://yamada-ui.com/docs/components/line-chart.md) - [Link](https://yamada-ui.com/docs/components/link.md) - [LinkBox](https://yamada-ui.com/docs/components/link-box.md) - [List](https://yamada-ui.com/docs/components/list.md) - [Loading](https://yamada-ui.com/docs/components/loading.md) - [Mark](https://yamada-ui.com/docs/components/mark.md) - [Menu](https://yamada-ui.com/docs/components/menu.md) - [Modal](https://yamada-ui.com/docs/components/modal.md) - [Motion](https://yamada-ui.com/docs/components/motion.md) - [NativeAccordion](https://yamada-ui.com/docs/components/native-accordion.md) - [NativePopover](https://yamada-ui.com/docs/components/native-popover.md) - [NativeSelect](https://yamada-ui.com/docs/components/native-select.md) - [NativeTable](https://yamada-ui.com/docs/components/native-table.md) - [NumberInput](https://yamada-ui.com/docs/components/number-input.md) - [Pagination](https://yamada-ui.com/docs/components/pagination.md) - [PasswordInput](https://yamada-ui.com/docs/components/password-input.md) - [PhoneInput](https://yamada-ui.com/docs/components/phone-input.md) - [Picture](https://yamada-ui.com/docs/components/picture.md) - [PieChart](https://yamada-ui.com/docs/components/pie-chart.md) - [PinInput](https://yamada-ui.com/docs/components/pin-input.md) - [Popover](https://yamada-ui.com/docs/components/popover.md) - [Portal](https://yamada-ui.com/docs/components/portal.md) - [Progress](https://yamada-ui.com/docs/components/progress.md) - [QrCode](https://yamada-ui.com/docs/components/qr-code.md) - [RadarChart](https://yamada-ui.com/docs/components/radar-chart.md) - [RadialChart](https://yamada-ui.com/docs/components/radial-chart.md) - [Radio](https://yamada-ui.com/docs/components/radio.md) - [RadioCard](https://yamada-ui.com/docs/components/radio-card.md) - [Rating](https://yamada-ui.com/docs/components/rating.md) - [Reorder](https://yamada-ui.com/docs/components/reorder.md) - [Resizable](https://yamada-ui.com/docs/components/resizable.md) - [Ripple](https://yamada-ui.com/docs/components/ripple.md) - [Rotate](https://yamada-ui.com/docs/components/rotate.md) - [SaturationSlider](https://yamada-ui.com/docs/components/saturation-slider.md) - [ScrollArea](https://yamada-ui.com/docs/components/scroll-area.md) - [SegmentedControl](https://yamada-ui.com/docs/components/segmented-control.md) - [Select](https://yamada-ui.com/docs/components/select.md) - [Separator](https://yamada-ui.com/docs/components/separator.md) - [Show](https://yamada-ui.com/docs/components/show.md) - [Sidebar](https://yamada-ui.com/docs/components/sidebar.md) - [SimpleGrid](https://yamada-ui.com/docs/components/simple-grid.md) - [Skeleton](https://yamada-ui.com/docs/components/skeleton.md) - [Slide](https://yamada-ui.com/docs/components/slide.md) - [SlideFade](https://yamada-ui.com/docs/components/slide-fade.md) - [Slider](https://yamada-ui.com/docs/components/slider.md) - [Slot](https://yamada-ui.com/docs/components/slot.md) - [Snacks](https://yamada-ui.com/docs/components/snacks.md) - [Spacer](https://yamada-ui.com/docs/components/spacer.md) - [Stack](https://yamada-ui.com/docs/components/stack.md) - [Stat](https://yamada-ui.com/docs/components/stat.md) - [Status](https://yamada-ui.com/docs/components/status.md) - [Steps](https://yamada-ui.com/docs/components/steps.md) - [Swipeable](https://yamada-ui.com/docs/components/swipeable.md) - [Switch](https://yamada-ui.com/docs/components/switch.md) - [Table](https://yamada-ui.com/docs/components/table.md) - [Tabs](https://yamada-ui.com/docs/components/tabs.md) - [Tag](https://yamada-ui.com/docs/components/tag.md) - [Text](https://yamada-ui.com/docs/components/text.md) - [Textarea](https://yamada-ui.com/docs/components/textarea.md) - [Timeline](https://yamada-ui.com/docs/components/timeline.md) - [TimePicker](https://yamada-ui.com/docs/components/time-picker.md) - [Tip](https://yamada-ui.com/docs/components/tip.md) - [Toggle](https://yamada-ui.com/docs/components/toggle.md) - [Tooltip](https://yamada-ui.com/docs/components/tooltip.md) - [Tour](https://yamada-ui.com/docs/components/tour.md) - [Tree](https://yamada-ui.com/docs/components/tree.md) - [VisuallyHidden](https://yamada-ui.com/docs/components/visually-hidden.md) - [VStack](https://yamada-ui.com/docs/components/v-stack.md) - [Wrap](https://yamada-ui.com/docs/components/wrap.md) - [ZStack](https://yamada-ui.com/docs/components/z-stack.md) # Internationalization --- title: Internationalization description: "Adapting components to respect the languages and cultures of users around the world is an important way to make your application accessible to more people. Yamada UI supports over 30 languages." --- # Internationalization Adapting components to respect the languages and cultures of users around the world is an important way to make your application accessible to more people. Yamada UI supports over 30 languages. ## Overview Internationalization is the process of structuring code and user interfaces to be localized. Yamada UI supports various localizations in many components, from built-in string translations to date and number formats. By using Yamada UI's components, these internationalizations are automatically handled. ## Localization Localization is the process of adapting an application to a specific language or region. It includes adjustments such as text translations, date and number formats, and text search. Yamada UI supports localization in over 30 locales. :::note Yamada UI uses [Intl MessageFormat](https://formatjs.github.io/docs/intl-messageformat) internally. ::: ## Change the Locale To change the locale, set a value for [locale](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#locales). ```tsx import { UIProvider } from "@yamada-ui/react" const App = () => { return ( ) } ``` :::note Yamada UI automatically detects the locale using [navigator.language](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/language) and [Intl.DateTimeFormat.supportedLocalesOf](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/supportedLocalesOf). After detection, it automatically updates using [languagechange](https://developer.mozilla.org/en-US/docs/Web/API/Window/languagechange_event). Therefore, when setting the locale to match the user's application, you do not need to set the `locale`. ::: ## Change the Label To change the label, you need to download the `i18n-provider` using the [CLI](https://yamada-ui.com/docs/get-started/cli.md). :::warning Before running the following commands, you need to install `@yamada-ui/cli` and run the `init` command. Please refer to [this](https://yamada-ui.com/docs/get-started/cli.md) for more details. ::: ### Add the Provider Use the `add` command to add the `i18n-provider`. ```bash pnpm yamada-cli add i18n-provider ``` ```bash npm yamada-cli add i18n-provider ``` ```bash yarn yamada-cli add i18n-provider ``` ```bash bun yamada-cli add i18n-provider ``` ### Change the Language Data The `i18n-provider`'s `intl` folder contains the data for each language. Change the data for the language you want to change. ```ts import type { IntlData } from "." const data: IntlData = { /* ... */ avatar: { "Avatar Icon": "ユーザーアイコン", }, /* ... */ } export default data ``` :::warning The language data is based on English, and the English key is associated with the data for each language. If you change `en-US.ts`, you need to correct all language data. If you do not change it, the association of language data will be lost. ::: ## Add a Language To add a language, you need to download the `i18n-provider` using the [CLI](https://yamada-ui.com/docs/get-started/cli.md). :::warning Before running the following commands, you need to install `@yamada-ui/cli` and run the `init` command. Please refer to [this](https://yamada-ui.com/docs/get-started/cli.md) for more details. ::: ### Add the Provider Use the `add` command to add the `i18n-provider`. ```bash pnpm yamada-cli add i18n-provider ``` ```bash npm yamada-cli add i18n-provider ``` ```bash yarn yamada-cli add i18n-provider ``` ```bash bun yamada-cli add i18n-provider ``` ### Add the Language Data The `i18n-provider`'s `intl` folder contains the data for each language. Add the data for the new language. The data is copied and pasted from `intl/en-US.ts` and changed for each value. ```ts import type { IntlData } from "." const data: IntlData = { autocomplete: { "Clear value": "Giá trị xóa", "No results found": "Không tìm thấy kết quả", }, /* ... */ } export default data ``` ### Update the Index Add the language data you added to `intl/index.ts`. ```ts import arAE from "./ar-AE" /* ... */ import viVN from "./vi-VN" /* ... */ export default { "ar-AE": arAE, /* ... */ "vi-VN": viVN, } ``` ## Supported Locales - Japanese (Japan) - English (Great Britain) - English (United States) - Arabic (United Arab Emirates) - Bulgarian (Bulgaria) - Croatian (Croatia) - Czech (Czech Republic) - Danish (Denmark) - Dutch (Netherlands) - Estonian (Estonia) - Finnish (Finland) - French (Canada) - French (France) - German (Germany) - Greek (Greece) - Hebrew (Israel) - Hungarian (Hungary) - Italian (Italy) - Latvian (Latvia) - Lithuanian (Lithuania) - Norwegian (Norway) - Polish (Poland) - Portuguese (Brazil) - Romanian (Romania) - Russian (Russia) - Serbian (Serbia) - Slovakian (Slovakia) - Slovenian (Slovenia) - Spanish (Spain) - Swedish (Sweden) - Turkish (Turkey) - Ukrainian (Ukraine) - Chinese (Simplified) - Chinese (Traditional) - Korean (Korea) ## Optimize the Bundle Size Yamada UI includes the data for all of the languages above by default. This is convenient for many users, but it increases the bundle size. If your application does not support all of these locales, you can optimize the bundle size by removing unnecessary data from `intl/index.ts`. # styled --- title: styled description: "The `styled` function generates a JSX element that allows styling using props." --- # styled The `styled` function generates a JSX element that allows styling using props. ## Overview `styled` is an object of JSX elements enabled with Yamada UI's style system, and can also be used as a function for custom components to receive Yamada UI's style system. ## Usage Use the `styled.` notation to generate an HTML element with [Style Props](https://yamada-ui.com/docs/styling/style-props.md). For example, to generate an `button` element with [Style Props](https://yamada-ui.com/docs/styling/style-props.md), write ``. ```tsx ``` ### Create a component `styled` can be used in two ways: as an object of JSX elements (``) and as a function that returns a JSX element (`styled('div')`). The function is suitable for generating simple components. ```tsx import { styled } from "@workspaces/ui" const Button = styled("button") const App = () => { return } ``` You can also pass a custom component to the argument and generate a custom component with [Style Props](https://yamada-ui.com/docs/styling/style-props.md). ```tsx import { styled } from "@workspaces/ui" import { YourComponent } from "./your-component" const NewComponent = styled(YourComponent) const App = () => { return } ``` ### Styling You can set default styles for a component or set styles based on conditions such as `variant` and `size`. #### Base Style Base style sets the default styles for a component. ```tsx const Button = styled("button", { base: { alignItems: "center", appearance: "none", cursor: "pointer", display: "inline-flex", fontWeight: "medium", justifyContent: "center", overflow: "hidden", position: "relative", rounded: "l2", transitionDuration: "moderate", transitionProperty: "common", userSelect: "none", verticalAlign: "middle", whiteSpace: "nowrap", _readOnly: { layerStyle: "readOnly" }, _disabled: { layerStyle: "disabled" }, }, }) ``` #### Variant Style Variant style sets styles based on the `variant` of the component. ```tsx const Button = styled("button", { variants: { outline: { layerStyle: "outline", _hover: { layerStyle: "outline.hover" }, }, solid: { layerStyle: "solid", _hover: { layerStyle: "solid.hover" }, }, subtle: { layerStyle: "subtle", _hover: { layerStyle: "subtle.hover" }, }, }, }) ``` To apply the variant style, set the `variant` value. ```tsx ) ``` ## Usage ```tsx import { useAsyncCallback } from "@yamada-ui/react" ``` ```tsx import { useAsyncCallback } from "@/components/ui" ``` ```tsx import { useAsyncCallback } from "@workspaces/ui" ``` ```tsx const [loading, onClick] = useAsyncCallback(async () => {}, []) ``` ### Use loading When using loading, set `loading` to `screen` or `page` etc. ```tsx const [loading, onClick] = useAsyncCallback( async () => { await wait(3000) }, [], { loading: "page" }, ) return ( ) ``` ### Disable processing When disabling processing, set `processing` to `false`. ```tsx const [, onClick] = useAsyncCallback( async () => { await wait(3000) }, [], { loading: "page", processing: false }, ) return ``` ## Uses Components & Hooks - [Loading](https://yamada-ui.com/docs/components/loading.md): `Loading` is a component displayed during waiting times, such as when data is being loaded. - [useProcessing](https://yamada-ui.com/docs/hooks/use-processing.md): `useProcessing` is a custom hook for handling processing states. # useAsync --- title: useAsync description: "`useAsync` is a custom hook that executes an asynchronous function and tracks its state." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/hooks/use-async - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/hooks-useasync--basic --- # useAsync `useAsync` is a custom hook that executes an asynchronous function and tracks its state. ```tsx const [flg, { toggle }] = useBoolean() const { value, error, loading } = useAsync( async () => new Promise((resolve, reject) => { setTimeout(() => { if (Math.random() > 0.5) { resolve("Succeeded.") } else { reject(new Error("A pseudo random error occurred.")) } }, 3000) }), [flg], ) return ( {loading ? ( Loading... ) : error ? ( Error: {error.message} ) : ( Value: {value} )} ) ``` ## Usage ```tsx import { useAsync } from "@yamada-ui/react" ``` ```tsx import { useAsync } from "@/components/ui" ``` ```tsx import { useAsync } from "@workspaces/ui" ``` ```tsx const { value, error, loading } = useAsync(async () => {}, []) ``` # useBoolean --- title: useBoolean description: "`useBoolean` is a custom hook used to manage boolean values using `on`, `off`, and `toggle` functions." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/hooks/use-boolean - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/hooks-useboolean--basic --- # useBoolean `useBoolean` is a custom hook used to manage boolean values using `on`, `off`, and `toggle` functions. ```tsx const [flg, { on, off, toggle }] = useBoolean() return ( state: {String(flg)} On Off Toggle ) ``` ## Usage ```tsx import { useBoolean } from "@yamada-ui/react" ``` ```tsx import { useBoolean } from "@/components/ui" ``` ```tsx import { useBoolean } from "@workspaces/ui" ``` ```tsx const [flg, { on, off, toggle }] = useBoolean() ``` ### Using Initial Values ```tsx const [flg, { on, off, toggle }] = useBoolean(true) return ( state: {String(flg)} On Off Toggle ) ``` ## Used By Components & Hooks - [Carousel](https://yamada-ui.com/docs/components/carousel.md): `Carousel` is a component that displays multiple elements like a slideshow. - [useProcessing](https://yamada-ui.com/docs/hooks/use-processing.md): `useProcessing` is a custom hook for handling processing states. # useBreakpointEffect --- title: useBreakpointEffect description: "`useBreakpointEffect` is a custom hook that executes a specific callback function when the breakpoint changes." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/hooks/use-breakpoint - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/hooks-usebreakpointeffect--basic --- # useBreakpointEffect `useBreakpointEffect` is a custom hook that executes a specific callback function when the breakpoint changes. ```tsx const [device, setDevice] = useState("mobile"); useBreakpointEffect(breakpoint => { if (breakpoint === "sm") { setDevice("mobile"); } else if (breakpoint === "md") { setDevice("tablet"); } else { setDevice("desktop"); } }, []); return The current device is "{device}"; ``` ## Usage ```tsx import { useBreakpointEffect } from "@yamada-ui/react" ``` ```tsx import { useBreakpointEffect } from "@/components/ui" ``` ```tsx import { useBreakpointEffect } from "@workspaces/ui" ``` ```tsx const [device, setDevice] = useState("mobile") useBreakpointEffect((breakpoint) => { if (breakpoint === "sm") { setDevice("mobile") } else if (breakpoint === "md") { setDevice("tablet") } else { setDevice("desktop") } }, []) ``` # useBreakpointState --- title: useBreakpointState description: "`useBreakpointState` is a custom hook that takes a responsive object as an initial state and returns a state corresponding to the current breakpoint." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/hooks/use-breakpoint --- # useBreakpointState `useBreakpointState` is a custom hook that takes a responsive object as an initial state and returns a state corresponding to the current breakpoint. ```tsx const [value, setValue] = useBreakpointState({ base: 1, md: 2 }) return ( ) ``` ## Usage ```tsx import { useBreakpointState } from "@yamada-ui/react" ``` ```tsx import { useBreakpointState } from "@/components/ui" ``` ```tsx import { useBreakpointState } from "@workspaces/ui" ``` ```tsx const [value, setValue] = useBreakpointState({ base: 1, md: 2 }) ``` # useBreakpointValue --- title: useBreakpointValue description: "`useBreakpointValue` is a custom hook that returns the value of the current breakpoint from the provided object. This hook monitors changes in the window size and returns the appropriate value." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/hooks/use-breakpoint - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/hooks-usebreakpointvalue--basic --- # useBreakpointValue `useBreakpointValue` is a custom hook that returns the value of the current breakpoint from the provided object. This hook monitors changes in the window size and returns the appropriate value. ```tsx const breakpoint = useBreakpoint() const bg = useBreakpointValue({ base: "red.500", sm: "purple.500", md: "yellow.500", lg: "green.500", xl: "blue.500", "2xl": "pink.500", }) return ( The current breakpoint is "{breakpoint}" ) ``` ## Usage ```tsx import { useBreakpointValue } from "@yamada-ui/react" ``` ```tsx import { useBreakpointValue } from "@/components/ui" ``` ```tsx import { useBreakpointValue } from "@workspaces/ui" ``` ```tsx const bg = useBreakpointValue({ base: "red.500", sm: "purple.500", md: "yellow.500", lg: "green.500", xl: "blue.500", "2xl": "pink.500", }) ``` # useBreakpoint --- title: useBreakpoint description: "`useBreakpoint` is a custom hook that returns the current breakpoint. This hook monitors changes in the window size and returns the appropriate value." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/hooks/use-breakpoint - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/hooks-usebreakpoint--basic --- # useBreakpoint `useBreakpoint` is a custom hook that returns the current breakpoint. This hook monitors changes in the window size and returns the appropriate value. ```tsx const breakpoint = useBreakpoint() return The current breakpoint is "{breakpoint}". ``` ## Usage ```tsx import { useBreakpoint } from "@yamada-ui/react" ``` ```tsx import { useBreakpoint } from "@/components/ui" ``` ```tsx import { useBreakpoint } from "@workspaces/ui" ``` ```tsx const breakpoint = useBreakpoint() ``` :::note The return value refers to the [breakpoint](https://yamada-ui.com/docs/theming/breakpoints.md) of the theme. ::: ## Used By Components & Hooks - [Sidebar](https://yamada-ui.com/docs/components/sidebar.md): `Sidebar` is a component used to display a list of items in a sidebar. - [useValue](https://yamada-ui.com/docs/hooks/use-value.md): `useValue` is a custom hook that combines `useBreakpointValue` and `useColorModeValue`. # useClipboard --- title: useClipboard description: "`useClipboard` is a custom hook that performs the operation of copying a value to the clipboard." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/hooks/use-clipboard - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/hooks-useclipboard--basic --- # useClipboard `useClipboard` is a custom hook that performs the operation of copying a value to the clipboard. ```tsx const { onCopy, value, setValue, copied } = useClipboard() return ( setValue(e.target.value)} /> ) ``` ## Usage ```tsx import { useClipboard } from "@yamada-ui/react" ``` ```tsx import { useClipboard } from "@/components/ui" ``` ```tsx import { useClipboard } from "@workspaces/ui" ``` ```tsx const { onCopy, value, setValue, copied } = useClipboard("initial value") ``` ### Using Initial Values ```tsx const { onCopy, value, setValue, copied } = useClipboard("initial value") return ( setValue(e.target.value)} /> ) ``` ### Change Timeout To change the timeout, set a number(milliseconds) to the second argument. The default is `1500`. ```tsx const { onCopy, value, setValue, copied } = useClipboard("", 5000) return ( setValue(e.target.value)} /> ) ``` ### Copy the Specified Value ```tsx const { onCopy, copied } = useClipboard() const value = "Read-Only Value" return ( ) ``` # useColorModeValue --- title: useColorModeValue description: "`useColorModeValue` is a custom hook that returns the value of the current color mode from the provided values." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/core/system - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/hooks-usecolormodevalue--basic --- # useColorModeValue `useColorModeValue` is a custom hook that returns the value of the current color mode from the provided values. ```tsx const { colorMode } = useColorMode() const color = useColorModeValue("green", "red") return The current colorMode is "{colorMode}" ``` ## Usage ```tsx import { useColorModeValue } from "@yamada-ui/react" ``` ```tsx import { useColorModeValue } from "@/components/ui" ``` ```tsx import { useColorModeValue } from "@workspaces/ui" ``` ```tsx const color = useColorModeValue("green", "red") ``` :::tip Color Mode overview is [here](https://yamada-ui.com/docs/styling/color-mode.md). ::: # useColorMode --- title: useColorMode description: "`useColorMode` is a custom hook that returns the current color mode." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/core/system - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/hooks-usecolormode--basic --- # useColorMode `useColorMode` is a custom hook that returns the current color mode. ```tsx const { colorMode } = useColorMode() return The current colorMode is "{colorMode}" ``` ## Usage ```tsx import { useColorMode } from "@yamada-ui/react" ``` ```tsx import { useColorMode } from "@/components/ui" ``` ```tsx import { useColorMode } from "@workspaces/ui" ``` ```tsx const { changeColorMode, colorMode, internalColorMode, toggleColorMode } = useColorMode() ``` :::tip Color Mode overview is [here](https://yamada-ui.com/docs/styling/color-mode.md). ::: ### Switching Color Mode - `colorMode`: Provides the current color mode. - `internalColorMode`: Provides the current color mode including `system`. ```tsx const { colorMode, internalColorMode, changeColorMode, toggleColorMode } = useColorMode() return ( The current colorMode is "{colorMode}", internal colorMode is " {internalColorMode}" ) ``` # useCounter --- title: useCounter description: "`useCounter` is a custom hook that returns the current counter value." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/hooks/use-counter --- # useCounter `useCounter` is a custom hook that returns the current counter value. ```tsx const { value, increment, decrement, reset } = useCounter({ defaultValue: 10, }) return ( Count: {value} increment()} > + 1 decrement()} > - 1 Reset ) ``` ## Usage ```tsx import { useCounter } from "@yamada-ui/react" ``` ```tsx import { useCounter } from "@/components/ui" ``` ```tsx import { useCounter } from "@workspaces/ui" ``` ```tsx const { value, valueAsNumber, update, increment, decrement, reset, cast, out } = useCounter() ``` ### Set Default Value To set a default value, pass a number or string to `defaultValue`. ```tsx const { value, increment, decrement, reset } = useCounter({ defaultValue: 10, }) return ( Count: {value} increment()} > + 1 decrement()} > - 1 Reset ) ``` ### Set Min And Max Values To set minimum and maximum values, set `min` or `max` to a number. ```tsx const { value, increment, decrement, min, max, reset } = useCounter({ defaultValue: 5, min: 0, max: 10, }) return ( Count: {value} increment()} disabled={max} > + 1 decrement()} disabled={min} > - 1 Reset ) ``` ### Set Step Value To set a step value, pass a number to `step`. ```tsx const { value, increment, decrement, reset } = useCounter({ defaultValue: 0, step: 5, }) return ( Count: {value} increment()} > + 5 decrement()} > - 5 Reset ) ``` ```tsx const { value, increment, decrement } = useCounter({ defaultValue: 0, }) return ( Count: {value} {(step) => ( increment(step)}> + {step} )} {(step) => ( decrement(step)}> - {step} )} ) ``` ### Specify Precision To specify precision, pass a number to `precision`. ```tsx const { value, increment, decrement, reset } = useCounter({ defaultValue: 5.123, step: 0.1, precision: 2, }) return ( Count: {value} increment()} > + 0.1 decrement()} > - 0.1 Reset ) ``` ### Allow Out Of Range Values To allow out of range values, set `keepWithinRange` to `false`. The `out` property is also provided to indicate whether the value is out of range. ```tsx const { value, increment, decrement, out, reset } = useCounter({ defaultValue: 5, min: 0, max: 10, keepWithinRange: false, }) return ( Count: {value} {out ? "(Out Of Range)" : ""} increment()} > + 1 decrement()} > - 1 Reset ) ``` ### Cast Value To cast value, use the `cast` function. ```tsx const { value, setValue, cast } = useCounter({ defaultValue: 0, precision: 2, }) return ( setValue(e.target.value)} onBlur={(e) => cast(e.target.value)} /> ) ``` ## Used By Components & Hooks - [NumberInput](https://yamada-ui.com/docs/components/number-input.md): `NumberInput` is a component used to obtain numeric input from the user. # useDescendants --- title: useDescendants description: "`useDescendants` is a custom hook that manages descendants." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/hooks/use-descendants --- # useDescendants `useDescendants` is a custom hook that manages descendants. ```tsx const { useDescendants, useDescendant, DescendantsContext } = createDescendants() const ref = useRef(null) const descendants = useDescendants() const onFocus = useCallback( (ev: FocusEvent) => { if (ev.target !== ref.current) return const descendant = descendants.enabledFirstValue() if (descendant) { descendant.node.focus() if (ref.current) ref.current.tabIndex = -1 } }, [descendants], ) const onBlur = useCallback((ev: FocusEvent) => { if (contains(ref.current, ev.relatedTarget)) return if (ref.current) ref.current.tabIndex = 0 }, []) const Item: FC<{ index: number }> = ({ index }) => { const { descendants, register } = useDescendant() const onKeyDown = useCallback( (ev: KeyboardEvent) => { runKeyAction(ev, { ArrowDown: () => { const descendant = descendants.enabledNextValue(index) if (descendant) descendant.node.focus() }, ArrowUp: () => { const descendant = descendants.enabledPrevValue(index) if (descendant) descendant.node.focus() }, Home: () => { const descendant = descendants.enabledFirstValue() if (descendant) descendant.node.focus() }, End: () => { const descendant = descendants.enabledLastValue() if (descendant) descendant.node.focus() }, }) }, [descendants], ) return (
Item {index}
) } return ( {Array.from({ length: 5 }).map((_, index) => ( ))} ) ``` ## Usage ```tsx import { createDescendants } from "@yamada-ui/react" ``` ```tsx import { createDescendants } from "@/components/ui" ``` ```tsx import { createDescendants } from "@workspaces/ui" ``` ```tsx const { DescendantsContext, useDescendant, useDescendantRegister, useDescendants, useDescendantsContext, } = createDescendants() ``` ```tsx const descendants = useDescendants() ``` ```tsx const { descendants, register } = useDescendant() ``` ### Disable descendant To disable a descendant, set the `disabled` prop to `true` on `useDescendant`. ```tsx const { useDescendants, useDescendant, DescendantsContext } = createDescendants() const ref = useRef(null) const descendants = useDescendants() const onFocus = useCallback( (ev: FocusEvent) => { if (ev.target !== ref.current) return const descendant = descendants.enabledFirstValue() if (descendant) { descendant.node.focus() if (ref.current) ref.current.tabIndex = -1 } }, [descendants], ) const onBlur = useCallback((ev: FocusEvent) => { if (contains(ref.current, ev.relatedTarget)) return if (ref.current) ref.current.tabIndex = 0 }, []) const Item: FC<{ index: number; disabled?: boolean }> = ({ index, disabled, }) => { const { descendants, register } = useDescendant({ disabled }) const onKeyDown = useCallback( (ev: KeyboardEvent) => { runKeyAction(ev, { ArrowDown: () => { const descendant = descendants.enabledNextValue(index) if (descendant) descendant.node.focus() }, ArrowUp: () => { const descendant = descendants.enabledPrevValue(index) if (descendant) descendant.node.focus() }, Home: () => { const descendant = descendants.enabledFirstValue() if (descendant) descendant.node.focus() }, End: () => { const descendant = descendants.enabledLastValue() if (descendant) descendant.node.focus() }, }) }, [descendants], ) return (
Item {index}
) } return ( {Array.from({ length: 5 }).map((_, index) => ( ))} ) ``` ## Used By Components & Hooks - [Accordion](https://yamada-ui.com/docs/components/accordion.md): `Accordion` is a component for a list that displays information in an expandable or collapsible manner. - [Calendar](https://yamada-ui.com/docs/components/calendar.md): `Calendar` is a component for displaying or selecting dates in a calendar. - [Menu](https://yamada-ui.com/docs/components/menu.md): `Menu` is a component that displays a common dropdown menu. - [PinInput](https://yamada-ui.com/docs/components/pin-input.md): `PinInput` is a component used to capture pin codes or OTP (One-Time Password) inputs. - [SegmentedControl](https://yamada-ui.com/docs/components/segmented-control.md): `SegmentedControl` is a component used for allowing users to select one option from multiple choices. - [Sidebar](https://yamada-ui.com/docs/components/sidebar.md): `Sidebar` is a component used to display a list of items in a sidebar. - [Steps](https://yamada-ui.com/docs/components/steps.md): `Steps` is a component that displays the progress of a multi-step process. - [Tabs](https://yamada-ui.com/docs/components/tabs.md): `Tabs` is a component for switching between different display areas. - [Tree](https://yamada-ui.com/docs/components/tree.md): `Tree` is a component used to display hierarchical data structures in an expandable tree format. # useDisclosure --- title: useDisclosure description: "`useDisclosure` is a custom hook that helps handle common open/close or toggle scenarios. It can be used to control components such as `Modal`, `Dialog`, `Drawer`, etc." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/hooks/use-disclosure - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/hooks-usedisclosure--basic --- # useDisclosure `useDisclosure` is a custom hook that helps handle common open/close or toggle scenarios. It can be used to control components such as `Modal`, `Dialog`, `Drawer`, etc. ```tsx const { open, onOpen, onClose } = useDisclosure() return ( <> ) ``` ## Usage ```tsx import { useDisclosure } from "@yamada-ui/react" ``` ```tsx import { useDisclosure } from "@/components/ui" ``` ```tsx import { useDisclosure } from "@workspaces/ui" ``` ```tsx const { open, onOpen, onClose, onToggle } = useDisclosure() ``` ### Using Callback Functions To use callback functions, assign a function to `onOpen` or `onClose`. This is useful for executing APIs or other logic before opening components such as [Modal](https://yamada-ui.com/docs/components/modal.md). ```tsx const { open, onClose, onOpen } = useDisclosure({ onClose: (value) => { console.log("onClose:", value) }, onOpen: (value) => { console.log("onOpen:", value) }, }) return ( <> onClose("This is arg")} onClose={() => onClose("This is arg")} onSuccess={() => onClose("This is arg")} /> ) ``` By default, the callback functions are executed before `onOpen` or `onClose`. If you want the callbacks to be executed after `onOpen` or `onClose`, set the `timing` option to `"after"`. ```tsx const { open, onClose, onOpen } = useDisclosure({ onClose: (value) => { console.log("onClose:", value) }, onOpen: (value) => { console.log("onOpen:", value) }, timing: "after", }) return ( <> onClose("This is arg")} onClose={() => onClose("This is arg")} onSuccess={() => onClose("This is arg")} /> ) ``` ## Used By Components & Hooks - [ActionBar](https://yamada-ui.com/docs/components/action-bar.md): `ActionBar` is a component that is used to display a bottom action bar with a set of actions. - [Menu](https://yamada-ui.com/docs/components/menu.md): `Menu` is a component that displays a common dropdown menu. - [Modal](https://yamada-ui.com/docs/components/modal.md): `Modal` is a component that is displayed over the main content to focus the user's attention solely on the information. - [Popover](https://yamada-ui.com/docs/components/popover.md): `Popover` is a component that floats around an element to display information. - [Sidebar](https://yamada-ui.com/docs/components/sidebar.md): `Sidebar` is a component used to display a list of items in a sidebar. - [Tooltip](https://yamada-ui.com/docs/components/tooltip.md): `Tooltip` is a component that displays short information, such as supplementary details for an element. - [Tree](https://yamada-ui.com/docs/components/tree.md): `Tree` is a component used to display hierarchical data structures in an expandable tree format. # useDynamicAnimation --- title: useDynamicAnimation description: "`useDynamicAnimation` is a custom hook used to switch animations." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/hooks/use-animation - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/hooks-usedynamicanimation--basic --- # useDynamicAnimation `useDynamicAnimation` is a custom hook used to switch animations. ```tsx const [animation, setAnimation] = useDynamicAnimation({ moveLeft: { duration: "moderate", fillMode: "forwards", keyframes: { "0%": { transform: "translateX(100%)" }, "100%": { transform: "translateX(0%)" }, }, timingFunction: "ease-in-out", }, moveRight: { duration: "moderate", fillMode: "forwards", keyframes: { "0%": { transform: "translateX(0%)" }, "100%": { transform: "translateX(100%)" }, }, timingFunction: "ease-in-out", }, }) return ( Box ) ``` ## Usage ```tsx import { useDynamicAnimation } from "@yamada-ui/react" ``` ```tsx import { useDynamicAnimation } from "@/components/ui" ``` ```tsx import { useDynamicAnimation } from "@workspaces/ui" ``` ```tsx const [animation, setAnimation] = useDynamicAnimation() ``` ### Use Theme Tokens To use [theme](https://yamada-ui.com/docs/theming.md) [animations](https://yamada-ui.com/docs/theming/tokens/animations.md), set the keys as the animation names. ```tsx const [animation, setAnimation] = useDynamicAnimation({ slideToLeft: "slide-to-right-full-reverse", slideToRight: "slide-to-right-full", }) return ( Box ) ``` :::warning By default, no animation tokens are defined. ::: ### Use Multiple Animations To use multiple animations, pass an object with the keys as the animation names. ```tsx const [animation, setAnimation] = useDynamicAnimation({ moveLeft: [ { duration: "moderate", fillMode: "forwards", keyframes: { "0%": { transform: "translateX(100%)" }, "100%": { transform: "translateX(0%)" }, }, timingFunction: "ease-in-out", }, { duration: "moderate", fillMode: "forwards", keyframes: { "0%": { bg: "green" }, "100%": { bg: "orange" }, }, timingFunction: "ease-in-out", }, ], moveRight: [ { duration: "moderate", fillMode: "forwards", keyframes: { "0%": { transform: "translateX(0%)" }, "100%": { transform: "translateX(100%)" }, }, timingFunction: "ease-in-out", }, { duration: "moderate", fillMode: "forwards", keyframes: { "0%": { bg: "orange" }, "100%": { bg: "green" }, }, timingFunction: "ease-in-out", }, ], }) return ( Box ) ``` # useEyeDropper --- title: useEyeDropper description: "`useEyeDropper` is a custom hook that opens the eye dropper tool and returns the color value." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/hooks/use-eye-dropper --- # useEyeDropper `useEyeDropper` is a custom hook that opens the eye dropper tool and returns the color value. ```tsx const { supported, onOpen } = useEyeDropper() const [color, setColor] = useState("#FF0000") const onClick = async () => { const result = await onOpen() if (result) setColor(result.sRGBHex) } return ( {color} EyeDropper API is not supported in this browser. ) ``` ## Usage ```tsx import { useEyeDropper } from "@yamada-ui/react" ``` ```tsx import { useEyeDropper } from "@/components/ui" ``` ```tsx import { useEyeDropper } from "@workspaces/ui" ``` ```tsx const { supported, onOpen } = useEyeDropper() ``` ## Used By Components & Hooks - [ColorPicker](https://yamada-ui.com/docs/components/color-picker.md): `ColorPicker` is a component used by the user to select a color or enter an arbitrary color value. - [ColorSelector](https://yamada-ui.com/docs/components/color-selector.md): `ColorSelector` is a component used by the user to select a color. # useFocusOnShow --- title: useFocusOnShow description: "`useFocusOnShow` is a custom hook that focuses on the target element when it is shown." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/hooks/use-focus --- # useFocusOnShow `useFocusOnShow` is a custom hook that focuses on the target element when it is shown. ```tsx const [visible, setVisible] = useState(false) const ref = useRef(null) const inputRef = useRef(null) useFocusOnShow(ref, { focusTarget: inputRef, visible, shouldFocus: true, }) return ( ) ``` ## Usage ```tsx import { useFocusOnShow } from "@yamada-ui/react" ``` ```tsx import { useFocusOnShow } from "@/components/ui" ``` ```tsx import { useFocusOnShow } from "@workspaces/ui" ``` ```tsx const ref = useRef(null) const focusTargetRef = useRef(null) useFocusOnShow(ref, { focusTarget: focusTargetRef, visible: true, shouldFocus: true, }) ``` # useFormatByte --- title: useFormatByte description: "`useFormatByte` is a custom hook for formatting bytes." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/format - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/hooks-useformatbyte--basic --- # useFormatByte `useFormatByte` is a custom hook for formatting bytes. ```tsx const kilobyte = useFormatByte(1024) const megabyte = useFormatByte(1024 * 1024) const gigabyte = useFormatByte(1024 * 1024 * 1024) const terabyte = useFormatByte(1024 * 1024 * 1024 * 1024) return ( <> {kilobyte} {megabyte} {gigabyte} {terabyte} ) ``` ## Usage ```tsx import { useFormatByte } from "@yamada-ui/react" ``` ```tsx import { useFormatByte } from "@/components/ui" ``` ```tsx import { useFormatByte } from "@workspaces/ui" ``` ```tsx const kilobyte = useFormatByte(1024) ``` :::note `FormatByte` automatically selects the most appropriate unit (`byte`, `kB`, `MB`, `GB`, `TB`) based on the byte value size. ::: :::note `useFormatByte` internally uses [Intl.NumberFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat). ::: ### Changing the Locale To change the locale, set a value for [locale](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#locales). ```tsx const enByte = useFormatByte(1024, { locale: "en-US" }) const jaByte = useFormatByte(1024, { locale: "ja-JP" }) const deByte = useFormatByte(1024, { locale: "de-DE" }) return ( en-US {enByte} ja-JP {jaByte} de-DE {deByte} ) ``` ### Set the Locale for the Entire Application If you want to set the locale for the entire application, set the `locale` for the `UIProvider`. ```tsx import { UIProvider } from "@yamada-ui/react" const App = () => { return ( ) } ``` ### Unit Format To convert units, set `unit` to either `"byte"` or `"bit"`. The default is `"byte"`. ```tsx const bytes = useFormatByte(1024, { unit: "byte" }) const bits = useFormatByte(1024, { unit: "bit" }) return ( Bytes {bytes} Bits {bits} ) ``` ### Unit Display To change the unit display, set a value for [unitDisplay](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#unitdisplay). ```tsx const short = useFormatByte(1024, { unitDisplay: "short" }) const narrow = useFormatByte(1024, { unitDisplay: "narrow" }) const long = useFormatByte(1024, { unitDisplay: "long" }) return ( Short {short} Narrow {narrow} Long {long} ) ``` # useFormatDateTime --- title: useFormatDateTime description: "`useFormatDateTime` is a custom hook for formatting date time." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/format - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/hooks-useformatdatetime--basic --- # useFormatDateTime `useFormatDateTime` is a custom hook for formatting date time. ```tsx const formattedValue = useFormatDateTime(new Date()) return {formattedValue} ``` ## Usage ```tsx import { useFormatDateTime } from "@yamada-ui/react" ``` ```tsx import { useFormatDateTime } from "@/components/ui" ``` ```tsx import { useFormatDateTime } from "@workspaces/ui" ``` ```tsx const formattedValue = useFormatDateTime(new Date()) ``` It formats date time according to the specified locale and options. The hook returns the formatted value directly. :::note `useFormatDateTime` internally uses [Intl.DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat). ::: ### Changing the Locale To change the locale, set a value for [locale](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#locales). ```tsx const enValue = useFormatDateTime(new Date(), { locale: "en-US" }) const jaValue = useFormatDateTime(new Date(), { locale: "ja-JP" }) const deValue = useFormatDateTime(new Date(), { locale: "de-DE" }) const frValue = useFormatDateTime(new Date(), { locale: "fr-FR" }) const zhValue = useFormatDateTime(new Date(), { locale: "zh-CN" }) return ( en-US {enValue} ja-JP {jaValue} de-DE {deValue} fr-FR {frValue} zh-CN {zhValue} ) ``` ### Set the Locale for the Entire Application If you want to set the locale for the entire application, set the `locale` for the `UIProvider`. ```tsx import { UIProvider } from "@yamada-ui/react" const App = () => { return ( ) } ``` ### Converting to Year To convert to year, set a value for [year](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#year). ```tsx const formattedValue = useFormatDateTime(new Date(), { year: "numeric" }) return {formattedValue} ``` ### Converting to Month To convert to month, set a value for [month](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#month). ```tsx const formattedValue = useFormatDateTime(new Date(), { month: "long" }) return {formattedValue} ``` ### Converting to Day To convert to day, set a value for [day](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#day). ```tsx const formattedValue = useFormatDateTime(new Date(), { day: "2-digit" }) return {formattedValue} ``` ### Converting to Weekday To convert to weekday, set a value for [weekday](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#weekday). ```tsx const formattedValue = useFormatDateTime(new Date(), { weekday: "long" }) return {formattedValue} ``` # useFormatNumber --- title: useFormatNumber description: "`useFormatNumber` is a custom hook for formatting numbers." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/format - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/hooks-useformatnumber--basic --- # useFormatNumber `useFormatNumber` is a custom hook for formatting numbers. ```tsx const formattedValue = useFormatNumber(1234567.89) return {formattedValue} ``` ## Usage ```tsx import { useFormatNumber } from "@yamada-ui/react" ``` ```tsx import { useFormatNumber } from "@/components/ui" ``` ```tsx import { useFormatNumber } from "@workspaces/ui" ``` ```tsx const formattedValue = useFormatNumber(1234567.89) ``` It formats numbers according to the specified locale and options. The hook returns the formatted value directly. :::note `useFormatNumber` internally uses [Intl.NumberFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat). ::: ### Changing the Locale To change the locale, set a value for [locale](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#locales). ```tsx const enValue = useFormatNumber(1234567.89, { locale: "en-US" }) const jaValue = useFormatNumber(1234567.89, { locale: "ja-JP" }) const deValue = useFormatNumber(1234567.89, { locale: "de-DE" }) const frValue = useFormatNumber(1234567.89, { locale: "fr-FR" }) const zhValue = useFormatNumber(1234567.89, { locale: "zh-CN" }) return ( en-US {enValue} ja-JP {jaValue} de-DE {deValue} fr-FR {frValue} zh-CN {zhValue} ) ``` ### Set the Locale for the Entire Application If you want to set the locale for the entire application, set the `locale` for the `UIProvider`. ```tsx import { UIProvider } from "@yamada-ui/react" const App = () => { return ( ) } ``` ### Converting to Currency To convert to currency, set `"currency"` for [style](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#style). ```tsx const usdValue = useFormatNumber(1234567.89, { style: "currency", currency: "USD", locale: "en-US", }) const eurValue = useFormatNumber(1234567.89, { style: "currency", currency: "EUR", locale: "de-DE", }) const jpyValue = useFormatNumber(1234567.89, { style: "currency", currency: "JPY", locale: "ja-JP", }) return ( USD {usdValue} EUR {eurValue} JPY {jpyValue} ) ``` ### Converting to Units To convert to units, set `"unit"` for [style](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#style). ```tsx const kilogramValue = useFormatNumber(100, { style: "unit", unit: "kilogram", }) const celsiusValue = useFormatNumber(100, { style: "unit", unit: "celsius", unitDisplay: "long", }) const speedValue = useFormatNumber(100, { style: "unit", unit: "kilometer-per-hour", unitDisplay: "narrow", }) return ( {kilogramValue} {celsiusValue} {speedValue} ) ``` ### Converting to Percent To convert to percent, set `"percent"` for [style](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#style). ```tsx const percent1Value = useFormatNumber(0.45, { style: "percent" }) const percent2Value = useFormatNumber(0.45, { style: "percent", minimumFractionDigits: 2, }) return ( {percent1Value} {percent2Value} ) ``` ### Converting Notation To convert notation, set a value for [notation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#notation). ```tsx const standardValue = useFormatNumber(1234567.89, { notation: "standard" }) const scientificValue = useFormatNumber(1234567.89, { notation: "scientific" }) const engineeringValue = useFormatNumber(1234567.89, { notation: "engineering", }) const compactValue = useFormatNumber(1234567.89, { notation: "compact" }) return ( {standardValue} {scientificValue} {engineeringValue} {compactValue} ) ``` ### Controlling Decimal Places To control the number of decimal places, use [minimumFractionDigits](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#minimumfractiondigits) and [maximumFractionDigits](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#maximumfractiondigits). ```tsx const fixed2Value = useFormatNumber(1234.5, { minimumFractionDigits: 2, maximumFractionDigits: 2, }) const range03Value = useFormatNumber(1234.567, { minimumFractionDigits: 0, maximumFractionDigits: 3, }) const fixed4Value = useFormatNumber(1234, { minimumFractionDigits: 4, maximumFractionDigits: 4, }) return ( {fixed2Value} {range03Value} {fixed4Value} ) ``` ### Disabling Grouping To disable grouping, set `false` for [useGrouping](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#usegrouping). ```tsx const noGroupingValue = useFormatNumber(1234567.89, { useGrouping: false }) return {noGroupingValue} ``` ### Changing the Sign Display To change the sign display, set a value for [signDisplay](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#signdisplay). ```tsx const alwaysValue = useFormatNumber(1234.5, { signDisplay: "always" }) const exceptZeroValue = useFormatNumber(-1234.5, { signDisplay: "exceptZero" }) return ( {alwaysValue} {exceptZeroValue} ) ``` # useHover --- title: useHover description: "`useHover` is a custom hook that detects whether the pointer has moved over or away from an element." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/hooks/use-hover - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/hooks-usehover--basic --- # useHover `useHover` is a custom hook that detects whether the pointer has moved over or away from an element. ```tsx const { hovered, ref } = useHover() return ( {hovered ? "I am hovered" : "Put mouse over me please"} ) ``` ## Usage ```tsx import { useHover } from "@yamada-ui/react" ``` ```tsx import { useHover } from "@/components/ui" ``` ```tsx import { useHover } from "@workspaces/ui" ``` ```tsx const { hovered, ref } = useHover() ``` # useIdle --- title: useIdle description: "`useIdle` is a custom hook that detects whether the user has been idle for a certain amount of time in milliseconds." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/hooks/use-idle - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/hooks-useidle--basic --- # useIdle `useIdle` is a custom hook that detects whether the user has been idle for a certain amount of time in milliseconds. ```tsx const idle = useIdle(2000) return Current state: {idle ? "idle" : "not idle"} ``` ## Usage ```tsx import { useIdle } from "@yamada-ui/react" ``` ```tsx import { useIdle } from "@/components/ui" ``` ```tsx import { useIdle } from "@workspaces/ui" ``` ```tsx const idle = useIdle(2000) ``` # useInfiniteScroll --- title: useInfiniteScroll description: "`useInfiniteScroll` is a custom hook that provides infinite scroll functionality." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/infinite-scroll-area - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/hooks-useinfinitescroll--basic --- # useInfiniteScroll `useInfiniteScroll` is a custom hook that provides infinite scroll functionality. ```tsx const [count, setCount] = useState(50) const { ref, finish } = useInfiniteScroll({ onLoad: ({ finish, index }) => { console.log("onLoad", index) setCount((prev) => prev + 50) if (index >= 5) finish() }, }) return ( {Array(count) .fill(0) .map((_, index) => ( 天元突破グレンラガン いいか、忘れんな。お前を信じろ。俺が信じるお前でもない。お前が信じる俺でもない。お前が信じる…お前を信じろ! ))} {!finish ? (
) : null}
) ``` ## Usage ```tsx import { useInfiniteScroll } from "@yamada-ui/react" ``` ```tsx import { useInfiniteScroll } from "@/components/ui" ``` ```tsx import { useInfiniteScroll } from "@workspace/ui" ``` ```tsx const { ref, finish } = useInfiniteScroll() ``` ### Specify the Viewport To specify the viewport, set a `ref` to `rootRef`. :::note If `rootRef` is not set, the browser's viewport will be used. ::: ```tsx const rootRef = useRef(null) const resetRef = useRef<() => void>(noop) const [count, setCount] = useState(50) const { ref, finish } = useInfiniteScroll({ resetRef, rootRef, onLoad: ({ finish, index }) => { console.log("onLoad", index) setCount((prev) => prev + 50) if (index >= 5) finish() }, }) return ( {Array(count) .fill(0) .map((_, index) => ( 天元突破グレンラガン いいか、忘れんな。お前を信じろ。俺が信じるお前でもない。お前が信じる俺でもない。お前が信じる…お前を信じろ! ))} {!finish ? (
) : null}
) ``` ### Set rootMargin To set [rootMargin](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API#rootmargin), assign a string to rootMargin. ```tsx const [count, setCount] = useState(50) const { ref, finish } = useInfiniteScroll({ rootMargin: "0px 0px 300px 0px", onLoad: ({ finish, index }) => { console.log("onLoad", index) setCount((prev) => prev + 50) if (index >= 5) finish() }, }) return ( {Array(count) .fill(0) .map((_, index) => ( 天元突破グレンラガン いいか、忘れんな。お前を信じろ。俺が信じるお前でもない。お前が信じる俺でもない。お前が信じる…お前を信じろ! ))} {!finish ? (
) : null}
) ``` ### Set threshold To set [threshold](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API#threshold), assign a number to `threshold`. ```tsx const [count, setCount] = useState(50) const { ref, finish } = useInfiniteScroll({ threshold: 1, onLoad: ({ finish, index }) => { console.log("onLoad", index) setCount((prev) => prev + 50) if (index >= 5) finish() }, }) return ( {Array(count) .fill(0) .map((_, index) => ( 天元突破グレンラガン いいか、忘れんな。お前を信じろ。俺が信じるお前でもない。お前が信じる俺でもない。お前が信じる…お前を信じろ! ))} {!finish ? (
) : null}
) ``` ### Initial Load To load initially, set `initialLoad` to `true`. By default, `initialLoad` is set to `false`, and the initial(`index=0`) `onLoad` is not executed. `true`: The first `onLoad` is executed regardless of the scroll amount, and the provided `index` starts from `0`.\ `false`: `onLoad` is executed when a certain scroll is reached, and the provided `index` starts from `1`. ```tsx const [count, setCount] = useState(50) const { ref, finish } = useInfiniteScroll({ initialLoad: true, onLoad: ({ finish, index }) => { console.log("onLoad", index) setCount((prev) => prev + 50) if (index >= 5) finish() }, }) return ( {Array(count) .fill(0) .map((_, index) => ( 天元突破グレンラガン いいか、忘れんな。お前を信じろ。俺が信じるお前でもない。お前が信じる俺でもない。お前が信じる…お前を信じろ! ))} {!finish ? (
) : null}
) ``` ### Change the Starting index To change the starting index, set a number to `startIndex`. The default is `1`. ```tsx const [count, setCount] = useState(50) const { ref, finish } = useInfiniteScroll({ startIndex: 3, onLoad: ({ finish, index }) => { console.log("onLoad", index) setCount((prev) => prev + 50) if (index >= 5) finish() }, }) return ( {Array(count) .fill(0) .map((_, index) => ( 天元突破グレンラガン いいか、忘れんな。お前を信じろ。俺が信じるお前でもない。お前が信じる俺でもない。お前が信じる…お前を信じろ! ))} {!finish ? (
) : null}
) ``` ### Reverse To reverse, set `reverse` to `true`. The default is `false`. ```tsx const rootRef = useRef(null) const [count, setCount] = useState(50) const { ref, finish } = useInfiniteScroll({ reverse: true, rootRef, onLoad: ({ finish, index }) => { console.log("onLoad", index) setCount((prev) => prev + 50) if (index >= 5) finish() }, }) return ( {!finish ? (
) : null} {Array(count) .fill(0) .map((_, index) => ( 天元突破グレンラガン いいか、忘れんな。お前を信じろ。俺が信じるお前でもない。お前が信じる俺でもない。お前が信じる…お前を信じろ! ))}
) ``` # useInterval --- title: useInterval description: "`useInterval` is a custom hook that runs a function at a specified interval." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/hooks/use-interval - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/hooks-useinterval--basic --- # useInterval `useInterval` is a custom hook that runs a function at a specified interval. ```tsx const [state, setState] = useState(1) useInterval(() => setState((prev) => prev + 1), 3000) return Current state: {state} ``` ## Usage ```tsx import { useInterval } from "@yamada-ui/react" ``` ```tsx import { useInterval } from "@/components/ui" ``` ```tsx import { useInterval } from "@workspaces/ui" ``` ```tsx const [state, setState] = useState(1) useInterval(() => setState((prev) => prev + 1), 3000) ``` ## Used By Components & Hooks - [NumberInput](https://yamada-ui.com/docs/components/number-input.md): `NumberInput` is a component used to obtain numeric input from the user. # useLoading --- title: useLoading description: "`useLoading` is a custom hook for controlling the loading of the application." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/loading - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/hooks-useloading--basic --- # useLoading `useLoading` is a custom hook for controlling the loading of the application. ```tsx const { screen, page, background } = useLoading() const onLoadingScreen = async () => { try { screen.start() await wait(3000) } finally { screen.finish() } } const onLoadingPage = async () => { try { page.start() await wait(3000) } finally { page.finish() } } const onLoadingBackground = async () => { try { background.start() await wait(3000) } finally { background.finish() } } return ( ) ``` ## Usage ```tsx import { useLoading } from "@yamada-ui/react" ``` ```tsx import { useLoading } from "@/components/ui" ``` ```tsx import { useLoading } from "@workspaces/ui" ``` ```tsx const { screen, page, background } = useLoading() ``` `useLoading` returns instances of `screen`, `page`, and `background`. Each instance provides several methods: - `start`: Starts the loading animation. - `update`: Updates the loading animation. - `finish`: Finishes the loading animation. - `force`: Forces the loading animation to update. ### Change Loading Scheme ```tsx const { screen, page, background } = useLoading() return ( ) ``` ### Set Duration To set the duration, set a number (milliseconds) to `duration`. ```tsx const { screen, page, background } = useLoading() return ( ) ``` ### Set Message To set a message, set a `ReactNode` to `message`. ```tsx const { screen, page, background } = useLoading() return ( ) ``` ### Update Message To update a message, use `update`. ```tsx const { screen, page, background } = useLoading() const onLoadingScreen = async () => { try { screen.start({ message: "Loading" }) await wait(3000) screen.update({ message: "Please Wait" }) await wait(3000) } finally { screen.finish() } } const onLoadingPage = async () => { try { page.start({ message: "Loading" }) await wait(3000) page.update({ message: "Please Wait" }) await wait(3000) } finally { page.finish() } } const onLoadingBackground = async () => { try { background.start({ message: "Loading" }) await wait(3000) background.update({ message: "Please Wait" }) await wait(3000) } finally { background.finish() } } return ( ) ``` ## Configuration ### Change Loading Scheme ```tsx const config = extendConfig({ loading: { background: { loadingScheme: "puff" }, page: { loadingScheme: "dots" }, screen: { loadingScheme: "grid" }, }, }) const App: FC = () => { const { screen, page, background } = useLoading() return ( ) } return ( ) ``` # useLocalStorage --- title: useLocalStorage description: "`useLocalStorage` is a custom hook for storing, updating, and retrieving values in local storage." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/hooks/use-local-storage - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/hooks-uselocalstorage--basic --- # useLocalStorage `useLocalStorage` is a custom hook for storing, updating, and retrieving values in local storage. ```tsx const [value, setValue, resetValue] = useLocalStorage({ key: "value", defaultValue: 1, }) return ( ) ``` ## Usage ```tsx import { useLocalStorage } from "@yamada-ui/react" ``` ```tsx import { useLocalStorage } from "@/components/ui" ``` ```tsx import { useLocalStorage } from "@workspaces/ui" ``` ```tsx const [value, setValue, resetValue] = useLocalStorage({ key: "value", defaultValue: 1, }) ``` ## Uses Components & Hooks - [useWindowEvent](https://yamada-ui.com/docs/hooks/use-window-event.md): `useWindowEvent` is a custom hook that assigns an event listener to `window`. # useMediaQuery --- title: useMediaQuery description: "`useMediaQuery` is a custom hook that detects whether it matches a single or multiple media queries." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/hooks/use-media-query - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/hooks-usemediaquery--basic --- # useMediaQuery `useMediaQuery` is a custom hook that detects whether it matches a single or multiple media queries. ```tsx const large = useMediaQuery("(min-width: 1280px)") return {large ? "larger than 1280px" : "smaller than 1280px"} ``` ## Usage ```tsx import { useMediaQuery } from "@yamada-ui/react" ``` ```tsx import { useMediaQuery } from "@/components/ui" ``` ```tsx import { useMediaQuery } from "@workspaces/ui" ``` ```tsx const large = useMediaQuery("(min-width: 1280px)") ``` # useNotice --- title: useNotice description: "`useNotice` is a custom hook that controls the notifications of the application." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/notice - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/hooks-usenotice--basic --- # useNotice `useNotice` is a custom hook that controls the notifications of the application. ```tsx const notice = useNotice() return ( ) ``` ## Usage ```tsx import { useNotice } from "@yamada-ui/react" ``` ```tsx import { useNotice } from "@/components/ui" ``` ```tsx import { useNotice } from "@workspaces/ui" ``` ```tsx const notice = useNotice() ``` ### Change Variant ```tsx const notice = useNotice() return ( {(variant) => ( )} ) ``` ### Change Color Scheme ```tsx const notice = useNotice() return ( {(colorScheme) => ( )} ) ``` ### Change Loading Scheme ```tsx const notice = useNotice() return ( {(loadingScheme) => ( )} ) ``` ### Change Status To change the status, set the `status` to `"info"` or `"success"` etc. ```tsx const notice = useNotice() return ( {(status) => ( )} ) ``` ### Change Limit To change the limit, set the `limit` to a number. ```tsx const notice = useNotice({ limit: 10 }) return ( ) ``` ### Change Duration To change the duration, set the `duration` to a number. ```tsx const notice = useNotice({ duration: 10000 }) return ( ) ``` ### Keep Stay To keep the notice staying, set the `duration` to `null`. ```tsx const notice = useNotice({ duration: null }) return ( ) ``` ### Change Placement To change the placement, set the `placement` to `"start"` or `"end"` etc. ```tsx const notice = useNotice({ duration: null }) return ( {(placement) => ( )} ) ``` ### Change Close Strategy To change the close strategy, set the `closeStrategy` to `"click"` or `"drag"` etc. ```tsx const notice = useNotice() return ( {(closeStrategy) => ( )} {(closeStrategy) => ( )} ) ``` ### Close Notice To close the notice, use `close` or `closeAll`. ```tsx const notice = useNotice() const id = useRef(null) const onOpen = () => { id.current = notice({ closable: true, description: "お前が好きだ。", duration: 30000, title: "クラン・クラン", }) } const onClose = () => { if (id.current) notice.close(id.current) } const onCloseAll = () => { notice.closeAll() } return ( ) ``` ### Update Notice To update the notice, use `update`. ```tsx const notice = useNotice() const id = useRef(null) const onOpen = () => { id.current = notice({ colorScheme: "orange", description: "チャンスは目の前にあるものよ。", duration: 5000, title: "シェリル・ノーム", }) } const onUpdate = () => { if (id.current) notice.update(id.current, { colorScheme: "blue", description: "人生はワン・ツー・デカルチャー!!頑張れ、私。", duration: 5000, title: "ランカ・リー", }) } return ( ) ``` ## Configuration ### Make Notice Always Expand To make the notice always expand, set the `expand` to `true`. ```tsx import { UIProvider, extendConfig } from "@yamada-ui/react" const config = extendConfig({ notice: { expand: true, }, }) const App = () => { return ( ) } ``` ### Change Placement To change the placement, set the `placement` to `"start"` or `"end"` etc. ```tsx import { UIProvider, extendConfig } from "@yamada-ui/react" const config = extendConfig({ notice: { placement: "end-end",, }, }) const App = () => { return ( ) } ``` ### Change Limit To change the limit, set the `limit` to a number. ```tsx import { UIProvider, extendConfig } from "@yamada-ui/react" const config = extendConfig({ notice: { limit: 5, }, }) const App = () => { return ( ) } ``` ### Change Close Strategy To change the close strategy, set the `closeStrategy` to `"click"` or `"drag"` etc. ```tsx import { UIProvider, extendConfig } from "@yamada-ui/react" const config = extendConfig({ notice: { closeStrategy: "click", }, }) const App = () => { return ( ) } ``` # useOnline --- title: useOnline description: "`useOnline` is a custom hook that detects whether the browser is online." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/hooks/use-online - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/hooks-useonline--basic --- # useOnline `useOnline` is a custom hook that detects whether the browser is online. ```tsx const online = useOnline() return ( {online ? "Online" : "Offline"} ) ``` ## Usage ```tsx import { useOnline } from "@yamada-ui/react" ``` ```tsx import { useOnline } from "@/components/ui" ``` ```tsx import { useOnline } from "@workspaces/ui" ``` ```tsx const online = useOnline() ``` # useOS --- title: useOS description: "`useOS` is a custom hook that returns the user's OS." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/hooks/use-os - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/hooks-useos--basic --- # useOS `useOS` is a custom hook that returns the user's OS. ```tsx const os = useOS() return Your os is "{os}" ``` ## Usage ```tsx import { useOS } from "@yamada-ui/react" ``` ```tsx import { useOS } from "@/components/ui" ``` ```tsx import { useOS } from "@workspaces/ui" ``` ```tsx const os = useOS() ``` # useOutsideClick --- title: useOutsideClick description: "`useOutsideClick` is a custom hook that detects click events outside of an element." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/hooks/use-outside-click - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/hooks-useoutsideclick--basic --- # useOutsideClick `useOutsideClick` is a custom hook that detects click events outside of an element. ```tsx const ref = useRef(null) const { open, onOpen, onClose } = useDisclosure() useOutsideClick({ ref, handler: onClose, }) return ( <> {open ? (
Hey, Click anywhere outside of me to close.
) : ( )} ) ``` ## Usage ```tsx import { useOutsideClick } from "@yamada-ui/react" ``` ```tsx import { useOutsideClick } from "@/components/ui" ``` ```tsx import { useOutsideClick } from "@workspaces/ui" ``` ```tsx const { open, onOpen, onClose } = useDisclosure() useOutsideClick({ ref, handler: onClose, }) ``` ## Used By Components & Hooks - [Popover](https://yamada-ui.com/docs/components/popover.md): `Popover` is a component that floats around an element to display information. - [Tooltip](https://yamada-ui.com/docs/components/tooltip.md): `Tooltip` is a component that displays short information, such as supplementary details for an element. # usePrevious --- title: usePrevious description: "`usePrevious` is a custom hook for obtaining the previous value." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/hooks/use-previous - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/hooks-useprevious--basic --- # usePrevious `usePrevious` is a custom hook for obtaining the previous value. ```tsx const [flg, { toggle }] = useBoolean() const prevFlg = usePrevious(flg) return ( state: {String(flg)}, prev: {String(prevFlg)} ) ``` ## Usage ```tsx import { usePrevious } from "@yamada-ui/react" ``` ```tsx import { usePrevious } from "@/components/ui" ``` ```tsx import { usePrevious } from "@workspaces/ui" ``` ```tsx const [flg, { toggle }] = useBoolean() const prevFlg = usePrevious(flg) ``` # useProcessing --- title: useProcessing description: "`useProcessing` is a custom hook for handling processing states." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/hooks/use-processing - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/hooks-useprocessing--basic --- # useProcessing `useProcessing` is a custom hook for handling processing states. ```tsx const { loading, start, finish } = useProcessing() const onClick = () => { start() setTimeout(() => finish(), 3000) } return ( ) ``` ## Usage ```tsx import { useProcessing } from "@yamada-ui/react" ``` ```tsx import { useProcessing } from "@/components/ui" ``` ```tsx import { useProcessing } from "@workspaces/ui" ``` ```tsx const { loading, start, finish } = useProcessing() ``` ## Uses Components & Hooks - [useBoolean](https://yamada-ui.com/docs/hooks/use-boolean.md): `useBoolean` is a custom hook used to manage boolean values using `on`, `off`, and `toggle` functions. ## Used By Components & Hooks - [useAsyncCallback](https://yamada-ui.com/docs/hooks/use-async-callback.md): `useAsyncCallback` is a custom hook for managing asynchronous callbacks. # usePromiseDisclosure --- title: usePromiseDisclosure description: "`usePromiseDisclosure` is a custom hook that helps handle common open/close or toggle scenarios with promises. It can be used to control components such as `Modal`, `Dialog`, `Drawer`, etc." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/hooks/use-disclosure - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/hooks-usepromisedisclosure--basic --- # usePromiseDisclosure `usePromiseDisclosure` is a custom hook that helps handle common open/close or toggle scenarios with promises. It can be used to control components such as `Modal`, `Dialog`, `Drawer`, etc. ```tsx const { open, onClose, onOpen, onSuccess } = usePromiseDisclosure() const onClick = async () => { try { await onOpen() console.log("やるじゃねえか、サタン!!!") console.log("おめえはホントに世界の…") console.log("救世主かもな!!!!") } catch { console.error("地球は滅亡しました") } } return ( だ…大地よ海よ そして生きているすべての みんな… このオラにほんのちょっとずつだけ元気をわけてくれ…!!! き、きさまらいいかげんにしろーーーっ!!! さっさと協力しないかーーーっ!!! このミスター・サタンさまのたのみも、きけんというのかーーーっ!!! } cancel="わけない" open={open} success="わける" title="ミスター・サタン" onCancel={onClose} onClose={onClose} onSuccess={onSuccess} /> ) ``` ## Usage ```tsx import { usePromiseDisclosure } from "@yamada-ui/react" ``` ```tsx import { usePromiseDisclosure } from "@/components/ui" ``` ```tsx import { usePromiseDisclosure } from "@workspaces/ui" ``` ```tsx const { open, onClose, onOpen, onSuccess } = usePromiseDisclosure() ``` # useResizeObserver --- title: useResizeObserver description: "`useResizeObserver` is a custom hook that tracks changes in the size and position of an element." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/hooks/use-resize-observer - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/hooks-useresizeobserver--basic --- # useResizeObserver `useResizeObserver` is a custom hook that tracks changes in the size and position of an element. ```tsx const [flg, { toggle }] = useBoolean() const [ref, rect] = useResizeObserver() return ( {JSON.stringify(rect)}
Click me
) ``` ## Usage ```tsx import { useResizeObserver } from "@yamada-ui/react" ``` ```tsx import { useResizeObserver } from "@/components/ui" ``` ```tsx import { useResizeObserver } from "@workspaces/ui" ``` ```tsx const [ref, rect] = useResizeObserver() ``` # useTheme --- title: useTheme description: "`useTheme` is a custom hook that returns a function for retrieving and switching themes." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/core/system - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/hooks-usetheme--basic --- # useTheme `useTheme` is a custom hook that returns a function for retrieving and switching themes. ```tsx const { theme } = useTheme() return {JSON.stringify(theme)} ``` ## Usage ```tsx import { useTheme } from "@yamada-ui/react" ``` ```tsx import { useTheme } from "@/components/ui" ``` ```tsx import { useTheme } from "@workspaces/ui" ``` ```tsx const { themeScheme, changeThemeScheme } = useTheme() ``` :::note For more information about themes, please see [here](https://yamada-ui.com/docs/theming.md). ::: ### Switching Themes ```tsx const { themeScheme, changeThemeScheme } = useTheme() return ( The current scheme is "{themeScheme}" Primary Secondary Primary Secondary ) ``` :::warning In order to switch themes, you need to prepare multiple themes. For more details, please check [here](https://yamada-ui.com/docs/theming/switching-themes.md). ::: # useTimeout --- title: useTimeout description: "`useTimeout` is a custom hook that executes a function after a specified number of milliseconds." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/hooks/use-timeout - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/hooks-usetimeout--basic --- # useTimeout `useTimeout` is a custom hook that executes a function after a specified number of milliseconds. ```tsx const [state, setState] = useState(1) useTimeout(() => setState((prev) => prev + 1), 3000) return Current state: {state} ``` ## Usage ```tsx import { useTimeout } from "@yamada-ui/react" ``` ```tsx import { useTimeout } from "@/components/ui" ``` ```tsx import { useTimeout } from "@workspaces/ui" ``` ```tsx const [state, setState] = useState(1) useTimeout(() => setState((prev) => prev + 1), 3000) ``` ## Used By Components & Hooks - [Loading](https://yamada-ui.com/docs/components/loading.md): `Loading` is a component displayed during waiting times, such as when data is being loaded. - [Snacks](https://yamada-ui.com/docs/components/snacks.md): `Snacks` is a component for controlling notifications used in forms and other similar situations. # useUpdateBreakpointEffect --- title: useUpdateBreakpointEffect description: "`useUpdateBreakpointEffect` is a custom hook that skips the side effect on the initial render and executes a specific callback function when the breakpoint changes." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/hooks/use-breakpoint - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/hooks-useupdatebreakpointeffect--basic --- # useUpdateBreakpointEffect `useUpdateBreakpointEffect` is a custom hook that skips the side effect on the initial render and executes a specific callback function when the breakpoint changes. ```tsx const [device, setDevice] = useState("unknown"); useUpdateBreakpointEffect(breakpoint => { if (breakpoint === "sm") { setDevice("mobile"); } else if (breakpoint === "md") { setDevice("tablet"); } else { setDevice("desktop"); } }, []); return The current device is "{device}"
; ``` ## Usage ```tsx import { useUpdateBreakpointEffect } from "@yamada-ui/react" ``` ```tsx import { useUpdateBreakpointEffect } from "@/components/ui" ``` ```tsx import { useUpdateBreakpointEffect } from "@workspaces/ui" ``` ```tsx const [device, setDevice] = useState("unknown") useUpdateBreakpointEffect((breakpoint) => { if (breakpoint === "sm") { setDevice("mobile") } else if (breakpoint === "md") { setDevice("tablet") } else { setDevice("desktop") } }, []) ``` # useUpdateEffect --- title: useUpdateEffect description: "`useUpdateEffect` is a custom hook that skips side effects on the initial render, and only runs them when the dependency array changes." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/utils - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/hooks-useupdateeffect--basic --- # useUpdateEffect `useUpdateEffect` is a custom hook that skips side effects on the initial render, and only runs them when the dependency array changes. ```tsx const [state, setState] = useState(1) const [updateState, setUpdateState] = useState(1) const [flg, { toggle }] = useBoolean() useEffect(() => { setState((prev) => prev + 1) }, [flg]) useUpdateEffect(() => { setUpdateState((prev) => prev + 1) }, [flg]) return ( state changed by useEffect: {String(state)} state changed by useUpdateEffect: {String(updateState)} ) ``` ## Usage ```tsx import { useUpdateEffect } from "@yamada-ui/react" ``` ```tsx import { useUpdateEffect } from "@/components/ui" ``` ```tsx import { useUpdateEffect } from "@workspaces/ui" ``` ```tsx useUpdateEffect(() => {}, []) ``` # useValue --- title: useValue description: "`useValue` is a custom hook that combines `useBreakpointValue` and `useColorModeValue`." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/hooks/use-value - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/hooks-usevalue--basic --- # useValue `useValue` is a custom hook that combines `useBreakpointValue` and `useColorModeValue`. ```tsx const breakpoint = useBreakpoint() const color = useValue({ base: "red", md: "green" }) return The current breakpoint is "{breakpoint}" ``` ```tsx const { colorMode } = useColorMode() const color = useValue(["green", "red"]) return The current colorMode is "{colorMode}" ``` ## Usage ```tsx import { useValue } from "@yamada-ui/react" ``` ```tsx import { useValue } from "@/components/ui" ``` ```tsx import { useValue } from "@workspaces/ui" ``` ```tsx const color = useValue({ base: "red", md: "green" }) ``` :::note `useValue` is using [useBreakpointValue](https://yamada-ui.com/hooks/use-breakpoint-value.md) and [useColorModeValue](https://yamada-ui.com/hooks/use-color-mode-value.md). ::: ## Uses Components & Hooks - [useBreakpoint](https://yamada-ui.com/docs/hooks/use-breakpoint.md): `useBreakpoint` is a custom hook that returns the current breakpoint. This hook monitors changes in the window size and returns the appropriate value. ## Used By Components & Hooks - [ActionBar](https://yamada-ui.com/docs/components/action-bar.md): `ActionBar` is a component that is used to display a bottom action bar with a set of actions. - [AlphaSlider](https://yamada-ui.com/docs/components/alpha-slider.md): `AlphaSlider` is a component used to allow the user to select color transparency. - [Drawer](https://yamada-ui.com/docs/components/drawer.md): `Drawer` is a component for a panel that appears from the edge of the screen. - [Group](https://yamada-ui.com/docs/components/group.md): `Group` is a component that groups and attaches multiple elements together. - [HueSlider](https://yamada-ui.com/docs/components/hue-slider.md): `HueSlider` is a component used to allow the user to select a color hue. - [InfiniteScrollArea](https://yamada-ui.com/docs/components/infinite-scroll-area.md): `InfiniteScrollArea` is a component that provides infinite scrolling functionality. This component offers a smooth scrolling experience by automatically loading and displaying the next dataset when the end of the component is reached. - [Modal](https://yamada-ui.com/docs/components/modal.md): `Modal` is a component that is displayed over the main content to focus the user's attention solely on the information. - [Popover](https://yamada-ui.com/docs/components/popover.md): `Popover` is a component that floats around an element to display information. - [Reorder](https://yamada-ui.com/docs/components/reorder.md): `Reorder` is a component that allows you to change the order of items using drag and drop. - [Resizable](https://yamada-ui.com/docs/components/resizable.md): `Resizable` is accessible resizable panel groups and layouts with keyboard support. - [SegmentedControl](https://yamada-ui.com/docs/components/segmented-control.md): `SegmentedControl` is a component used for allowing users to select one option from multiple choices. - [Sidebar](https://yamada-ui.com/docs/components/sidebar.md): `Sidebar` is a component used to display a list of items in a sidebar. - [Slide](https://yamada-ui.com/docs/components/slide.md): `Slide` is a component that shows or hides an element from the corners of the page. - [Slider](https://yamada-ui.com/docs/components/slider.md): `Slider` is a component used for allowing users to select a value from a range. - [Steps](https://yamada-ui.com/docs/components/steps.md): `Steps` is a component that displays the progress of a multi-step process. - [Tabs](https://yamada-ui.com/docs/components/tabs.md): `Tabs` is a component for switching between different display areas. - [Timeline](https://yamada-ui.com/docs/components/timeline.md): `Timeline` is a component that is used to display a list of events in chronological order. # useWindowEvent --- title: useWindowEvent description: "`useWindowEvent` is a custom hook that assigns an event listener to `window`." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/hooks/use-window-event - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/hooks-usewindowevent--basic --- # useWindowEvent `useWindowEvent` is a custom hook that assigns an event listener to `window`. ```tsx const [count, setCount] = useState(0) useWindowEvent("click", () => { setCount((prev) => prev + 1) }) return Click count: {count} ``` ## Usage ```tsx import { useWindowEvent } from "@yamada-ui/react" ``` ```tsx import { useWindowEvent } from "@/components/ui" ``` ```tsx import { useWindowEvent } from "@workspaces/ui" ``` ```tsx const [count, setCount] = useState(0) useWindowEvent("click", () => { setCount((prev) => prev + 1) }) ``` ## Used By Components & Hooks - [Sidebar](https://yamada-ui.com/docs/components/sidebar.md): `Sidebar` is a component used to display a list of items in a sidebar. - [useLocalStorage](https://yamada-ui.com/docs/hooks/use-local-storage.md): `useLocalStorage` is a custom hook for storing, updating, and retrieving values in local storage. # Animation --- title: Animation description: "Yamada UI provides features to easily achieve the animation you want." --- # Animation Yamada UI provides features to easily achieve the animation you want. ## Usage ```tsx Box ``` You can also use [theme](https://yamada-ui.com/docs/theming.md) [keyframes](https://yamada-ui.com/docs/theming/tokens/keyframes.md) to apply common keyframes throughout your application. Using `animationName` or `_keyframes` is recommended. ```tsx Box ``` ### Use Theme Tokens To use [theme](https://yamada-ui.com/docs/theming.md) [animations](https://yamada-ui.com/docs/theming/tokens/animations.md), set the `animation` property. ```tsx Box ``` :::warning By default, no animation tokens are defined. ::: ## Components Yamada UI provides components that make animations easier to implement. - [Motion](https://yamada-ui.com/docs/components/motion.md): A convenient component that extends the Yamada UI [Style Props](https://yamada-ui.com/docs/styling/style-props.md) to [Motion](https://motion.dev/). - [Airy](https://yamada-ui.com/docs/components/airy.md): A component that provides an animation that smoothly switches between two elements. - [Collapse](https://yamada-ui.com/docs/components/collapse.md): A component that expands or collapses an element to display it. - [FadeScale](https://yamada-ui.com/docs/components/fade-scale.md): A component that gradually expands or shrinks an element to display or hide it. - [Fade](https://yamada-ui.com/docs/components/fade.md): A component that gradually displays or hides an element. - [Flip](https://yamada-ui.com/docs/components/flip.md): A component that provides an animation that flips between two elements. - [Ripple](https://yamada-ui.com/docs/components/ripple.md): A component that provides a ripple effect to an element to recognize if the user has clicked it. - [Rotate](https://yamada-ui.com/docs/components/rotate.md): A component that provides an animation that rotates between two elements. - [Skeleton](https://yamada-ui.com/docs/components/skeleton.md): A component that functions as a placeholder until the content is loaded. - [SlideFade](https://yamada-ui.com/docs/components/slide-fade.md): A component that gradually displays or hides an element from a specified position. - [Slide](https://yamada-ui.com/docs/components/slide.md): A component that displays or hides an element from the corner of the page. ## Hooks Yamada UI provides convenient custom hooks for animations. - [useAnimation](https://yamada-ui.com/docs/hooks/use-animation.md): A custom hook that implements animations similar to CSS `keyframes`. - [useDynamicAnimation](https://yamada-ui.com/docs/hooks/use-dynamic-animation.md): A custom hook that is used to switch animations. # At-Rules --- title: At-Rules description: "Yamada UI supports CSS at-rules." --- # At-Rules Yamada UI supports CSS at-rules. ## Overview You can configure CSS [at-rules](https://developer.mozilla.org/en-US/docs/Web/CSS/At-rule) by using [Style Props](https://yamada-ui.com/docs/styling/style-props.md). ## @media [@media](https://developer.mozilla.org/en-US/docs/Web/CSS/@media) to apply styles based on specific conditions, use `_media`. ```tsx
Print me
``` `print` and other media types have a convenient shortcut. ```tsx
Print me
``` :::note Available @media are [here](https://yamada-ui.com/docs/styling/style-props.md#at-rules). ::: ### Use multiple queries To use multiple queries, set multiple values in an array. ```tsx Box ``` ### Use arbitrary queries To use arbitrary queries, use `query`. ```tsx Box ``` ## @container [@container](https://developer.mozilla.org/en-US/docs/Web/CSS/@container) to apply styles based on the size or conditions of a specific container, use `_container`. ```tsx
Resize me
``` ### Specify container name ```tsx
Resize me
``` ## @supports [@supports](https://developer.mozilla.org/en-US/docs/Web/CSS/@supports) to apply styles based on conditions, use `_supports`. ```tsx Supported flex ``` ## @keyframes [@keyframes](https://developer.mozilla.org/en-US/docs/Web/CSS/@keyframes) to apply intermediate states of an animation, use `_keyframes`. ```tsx Box ``` :::note Animations have their own documentation. See [Animations](https://yamada-ui.com/docs/styling/animation.md) for more details. ::: ## Arbitrary at-rules To use arbitrary at-rules, use `css`. ```tsx (RULE)": { // Define the style you want to customize. }, }} > Box ``` # Cascade Layers --- title: Cascade Layers description: "CSS Cascade Layers is a feature that manages the order in which CSS rules are applied to elements." --- # Cascade Layers CSS Cascade Layers is a feature that manages the order in which CSS rules are applied to elements. ## Overview Yamada UI uses CSS [Cascade Layers](https://developer.mozilla.org/en-US/docs/Web/CSS/@layer) to set the priority between [themes](https://yamada-ui.com/docs/theming.md) and [Style Props](https://yamada-ui.com/docs/styling/style-props.md). This priority plays an important role in component styling. ## Layer Types The layer types are as follows. - `tokens`: [themes](https://yamada-ui.com/docs/theming.md) tokens. - `reset`: [reset styles](https://yamada-ui.com/docs/styling/reset-styles.md). - `global`: [global styles](https://yamada-ui.com/docs/styling/global-styles.md). - `base`: [base style](https://yamada-ui.com/docs/components/styled.md#base-style) of components. - `size`: [size style](https://yamada-ui.com/docs/components/styled.md#size-style) of components. - `variant`: [variant style](https://yamada-ui.com/docs/components/styled.md#variant-style) of components. - `props`: [props style](https://yamada-ui.com/docs/components/styled.md#props-style) of components. - `compounds`: [compounds style](https://yamada-ui.com/docs/components/styled.md#compounds-style) of components. ## Layer Order The order of the generated layers is as follows. The same property is overridden in order of priority. ```css @layer tokens, reset, global, base, size, variant, props, compounds; ``` :::note [Style Props](https://yamada-ui.com/docs/styling/style-props.md) is always prioritized unless [!important](https://developer.mozilla.org/en-US/docs/Web/CSS/important) is applied because it is not set in the layer. ::: ## Customize ### Generate a Theme Use the [CLI](https://yamada-ui.com/docs/theming/cli.md) to generate a theme. :::warning Before running the following commands, you need to install `@yamada-ui/cli` and execute the `init` command. For more details, please see [here](https://yamada-ui.com/docs/get-started/cli.md). ::: ```bash pnpm yamada-cli theme ``` ```bash npm yamada-cli theme ``` ```bash yarn yamada-cli theme ``` ```bash bun yamada-cli theme ``` ### Change the Config Change the `config.ts` in the generated theme. ```tsx import type { LayersConfig } from "@yamada-ui/react" import { defineConfig } from "@yamada-ui/react" export const layers: LayersConfig = { tokens: { name: "tokens", order: 0 }, reset: { name: "reset", order: 1 }, global: { name: "global", order: 2 }, base: { name: "base", order: 3 }, size: { name: "size", order: 4 }, variant: { name: "variant", order: 5 }, props: { name: "props", order: 6 }, compounds: { name: "compounds", order: 7 }, } export const config = defineConfig({ css: { layers, varPrefix: "ui" }, breakpoint: { direction: "down", identifier: "@media screen" }, defaultColorMode: "dark", defaultThemeScheme: "base", notice: { duration: 5000 }, theme: { responsive: true }, }) ``` ### Update the Provider Set the generated theme to `UIProvider`. ```tsx import { UIProvider } from "@workspaces/ui" import { theme, config } from "@workspace/theme" const App = () => { return ( ) } ``` ## Disable To disable the cascade layers, set `css.layers` to `false`. ```tsx import { defineConfig } from "@yamada-ui/react" export const config = defineConfig({ css: { layers: false, varPrefix: "ui" }, // [!code highlight] breakpoint: { direction: "down", identifier: "@media screen" }, defaultColorMode: "dark", defaultThemeScheme: "base", notice: { duration: 5000 }, theme: { responsive: true }, }) ``` # Color Mode --- title: Color Mode description: "Yamada UI provides features to change styles according to the color mode." --- # Color Mode Yamada UI provides features to change styles according to the color mode. ## Overview Yamada UI has built-in support for managing the application's color mode, allowing you to easily switch between light and dark modes. All provided components also support dark mode. :::info If you want to change the default color mode, please see [here](https://yamada-ui.com/docs/theming/color-mode.md). ::: ## Usage To apply color mode to [Style Props](https://yamada-ui.com/docs/styling/style-props.md), set an array. - Set the value for light mode as the first element. - Set the value for dark mode as the last element. ```tsx This is Box ``` ## Utilities Yamada UI provides useful custom hooks for color mode. - [useColorMode](https://yamada-ui.com/docs/hooks/use-color-mode.md): A custom hook that returns the current color mode. - [useColorModeValue](https://yamada-ui.com/docs/hooks/use-color-mode-value.md): A custom hook that returns the value of the current color mode from the provided values. # Color Scheme --- title: Color Scheme description: "Yamada UI provides features to create and use color contexts according to the color scheme." --- # Color Scheme Yamada UI provides features to create and use color contexts according to the color scheme. ## Overview Color scheme generates color contexts for components based on values. This improves color consistency. When a value is set to the color scheme, the following properties are generated. These values are set in the [semantic tokens](https://yamada-ui.com/docs/theming/tokens/colors.md#semantic-tokens) of the [theme](https://yamada-ui.com/docs/theming.md). - `colorScheme.solid`: The solid color used for background etc. - `colorScheme.bg`: The faint color used for background etc. - `colorScheme.ghost`: The faint color used for background etc. - `colorScheme.fg`: The color used for text etc. - `colorScheme.outline`: The color used for border etc. - `colorScheme.contrast`: The text color used for `colorScheme.solid`. - `colorScheme.subtle`: The color with higher contrast than `colorScheme.bg`. - `colorScheme.muted`: The color with higher contrast than `colorScheme.subtle`. - `colorScheme.emphasized`: The color with higher contrast than `colorScheme.muted`. Also, [tone colors](https://yamada-ui.com/docs/theming/tokens/colors.md#tokens) from `colorScheme.50` to `colorScheme.950` are generated. :::note In Yamada UI, the `colorScheme` is set to `"mono"` for the `body` in the [global styles](https://yamada-ui.com/docs/styling/global-styles.md). If you want to change the `colorScheme` for the entire application, please refer to [customization](https://yamada-ui.com/docs/theming/styles/global-styles.md#customize). ::: ## 使い方 ```tsx Solid Subtle ``` Color scheme inherits the color scheme of the parent element. ```tsx Provided by Parent Child ``` # Conditional Styles --- title: Conditional Styles description: "Yamada UI provides features to apply styles according to conditions." --- # Conditional Styles Yamada UI provides features to apply styles according to conditions. ## Overview By using conditional styles, you can apply styles for [pseudo-elements](https://yamada-ui.com/docs/styling/style-props.md#pseudo-elements), [pseudo-classes](https://yamada-ui.com/docs/styling/style-props.md#pseudo-classes), and [selectors](https://yamada-ui.com/docs/styling/style-props.md#selectors). ## Pseudo Elements To apply styles to the `::before` pseudo-element, use `_before`. ```tsx Box ``` :::note Available pseudo-elements are [here](https://yamada-ui.com/docs/styling/style-props.md#pseudo-elements). ::: ## Pseudo Classes To apply styles to the `:hover` pseudo-class, use `_hover`. ```tsx Hover me ``` You can also apply multiple values together. ```tsx Hover me ``` You can also combine multiple conditions. ```tsx Hover and focus me ``` :::note Available pseudo-classes are [here](https://yamada-ui.com/docs/styling/style-props.md#pseudo-classes). ::: ## Selectors To apply styles based on the `data-orientation` attribute, use `_horizontal` or `_vertical`. ```tsx horizontal ``` :::note Available selectors are [here](https://yamada-ui.com/docs/styling/style-props.md#selectors). ::: ### Group Selectors To apply styles to an element based on the state or attribute of the parent element, add the `"group"` or `"data-group"` role to the parent element and use the `_group*` conditional styles for the child elements. ```tsx Hover me ``` :::note Available group selectors are [here](https://yamada-ui.com/docs/styling/style-props.md#selectors). ::: ### Peer Selectors To apply styles to an element based on the state or attribute of the peer element, add the `data-peer` to the peer element and use the `_peer*` conditional styles. ```tsx
Focus the peer
Focus me!
``` :::note Available peer selectors are [here](https://yamada-ui.com/docs/styling/style-props.md#selectors). ::: ### Any Selectors To use any selectors, use `css` to apply styles. ```tsx Closed ``` # CSS Custom Properties --- title: CSS Custom Properties description: "Yamada UI provides features to easily create and reference CSS custom properties." --- # CSS Custom Properties Yamada UI provides features to easily create and reference CSS custom properties. ## Usage To create a [CSS custom property (variable)](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties), set a property with the `--` prefix in either props or `css`. ```tsx ``` To reference custom properties, use CSS [var](https://developer.mozilla.org/en-US/docs/Web/CSS/var) or `{}` ([interpolation](https://yamada-ui.com/docs/styling/interpolation.md)). ```tsx Box ``` :::warning Custom properties you set will only apply to child elements of the element where they are defined. ::: Additionally, custom properties can reference [theme](https://yamada-ui.com/docs/theming.md) tokens. ```tsx Box ``` # CSS Value Functions --- title: CSS Value Functions description: "Yamada UI provides various functions that make CSS value functions more convenient." --- # CSS Value Functions Yamada UI provides various functions that make CSS value functions more convenient. :::note Function arguments can reference tokens from the [theme](https://yamada-ui.com/docs/theming.md). ::: ## Calculation & Comparison Yamada UI provides functions that make CSS calculation and comparison functions more convenient. ### calc You can use CSS's [calc](https://developer.mozilla.org/en-US/docs/Web/CSS/calc) to reference and calculate tokens from the [theme](https://yamada-ui.com/docs/theming.md). ```tsx
Calc
``` ```tsx
Use interpolated token
``` :::warning If the token name is a number, such as the [spaces](https://yamada-ui.com/docs/theming/tokens/spaces.md) tokens in the [theme](https://yamada-ui.com/docs/theming.md), reference it using `{}` (see [interpolation](https://yamada-ui.com/docs/styling/interpolation.md)). ::: ### min Use CSS's [min](https://developer.mozilla.org/en-US/docs/Web/CSS/min) to set the smallest value from the given arguments. If there is only one argument, a second value of `"100%"` is set. ```tsx
Min
Omitted Min
``` ### max Use CSS's [max](https://developer.mozilla.org/en-US/docs/Web/CSS/max) to set the largest value from the given arguments. If there is only one argument, a second value of `"100%"` is set. ```tsx
Max
Omitted Max
``` ### clamp Use CSS's [clamp](https://developer.mozilla.org/en-US/docs/Web/CSS/clamp) to constrain a value between an upper and lower bound. If there are two arguments, a recommended value of `"100%"` is set. ```tsx
Clamp
Omitted Clamp
``` ## Color Yamada UI provides functions that easily mix colors together, lighten, and darken colors. ### mix Use CSS's [color-mix](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/color-mix) to mix colors together. You can specify two or three arguments. The [method](https://developer.mozilla.org/en-US/docs/Web/CSS/color-interpolation-method) can be omitted, and the default is `in srgb`. ```tsx
"in srgb" + "red.500" + "blue.500"
``` You can change the ratio by specifying a percentage. ```tsx
"in lab" + "orange.500 80%" + "purple.500 20%"
``` :::warning Make sure the percentages add up to `100%`. ::: ### tint Use [mix](#mix) to lighten a color by mixing it with `#FFFFFF`. ```tsx
Tint color
``` ### shade Use [mix](#mix) to darken a color by mixing it with `#000000`. ```tsx
Shade color
``` ### transparentize Use [mix](#mix) to make a color transparent by mixing it with `transparent`. A shorthand notation like `bg="red.500 / 50"` is also available. ```tsx
Transparentize color
``` ### tone Use [mix](#mix) to create a color based on a specified color and tone. ```tsx preview {TONES.map((tone) => (
Tone {tone}
))}
``` ## Gradient Yamada UI provides functions that easily create gradients. To add a gradient, set functions and values to `bgGradient`. - `linear(, , )` - `radial(, )` You can also use other CSS gradient functions like `repeating-linear` or `conic`. Shortcuts are available for ``. ```ts { 'to-t': 'to top', 'to-tr': 'to top right', 'to-r': 'to right', 'to-br': 'to bottom right', 'to-b': 'to bottom', 'to-bl': 'to bottom left', 'to-l': 'to left', 'to-tl': 'to top left', } ``` ```tsx ``` ### Customize Colors You can use both theme [tokens](https://yamada-ui.com/docs/theming/tokens/colors.md) and [CSS color values](https://developer.mozilla.org/en-US/docs/Web/CSS/color). ```tsx ``` ### Text Gradient To add a gradient to text, set `bgGradient` and `bgClip` to `text`. ```tsx クリリンのことか……クリリンのことかーーーっ!!!!! ``` # Focus Ring --- title: Focus Ring description: "Yamada UI provides features to apply various styles when an element is focused." --- # Focus Ring Yamada UI provides features to apply various styles when an element is focused. ## Overview A focus ring is used to identify the element that is currently focused. Yamada UI provides `focusRing` and `focusVisibleRing` to easily configure the style of the focus ring. ## Usage ### focusRing `focusRing` is applied to `&:is(:focus, [data-focus])`. ```tsx ``` ### focusVisibleRing `focusVisibleRing` is applied to `&:is(:focus-visible, [data-focus-visible])`. ```tsx ``` :::note By default, Yamada UI sets `focusVisibleRing="outline"` for all elements via [global styles](https://yamada-ui.com/docs/styling/global-styles.md). Therefore, you do not need to set `focusVisibleRing` individually for each element. ::: ## Customize ### Change Variant ```tsx {(value, index) => ( )} ``` ### Change Color To change the color, set a value to `focusRingColor`. ```tsx ``` ### Change Width To change the width, set a value to `focusRingWidth`. ```tsx ``` ### Change Style To change the style, set a value to `focusRingStyle`. ```tsx ``` ### Change Offset To change the offset, set a value to `focusRingOffset`. ```tsx ``` # Global Styles --- title: Global Styles description: "Yamada UI provides features to customize and add global styles." --- # Global Styles Yamada UI provides features to customize and add global styles. ## Overview Global styles are styles that are applied to the entire application. The styles defined in the theme are [here](https://github.com/yamada-ui/yamada-ui/blob/main/packages/react/src/theme/styles/global-style.ts). ```tsx export const globalStyle = defineStyles.globalStyle({ "*, *::before, *::after": { borderColor: "border", borderStyle: "solid", borderWidth: "0", focusVisibleRing: "outline", fontFeatureSettings: '"cv11"', overflowWrap: "break-word", }, "*::placeholder, *[data-placeholder]": { color: "fg.subtle", }, body: { colorScheme: "mono", bg: "bg", color: "fg", fontFamily: "body", lineHeight: "moderate", overflowX: "hidden", transitionDuration: "moderate", transitionProperty: "background-color", }, }) ``` ## Customize ### Generate a Theme Use the [CLI](https://yamada-ui.com/docs/theming/cli.md) to generate a theme. :::warning Before running the following commands, you need to install `@yamada-ui/cli` and execute the `init` command. For more details, please see [here](https://yamada-ui.com/docs/get-started/cli.md). ::: ```bash pnpm yamada-cli theme ``` ```bash npm yamada-cli theme ``` ```bash yarn yamada-cli theme ``` ```bash bun yamada-cli theme ``` ### Change the Style Change the `styles/global-style.ts` in the generated theme. ```tsx import { defineStyles } from "@yamada-ui/react" export const globalStyle = defineStyles.globalStyle({ "*, *::before, *::after": { borderColor: "border", borderStyle: "solid", borderWidth: "0", focusVisibleRing: "outline", fontFeatureSettings: '"cv11"', overflowWrap: "break-word", }, "*::placeholder, *[data-placeholder]": { color: "fg.subtle", }, body: { colorScheme: "blue", // [!code highlight] bg: "bg", color: "fg", fontFamily: "body", lineHeight: "moderate", overflowX: "hidden", transitionDuration: "moderate", transitionProperty: "background-color", }, }) ``` ### Update the Provider Set the generated theme to `UIProvider`. ```tsx import { UIProvider } from "@workspaces/ui" import { theme } from "@workspace/theme" const App = () => { return ( ) } ``` # Styling --- title: Styling description: "All components are designed to be styled using props." --- # Styling All components are designed to be styled using props. ## Overview The list of major concepts provided by the library is as follows. - [Style Props](https://yamada-ui.com/docs/styling/style-props.md) - [Conditional Styles](https://yamada-ui.com/docs/styling/conditional-styles.md) - [Responsive Design](https://yamada-ui.com/docs/styling/responsive-design.md) - [Color Mode](https://yamada-ui.com/docs/styling/color-mode.md) - [Color Scheme](https://yamada-ui.com/docs/styling/color-scheme.md) - [CSS Value Functions](https://yamada-ui.com/docs/styling/css-value-functions.md) - [Interpolation](https://yamada-ui.com/docs/styling/interpolation.md) - [Animation](https://yamada-ui.com/docs/styling/animation.md) - [Focus Ring](https://yamada-ui.com/docs/styling/focus-ring.md) - [Global Styles](https://yamada-ui.com/docs/styling/global-styles.md) - [Reset Styles](https://yamada-ui.com/docs/styling/reset-styles.md) - [Layer Styles](https://yamada-ui.com/docs/styling/layer-styles.md) - [Text Styles](https://yamada-ui.com/docs/styling/text-styles.md) - [At-Rules](https://yamada-ui.com/docs/styling/at-rules.md) - [Cascade Layers](https://yamada-ui.com/docs/styling/cascade-layers.md) ## Usage [Style Props](https://yamada-ui.com/docs/styling/style-props.md) allow you to apply styles to elements using props. Style Props conform to the [CSS properties](https://developer.mozilla.org/en-US/docs/Web/CSS/Properties) and provide all properties in camelCase. ```tsx Box ``` :::note [Style Props](https://yamada-ui.com/docs/styling/style-props.md) uses [@mdn/browser-compat-data](https://github.com/mdn/browser-compat-data). When the library is updated, Style Props is also updated periodically. ::: # Interpolation --- title: Interpolation description: "Yamada UI provides a feature for easily accessing CSS custom properties (variables) or tokens from the theme." --- # Interpolation Yamada UI provides a feature for easily accessing CSS custom properties (variables) or tokens from the theme. ## Overview Interpolation is a feature for referencing [CSS custom properties (variables)](https://yamada-ui.com/docs/styling/css-custom-properties.md) or tokens from the [theme](https://yamada-ui.com/docs/theming.md). ## Usage You can reference the property name set with [CSS custom properties (variables)](https://yamada-ui.com/docs/styling/css-custom-properties.md) using `{custom-property-name}`. ```tsx Box ``` ### Reference Theme Tokens Yamada UI [Style Props](https://yamada-ui.com/docs/styling/style-props.md) only reference the corresponding tokens from the [theme](https://yamada-ui.com/docs/theming.md). For example, `borderRadius` references tokens from `radii`, but not from `spaces`. By using `{}`, you can reference tokens outside of the corresponding ones. ```tsx Box Box ``` Additionally, by using `{}` within strings, you can reference tokens from the [theme](https://yamada-ui.com/docs/theming.md). This is useful for [shorthand properties](https://developer.mozilla.org/en-US/docs/Web/CSS/Shorthand_properties) such as [border](https://developer.mozilla.org/en-US/docs/Web/CSS/border). ```tsx Box ``` # Layer Styles --- title: Layer Styles description: "Yamada UI provides features to create reusable styles." --- # Layer Styles Yamada UI provides features to create reusable styles. ## Overview Layer styles are tokens that are used to reuse visual styles across the project. The styles defined in the theme are [here](https://github.com/yamada-ui/yamada-ui/blob/main/packages/react/src/theme/styles/layer-styles.ts). ```tsx preview {(token, index) => ( {toTitleCase(token)} )} ``` ```tsx export const layerStyles = defineStyles.layerStyle({ active: { opacity: 1 }, disabled: { cursor: "not-allowed", opacity: 0.4, _ripple: { display: "none" }, }, ghost: { bg: "transparent", border: "1px solid transparent", color: "colorScheme.outline", }, "ghost.hover": { bg: "colorScheme.ghost", }, hover: { opacity: 0.8 }, outline: { bg: "transparent", border: "1px solid {colorScheme.muted}", color: "colorScheme.outline", }, "outline.hover": { bg: "colorScheme.ghost", }, panel: { bg: "bg.panel", borderColor: "border", borderWidth: "1px", }, readOnly: { cursor: "default", _ripple: { display: "none" }, }, solid: { bg: "colorScheme.solid", border: "1px solid transparent", color: "colorScheme.contrast", }, "solid.hover": { bg: "colorScheme.solid/80", }, subtle: { bg: "colorScheme.subtle", border: "1px solid transparent", color: "colorScheme.fg", }, "subtle.hover": { bg: "colorScheme.muted", }, surface: { bg: "colorScheme.subtle", border: "1px solid {colorScheme.muted}", color: "colorScheme.fg", }, "surface.hover": { bg: "colorScheme.muted", }, visuallyHidden: visuallyHiddenAttributes.style, }) ``` ## Customize ### Generate a Theme Use the [CLI](https://yamada-ui.com/docs/theming/cli.md) to generate a theme. :::warning Before running the following commands, you need to install `@yamada-ui/cli` and execute the `init` command. For more details, please see [here](https://yamada-ui.com/docs/get-started/cli.md). ::: ```bash pnpm yamada-cli theme ``` ```bash npm yamada-cli theme ``` ```bash yarn yamada-cli theme ``` ```bash bun yamada-cli theme ``` ### Change the Style Change the `styles/layer-styles.ts` in the generated theme. ```tsx import { defineStyles, visuallyHiddenAttributes } from "@yamada-ui/react" export const layerStyles = defineStyles.layerStyle({ dim: { opacity: 0.6 }, // [!code highlight] active: { opacity: 1 }, disabled: { cursor: "not-allowed", opacity: 0.4, _ripple: { display: "none" }, }, ghost: { bg: "transparent", border: "1px solid transparent", color: "colorScheme.outline", }, "ghost.hover": { bg: "colorScheme.ghost", }, hover: { opacity: 0.8 }, outline: { bg: "transparent", border: "1px solid {colorScheme.muted}", color: "colorScheme.outline", }, "outline.hover": { bg: "colorScheme.ghost", }, panel: { bg: "bg.panel", borderColor: "border", borderWidth: "1px", }, readOnly: { cursor: "default", _ripple: { display: "none" }, }, solid: { bg: "colorScheme.solid", border: "1px solid transparent", color: "colorScheme.contrast", }, "solid.hover": { bg: "colorScheme.solid/80", }, subtle: { bg: "colorScheme.subtle", border: "1px solid transparent", color: "colorScheme.fg", }, "subtle.hover": { bg: "colorScheme.muted", }, surface: { bg: "colorScheme.subtle", border: "1px solid {colorScheme.muted}", color: "colorScheme.fg", }, "surface.hover": { bg: "colorScheme.muted", }, visuallyHidden: visuallyHiddenAttributes.style, }) ``` ### Update the Provider Set the generated theme to `UIProvider`. ```tsx import { UIProvider } from "@workspaces/ui" import { theme } from "@workspace/theme" const App = () => { return ( ) } ``` ### Use Layer Style Set the value to `layerStyle`. ```tsx ``` # Reset Styles --- title: Reset Styles description: "Yamada UI provides features to customize and add reset styles." --- # Reset Styles Yamada UI provides features to customize and add reset styles. ## Overview Reset styles are styles that are applied to the entire application. The styles defined in the theme are [here](https://github.com/yamada-ui/yamada-ui/blob/main/packages/react/src/theme/styles/reset-style.ts). ```tsx export const resetStyle = defineStyles.resetStyle({ "*, *::before, *::after": { boxSizing: "border-box", margin: 0, padding: 0, }, "::-webkit-file-upload-button": { font: "inherit", WebkitAppearance: "button", }, "::-webkit-search-cancel-button, ::-webkit-search-decoration": { WebkitAppearance: "none", }, "[contenteditable]": { outline: "none", }, "[hidden]:where(:not([hidden='until-found']))": { display: "none !important", }, "[type='time']::-webkit-calendar-picker-indicator": { display: "none", }, a: { color: "inherit", textDecoration: "none", }, "abbr[title]": { textDecoration: "underline dotted", }, "b, strong": { fontWeight: "bolder", }, "button, input, optgroup, select, textarea": { appearance: "none", backgroundColor: "transparent", border: 0, borderRadius: 0, color: "inherit", font: "inherit", fontFeatureSettings: "inherit", fontVariationSettings: "inherit", letterSpacing: "inherit", outline: 0, WebkitAppearance: "none", }, "code, kbd, samp, pre": { fontFamily: "inherit", fontSize: "1em", }, fieldset: { border: 0, minWidth: 0, }, "h1, h2, h3, h4, h5, h6": { fontSize: "inherit", fontWeight: "inherit", }, hr: { blockSize: 0, border: "none", borderBlockStart: "1px solid", color: "inherit", overflow: "visible", }, html: { fontFamily: "system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'", lineHeight: 1.5, WebkitTapHighlightColor: "transparent", WebkitTextSizeAdjust: "100%", }, "img, svg, video, canvas, audio, iframe, embed, object": { display: "block", }, "input[type='number']::-webkit-inner-spin-button, input[type='number']::-webkit-outer-spin-button": { display: "none", }, "input[type='search']": { outlineOffset: "-2px", }, legend: { display: "table", float: "left", width: "100%", }, mark: { backgroundColor: "inherit", color: "inherit", }, progress: { verticalAlign: "baseline", }, small: { fontSize: "80%", }, sub: { bottom: "-0.25em", }, "sub, sup": { fontSize: "75%", lineHeight: 0, position: "relative", verticalAlign: "baseline", }, summary: { display: "list-item", }, sup: { top: "-0.5em", }, "ul, ol": { listStyle: "none", }, "@media (prefers-reduced-motion: no-preference)": { ":where(html:focus-within)": { scrollBehavior: "smooth", }, }, ":where(html:has(dialog:modal[open]))": { overflow: "clip", }, ":where(dialog, [popover])": { background: "none", border: "none", color: "inherit", inset: "unset", maxHeight: "unset", maxWidth: "unset", overflow: "unset", }, ":where(dialog:not([open], [popover]), [popover]:not(:popover-open))": { display: "none !important", }, }) ``` ## Customize ### Generate a Theme Use the [CLI](https://yamada-ui.com/docs/theming/cli.md) to generate a theme. :::warning Before running the following commands, you need to install `@yamada-ui/cli` and execute the `init` command. For more details, please see [here](https://yamada-ui.com/docs/get-started/cli.md). ::: ```bash pnpm yamada-cli theme ``` ```bash npm yamada-cli theme ``` ```bash yarn yamada-cli theme ``` ```bash bun yamada-cli theme ``` ### Change the Style Change the `styles/reset-style.ts` in the generated theme. ```tsx import { defineStyles } from "@yamada-ui/react" export const resetStyle = defineStyles.resetStyle({ "*, *::before, *::after": { boxSizing: "content-box", // [!code highlight] margin: 0, padding: 0, }, "::-webkit-file-upload-button": { font: "inherit", WebkitAppearance: "button", }, "::-webkit-search-cancel-button, ::-webkit-search-decoration": { WebkitAppearance: "none", }, "[contenteditable]": { outline: "none", }, "[hidden]:where(:not([hidden='until-found']))": { display: "none !important", }, "[type='time']::-webkit-calendar-picker-indicator": { display: "none", }, a: { color: "inherit", textDecoration: "none", }, "abbr[title]": { textDecoration: "underline dotted", }, "b, strong": { fontWeight: "bolder", }, "button, input, optgroup, select, textarea": { appearance: "none", backgroundColor: "transparent", border: 0, borderRadius: 0, color: "inherit", font: "inherit", fontFeatureSettings: "inherit", fontVariationSettings: "inherit", letterSpacing: "inherit", outline: 0, WebkitAppearance: "none", }, "code, kbd, samp, pre": { fontFamily: "inherit", fontSize: "1em", }, fieldset: { border: 0, minWidth: 0, }, "h1, h2, h3, h4, h5, h6": { fontSize: "inherit", fontWeight: "inherit", }, hr: { blockSize: 0, border: "none", borderBlockStart: "1px solid", color: "inherit", overflow: "visible", }, html: { fontFamily: "system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'", lineHeight: 1.5, WebkitTapHighlightColor: "transparent", WebkitTextSizeAdjust: "100%", }, "img, svg, video, canvas, audio, iframe, embed, object": { display: "block", }, "input[type='number']::-webkit-inner-spin-button, input[type='number']::-webkit-outer-spin-button": { display: "none", }, "input[type='search']": { outlineOffset: "-2px", }, legend: { display: "table", float: "left", width: "100%", }, mark: { backgroundColor: "inherit", color: "inherit", }, progress: { verticalAlign: "baseline", }, small: { fontSize: "80%", }, sub: { bottom: "-0.25em", }, "sub, sup": { fontSize: "75%", lineHeight: 0, position: "relative", verticalAlign: "baseline", }, summary: { display: "list-item", }, sup: { top: "-0.5em", }, "ul, ol": { listStyle: "none", }, "@media (prefers-reduced-motion: no-preference)": { ":where(html:focus-within)": { scrollBehavior: "smooth", }, }, ":where(html:has(dialog:modal[open]))": { overflow: "clip", }, ":where(dialog, [popover])": { background: "none", border: "none", color: "inherit", inset: "unset", maxHeight: "unset", maxWidth: "unset", overflow: "unset", }, ":where(dialog:not([open], [popover]), [popover]:not(:popover-open))": { display: "none !important", }, }) ``` ### Update the Provider Set the generated theme to `UIProvider`. ```tsx import { UIProvider } from "@workspaces/ui" import { theme } from "@workspace/theme" const App = () => { return ( ) } ``` # Responsive Design --- title: Responsive Design description: "Yamada UI provides features to change styles according to the screen size." --- # Responsive Design Yamada UI provides features to change styles according to the screen size. :::tip By default, responsive design using `@media(max-width)` media queries is adopted. If you want to use `@media(min-width)` media queries, please refer to [here](https://yamada-ui.com/docs/theming/breakpoints.md#media-queries). ::: ## Overview Responsive design refers to the breakpoints defined in the theme. Yamada UI has a Default Theme where [breakpoints](https://yamada-ui.com/docs/theming/tokens/breakpoints.md) are defined. :::note If you want to change the breakpoints, please check theme's [Breakpoints](https://yamada-ui.com/docs/theming/breakpoints.md). ::: ## Usage To set responsive design to [Style Props](https://yamada-ui.com/docs/styling/style-props.md), set an object with the breakpoints as the key. - The keys of the object define the keys set in the theme's [Breakpoints](https://yamada-ui.com/docs/theming/tokens/breakpoints.md). - The values of the object define the values of the styles set by the key. ```tsx Box ``` The above code generates the following CSS: ```css .Box { background: var(--ui-colors-bg-contrast); @media screen and (max-width: 768px) { background: var(--ui-colors-success); } } ``` ## Utilities Yamada UI provides useful custom hooks for building responsive layouts. - [useBreakpoint](https://yamada-ui.com/docs/hooks/use-breakpoint.md): A custom hook that returns the current breakpoint. This hook monitors the window size and returns the appropriate value. - [useBreakpointEffect](https://yamada-ui.com/docs/hooks/use-breakpoint-effect.md): A custom hook that executes a specific callback function when the breakpoint changes. - [useUpdateBreakpointEffect](https://yamada-ui.com/docs/hooks/use-update-breakpoint-effect.md): A custom hook that skips the side effect on the initial render and executes a specific callback function when the breakpoint changes. - [useBreakpointState](https://yamada-ui.com/docs/hooks/use-breakpoint-state.md): A custom hook that returns the current breakpoint from the provided object as the initial value. - [useBreakpointValue](https://yamada-ui.com/docs/hooks/use-breakpoint-value.md): A custom hook that returns the value of the current breakpoint from the provided object. This hook monitors changes in the window size and returns the appropriate value. # Style Props --- title: Style Props description: "Style Props is a feature that allows you to customize the style of a component." --- # Style Props Style Props is a feature that allows you to customize the style of a component. Here's a list of all the Style Props available in the library. | Prop | CSS Property | Theme Token | | ------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | | `accent` | [`accent-color`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/accent-color) | [`colors`](https://yamada-ui.com/docs/theming/tokens/colors.md) | | `accentColor` | [`accent-color`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/accent-color) | [`colors`](https://yamada-ui.com/docs/theming/tokens/colors.md) | | `alignContent` | [`align-content`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/align-content) | - | | `alignItems` | [`align-items`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/align-items) | - | | `alignmentBaseline` | [`alignment-baseline`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/alignment-baseline) | - | | `alignSelf` | [`align-self`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/align-self) | - | | `all` | [`all`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/all) | - | | `anchorName` | [`anchor-name`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/anchor-name) | - | | `anchorScope` | [`anchor-scope`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/anchor-scope) | - | | `animation` | [`animation`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/animation) | [`animations`](https://yamada-ui.com/docs/theming/tokens/animations.md) | | `animationComposition` | [`animation-composition`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/animation-composition) | - | | `animationDelay` | [`animation-delay`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/animation-delay) | - | | `animationDirection` | [`animation-direction`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/animation-direction) | - | | `animationDuration` | [`animation-duration`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/animation-duration) | [`durations`](https://yamada-ui.com/docs/theming/tokens/durations.md) | | `animationFillMode` | [`animation-fill-mode`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/animation-fill-mode) | - | | `animationIterationCount` | [`animation-iteration-count`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/animation-iteration-count) | - | | `animationName` | [`animation-name`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/animation-name) | [`keyframes`](https://yamada-ui.com/docs/theming/tokens/keyframes.md) | | `animationPlayState` | [`animation-play-state`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/animation-play-state) | - | | `animationRange` | [`animation-range`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/animation-range) | - | | `animationRangeEnd` | [`animation-range-end`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/animation-range-end) | - | | `animationRangeStart` | [`animation-range-start`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/animation-range-start) | - | | `animationTimeline` | [`animation-timeline`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/animation-timeline) | - | | `animationTimingFunction` | [`animation-timing-function`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/animation-timing-function) | [`easings`](https://yamada-ui.com/docs/theming/tokens/easings.md) | | `animationTrigger` | [`animation-trigger`](https://drafts.csswg.org/animation-triggers-1/#propdef-animation-trigger) | - | | `appearance` | [`appearance`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/appearance) | - | | `apply` | - | - | | `aspectRatio` | [`aspect-ratio`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/aspect-ratio) | [`aspectRatios`](https://yamada-ui.com/docs/theming/tokens/aspect-ratios.md) | | `backdropBlur` | `--backdrop-blur` | [`blurs`](https://yamada-ui.com/docs/theming/tokens/blurs.md) | | `backdropBrightness` | `--backdrop-brightness` | - | | `backdropContrast` | `--backdrop-contrast` | - | | `backdropDropShadow` | `--backdrop-drop-shadow` | [`shadows`](https://yamada-ui.com/docs/theming/tokens/shadows.md) | | `backdropFilter` | [`backdrop-filter`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/backdrop-filter) | - | | `backdropGrayscale` | `--backdrop-grayscale` | - | | `backdropHueRotate` | `--backdrop-hue-rotate` | - | | `backdropInvert` | `--backdrop-invert` | - | | `backdropSaturate` | `--backdrop-saturate` | - | | `backdropSepia` | `--backdrop-sepia` | - | | `backfaceVisibility` | [`backface-visibility`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/backface-visibility) | [`sizes`](https://yamada-ui.com/docs/theming/tokens/sizes.md) | | `background` | [`background`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/background) | [`colors`](https://yamada-ui.com/docs/theming/tokens/colors.md) | | `backgroundAttachment` | [`background-attachment`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/background-attachment) | - | | `backgroundBlendMode` | [`background-blend-mode`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/background-blend-mode) | - | | `backgroundClip` | [`background-clip`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/background-clip) | - | | `backgroundColor` | [`background-color`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/background-color) | [`colors`](https://yamada-ui.com/docs/theming/tokens/colors.md) | | `backgroundImage` | [`background-image`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/background-image) | [`gradients`](https://yamada-ui.com/docs/theming/tokens/gradients.md) | | `backgroundOrigin` | [`background-origin`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/background-origin) | - | | `backgroundPosition` | [`background-position`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/background-position) | - | | `backgroundPositionX` | [`background-position-x`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/background-position-x) | - | | `backgroundPositionY` | [`background-position-y`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/background-position-y) | - | | `backgroundRepeat` | [`background-repeat`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/background-repeat) | - | | `backgroundRepeatX` | [`background-repeat-x`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/background-repeat-x) | - | | `backgroundRepeatY` | [`background-repeat-y`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/background-repeat-y) | - | | `backgroundSize` | [`background-size`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/background-size) | - | | `baselineShift` | [`baseline-shift`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/baseline-shift) | - | | `baselineSource` | [`baseline-source`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/baseline-source) | - | | `bg` | [`background`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/background) | [`colors`](https://yamada-ui.com/docs/theming/tokens/colors.md) | | `bgAttachment` | [`background-attachment`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/background-attachment) | - | | `bgBlendMode` | [`background-blend-mode`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/background-blend-mode) | - | | `bgClip` | [`background-clip`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/background-clip) | - | | `bgColor` | [`background-color`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/background-color) | [`colors`](https://yamada-ui.com/docs/theming/tokens/colors.md) | | `bgGradient` | [`background-image`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/background-image) | [`gradients`](https://yamada-ui.com/docs/theming/tokens/gradients.md) | | `bgImage` | [`background-image`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/background-image) | [`gradients`](https://yamada-ui.com/docs/theming/tokens/gradients.md) | | `bgImg` | [`background-image`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/background-image) | [`gradients`](https://yamada-ui.com/docs/theming/tokens/gradients.md) | | `bgOrigin` | [`background-origin`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/background-origin) | - | | `bgPosition` | [`background-position`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/background-position) | - | | `bgPositionX` | [`background-position-x`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/background-position-x) | - | | `bgPositionY` | [`background-position-y`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/background-position-y) | - | | `bgPosX` | [`background-position-x`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/background-position-x) | - | | `bgPosY` | [`background-position-y`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/background-position-y) | - | | `bgRepeat` | [`background-repeat`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/background-repeat) | - | | `bgSize` | [`background-size`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/background-size) | - | | `blendMode` | [`mix-blend-mode`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/mix-blend-mode) | - | | `blockSize` | [`block-size`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/block-size) | [`sizes`](https://yamada-ui.com/docs/theming/tokens/sizes.md) | | `blur` | `--blur` | [`blurs`](https://yamada-ui.com/docs/theming/tokens/blurs.md) | | `border` | [`border`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border) | [`borders`](https://yamada-ui.com/docs/theming/tokens/borders.md) | | `borderBlock` | [`border-block`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-block) | [`borders`](https://yamada-ui.com/docs/theming/tokens/borders.md) | | `borderBlockColor` | [`border-block-color`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-block-color) | [`colors`](https://yamada-ui.com/docs/theming/tokens/colors.md) | | `borderBlockEnd` | [`border-block-end`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-block-end) | [`borders`](https://yamada-ui.com/docs/theming/tokens/borders.md) | | `borderBlockEndColor` | [`border-block-end-color`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-block-end-color) | [`colors`](https://yamada-ui.com/docs/theming/tokens/colors.md) | | `borderBlockEndStyle` | [`border-block-end-style`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-block-end-style) | - | | `borderBlockEndWidth` | [`border-block-end-width`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-block-end-width) | - | | `borderBlockStart` | [`border-block-start`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-block-start) | [`borders`](https://yamada-ui.com/docs/theming/tokens/borders.md) | | `borderBlockStartColor` | [`border-block-start-color`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-block-start-color) | [`colors`](https://yamada-ui.com/docs/theming/tokens/colors.md) | | `borderBlockStartStyle` | [`border-block-start-style`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-block-start-style) | - | | `borderBlockStartWidth` | [`border-block-start-width`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-block-start-width) | - | | `borderBlockStyle` | [`border-block-style`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-block-style) | - | | `borderBlockWidth` | [`border-block-width`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-block-width) | - | | `borderBottom` | [`border-bottom`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-bottom) | [`borders`](https://yamada-ui.com/docs/theming/tokens/borders.md) | | `borderBottomColor` | [`border-bottom-color`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-bottom-color) | [`colors`](https://yamada-ui.com/docs/theming/tokens/colors.md) | | `borderBottomEndRadius` | [`border-end-end-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-end-end-radius) | [`radii`](https://yamada-ui.com/docs/theming/tokens/radii.md) | | `borderBottomLeftRadius` | [`border-bottom-left-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-bottom-left-radius) | [`radii`](https://yamada-ui.com/docs/theming/tokens/radii.md) | | `borderBottomRadius` | [`border-bottom-left-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-bottom-left-radius), [`border-bottom-right-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-bottom-right-radius) | [`radii`](https://yamada-ui.com/docs/theming/tokens/radii.md) | | `borderBottomRightRadius` | [`border-bottom-right-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-bottom-right-radius) | [`radii`](https://yamada-ui.com/docs/theming/tokens/radii.md) | | `borderBottomStartRadius` | [`border-end-start-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-end-start-radius) | [`radii`](https://yamada-ui.com/docs/theming/tokens/radii.md) | | `borderBottomStyle` | [`border-bottom-style`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-bottom-style) | - | | `borderBottomWidth` | [`border-bottom-width`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-bottom-width) | - | | `borderCollapse` | [`border-collapse`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-collapse) | - | | `borderColor` | [`border-color`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-color) | [`colors`](https://yamada-ui.com/docs/theming/tokens/colors.md) | | `borderEnd` | [`border-inline-end`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-inline-end) | [`borders`](https://yamada-ui.com/docs/theming/tokens/borders.md) | | `borderEndColor` | [`border-inline-end-color`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-inline-end-color) | [`colors`](https://yamada-ui.com/docs/theming/tokens/colors.md) | | `borderEndEndRadius` | [`border-end-end-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-end-end-radius) | [`radii`](https://yamada-ui.com/docs/theming/tokens/radii.md) | | `borderEndRadius` | [`border-end-start-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-end-start-radius), [`border-end-end-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-end-end-radius) | [`radii`](https://yamada-ui.com/docs/theming/tokens/radii.md) | | `borderEndStartRadius` | [`border-end-start-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-end-start-radius) | [`radii`](https://yamada-ui.com/docs/theming/tokens/radii.md) | | `borderEndStyle` | [`border-inline-end-style`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-inline-end-style) | - | | `borderEndWidth` | [`border-inline-end-width`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-inline-end-width) | - | | `borderImage` | [`border-image`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-image) | [`borders`](https://yamada-ui.com/docs/theming/tokens/borders.md) | | `borderImageOutset` | [`border-image-outset`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-image-outset) | - | | `borderImageRepeat` | [`border-image-repeat`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-image-repeat) | - | | `borderImageSlice` | [`border-image-slice`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-image-slice) | - | | `borderImageSource` | [`border-image-source`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-image-source) | [`gradients`](https://yamada-ui.com/docs/theming/tokens/gradients.md) | | `borderImageWidth` | [`border-image-width`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-image-width) | - | | `borderInline` | [`border-inline`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-inline) | [`borders`](https://yamada-ui.com/docs/theming/tokens/borders.md) | | `borderInlineColor` | [`border-inline-color`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-inline-color) | [`colors`](https://yamada-ui.com/docs/theming/tokens/colors.md) | | `borderInlineEnd` | [`border-inline-end`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-inline-end) | [`borders`](https://yamada-ui.com/docs/theming/tokens/borders.md) | | `borderInlineEndColor` | [`border-inline-end-color`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-inline-end-color) | [`colors`](https://yamada-ui.com/docs/theming/tokens/colors.md) | | `borderInlineEndRadius` | [`border-end-start-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-end-start-radius), [`border-end-end-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-end-end-radius) | [`radii`](https://yamada-ui.com/docs/theming/tokens/radii.md) | | `borderInlineEndStyle` | [`border-inline-end-style`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-inline-end-style) | - | | `borderInlineEndWidth` | [`border-inline-end-width`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-inline-end-width) | - | | `borderInlineStart` | [`border-inline-start`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-inline-start) | [`borders`](https://yamada-ui.com/docs/theming/tokens/borders.md) | | `borderInlineStartColor` | [`border-inline-start-color`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-inline-start-color) | [`colors`](https://yamada-ui.com/docs/theming/tokens/colors.md) | | `borderInlineStartRadius` | [`border-start-start-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-start-start-radius), [`border-start-end-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-start-end-radius) | [`radii`](https://yamada-ui.com/docs/theming/tokens/radii.md) | | `borderInlineStartStyle` | [`border-inline-start-style`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-inline-start-style) | - | | `borderInlineStartWidth` | [`border-inline-start-width`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-inline-start-width) | - | | `borderInlineStyle` | [`border-inline-style`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-inline-style) | - | | `borderInlineWidth` | [`border-inline-width`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-inline-width) | - | | `borderLeft` | [`border-left`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-left) | [`borders`](https://yamada-ui.com/docs/theming/tokens/borders.md) | | `borderLeftColor` | [`border-left-color`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-left-color) | [`colors`](https://yamada-ui.com/docs/theming/tokens/colors.md) | | `borderLeftRadius` | [`border-top-left-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-top-left-radius), [`border-bottom-left-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-bottom-left-radius) | [`radii`](https://yamada-ui.com/docs/theming/tokens/radii.md) | | `borderLeftStyle` | [`border-left-style`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-left-style) | - | | `borderLeftWidth` | [`border-left-width`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-left-width) | - | | `borderRadius` | [`border-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-radius) | [`radii`](https://yamada-ui.com/docs/theming/tokens/radii.md) | | `borderRight` | [`border-right`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-right) | [`borders`](https://yamada-ui.com/docs/theming/tokens/borders.md) | | `borderRightColor` | [`border-right-color`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-right-color) | [`colors`](https://yamada-ui.com/docs/theming/tokens/colors.md) | | `borderRightRadius` | [`border-top-right-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-top-right-radius), [`border-bottom-right-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-bottom-right-radius) | [`radii`](https://yamada-ui.com/docs/theming/tokens/radii.md) | | `borderRightStyle` | [`border-right-style`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-right-style) | - | | `borderRightWidth` | [`border-right-width`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-right-width) | - | | `borderShape` | [`border-shape`](https://drafts.csswg.org/css-borders-4/#border-shape) | - | | `borderSpacing` | [`border-spacing`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-spacing) | - | | `borderStart` | [`border-inline-start`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-inline-start) | [`borders`](https://yamada-ui.com/docs/theming/tokens/borders.md) | | `borderStartColor` | [`border-inline-start-color`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-inline-start-color) | [`colors`](https://yamada-ui.com/docs/theming/tokens/colors.md) | | `borderStartEndRadius` | [`border-start-end-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-start-end-radius) | [`radii`](https://yamada-ui.com/docs/theming/tokens/radii.md) | | `borderStartRadius` | [`border-start-start-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-start-start-radius), [`border-start-end-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-start-end-radius) | [`radii`](https://yamada-ui.com/docs/theming/tokens/radii.md) | | `borderStartStartRadius` | [`border-start-start-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-start-start-radius) | [`radii`](https://yamada-ui.com/docs/theming/tokens/radii.md) | | `borderStartStyle` | [`border-inline-start-style`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-inline-start-style) | - | | `borderStartWidth` | [`border-inline-start-width`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-inline-start-width) | - | | `borderStyle` | [`border-style`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-style) | - | | `borderTop` | [`border-top`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-top) | [`borders`](https://yamada-ui.com/docs/theming/tokens/borders.md) | | `borderTopColor` | [`border-top-color`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-top-color) | [`colors`](https://yamada-ui.com/docs/theming/tokens/colors.md) | | `borderTopEndRadius` | [`border-start-end-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-start-end-radius) | [`radii`](https://yamada-ui.com/docs/theming/tokens/radii.md) | | `borderTopLeftRadius` | [`border-top-left-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-top-left-radius) | [`radii`](https://yamada-ui.com/docs/theming/tokens/radii.md) | | `borderTopRadius` | [`border-top-left-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-top-left-radius), [`border-top-right-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-top-right-radius) | [`radii`](https://yamada-ui.com/docs/theming/tokens/radii.md) | | `borderTopRightRadius` | [`border-top-right-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-top-right-radius) | [`radii`](https://yamada-ui.com/docs/theming/tokens/radii.md) | | `borderTopStartRadius` | [`border-start-start-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-start-start-radius) | [`radii`](https://yamada-ui.com/docs/theming/tokens/radii.md) | | `borderTopStyle` | [`border-top-style`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-top-style) | - | | `borderTopWidth` | [`border-top-width`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-top-width) | - | | `borderWidth` | [`border-width`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-width) | - | | `borderX` | [`border-left`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-left), [`border-right`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-right) | [`borders`](https://yamada-ui.com/docs/theming/tokens/borders.md) | | `borderY` | [`border-top`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-top), [`border-bottom`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-bottom) | [`borders`](https://yamada-ui.com/docs/theming/tokens/borders.md) | | `bottom` | [`bottom`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/bottom) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `boxAlign` | [`box-align`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/box-align) | - | | `boxDecorationBreak` | [`box-decoration-break`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/box-decoration-break) | - | | `boxDirection` | [`box-direction`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/box-direction) | - | | `boxFlex` | [`box-flex`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/box-flex) | - | | `boxFlexGroup` | [`box-flex-group`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/box-flex-group) | - | | `boxLines` | [`box-lines`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/box-lines) | - | | `boxOrdinalGroup` | [`box-ordinal-group`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/box-ordinal-group) | - | | `boxOrient` | [`box-orient`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/box-orient) | - | | `boxPack` | [`box-pack`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/box-pack) | - | | `boxShadow` | [`box-shadow`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/box-shadow) | [`shadows`](https://yamada-ui.com/docs/theming/tokens/shadows.md) | | `boxSize` | [`width`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/width), [`height`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/height) | [`sizes`](https://yamada-ui.com/docs/theming/tokens/sizes.md) | | `boxSizing` | [`box-sizing`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/box-sizing) | - | | `breakAfter` | [`break-after`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/break-after) | - | | `breakBefore` | [`break-before`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/break-before) | - | | `breakInside` | [`break-inside`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/break-inside) | - | | `brightness` | `--brightness` | - | | `bufferedRendering` | `buffered-rendering` | - | | `captionSide` | [`caption-side`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/caption-side) | - | | `caret` | [`caret-color`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/caret-color) | [`colors`](https://yamada-ui.com/docs/theming/tokens/colors.md) | | `caretAnimation` | [`caret-animation`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/caret-animation) | - | | `caretColor` | [`caret-color`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/caret-color) | [`colors`](https://yamada-ui.com/docs/theming/tokens/colors.md) | | `caretShape` | [`caret-shape`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/caret-shape) | - | | `clear` | [`clear`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/clear) | - | | `clip` | [`clip`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/clip) | - | | `clipPath` | [`clip-path`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/clip-path) | - | | `clipRule` | [`clip-rule`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/clip-rule) | - | | `color` | [`color`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/color) | [`colors`](https://yamada-ui.com/docs/theming/tokens/colors.md) | | `colorAdjust` | [`color-adjust`](https://drafts.csswg.org/css-color-adjust-1/#color-adjust) | - | | `colorInterpolation` | [`color-interpolation`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/color-interpolation) | - | | `colorInterpolationFilters` | [`color-interpolation-filters`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/color-interpolation-filters) | - | | `colorMode` | [`color-scheme`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/color-scheme) | - | | `colorRendering` | `color-rendering` | - | | `colorScheme` | - | - | | `columnCount` | [`column-count`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/column-count) | - | | `columnFill` | [`column-fill`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/column-fill) | - | | `columnGap` | [`column-gap`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/column-gap) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `columnHeight` | [`column-height`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/column-height) | - | | `columnRule` | [`column-rule`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/column-rule) | - | | `columnRuleBreak` | [`column-rule-break`](https://drafts.csswg.org/css-gaps-1/#propdef-column-rule-break) | - | | `columnRuleColor` | [`column-rule-color`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/column-rule-color) | [`colors`](https://yamada-ui.com/docs/theming/tokens/colors.md) | | `columnRuleInset` | [`column-rule-inset`](https://drafts.csswg.org/css-gaps-1/#propdef-column-rule-inset) | - | | `columnRuleInsetCap` | [`column-rule-inset-cap`](https://drafts.csswg.org/css-gaps-1/#propdef-column-rule-inset-cap) | - | | `columnRuleInsetCapEnd` | [`column-rule-inset-cap-end`](https://drafts.csswg.org/css-gaps-1/#propdef-column-rule-inset-cap-end) | - | | `columnRuleInsetCapStart` | [`column-rule-inset-cap-start`](https://drafts.csswg.org/css-gaps-1/#propdef-column-rule-inset-cap-start) | - | | `columnRuleInsetEnd` | [`column-rule-inset-end`](https://drafts.csswg.org/css-gaps-1/#propdef-column-rule-inset-end) | - | | `columnRuleInsetJunction` | [`column-rule-inset-junction`](https://drafts.csswg.org/css-gaps-1/#propdef-column-rule-inset-junction) | - | | `columnRuleInsetJunctionEnd` | [`column-rule-inset-junction-end`](https://drafts.csswg.org/css-gaps-1/#propdef-column-rule-inset-junction-end) | - | | `columnRuleInsetJunctionStart` | [`column-rule-inset-junction-start`](https://drafts.csswg.org/css-gaps-1/#propdef-column-rule-inset-junction-start) | - | | `columnRuleInsetStart` | [`column-rule-inset-start`](https://drafts.csswg.org/css-gaps-1/#propdef-column-rule-inset-start) | - | | `columnRuleStyle` | [`column-rule-style`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/column-rule-style) | - | | `columnRuleVisibilityItems` | [`column-rule-visibility-items`](https://drafts.csswg.org/css-gaps-1/#propdef-column-rule-visibility-items) | - | | `columnRuleWidth` | [`column-rule-width`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/column-rule-width) | - | | `columns` | [`columns`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/columns) | - | | `columnSpan` | [`column-span`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/column-span) | - | | `columnWidth` | [`column-width`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/column-width) | [`sizes`](https://yamada-ui.com/docs/theming/tokens/sizes.md) | | `columnWrap` | [`column-wrap`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/column-wrap) | - | | `contain` | [`contain`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/contain) | - | | `container` | [`container`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/container) | - | | `containerName` | [`container-name`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/container-name) | - | | `containerType` | [`container-type`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/container-type) | - | | `containIntrinsicBlockSize` | [`contain-intrinsic-block-size`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/contain-intrinsic-block-size) | - | | `containIntrinsicHeight` | [`contain-intrinsic-height`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/contain-intrinsic-height) | - | | `containIntrinsicInlineSize` | [`contain-intrinsic-inline-size`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/contain-intrinsic-inline-size) | - | | `containIntrinsicSize` | [`contain-intrinsic-size`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/contain-intrinsic-size) | - | | `containIntrinsicWidth` | [`contain-intrinsic-width`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/contain-intrinsic-width) | [`sizes`](https://yamada-ui.com/docs/theming/tokens/sizes.md) | | `content` | [`content`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/content) | - | | `contentVisibility` | [`content-visibility`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/content-visibility) | - | | `contrast` | `--contrast` | - | | `cornerBlockEndShape` | [`corner-block-end-shape`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/corner-block-end-shape) | - | | `cornerBlockStartShape` | [`corner-block-start-shape`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/corner-block-start-shape) | - | | `cornerBottomLeftShape` | [`corner-bottom-left-shape`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/corner-bottom-left-shape) | - | | `cornerBottomRightShape` | [`corner-bottom-right-shape`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/corner-bottom-right-shape) | - | | `cornerBottomShape` | [`corner-bottom-shape`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/corner-bottom-shape) | - | | `cornerEndEndShape` | [`corner-end-end-shape`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/corner-end-end-shape) | - | | `cornerEndStartShape` | [`corner-end-start-shape`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/corner-end-start-shape) | - | | `cornerInlineEndShape` | [`corner-inline-end-shape`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/corner-inline-end-shape) | - | | `cornerInlineStartShape` | [`corner-inline-start-shape`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/corner-inline-start-shape) | - | | `cornerLeftShape` | [`corner-left-shape`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/corner-left-shape) | - | | `cornerRightShape` | [`corner-right-shape`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/corner-right-shape) | - | | `cornerShape` | [`corner-shape`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/corner-shape) | - | | `cornerStartEndShape` | [`corner-start-end-shape`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/corner-start-end-shape) | - | | `cornerStartStartShape` | [`corner-start-start-shape`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/corner-start-start-shape) | - | | `cornerTopLeftShape` | [`corner-top-left-shape`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/corner-top-left-shape) | - | | `cornerTopRightShape` | [`corner-top-right-shape`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/corner-top-right-shape) | - | | `cornerTopShape` | [`corner-top-shape`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/corner-top-shape) | - | | `counterIncrement` | [`counter-increment`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/counter-increment) | - | | `counterReset` | [`counter-reset`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/counter-reset) | - | | `counterSet` | [`counter-set`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/counter-set) | - | | `cursor` | [`cursor`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/cursor) | - | | `cx` | [`cx`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/cx) | - | | `cy` | [`cy`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/cy) | - | | `direction` | [`direction`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/direction) | - | | `display` | - | - | | `dominantBaseline` | [`dominant-baseline`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/dominant-baseline) | - | | `dropShadow` | `--drop-shadow` | [`shadows`](https://yamada-ui.com/docs/theming/tokens/shadows.md) | | `dynamicRangeLimit` | [`dynamic-range-limit`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/dynamic-range-limit) | - | | `emptyCells` | [`empty-cells`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/empty-cells) | - | | `fieldSizing` | [`field-sizing`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/field-sizing) | - | | `fill` | [`fill`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/fill) | [`colors`](https://yamada-ui.com/docs/theming/tokens/colors.md) | | `fillOpacity` | [`fill-opacity`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/fill-opacity) | - | | `fillRule` | [`fill-rule`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/fill-rule) | - | | `filter` | [`filter`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/filter) | - | | `flex` | [`flex`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/flex) | - | | `flexBasis` | [`flex-basis`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/flex-basis) | [`sizes`](https://yamada-ui.com/docs/theming/tokens/sizes.md) | | `flexDir` | [`flex-direction`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/flex-direction) | - | | `flexDirection` | [`flex-direction`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/flex-direction) | - | | `flexFlow` | [`flex-flow`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/flex-flow) | - | | `flexGrow` | [`flex-grow`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/flex-grow) | - | | `flexShrink` | [`flex-shrink`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/flex-shrink) | - | | `flexWrap` | [`flex-wrap`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/flex-wrap) | - | | `float` | [`float`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/float) | - | | `floodColor` | [`flood-color`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/flood-color) | [`colors`](https://yamada-ui.com/docs/theming/tokens/colors.md) | | `floodOpacity` | [`flood-opacity`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/flood-opacity) | - | | `flowTolerance` | [`flow-tolerance`](https://drafts.csswg.org/css-grid-3/#propdef-flow-tolerance) | - | | `focusRing` | - | - | | `focusRingColor` | `--focus-ring-color` | [`colors`](https://yamada-ui.com/docs/theming/tokens/colors.md) | | `focusRingOffset` | `--focus-ring-offset` | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `focusRingStyle` | `--focus-ring-style` | - | | `focusRingWidth` | `--focus-ring-width` | - | | `focusVisibleRing` | - | - | | `font` | [`font`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/font) | - | | `fontFamily` | [`font-family`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/font-family) | [`fonts`](https://yamada-ui.com/docs/theming/tokens/fonts.md) | | `fontFeatureSettings` | [`font-feature-settings`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/font-feature-settings) | - | | `fontKerning` | [`font-kerning`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/font-kerning) | - | | `fontLanguageOverride` | [`font-language-override`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/font-language-override) | - | | `fontOpticalSizing` | [`font-optical-sizing`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/font-optical-sizing) | - | | `fontPalette` | [`font-palette`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/font-palette) | - | | `fontSize` | [`font-size`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/font-size) | [`fontSizes`](https://yamada-ui.com/docs/theming/tokens/font-sizes.md) | | `fontSizeAdjust` | [`font-size-adjust`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/font-size-adjust) | - | | `fontSmooth` | [`font-smooth`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/font-smooth) | - | | `fontStretch` | [`font-stretch`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/font-stretch) | - | | `fontStyle` | [`font-style`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/font-style) | - | | `fontSynthesis` | [`font-synthesis`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/font-synthesis) | - | | `fontSynthesisPosition` | [`font-synthesis-position`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/font-synthesis-position) | - | | `fontSynthesisSmallCaps` | [`font-synthesis-small-caps`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/font-synthesis-small-caps) | - | | `fontSynthesisStyle` | [`font-synthesis-style`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/font-synthesis-style) | - | | `fontSynthesisWeight` | [`font-synthesis-weight`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/font-synthesis-weight) | - | | `fontVariant` | [`font-variant`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/font-variant) | - | | `fontVariantAlternates` | [`font-variant-alternates`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/font-variant-alternates) | - | | `fontVariantCaps` | [`font-variant-caps`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/font-variant-caps) | - | | `fontVariantEastAsian` | [`font-variant-east-asian`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/font-variant-east-asian) | - | | `fontVariantEmoji` | [`font-variant-emoji`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/font-variant-emoji) | - | | `fontVariantLigatures` | [`font-variant-ligatures`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/font-variant-ligatures) | - | | `fontVariantNumeric` | [`font-variant-numeric`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/font-variant-numeric) | - | | `fontVariantPosition` | [`font-variant-position`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/font-variant-position) | - | | `fontVariationSettings` | [`font-variation-settings`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/font-variation-settings) | - | | `fontWeight` | [`font-weight`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/font-weight) | [`fontWeights`](https://yamada-ui.com/docs/theming/tokens/font-weights.md) | | `fontWidth` | [`font-width`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/font-width) | - | | `forcedColorAdjust` | [`forced-color-adjust`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/forced-color-adjust) | - | | `g` | [`gap`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/gap) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `gap` | [`gap`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/gap) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `gapX` | [`column-gap`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/column-gap) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `gapY` | [`row-gap`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/row-gap) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `glyphOrientationHorizontal` | [`glyph-orientation-horizontal`](https://developer.mozilla.org/docs/Web/SVG/Reference/Attribute/glyph-orientation-horizontal) | - | | `glyphOrientationVertical` | [`glyph-orientation-vertical`](https://drafts.csswg.org/css-writing-modes-4/#glyph-orientation) | - | | `grayscale` | `--grayscale` | - | | `grid` | [`grid`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/grid) | - | | `gridArea` | [`grid-area`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/grid-area) | - | | `gridAutoColumns` | [`grid-auto-columns`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/grid-auto-columns) | [`sizes`](https://yamada-ui.com/docs/theming/tokens/sizes.md) | | `gridAutoFlow` | [`grid-auto-flow`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/grid-auto-flow) | - | | `gridAutoRows` | [`grid-auto-rows`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/grid-auto-rows) | [`sizes`](https://yamada-ui.com/docs/theming/tokens/sizes.md) | | `gridColumn` | [`grid-column`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/grid-column) | - | | `gridColumnEnd` | [`grid-column-end`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/grid-column-end) | - | | `gridColumnStart` | [`grid-column-start`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/grid-column-start) | - | | `gridRow` | [`grid-row`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/grid-row) | - | | `gridRowEnd` | [`grid-row-end`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/grid-row-end) | - | | `gridRowStart` | [`grid-row-start`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/grid-row-start) | - | | `gridTemplate` | [`grid-template`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/grid-template) | - | | `gridTemplateAreas` | [`grid-template-areas`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/grid-template-areas) | - | | `gridTemplateColumns` | [`grid-template-columns`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/grid-template-columns) | [`sizes`](https://yamada-ui.com/docs/theming/tokens/sizes.md) | | `gridTemplateRows` | [`grid-template-rows`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/grid-template-rows) | [`sizes`](https://yamada-ui.com/docs/theming/tokens/sizes.md) | | `gx` | [`column-gap`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/column-gap) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `gy` | [`row-gap`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/row-gap) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `h` | [`height`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/height) | [`sizes`](https://yamada-ui.com/docs/theming/tokens/sizes.md) | | `hangingPunctuation` | [`hanging-punctuation`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/hanging-punctuation) | - | | `height` | [`height`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/height) | [`sizes`](https://yamada-ui.com/docs/theming/tokens/sizes.md) | | `hueRotate` | `--hue-rotate` | - | | `hyphenateCharacter` | [`hyphenate-character`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/hyphenate-character) | - | | `hyphenateLimitChars` | [`hyphenate-limit-chars`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/hyphenate-limit-chars) | - | | `hyphens` | [`hyphens`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/hyphens) | - | | `imageOrientation` | [`image-orientation`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/image-orientation) | - | | `imageRendering` | [`image-rendering`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/image-rendering) | - | | `imeMode` | [`ime-mode`](https://drafts.csswg.org/css-ui/#input-method-editor) | - | | `initialLetter` | [`initial-letter`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/initial-letter) | - | | `inlineSize` | [`inline-size`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/inline-size) | [`sizes`](https://yamada-ui.com/docs/theming/tokens/sizes.md) | | `inset` | [`inset`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/inset) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `insetBlock` | [`inset-block`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/inset-block) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `insetBlockEnd` | [`inset-block-end`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/inset-block-end) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `insetBlockStart` | [`inset-block-start`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/inset-block-start) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `insetEnd` | [`inset-inline-end`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/inset-inline-end) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `insetInline` | [`inset-inline`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/inset-inline) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `insetInlineEnd` | [`inset-inline-end`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/inset-inline-end) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `insetInlineStart` | [`inset-inline-start`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/inset-inline-start) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `insetStart` | [`inset-inline-start`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/inset-inline-start) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `insetX` | [`left`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/left), [`right`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/right) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `insetY` | [`top`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/top), [`bottom`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/bottom) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `interactivity` | [`interactivity`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/interactivity) | - | | `interestDelay` | [`interest-delay`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/interest-delay) | - | | `interestDelayEnd` | [`interest-delay-end`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/interest-delay-end) | - | | `interestDelayStart` | [`interest-delay-start`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/interest-delay-start) | - | | `interpolateSize` | [`interpolate-size`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/interpolate-size) | - | | `invert` | `--invert` | - | | `isolation` | [`isolation`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/isolation) | - | | `justifyContent` | [`justify-content`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/justify-content) | - | | `justifyItems` | [`justify-items`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/justify-items) | - | | `justifySelf` | [`justify-self`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/justify-self) | - | | `layerStyle` | - | - | | `leading` | [`line-height`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/line-height) | [`lineHeights`](https://yamada-ui.com/docs/theming/tokens/line-heights.md) | | `left` | [`left`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/left) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `letterSpacing` | [`letter-spacing`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/letter-spacing) | [`letterSpacings`](https://yamada-ui.com/docs/theming/tokens/letter-spacings.md) | | `lightingColor` | [`lighting-color`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/lighting-color) | [`colors`](https://yamada-ui.com/docs/theming/tokens/colors.md) | | `lineBreak` | [`line-break`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/line-break) | - | | `lineClamp` | `--line-clamp` | - | | `lineHeight` | [`line-height`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/line-height) | [`lineHeights`](https://yamada-ui.com/docs/theming/tokens/line-heights.md) | | `listStyle` | [`list-style`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/list-style) | - | | `listStyleImage` | [`list-style-image`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/list-style-image) | [`gradients`](https://yamada-ui.com/docs/theming/tokens/gradients.md) | | `listStyleImg` | [`list-style-image`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/list-style-image) | [`gradients`](https://yamada-ui.com/docs/theming/tokens/gradients.md) | | `listStylePos` | [`list-style-position`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/list-style-position) | - | | `listStylePosition` | [`list-style-position`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/list-style-position) | - | | `listStyleType` | [`list-style-type`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/list-style-type) | - | | `m` | [`margin`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/margin) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `margin` | [`margin`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/margin) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `marginBlock` | [`margin-block`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/margin-block) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `marginBlockEnd` | [`margin-block-end`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/margin-block-end) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `marginBlockStart` | [`margin-block-start`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/margin-block-start) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `marginBottom` | [`margin-bottom`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/margin-bottom) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `marginEnd` | [`margin-inline-end`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/margin-inline-end) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `marginInline` | [`margin-inline`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/margin-inline) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `marginInlineEnd` | [`margin-inline-end`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/margin-inline-end) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `marginInlineStart` | [`margin-inline-start`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/margin-inline-start) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `marginLeft` | [`margin-left`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/margin-left) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `marginRight` | [`margin-right`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/margin-right) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `marginStart` | [`margin-inline-start`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/margin-inline-start) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `marginTop` | [`margin-top`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/margin-top) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `marginTrim` | [`margin-trim`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/margin-trim) | - | | `marginX` | [`margin-inline-start`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/margin-inline-start), [`margin-inline-end`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/margin-inline-end) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `marginY` | [`margin-top`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/margin-top), [`margin-bottom`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/margin-bottom) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `marker` | [`marker`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/marker) | - | | `markerEnd` | [`marker-end`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/marker-end) | - | | `markerMid` | [`marker-mid`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/marker-mid) | - | | `markerStart` | [`marker-start`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/marker-start) | - | | `mask` | [`mask`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/mask) | - | | `maskBorder` | [`mask-border`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/mask-border) | - | | `maskBorderOutset` | [`mask-border-outset`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/mask-border-outset) | - | | `maskBorderRepeat` | [`mask-border-repeat`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/mask-border-repeat) | - | | `maskBorderSlice` | [`mask-border-slice`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/mask-border-slice) | - | | `maskBorderSource` | [`mask-border-source`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/mask-border-source) | - | | `maskBorderWidth` | [`mask-border-width`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/mask-border-width) | - | | `maskClip` | [`mask-clip`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/mask-clip) | - | | `maskComposite` | [`mask-composite`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/mask-composite) | - | | `maskImage` | [`mask-image`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/mask-image) | [`gradients`](https://yamada-ui.com/docs/theming/tokens/gradients.md) | | `maskMode` | [`mask-mode`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/mask-mode) | - | | `maskOrigin` | [`mask-origin`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/mask-origin) | - | | `maskPosition` | [`mask-position`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/mask-position) | - | | `maskRepeat` | [`mask-repeat`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/mask-repeat) | - | | `maskSize` | [`mask-size`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/mask-size) | - | | `maskType` | [`mask-type`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/mask-type) | - | | `mathDepth` | [`math-depth`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/math-depth) | - | | `mathShift` | [`math-shift`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/math-shift) | - | | `mathStyle` | [`math-style`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/math-style) | - | | `maxBlockSize` | [`max-block-size`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/max-block-size) | [`sizes`](https://yamada-ui.com/docs/theming/tokens/sizes.md) | | `maxBoxSize` | [`max-width`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/max-width), [`max-height`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/max-height) | [`sizes`](https://yamada-ui.com/docs/theming/tokens/sizes.md) | | `maxH` | [`max-height`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/max-height) | [`sizes`](https://yamada-ui.com/docs/theming/tokens/sizes.md) | | `maxHeight` | [`max-height`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/max-height) | [`sizes`](https://yamada-ui.com/docs/theming/tokens/sizes.md) | | `maxInlineSize` | [`max-inline-size`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/max-inline-size) | [`sizes`](https://yamada-ui.com/docs/theming/tokens/sizes.md) | | `maxW` | [`max-width`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/max-width) | [`sizes`](https://yamada-ui.com/docs/theming/tokens/sizes.md) | | `maxWidth` | [`max-width`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/max-width) | [`sizes`](https://yamada-ui.com/docs/theming/tokens/sizes.md) | | `mb` | [`margin-bottom`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/margin-bottom) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `me` | [`margin-inline-end`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/margin-inline-end) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `minBlockSize` | [`min-block-size`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/min-block-size) | [`sizes`](https://yamada-ui.com/docs/theming/tokens/sizes.md) | | `minBoxSize` | [`min-width`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/min-width), [`min-height`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/min-height) | [`sizes`](https://yamada-ui.com/docs/theming/tokens/sizes.md) | | `minH` | [`min-height`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/min-height) | [`sizes`](https://yamada-ui.com/docs/theming/tokens/sizes.md) | | `minHeight` | [`min-height`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/min-height) | [`sizes`](https://yamada-ui.com/docs/theming/tokens/sizes.md) | | `minInlineSize` | [`min-inline-size`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/min-inline-size) | [`sizes`](https://yamada-ui.com/docs/theming/tokens/sizes.md) | | `minW` | [`min-width`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/min-width) | [`sizes`](https://yamada-ui.com/docs/theming/tokens/sizes.md) | | `minWidth` | [`min-width`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/min-width) | [`sizes`](https://yamada-ui.com/docs/theming/tokens/sizes.md) | | `mixBlendMode` | [`mix-blend-mode`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/mix-blend-mode) | - | | `ml` | [`margin-left`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/margin-left) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `mr` | [`margin-right`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/margin-right) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `ms` | [`margin-inline-start`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/margin-inline-start) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `mt` | [`margin-top`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/margin-top) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `mx` | [`margin-inline-start`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/margin-inline-start), [`margin-inline-end`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/margin-inline-end) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `my` | [`margin-top`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/margin-top), [`margin-bottom`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/margin-bottom) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `objectFit` | [`object-fit`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/object-fit) | - | | `objectPosition` | [`object-position`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/object-position) | - | | `objectViewBox` | [`object-view-box`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/object-view-box) | - | | `offset` | [`offset`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/offset) | - | | `offsetAnchor` | [`offset-anchor`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/offset-anchor) | - | | `offsetDistance` | [`offset-distance`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/offset-distance) | - | | `offsetPath` | [`offset-path`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/offset-path) | - | | `offsetPosition` | [`offset-position`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/offset-position) | - | | `offsetRotate` | [`offset-rotate`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/offset-rotate) | - | | `opacity` | [`opacity`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/opacity) | - | | `order` | [`order`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/order) | - | | `orphans` | [`orphans`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/orphans) | - | | `outline` | [`outline`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/outline) | - | | `outlineColor` | [`outline-color`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/outline-color) | [`colors`](https://yamada-ui.com/docs/theming/tokens/colors.md) | | `outlineOffset` | [`outline-offset`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/outline-offset) | - | | `outlineStyle` | [`outline-style`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/outline-style) | - | | `outlineWidth` | [`outline-width`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/outline-width) | - | | `overflow` | [`overflow`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/overflow) | - | | `overflowAnchor` | [`overflow-anchor`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/overflow-anchor) | - | | `overflowBlock` | [`overflow-block`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/overflow-block) | - | | `overflowClipMargin` | [`overflow-clip-margin`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/overflow-clip-margin) | - | | `overflowInline` | [`overflow-inline`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/overflow-inline) | - | | `overflowWrap` | [`overflow-wrap`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/overflow-wrap) | - | | `overflowX` | [`overflow-x`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/overflow-x) | - | | `overflowY` | [`overflow-y`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/overflow-y) | - | | `overlay` | [`overlay`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/overlay) | - | | `overscroll` | [`overscroll-behavior`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/overscroll-behavior) | - | | `overscrollBehavior` | [`overscroll-behavior`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/overscroll-behavior) | - | | `overscrollBehaviorBlock` | [`overscroll-behavior-block`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/overscroll-behavior-block) | - | | `overscrollBehaviorInline` | [`overscroll-behavior-inline`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/overscroll-behavior-inline) | - | | `overscrollBehaviorX` | [`overscroll-behavior-x`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/overscroll-behavior-x) | - | | `overscrollBehaviorY` | [`overscroll-behavior-y`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/overscroll-behavior-y) | - | | `overscrollX` | [`overscroll-behavior-x`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/overscroll-behavior-x) | - | | `overscrollY` | [`overscroll-behavior-y`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/overscroll-behavior-y) | - | | `p` | [`padding`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/padding) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `padding` | [`padding`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/padding) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `paddingBlock` | [`padding-block`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/padding-block) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `paddingBlockEnd` | [`padding-block-end`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/padding-block-end) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `paddingBlockStart` | [`padding-block-start`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/padding-block-start) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `paddingBottom` | [`padding-bottom`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/padding-bottom) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `paddingEnd` | [`padding-inline-end`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/padding-inline-end) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `paddingInline` | [`padding-inline`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/padding-inline) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `paddingInlineEnd` | [`padding-inline-end`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/padding-inline-end) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `paddingInlineStart` | [`padding-inline-start`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/padding-inline-start) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `paddingLeft` | [`padding-left`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/padding-left) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `paddingRight` | [`padding-right`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/padding-right) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `paddingStart` | [`padding-inline-start`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/padding-inline-start) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `paddingTop` | [`padding-top`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/padding-top) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `paddingX` | [`padding-inline-start`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/padding-inline-start), [`padding-inline-end`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/padding-inline-end) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `paddingY` | [`padding-top`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/padding-top), [`padding-bottom`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/padding-bottom) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `page` | [`page`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/page) | - | | `pageBreakAfter` | [`page-break-after`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/page-break-after) | - | | `pageBreakBefore` | [`page-break-before`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/page-break-before) | - | | `pageBreakInside` | [`page-break-inside`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/page-break-inside) | - | | `paintOrder` | [`paint-order`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/paint-order) | - | | `pb` | [`padding-bottom`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/padding-bottom) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `pe` | [`padding-inline-end`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/padding-inline-end) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `perspective` | [`perspective`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/perspective) | - | | `perspectiveOrigin` | [`perspective-origin`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/perspective-origin) | - | | `pl` | [`padding-left`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/padding-left) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `placeContent` | [`place-content`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/place-content) | - | | `placeItems` | [`place-items`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/place-items) | - | | `placeSelf` | [`place-self`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/place-self) | - | | `pointerEvents` | [`pointer-events`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/pointer-events) | - | | `pos` | [`position`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/position) | - | | `position` | [`position`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/position) | - | | `positionAnchor` | [`position-anchor`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/position-anchor) | - | | `positionArea` | [`position-area`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/position-area) | - | | `positionTry` | [`position-try`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/position-try) | - | | `positionTryFallbacks` | [`position-try-fallbacks`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/position-try-fallbacks) | - | | `positionTryOrder` | [`position-try-order`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/position-try-order) | - | | `positionVisibility` | [`position-visibility`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/position-visibility) | - | | `pr` | [`padding-right`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/padding-right) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `printColorAdjust` | [`print-color-adjust`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/print-color-adjust) | - | | `ps` | [`padding-inline-start`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/padding-inline-start) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `pt` | [`padding-top`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/padding-top) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `px` | [`padding-inline-start`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/padding-inline-start), [`padding-inline-end`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/padding-inline-end) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `py` | [`padding-top`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/padding-top), [`padding-bottom`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/padding-bottom) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `quotes` | [`quotes`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/quotes) | - | | `r` | [`r`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/r) | - | | `readingFlow` | [`reading-flow`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/reading-flow) | - | | `readingOrder` | [`reading-order`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/reading-order) | - | | `resize` | [`resize`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/resize) | - | | `right` | [`right`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/right) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `rotate` | [`rotate`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/rotate) | - | | `rotateX` | `--rotate-x` | - | | `rotateY` | `--rotate-y` | - | | `rotateZ` | `--rotate-z` | - | | `rounded` | [`border-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-radius) | [`radii`](https://yamada-ui.com/docs/theming/tokens/radii.md) | | `roundedBottom` | [`border-bottom-left-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-bottom-left-radius), [`border-bottom-right-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-bottom-right-radius) | [`radii`](https://yamada-ui.com/docs/theming/tokens/radii.md) | | `roundedBottomEnd` | [`border-end-end-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-end-end-radius) | [`radii`](https://yamada-ui.com/docs/theming/tokens/radii.md) | | `roundedBottomLeft` | [`border-bottom-left-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-bottom-left-radius) | [`radii`](https://yamada-ui.com/docs/theming/tokens/radii.md) | | `roundedBottomRight` | [`border-bottom-right-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-bottom-right-radius) | [`radii`](https://yamada-ui.com/docs/theming/tokens/radii.md) | | `roundedBottomStart` | [`border-end-start-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-end-start-radius) | [`radii`](https://yamada-ui.com/docs/theming/tokens/radii.md) | | `roundedEnd` | [`border-end-start-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-end-start-radius), [`border-end-end-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-end-end-radius) | [`radii`](https://yamada-ui.com/docs/theming/tokens/radii.md) | | `roundedLeft` | [`border-top-left-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-top-left-radius), [`border-bottom-left-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-bottom-left-radius) | [`radii`](https://yamada-ui.com/docs/theming/tokens/radii.md) | | `roundedRight` | [`border-top-right-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-top-right-radius), [`border-bottom-right-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-bottom-right-radius) | [`radii`](https://yamada-ui.com/docs/theming/tokens/radii.md) | | `roundedStart` | [`border-start-start-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-start-start-radius), [`border-start-end-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-start-end-radius) | [`radii`](https://yamada-ui.com/docs/theming/tokens/radii.md) | | `roundedTop` | [`border-top-left-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-top-left-radius), [`border-top-right-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-top-right-radius) | [`radii`](https://yamada-ui.com/docs/theming/tokens/radii.md) | | `roundedTopEnd` | [`border-start-end-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-start-end-radius) | [`radii`](https://yamada-ui.com/docs/theming/tokens/radii.md) | | `roundedTopLeft` | [`border-top-left-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-top-left-radius) | [`radii`](https://yamada-ui.com/docs/theming/tokens/radii.md) | | `roundedTopRight` | [`border-top-right-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-top-right-radius) | [`radii`](https://yamada-ui.com/docs/theming/tokens/radii.md) | | `roundedTopStart` | [`border-start-start-radius`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/border-start-start-radius) | [`radii`](https://yamada-ui.com/docs/theming/tokens/radii.md) | | `rowGap` | [`row-gap`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/row-gap) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `rowRule` | [`row-rule`](https://drafts.csswg.org/css-gaps-1/#propdef-row-rule) | - | | `rowRuleBreak` | [`row-rule-break`](https://drafts.csswg.org/css-gaps-1/#propdef-row-rule-break) | - | | `rowRuleColor` | [`row-rule-color`](https://drafts.csswg.org/css-gaps-1/#propdef-row-rule-color) | - | | `rowRuleInset` | [`row-rule-inset`](https://drafts.csswg.org/css-gaps-1/#propdef-row-rule-inset) | - | | `rowRuleInsetCap` | [`row-rule-inset-cap`](https://drafts.csswg.org/css-gaps-1/#propdef-row-rule-inset-cap) | - | | `rowRuleInsetCapEnd` | [`row-rule-inset-cap-end`](https://drafts.csswg.org/css-gaps-1/#propdef-row-rule-inset-cap-end) | - | | `rowRuleInsetCapStart` | [`row-rule-inset-cap-start`](https://drafts.csswg.org/css-gaps-1/#propdef-column-rule-inset-cap-start) | - | | `rowRuleInsetEnd` | [`row-rule-inset-end`](https://drafts.csswg.org/css-gaps-1/#propdef-row-rule-inset-end) | - | | `rowRuleInsetJunction` | [`row-rule-inset-junction`](https://drafts.csswg.org/css-gaps-1/#propdef-row-rule-inset-junction) | - | | `rowRuleInsetJunctionEnd` | [`row-rule-inset-junction-end`](https://drafts.csswg.org/css-gaps-1/#propdef-row-rule-inset-junction-end) | - | | `rowRuleInsetJunctionStart` | [`row-rule-inset-junction-start`](https://drafts.csswg.org/css-gaps-1/#propdef-row-rule-inset-junction-start) | - | | `rowRuleInsetStart` | [`row-rule-inset-start`](https://drafts.csswg.org/css-gaps-1/#propdef-row-rule-inset-start) | - | | `rowRuleStyle` | [`row-rule-style`](https://drafts.csswg.org/css-gaps-1/#propdef-row-rule-style) | - | | `rowRuleVisibilityItems` | [`row-rule-visibility-items`](https://drafts.csswg.org/css-gaps-1/#propdef-row-rule-visibility-items) | - | | `rowRuleWidth` | [`row-rule-width`](https://drafts.csswg.org/css-gaps-1/#propdef-row-rule-width) | - | | `rubyAlign` | [`ruby-align`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/ruby-align) | - | | `rubyOverhang` | [`ruby-overhang`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/ruby-overhang) | - | | `rubyPosition` | [`ruby-position`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/ruby-position) | - | | `rule` | [`rule`](https://drafts.csswg.org/css-gaps-1/#propdef-rule) | - | | `ruleBreak` | [`rule-break`](https://drafts.csswg.org/css-gaps-1/#propdef-rule-break) | - | | `ruleColor` | [`rule-color`](https://drafts.csswg.org/css-gaps-1/#propdef-rule-color) | - | | `ruleInset` | [`rule-inset`](https://drafts.csswg.org/css-gaps-1/#propdef-rule-inset) | - | | `ruleInsetCap` | [`rule-inset-cap`](https://drafts.csswg.org/css-gaps-1/#propdef-rule-inset-cap) | - | | `ruleInsetEnd` | [`rule-inset-end`](https://drafts.csswg.org/css-gaps-1/#propdef-rule-inset-end) | - | | `ruleInsetJunction` | [`rule-inset-junction`](https://drafts.csswg.org/css-gaps-1/#propdef-rule-inset-junction) | - | | `ruleInsetStart` | [`rule-inset-start`](https://drafts.csswg.org/css-gaps-1/#propdef-rule-inset-start) | - | | `ruleOverlap` | [`rule-overlap`](https://drafts.csswg.org/css-gaps-1/#propdef-rule-overlap) | - | | `ruleStyle` | [`rule-style`](https://drafts.csswg.org/css-gaps-1/#propdef-rule-style) | - | | `ruleVisibilityItems` | [`rule-visibility-items`](https://drafts.csswg.org/css-gaps-1/#propdef-rule-visibility-items) | - | | `ruleWidth` | [`rule-width`](https://drafts.csswg.org/css-gaps-1/#propdef-rule-width) | - | | `rx` | [`rx`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/rx) | - | | `ry` | [`ry`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/ry) | - | | `saturate` | `--saturate` | - | | `scale` | [`scale`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scale) | - | | `scaleX` | `--scale-x` | - | | `scaleY` | `--scale-y` | - | | `scaleZ` | `--scale-z` | - | | `scrollbarColor` | [`scrollbar-color`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scrollbar-color) | [`colors`](https://yamada-ui.com/docs/theming/tokens/colors.md) | | `scrollbarGutter` | [`scrollbar-gutter`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scrollbar-gutter) | - | | `scrollbarWidth` | [`scrollbar-width`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scrollbar-width) | - | | `scrollBehavior` | [`scroll-behavior`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scroll-behavior) | - | | `scrollInitialTarget` | [`scroll-initial-target`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scroll-initial-target) | - | | `scrollMargin` | [`scroll-margin`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scroll-margin) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `scrollMarginBlock` | [`scroll-margin-block`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scroll-margin-block) | - | | `scrollMarginBlockEnd` | [`scroll-margin-block-end`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scroll-margin-block-end) | - | | `scrollMarginBlockStart` | [`scroll-margin-block-start`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scroll-margin-block-start) | - | | `scrollMarginBottom` | [`scroll-margin-bottom`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scroll-margin-bottom) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `scrollMarginInline` | [`scroll-margin-inline`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scroll-margin-inline) | - | | `scrollMarginInlineEnd` | [`scroll-margin-inline-end`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scroll-margin-inline-end) | - | | `scrollMarginInlineStart` | [`scroll-margin-inline-start`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scroll-margin-inline-start) | - | | `scrollMarginLeft` | [`scroll-margin-left`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scroll-margin-left) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `scrollMarginRight` | [`scroll-margin-right`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scroll-margin-right) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `scrollMarginTop` | [`scroll-margin-top`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scroll-margin-top) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `scrollMarginX` | [`scroll-margin-left`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scroll-margin-left), [`scroll-margin-right`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scroll-margin-right) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `scrollMarginY` | [`scroll-margin-top`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scroll-margin-top), [`scroll-margin-bottom`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scroll-margin-bottom) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `scrollMarkerGroup` | [`scroll-marker-group`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scroll-marker-group) | - | | `scrollPadding` | [`scroll-padding`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scroll-padding) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `scrollPaddingBlock` | [`scroll-padding-block`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scroll-padding-block) | - | | `scrollPaddingBlockEnd` | [`scroll-padding-block-end`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scroll-padding-block-end) | - | | `scrollPaddingBlockStart` | [`scroll-padding-block-start`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scroll-padding-block-start) | - | | `scrollPaddingBottom` | [`scroll-padding-bottom`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scroll-padding-bottom) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `scrollPaddingInline` | [`scroll-padding-inline`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scroll-padding-inline) | - | | `scrollPaddingInlineEnd` | [`scroll-padding-inline-end`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scroll-padding-inline-end) | - | | `scrollPaddingInlineStart` | [`scroll-padding-inline-start`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scroll-padding-inline-start) | - | | `scrollPaddingLeft` | [`scroll-padding-left`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scroll-padding-left) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `scrollPaddingRight` | [`scroll-padding-right`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scroll-padding-right) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `scrollPaddingTop` | [`scroll-padding-top`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scroll-padding-top) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `scrollPaddingX` | [`scroll-padding-left`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scroll-padding-left), [`scroll-padding-right`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scroll-padding-right) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `scrollPaddingY` | [`scroll-padding-top`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scroll-padding-top), [`scroll-padding-bottom`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scroll-padding-bottom) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `scrollSnapAlign` | [`scroll-snap-align`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scroll-snap-align) | - | | `scrollSnapStop` | [`scroll-snap-stop`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scroll-snap-stop) | - | | `scrollSnapType` | [`scroll-snap-type`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scroll-snap-type) | - | | `scrollTargetGroup` | [`scroll-target-group`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scroll-target-group) | - | | `scrollTimeline` | [`scroll-timeline`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scroll-timeline) | - | | `scrollTimelineAxis` | [`scroll-timeline-axis`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scroll-timeline-axis) | - | | `scrollTimelineName` | [`scroll-timeline-name`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/scroll-timeline-name) | - | | `sepia` | `--sepia` | - | | `shadow` | [`box-shadow`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/box-shadow) | [`shadows`](https://yamada-ui.com/docs/theming/tokens/shadows.md) | | `shapeImageThreshold` | [`shape-image-threshold`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/shape-image-threshold) | - | | `shapeMargin` | [`shape-margin`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/shape-margin) | - | | `shapeOutside` | [`shape-outside`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/shape-outside) | - | | `shapeRendering` | [`shape-rendering`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/shape-rendering) | - | | `skewX` | `--skew-x` | - | | `skewY` | `--skew-y` | - | | `speak` | [`speak`](https://drafts.csswg.org/css-speech-1/#speaking-props-speak) | - | | `speakAs` | [`speak-as`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/speak-as) | - | | `stopColor` | [`stop-color`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/stop-color) | [`colors`](https://yamada-ui.com/docs/theming/tokens/colors.md) | | `stopOpacity` | [`stop-opacity`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/stop-opacity) | - | | `stroke` | [`stroke`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/stroke) | [`colors`](https://yamada-ui.com/docs/theming/tokens/colors.md) | | `strokeColor` | [`stroke-color`](https://drafts.csswg.org/fill-stroke-3/#stroke-color) | [`colors`](https://yamada-ui.com/docs/theming/tokens/colors.md) | | `strokeDasharray` | [`stroke-dasharray`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/stroke-dasharray) | - | | `strokeDashoffset` | [`stroke-dashoffset`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/stroke-dashoffset) | - | | `strokeLinecap` | [`stroke-linecap`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/stroke-linecap) | - | | `strokeLinejoin` | [`stroke-linejoin`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/stroke-linejoin) | - | | `strokeMiterlimit` | [`stroke-miterlimit`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/stroke-miterlimit) | - | | `strokeOpacity` | [`stroke-opacity`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/stroke-opacity) | - | | `strokeWidth` | [`stroke-width`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/stroke-width) | - | | `tableLayout` | [`table-layout`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/table-layout) | - | | `tabSize` | [`tab-size`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/tab-size) | - | | `text` | [`font-size`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/font-size) | [`fontSizes`](https://yamada-ui.com/docs/theming/tokens/font-sizes.md) | | `textAlign` | [`text-align`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/text-align) | - | | `textAlignLast` | [`text-align-last`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/text-align-last) | - | | `textAnchor` | [`text-anchor`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/text-anchor) | - | | `textAutospace` | [`text-autospace`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/text-autospace) | - | | `textBox` | [`text-box`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/text-box) | - | | `textBoxEdge` | [`text-box-edge`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/text-box-edge) | - | | `textBoxTrim` | [`text-box-trim`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/text-box-trim) | - | | `textColor` | [`color`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/color) | [`colors`](https://yamada-ui.com/docs/theming/tokens/colors.md) | | `textCombineUpright` | [`text-combine-upright`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/text-combine-upright) | - | | `textDecor` | [`text-decoration`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/text-decoration) | - | | `textDecoration` | [`text-decoration`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/text-decoration) | - | | `textDecorationColor` | [`text-decoration-color`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/text-decoration-color) | [`colors`](https://yamada-ui.com/docs/theming/tokens/colors.md) | | `textDecorationInset` | [`text-decoration-inset`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/text-decoration-inset) | - | | `textDecorationLine` | [`text-decoration-line`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/text-decoration-line) | - | | `textDecorationSkip` | [`text-decoration-skip`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/text-decoration-skip) | - | | `textDecorationSkipInk` | [`text-decoration-skip-ink`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/text-decoration-skip-ink) | - | | `textDecorationStyle` | [`text-decoration-style`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/text-decoration-style) | - | | `textDecorationThickness` | [`text-decoration-thickness`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/text-decoration-thickness) | - | | `textEmphasis` | [`text-emphasis`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/text-emphasis) | - | | `textEmphasisColor` | [`text-emphasis-color`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/text-emphasis-color) | [`colors`](https://yamada-ui.com/docs/theming/tokens/colors.md) | | `textEmphasisPosition` | [`text-emphasis-position`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/text-emphasis-position) | - | | `textEmphasisStyle` | [`text-emphasis-style`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/text-emphasis-style) | - | | `textIndent` | [`text-indent`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/text-indent) | - | | `textJustify` | [`text-justify`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/text-justify) | - | | `textOrientation` | [`text-orientation`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/text-orientation) | - | | `textOverflow` | [`text-overflow`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/text-overflow) | - | | `textRendering` | [`text-rendering`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/text-rendering) | - | | `textShadow` | [`text-shadow`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/text-shadow) | [`shadows`](https://yamada-ui.com/docs/theming/tokens/shadows.md) | | `textSizeAdjust` | [`text-size-adjust`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/text-size-adjust) | - | | `textSpacingTrim` | [`text-spacing-trim`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/text-spacing-trim) | - | | `textStyle` | - | - | | `textTransform` | [`text-transform`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/text-transform) | - | | `textUnderlineOffset` | [`text-underline-offset`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/text-underline-offset) | - | | `textUnderlinePosition` | [`text-underline-position`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/text-underline-position) | - | | `textWrap` | [`text-wrap`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/text-wrap) | - | | `textWrapMode` | [`text-wrap-mode`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/text-wrap-mode) | - | | `textWrapStyle` | [`text-wrap-style`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/text-wrap-style) | - | | `timelineScope` | [`timeline-scope`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/timeline-scope) | - | | `timelineTrigger` | [`timeline-trigger`](https://drafts.csswg.org/animation-triggers-1/#propdef-timeline-trigger) | - | | `timelineTriggerActivationRange` | [`timeline-trigger-activation-range`](https://drafts.csswg.org/animation-triggers-1/#propdef-timeline-trigger-activation-range) | - | | `timelineTriggerActivationRangeEnd` | [`timeline-trigger-activation-range-end`](https://drafts.csswg.org/animation-triggers-1/#propdef-timeline-trigger-activation-range-end) | - | | `timelineTriggerActivationRangeStart` | [`timeline-trigger-activation-range-start`](https://drafts.csswg.org/animation-triggers-1/#propdef-timeline-trigger-activation-range-start) | - | | `timelineTriggerActiveRange` | [`timeline-trigger-active-range`](https://drafts.csswg.org/animation-triggers-1/#propdef-timeline-trigger-active-range) | - | | `timelineTriggerActiveRangeEnd` | [`timeline-trigger-active-range-end`](https://drafts.csswg.org/animation-triggers-1/#propdef-timeline-trigger-active-range-end) | - | | `timelineTriggerActiveRangeStart` | [`timeline-trigger-active-range-start`](https://drafts.csswg.org/animation-triggers-1/#propdef-timeline-trigger-active-range-start) | - | | `timelineTriggerName` | [`timeline-trigger-name`](https://drafts.csswg.org/animation-triggers-1/#propdef-timeline-trigger-name) | - | | `timelineTriggerSource` | [`timeline-trigger-source`](https://drafts.csswg.org/animation-triggers-1/#propdef-timeline-trigger-source) | - | | `top` | [`top`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/top) | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `touchAction` | [`touch-action`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/touch-action) | - | | `tracking` | [`letter-spacing`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/letter-spacing) | [`letterSpacings`](https://yamada-ui.com/docs/theming/tokens/letter-spacings.md) | | `transform` | [`transform`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/transform) | - | | `transformBox` | [`transform-box`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/transform-box) | - | | `transformOrigin` | [`transform-origin`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/transform-origin) | - | | `transformStyle` | [`transform-style`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/transform-style) | - | | `transition` | - | - | | `transitionBehavior` | [`transition-behavior`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/transition-behavior) | - | | `transitionDelay` | [`transition-delay`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/transition-delay) | - | | `transitionDuration` | [`transition-duration`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/transition-duration) | [`durations`](https://yamada-ui.com/docs/theming/tokens/durations.md) | | `transitionProperty` | - | - | | `transitionTimingFunction` | [`transition-timing-function`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/transition-timing-function) | [`easings`](https://yamada-ui.com/docs/theming/tokens/easings.md) | | `translateX` | `--translate-x` | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `translateY` | `--translate-y` | [`spaces`](https://yamada-ui.com/docs/theming/tokens/spaces.md) | | `translateZ` | `--translate-z` | - | | `triggerScope` | [`trigger-scope`](https://drafts.csswg.org/animation-triggers-1/#propdef-trigger-scope) | - | | `truncated` | - | - | | `unicodeBidi` | [`unicode-bidi`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/unicode-bidi) | - | | `userModify` | [`user-modify`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/user-modify) | - | | `userSelect` | [`user-select`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/user-select) | - | | `vectorEffect` | [`vector-effect`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/vector-effect) | - | | `verticalAlign` | [`vertical-align`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/vertical-align) | - | | `viewTimeline` | [`view-timeline`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/view-timeline) | - | | `viewTimelineAxis` | [`view-timeline-axis`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/view-timeline-axis) | - | | `viewTimelineInset` | [`view-timeline-inset`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/view-timeline-inset) | - | | `viewTimelineName` | [`view-timeline-name`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/view-timeline-name) | - | | `viewTransitionClass` | [`view-transition-class`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/view-transition-class) | - | | `viewTransitionGroup` | [`view-transition-group`](https://drafts.csswg.org/css-view-transitions-2/#view-transition-group-prop) | - | | `viewTransitionName` | [`view-transition-name`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/view-transition-name) | - | | `viewTransitionScope` | [`view-transition-scope`](https://drafts.csswg.org/css-view-transitions-2/#view-transition-scope-prop) | - | | `visibility` | [`visibility`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/visibility) | - | | `w` | [`width`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/width) | [`sizes`](https://yamada-ui.com/docs/theming/tokens/sizes.md) | | `whiteSpace` | [`white-space`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/white-space) | - | | `whiteSpaceCollapse` | [`white-space-collapse`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/white-space-collapse) | - | | `widows` | [`widows`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/widows) | - | | `width` | [`width`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/width) | [`sizes`](https://yamada-ui.com/docs/theming/tokens/sizes.md) | | `willChange` | [`will-change`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/will-change) | - | | `wordBreak` | [`word-break`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/word-break) | - | | `wordSpacing` | [`word-spacing`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/word-spacing) | - | | `writingMode` | [`writing-mode`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/writing-mode) | - | | `x` | [`x`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/x) | - | | `y` | [`y`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/y) | - | | `z` | [`z-index`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/z-index) | [`zIndices`](https://yamada-ui.com/docs/theming/tokens/z-indices.md) | | `zIndex` | [`z-index`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/z-index) | [`zIndices`](https://yamada-ui.com/docs/theming/tokens/z-indices.md) | | `zoom` | [`zoom`](https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/zoom) | - | ## At-Rules | Prop | CSS Property | Theme Token | | -------------------- | --------------- | --------------------------------------------------------------------- | | `_container` | @container | - | | `_keyframes` | @keyframes | [`keyframes`](https://yamada-ui.com/docs/theming/tokens/keyframes.md) | | `_landscape` | @media | - | | `_media` | @media | - | | `_mediaDark` | @media | - | | `_mediaLight` | @media | - | | `_mediaReduceMotion` | @media | - | | `_portrait` | @media | - | | `_print` | @media | - | | `_startingStyle` | @starting-style | - | | `_supports` | @supports | - | ## Pseudo Elements | Prop | CSS Property | | ---------------------- | ----------------------------------------- | | `_after` | `&::after` | | `_backdrop` | `&::backdrop` | | `_before` | `&::before` | | `_cue` | `&::cue` | | `_cueRegion` | `&::cue-region` | | `_detailsContent` | `&::details-content` | | `_fileSelector` | `&::file-selector-button` | | `_firstLetter` | `&::first-letter` | | `_firstLine` | `&::first-line` | | `_marker` | `&::marker` | | `_placeholder` | `&::placeholder, &[data-placeholder]` | | `_scrollbar` | `&::-webkit-scrollbar, &[data-scrollbar]` | | `_scrollbarButton` | `&::-webkit-scrollbar-button` | | `_scrollbarCorner` | `&::-webkit-scrollbar-corner` | | `_scrollbarThumb` | `&::-webkit-scrollbar-thumb` | | `_scrollbarTrack` | `&::-webkit-scrollbar-track` | | `_scrollbarTrackPiece` | `&::-webkit-scrollbar-track-piece` | | `_selection` | `&::selection` | ## Pseudo Classes | Prop | CSS Property | | --------------------- | ------------------------------------------------------------------------------------------------ | | `_active` | `&:is(:active, [data-active]):not(:disabled, [disabled], [aria-disabled=true], [data-disabled])` | | `_activedescendant` | `&:is([data-activedescendant])` | | `_anyLink` | `&:is(:any-link, [data-any-link])` | | `_autofill` | `&:autofill` | | `_blank` | `&:is(:blank, [data-blank])` | | `_checked` | `&:is(:checked, [data-checked], [aria-checked=true])` | | `_child` | `& > *` | | `_content` | `& > [data-content]` | | `_default` | `&:default` | | `_disabled` | `&:is(:disabled, [disabled], [data-disabled])` | | `_empty` | `&:empty` | | `_enabled` | `&:is(:enabled, [data-enabled])` | | `_even` | `&:nth-of-type(even)` | | `_first` | `&:first-of-type` | | `_firstChild` | `& > *:first-child` | | `_focus` | `&:is(:focus, [data-focus])` | | `_focusVisible` | `&:is(:focus-visible, [data-focus-visible])` | | `_focusWithin` | `&:not(:focus-within, [data-focus-within])` | | `_fullScreen` | `&:fullscreen` | | `_horizontal` | `&:is([data-orientation=horizontal], [aria-orientation=horizontal])` | | `_hover` | `&:is(:hover, [data-hover]):not(:disabled, [disabled], [aria-disabled=true], [data-disabled])` | | `_icon` | `&:where(svg:not([data-loading])), & > [data-icon]` | | `_indeterminate` | `&:is(:indeterminate, [data-indeterminate], [aria-checked=mixed])` | | `_indicator` | `& > [data-indicator]` | | `_inRange` | `&:is(:in-range, [data-in-range])` | | `_invalid` | `&:is([data-invalid], [aria-invalid=true])` | | `_last` | `&:last-of-type` | | `_lastChild` | `& > *:last-child` | | `_link` | `&:is(:link, [data-link])` | | `_modal` | `&:modal` | | `_nativeActive` | `&:active` | | `_nativeChecked` | `&:checked` | | `_nativeDisabled` | `&:is(disabled, [disabled])` | | `_nativeFocus` | `&:focus` | | `_nativeFocusVisible` | `&:focus-visible` | | `_nativeFocusWithin` | `&:focus-within` | | `_nativeHover` | `&:hover` | | `_nativeReadOnly` | `&:is([readonly], [aria-readonly=true])` | | `_nativeTarget` | `&:target` | | `_nativeValid` | `&:valid` | | `_notChecked` | `&:not(:checked):not([data-checked]):not([aria-checked=true])` | | `_notEmpty` | `&:not(:empty)` | | `_notFirst` | `&:not(:first-of-type)` | | `_notFirstChild` | `& > *:not(:first-child)` | | `_notLast` | `&:not(:last-of-type)` | | `_notLastChild` | `& > *:not(:last-child)` | | `_notTarget` | `&:not(:target)` | | `_odd` | `&:nth-of-type(odd)` | | `_only` | `&:only-of-type` | | `_onlyChild` | `&:only-child` | | `_optional` | `&:is(:optional, [data-optional])` | | `_outRange` | `&:is(:out-of-range, [data-out-of-range])` | | `_paused` | `&:is(:paused, [data-paused])` | | `_picture` | `&:picture-in-picture` | | `_placeholderShown` | `&:placeholder-shown` | | `_playing` | `&:is(:playing, [data-playing])` | | `_popoverOpen` | `&:popover-open` | | `_readOnly` | `&:is([readonly], [data-readonly], [aria-readonly=true])` | | `_readWrite` | `&:is(:read-write, [data-read-write])` | | `_required` | `&:is(:required, [required])` | | `_target` | `&:is(:target, [data-target])` | | `_userInvalid` | `&:is(:user-invalid, [data-user-invalid])` | | `_valid` | `&:is(:valid, [data-valid])` | | `_vertical` | `&:is([data-orientation=vertical], [aria-orientation=vertical])` | | `_visited` | `&:visited` | ## Selectors | Prop | CSS Property | | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `_accept` | `&[data-accept]` | | `_animated` | `&[data-animated]` | | `_between` | `&[data-between]` | | `_center` | `&:is([data-center], [data-group-center])` | | `_collapsed` | `&:is([data-collapsed], :not([data-expanded]), [aria-expanded=false])` | | `_complete` | `&[data-complete]` | | `_current` | `&:is([aria-current], [data-current]):not([aria-current='false'])` | | `_dark` | `:host([data-mode=dark]) &, .dark &:not([data-mode]), [data-mode=dark] &:not([data-mode]), &[data-mode=dark]` | | `_end` | `&:is([data-end], [data-group-end])` | | `_expanded` | `&:is([data-expanded], [aria-expanded=true])` | | `_fallback` | `&[data-fallback]` | | `_filled` | `&[data-filled]` | | `_grabbed` | `&:is([data-grabbed], [aria-grabbed=true])` | | `_grid` | `&:is([role=grid], [data-grid])` | | `_groupAccept` | `[role=group][data-accept] &, [data-group][data-accept] &, .group[data-accept] &` | | `_groupActive` | `[role=group]:is(:active, [data-active]):not(:disabled, [disabled], [aria-disabled=true], [data-disabled]) &, [data-group]:is(:active, [data-active]):not(:disabled, [disabled], [aria-disabled=true], [data-disabled]) &, .group:is(:active, [data-active]):not(:disabled, [disabled], [aria-disabled=true], [data-disabled]) &` | | `_groupActivedescendant` | `[role=group]:is([data-activedescendant]) &, [data-group]:is([data-activedescendant]) &, .group:is([data-activedescendant]) &` | | `_groupAnimated` | `[role=group][data-animated] &, [data-group][data-animated] &, .group[data-animated] &` | | `_groupBlank` | `[role=group]:is(:blank, [data-blank]) &, [data-group]:is(:blank, [data-blank]) &, .group:is(:blank, [data-blank]) &` | | `_groupChecked` | `[role=group]:is(:checked, [data-checked], [aria-checked=true]) &, [data-group]:is(:checked, [data-checked], [aria-checked=true]) &, .group:is(:checked, [data-checked], [aria-checked=true]) &` | | `_groupCollapsed` | `[role=group]:is([data-collapsed], :not([data-expanded]), [aria-expanded=false]) &, [data-group]:is([data-collapsed], :not([data-expanded]), [aria-expanded=false]) &, .group:is([data-collapsed], :not([data-expanded]), [aria-expanded=false]) &` | | `_groupComplete` | `[role=group][data-complete] &, [data-group][data-complete] &, .group[data-complete] &` | | `_groupCurrent` | `[role=group]:is([aria-current], [data-current]):not([aria-current='false']) &, [data-group]:is([aria-current], [data-current]):not([aria-current='false']) &, .group:is([aria-current], [data-current]):not([aria-current='false']) &` | | `_groupDisabled` | `[role=group]:is(:disabled, [disabled], [data-disabled]) &, [data-group]:is(:disabled, [disabled], [data-disabled]) &, .group:is(:disabled, [disabled], [data-disabled]) &` | | `_groupEnabled` | `[role=group]:is(:enabled, [data-enabled]) &, [data-group]:is(:enabled, [data-enabled]) &, .group:is(:enabled, [data-enabled]) &` | | `_groupExpanded` | `[role=group]:is([data-expanded], [aria-expanded=true]) &, [data-group]:is([data-expanded], [aria-expanded=true]) &, .group:is([data-expanded], [aria-expanded=true]) &` | | `_groupFocus` | `[role=group]:is(:focus, [data-focus]) &, [data-group]:is(:focus, [data-focus]) &, .group:is(:focus, [data-focus]) &` | | `_groupFocusVisible` | `[role=group]:is(:focus-visible, [data-focus-visible]) &, [data-group]:is(:focus-visible, [data-focus-visible]) &, .group:is(:focus-visible, [data-focus-visible]) &` | | `_groupFocusWithin` | `[role=group]:not(:focus-within, [data-focus-within]) &, [data-group]:not(:focus-within, [data-focus-within]) &, .group:not(:focus-within, [data-focus-within]) &` | | `_groupGrabbed` | `[role=group]:is([data-grabbed], [aria-grabbed=true]) &, [data-group]:is([data-grabbed], [aria-grabbed=true]) &, .group:is([data-grabbed], [aria-grabbed=true]) &` | | `_groupHorizontal` | `[role=group]:is([data-orientation=horizontal], [aria-orientation=horizontal]) &, [data-group]:is([data-orientation=horizontal], [aria-orientation=horizontal]) &, .group:is([data-orientation=horizontal], [aria-orientation=horizontal]) &` | | `_groupHover` | `[role=group]:is(:hover, [data-hover]):not(:disabled, [disabled], [aria-disabled=true], [data-disabled]) &, [data-group]:is(:hover, [data-hover]):not(:disabled, [disabled], [aria-disabled=true], [data-disabled]) &, .group:is(:hover, [data-hover]):not(:disabled, [disabled], [aria-disabled=true], [data-disabled]) &` | | `_groupIdle` | `[role=group][data-idle] &, [data-group][data-idle] &, .group[data-idle] &` | | `_groupIncomplete` | `[role=group][data-incomplete] &, [data-group][data-incomplete] &, .group[data-incomplete] &` | | `_groupInvalid` | `[role=group]:is([data-invalid], [aria-invalid=true]) &, [data-group]:is([data-invalid], [aria-invalid=true]) &, .group:is([data-invalid], [aria-invalid=true]) &` | | `_groupLoaded` | `[role=group][data-loaded] &, [data-group][data-loaded] &, .group[data-loaded] &` | | `_groupLoading` | `[role=group]:is([data-loading], [aria-busy=true]) &, [data-group]:is([data-loading], [aria-busy=true]) &, .group:is([data-loading], [aria-busy=true]) &` | | `_groupOpen` | `[role=group]:is([open], [data-open]) &, [data-group]:is([open], [data-open]) &, .group:is([open], [data-open]) &` | | `_groupOptional` | `[role=group]:is(:optional, [data-optional]) &, [data-group]:is(:optional, [data-optional]) &, .group:is(:optional, [data-optional]) &` | | `_groupPlaceholderShown` | `[role=group]:placeholder-shown &, [data-group]:placeholder-shown &, .group:placeholder-shown &` | | `_groupPressed` | `[role=group]:is([data-pressed], [aria-pressed=true]) &, [data-group]:is([data-pressed], [aria-pressed=true]) &, .group:is([data-pressed], [aria-pressed=true]) &` | | `_groupRange` | `[role=group]:is([data-range]) &, [data-group]:is([data-range]) &, .group:is([data-range]) &` | | `_groupReadOnly` | `[role=group]:is([readonly], [data-readonly], [aria-readonly=true]) &, [data-group]:is([readonly], [data-readonly], [aria-readonly=true]) &, .group:is([readonly], [data-readonly], [aria-readonly=true]) &` | | `_groupReadWrite` | `[role=group]:is(:read-write, [data-read-write]) &, [data-group]:is(:read-write, [data-read-write]) &, .group:is(:read-write, [data-read-write]) &` | | `_groupReject` | `[role=group][data-reject] &, [data-group][data-reject] &, .group[data-reject] &` | | `_groupRequired` | `[role=group]:is(:required, [required]) &, [data-group]:is(:required, [required]) &, .group:is(:required, [required]) &` | | `_groupSelected` | `[role=group]:is([data-selected], [aria-selected=true]) &, [data-group]:is([data-selected], [aria-selected=true]) &, .group:is([data-selected], [aria-selected=true]) &` | | `_groupUserInvalid` | `[role=group]:is(:user-invalid, [data-user-invalid]) &, [data-group]:is(:user-invalid, [data-user-invalid]) &, .group:is(:user-invalid, [data-user-invalid]) &` | | `_groupValid` | `[role=group]:is(:valid, [data-valid]) &, [data-group]:is(:valid, [data-valid]) &, .group:is(:valid, [data-valid]) &` | | `_groupVertical` | `[role=group]:is([data-orientation=vertical], [aria-orientation=vertical]) &, [data-group]:is([data-orientation=vertical], [aria-orientation=vertical]) &, .group:is([data-orientation=vertical], [aria-orientation=vertical]) &` | | `_hasGroup` | `&:is(:has(> [role=group]), :has(> [data-group]), :has(> .group))` | | `_hasIcon` | `&:has(> [data-icon])` | | `_hidden` | `&:is([hidden], [data-hidden])` | | `_idle` | `&[data-idle]` | | `_inactive` | `&[data-inactive]` | | `_incomplete` | `&[data-incomplete]` | | `_light` | `:host([data-mode=light]) &, .light &:not([data-mode]), [data-mode=light] &:not([data-mode]), &[data-mode=light]` | | `_loaded` | `&[data-loaded]` | | `_loading` | `&:is([data-loading], [aria-busy=true])` | | `_ltr` | `[dir=ltr] &` | | `_nativeHidden` | `&[hidden]` | | `_never` | `&[data-never]` | | `_notAllowed` | `&[data-not-allowed]` | | `_notCurrent` | `&:not([aria-current], [data-current]), &[aria-current='false']` | | `_notFallback` | `&:not([data-fallback])` | | `_notHasGroup` | `&:not(:has(> [role=group]), :has(> [data-group]), :has(> .group))` | | `_notSelected` | `&:not([data-selected]):not([aria-selected=true])` | | `_numeric` | `&[data-numeric]` | | `_open` | `&:is([open], [data-open])` | | `_peer` | `&:has(~ [data-peer]), [data-peer] ~ &, &:has(~ .peer), .peer ~ &` | | `_peerAccept` | `&:has(~ [data-peer][data-accept]), [data-peer][data-accept] ~ &, &:has(~ .peer[data-accept]), .peer[data-accept] ~ &, &:has(~ [data-peer] *[data-accept]), [data-peer]:has(*[data-accept]) ~ &, &:has(~ .peer *[data-accept]), .peer:has(*[data-accept]) ~ &` | | `_peerActive` | `&:has(~ [data-peer]:is(:active, [data-active]):not(:disabled, [disabled], [aria-disabled=true], [data-disabled])), [data-peer]:is(:active, [data-active]):not(:disabled, [disabled], [aria-disabled=true], [data-disabled]) ~ &, &:has(~ .peer:is(:active, [data-active]):not(:disabled, [disabled], [aria-disabled=true], [data-disabled])), .peer:is(:active, [data-active]):not(:disabled, [disabled], [aria-disabled=true], [data-disabled]) ~ &, &:has(~ [data-peer] *:is(:active, [data-active]):not(:disabled, [disabled], [aria-disabled=true], [data-disabled])), [data-peer]:has(*:is(:active, [data-active]):not(:disabled, [disabled], [aria-disabled=true], [data-disabled])) ~ &, &:has(~ .peer *:is(:active, [data-active]):not(:disabled, [disabled], [aria-disabled=true], [data-disabled])), .peer:has(*:is(:active, [data-active]):not(:disabled, [disabled], [aria-disabled=true], [data-disabled])) ~ &` | | `_peerAnimated` | `&:has(~ [data-peer][data-animated]), [data-peer][data-animated] ~ &, &:has(~ .peer[data-animated]), .peer[data-animated] ~ &, &:has(~ [data-peer] *[data-animated]), [data-peer]:has(*[data-animated]) ~ &, &:has(~ .peer *[data-animated]), .peer:has(*[data-animated]) ~ &` | | `_peerBlank` | `&:has(~ [data-peer]:is(:blank, [data-blank])), [data-peer]:is(:blank, [data-blank]) ~ &, &:has(~ .peer:is(:blank, [data-blank])), .peer:is(:blank, [data-blank]) ~ &, &:has(~ [data-peer] *:is(:blank, [data-blank])), [data-peer]:has(*:is(:blank, [data-blank])) ~ &, &:has(~ .peer *:is(:blank, [data-blank])), .peer:has(*:is(:blank, [data-blank])) ~ &` | | `_peerChecked` | `&:has(~ [data-peer]:is(:checked, [data-checked], [aria-checked=true])), [data-peer]:is(:checked, [data-checked], [aria-checked=true]) ~ &, &:has(~ .peer:is(:checked, [data-checked], [aria-checked=true])), .peer:is(:checked, [data-checked], [aria-checked=true]) ~ &, &:has(~ [data-peer] *:is(:checked, [data-checked], [aria-checked=true])), [data-peer]:has(*:is(:checked, [data-checked], [aria-checked=true])) ~ &, &:has(~ .peer *:is(:checked, [data-checked], [aria-checked=true])), .peer:has(*:is(:checked, [data-checked], [aria-checked=true])) ~ &` | | `_peerCollapsed` | `&:has(~ [data-peer]:is([data-collapsed], :not([data-expanded]), [aria-expanded=false])), [data-peer]:is([data-collapsed], :not([data-expanded]), [aria-expanded=false]) ~ &, &:has(~ .peer:is([data-collapsed], :not([data-expanded]), [aria-expanded=false])), .peer:is([data-collapsed], :not([data-expanded]), [aria-expanded=false]) ~ &, &:has(~ [data-peer] *:is([data-collapsed], :not([data-expanded]), [aria-expanded=false])), [data-peer]:has(*:is([data-collapsed], :not([data-expanded]), [aria-expanded=false])) ~ &, &:has(~ .peer *:is([data-collapsed], :not([data-expanded]), [aria-expanded=false])), .peer:has(*:is([data-collapsed], :not([data-expanded]), [aria-expanded=false])) ~ &` | | `_peerComplete` | `&:has(~ [data-peer][data-complete]), [data-peer][data-complete] ~ &, &:has(~ .peer[data-complete]), .peer[data-complete] ~ &, &:has(~ [data-peer] *[data-complete]), [data-peer]:has(*[data-complete]) ~ &, &:has(~ .peer *[data-complete]), .peer:has(*[data-complete]) ~ &` | | `_peerCurrent` | `&:has(~ [data-peer]:is([aria-current], [data-current]):not([aria-current='false'])), [data-peer]:is([aria-current], [data-current]):not([aria-current='false']) ~ &, &:has(~ .peer:is([aria-current], [data-current]):not([aria-current='false'])), .peer:is([aria-current], [data-current]):not([aria-current='false']) ~ &, &:has(~ [data-peer] *:is([aria-current], [data-current]):not([aria-current='false'])), [data-peer]:has(*:is([aria-current], [data-current]):not([aria-current='false'])) ~ &, &:has(~ .peer *:is([aria-current], [data-current]):not([aria-current='false'])), .peer:has(*:is([aria-current], [data-current]):not([aria-current='false'])) ~ &` | | `_peerDisabled` | `&:has(~ [data-peer]:is(:disabled, [disabled], [data-disabled])), [data-peer]:is(:disabled, [disabled], [data-disabled]) ~ &, &:has(~ .peer:is(:disabled, [disabled], [data-disabled])), .peer:is(:disabled, [disabled], [data-disabled]) ~ &, &:has(~ [data-peer] *:is(:disabled, [disabled], [data-disabled])), [data-peer]:has(*:is(:disabled, [disabled], [data-disabled])) ~ &, &:has(~ .peer *:is(:disabled, [disabled], [data-disabled])), .peer:has(*:is(:disabled, [disabled], [data-disabled])) ~ &` | | `_peerEnabled` | `&:has(~ [data-peer]:is(:enabled, [data-enabled])), [data-peer]:is(:enabled, [data-enabled]) ~ &, &:has(~ .peer:is(:enabled, [data-enabled])), .peer:is(:enabled, [data-enabled]) ~ &, &:has(~ [data-peer] *:is(:enabled, [data-enabled])), [data-peer]:has(*:is(:enabled, [data-enabled])) ~ &, &:has(~ .peer *:is(:enabled, [data-enabled])), .peer:has(*:is(:enabled, [data-enabled])) ~ &` | | `_peerExpanded` | `&:has(~ [data-peer]:is([data-expanded], [aria-expanded=true])), [data-peer]:is([data-expanded], [aria-expanded=true]) ~ &, &:has(~ .peer:is([data-expanded], [aria-expanded=true])), .peer:is([data-expanded], [aria-expanded=true]) ~ &, &:has(~ [data-peer] *:is([data-expanded], [aria-expanded=true])), [data-peer]:has(*:is([data-expanded], [aria-expanded=true])) ~ &, &:has(~ .peer *:is([data-expanded], [aria-expanded=true])), .peer:has(*:is([data-expanded], [aria-expanded=true])) ~ &` | | `_peerFocus` | `&:has(~ [data-peer]:is(:focus, [data-focus])), [data-peer]:is(:focus, [data-focus]) ~ &, &:has(~ .peer:is(:focus, [data-focus])), .peer:is(:focus, [data-focus]) ~ &, &:has(~ [data-peer] *:is(:focus, [data-focus])), [data-peer]:has(*:is(:focus, [data-focus])) ~ &, &:has(~ .peer *:is(:focus, [data-focus])), .peer:has(*:is(:focus, [data-focus])) ~ &` | | `_peerFocusVisible` | `&:has(~ [data-peer]:is(:focus-visible, [data-focus-visible])), [data-peer]:is(:focus-visible, [data-focus-visible]) ~ &, &:has(~ .peer:is(:focus-visible, [data-focus-visible])), .peer:is(:focus-visible, [data-focus-visible]) ~ &, &:has(~ [data-peer] *:is(:focus-visible, [data-focus-visible])), [data-peer]:has(*:is(:focus-visible, [data-focus-visible])) ~ &, &:has(~ .peer *:is(:focus-visible, [data-focus-visible])), .peer:has(*:is(:focus-visible, [data-focus-visible])) ~ &` | | `_peerFocusWithin` | `&:has(~ [data-peer]:not(:focus-within, [data-focus-within])), [data-peer]:not(:focus-within, [data-focus-within]) ~ &, &:has(~ .peer:not(:focus-within, [data-focus-within])), .peer:not(:focus-within, [data-focus-within]) ~ &, &:has(~ [data-peer] *:not(:focus-within, [data-focus-within])), [data-peer]:has(*:not(:focus-within, [data-focus-within])) ~ &, &:has(~ .peer *:not(:focus-within, [data-focus-within])), .peer:has(*:not(:focus-within, [data-focus-within])) ~ &` | | `_peerGrabbed` | `&:has(~ [data-peer]:is([data-grabbed], [aria-grabbed=true])), [data-peer]:is([data-grabbed], [aria-grabbed=true]) ~ &, &:has(~ .peer:is([data-grabbed], [aria-grabbed=true])), .peer:is([data-grabbed], [aria-grabbed=true]) ~ &, &:has(~ [data-peer] *:is([data-grabbed], [aria-grabbed=true])), [data-peer]:has(*:is([data-grabbed], [aria-grabbed=true])) ~ &, &:has(~ .peer *:is([data-grabbed], [aria-grabbed=true])), .peer:has(*:is([data-grabbed], [aria-grabbed=true])) ~ &` | | `_peerHorizontal` | `&:has(~ [data-peer]:is([data-orientation=horizontal], [aria-orientation=horizontal])), [data-peer]:is([data-orientation=horizontal], [aria-orientation=horizontal]) ~ &, &:has(~ .peer:is([data-orientation=horizontal], [aria-orientation=horizontal])), .peer:is([data-orientation=horizontal], [aria-orientation=horizontal]) ~ &, &:has(~ [data-peer] *:is([data-orientation=horizontal], [aria-orientation=horizontal])), [data-peer]:has(*:is([data-orientation=horizontal], [aria-orientation=horizontal])) ~ &, &:has(~ .peer *:is([data-orientation=horizontal], [aria-orientation=horizontal])), .peer:has(*:is([data-orientation=horizontal], [aria-orientation=horizontal])) ~ &` | | `_peerHover` | `&:has(~ [data-peer]:is(:hover, [data-hover]):not(:disabled, [disabled], [aria-disabled=true], [data-disabled])), [data-peer]:is(:hover, [data-hover]):not(:disabled, [disabled], [aria-disabled=true], [data-disabled]) ~ &, &:has(~ .peer:is(:hover, [data-hover]):not(:disabled, [disabled], [aria-disabled=true], [data-disabled])), .peer:is(:hover, [data-hover]):not(:disabled, [disabled], [aria-disabled=true], [data-disabled]) ~ &, &:has(~ [data-peer] *:is(:hover, [data-hover]):not(:disabled, [disabled], [aria-disabled=true], [data-disabled])), [data-peer]:has(*:is(:hover, [data-hover]):not(:disabled, [disabled], [aria-disabled=true], [data-disabled])) ~ &, &:has(~ .peer *:is(:hover, [data-hover]):not(:disabled, [disabled], [aria-disabled=true], [data-disabled])), .peer:has(*:is(:hover, [data-hover]):not(:disabled, [disabled], [aria-disabled=true], [data-disabled])) ~ &` | | `_peerIdle` | `&:has(~ [data-peer][data-idle]), [data-peer][data-idle] ~ &, &:has(~ .peer[data-idle]), .peer[data-idle] ~ &, &:has(~ [data-peer] *[data-idle]), [data-peer]:has(*[data-idle]) ~ &, &:has(~ .peer *[data-idle]), .peer:has(*[data-idle]) ~ &` | | `_peerIncomplete` | `&:has(~ [data-peer][data-incomplete]), [data-peer][data-incomplete] ~ &, &:has(~ .peer[data-incomplete]), .peer[data-incomplete] ~ &, &:has(~ [data-peer] *[data-incomplete]), [data-peer]:has(*[data-incomplete]) ~ &, &:has(~ .peer *[data-incomplete]), .peer:has(*[data-incomplete]) ~ &` | | `_peerInvalid` | `&:has(~ [data-peer]:is([data-invalid], [aria-invalid=true])), [data-peer]:is([data-invalid], [aria-invalid=true]) ~ &, &:has(~ .peer:is([data-invalid], [aria-invalid=true])), .peer:is([data-invalid], [aria-invalid=true]) ~ &, &:has(~ [data-peer] *:is([data-invalid], [aria-invalid=true])), [data-peer]:has(*:is([data-invalid], [aria-invalid=true])) ~ &, &:has(~ .peer *:is([data-invalid], [aria-invalid=true])), .peer:has(*:is([data-invalid], [aria-invalid=true])) ~ &` | | `_peerLoaded` | `&:has(~ [data-peer][data-loaded]), [data-peer][data-loaded] ~ &, &:has(~ .peer[data-loaded]), .peer[data-loaded] ~ &, &:has(~ [data-peer] *[data-loaded]), [data-peer]:has(*[data-loaded]) ~ &, &:has(~ .peer *[data-loaded]), .peer:has(*[data-loaded]) ~ &` | | `_peerLoading` | `&:has(~ [data-peer]:is([data-loading], [aria-busy=true])), [data-peer]:is([data-loading], [aria-busy=true]) ~ &, &:has(~ .peer:is([data-loading], [aria-busy=true])), .peer:is([data-loading], [aria-busy=true]) ~ &, &:has(~ [data-peer] *:is([data-loading], [aria-busy=true])), [data-peer]:has(*:is([data-loading], [aria-busy=true])) ~ &, &:has(~ .peer *:is([data-loading], [aria-busy=true])), .peer:has(*:is([data-loading], [aria-busy=true])) ~ &` | | `_peerOptional` | `&:has(~ [data-peer]:is(:optional, [data-optional])), [data-peer]:is(:optional, [data-optional]) ~ &, &:has(~ .peer:is(:optional, [data-optional])), .peer:is(:optional, [data-optional]) ~ &, &:has(~ [data-peer] *:is(:optional, [data-optional])), [data-peer]:has(*:is(:optional, [data-optional])) ~ &, &:has(~ .peer *:is(:optional, [data-optional])), .peer:has(*:is(:optional, [data-optional])) ~ &` | | `_peerPlaceholderShown` | `&:has(~ [data-peer]:placeholder-shown), [data-peer]:placeholder-shown ~ &, &:has(~ .peer:placeholder-shown), .peer:placeholder-shown ~ &, &:has(~ [data-peer] *:placeholder-shown), [data-peer]:has(*:placeholder-shown) ~ &, &:has(~ .peer *:placeholder-shown), .peer:has(*:placeholder-shown) ~ &` | | `_peerPressed` | `&:has(~ [data-peer]:is([data-pressed], [aria-pressed=true])), [data-peer]:is([data-pressed], [aria-pressed=true]) ~ &, &:has(~ .peer:is([data-pressed], [aria-pressed=true])), .peer:is([data-pressed], [aria-pressed=true]) ~ &, &:has(~ [data-peer] *:is([data-pressed], [aria-pressed=true])), [data-peer]:has(*:is([data-pressed], [aria-pressed=true])) ~ &, &:has(~ .peer *:is([data-pressed], [aria-pressed=true])), .peer:has(*:is([data-pressed], [aria-pressed=true])) ~ &` | | `_peerRange` | `&:has(~ [data-peer]:is([data-range])), [data-peer]:is([data-range]) ~ &, &:has(~ .peer:is([data-range])), .peer:is([data-range]) ~ &, &:has(~ [data-peer] *:is([data-range])), [data-peer]:has(*:is([data-range])) ~ &, &:has(~ .peer *:is([data-range])), .peer:has(*:is([data-range])) ~ &` | | `_peerReadOnly` | `&:has(~ [data-peer]:is([readonly], [data-readonly], [aria-readonly=true])), [data-peer]:is([readonly], [data-readonly], [aria-readonly=true]) ~ &, &:has(~ .peer:is([readonly], [data-readonly], [aria-readonly=true])), .peer:is([readonly], [data-readonly], [aria-readonly=true]) ~ &, &:has(~ [data-peer] *:is([readonly], [data-readonly], [aria-readonly=true])), [data-peer]:has(*:is([readonly], [data-readonly], [aria-readonly=true])) ~ &, &:has(~ .peer *:is([readonly], [data-readonly], [aria-readonly=true])), .peer:has(*:is([readonly], [data-readonly], [aria-readonly=true])) ~ &` | | `_peerReadWrite` | `&:has(~ [data-peer]:is(:read-write, [data-read-write])), [data-peer]:is(:read-write, [data-read-write]) ~ &, &:has(~ .peer:is(:read-write, [data-read-write])), .peer:is(:read-write, [data-read-write]) ~ &, &:has(~ [data-peer] *:is(:read-write, [data-read-write])), [data-peer]:has(*:is(:read-write, [data-read-write])) ~ &, &:has(~ .peer *:is(:read-write, [data-read-write])), .peer:has(*:is(:read-write, [data-read-write])) ~ &` | | `_peerReject` | `&:has(~ [data-peer][data-reject]), [data-peer][data-reject] ~ &, &:has(~ .peer[data-reject]), .peer[data-reject] ~ &, &:has(~ [data-peer] *[data-reject]), [data-peer]:has(*[data-reject]) ~ &, &:has(~ .peer *[data-reject]), .peer:has(*[data-reject]) ~ &` | | `_peerRequired` | `&:has(~ [data-peer]:is(:required, [required])), [data-peer]:is(:required, [required]) ~ &, &:has(~ .peer:is(:required, [required])), .peer:is(:required, [required]) ~ &, &:has(~ [data-peer] *:is(:required, [required])), [data-peer]:has(*:is(:required, [required])) ~ &, &:has(~ .peer *:is(:required, [required])), .peer:has(*:is(:required, [required])) ~ &` | | `_peerSelected` | `&:has(~ [data-peer]:is([data-selected], [aria-selected=true])), [data-peer]:is([data-selected], [aria-selected=true]) ~ &, &:has(~ .peer:is([data-selected], [aria-selected=true])), .peer:is([data-selected], [aria-selected=true]) ~ &, &:has(~ [data-peer] *:is([data-selected], [aria-selected=true])), [data-peer]:has(*:is([data-selected], [aria-selected=true])) ~ &, &:has(~ .peer *:is([data-selected], [aria-selected=true])), .peer:has(*:is([data-selected], [aria-selected=true])) ~ &` | | `_peerUserInvalid` | `&:has(~ [data-peer]:is(:user-invalid, [data-user-invalid])), [data-peer]:is(:user-invalid, [data-user-invalid]) ~ &, &:has(~ .peer:is(:user-invalid, [data-user-invalid])), .peer:is(:user-invalid, [data-user-invalid]) ~ &, &:has(~ [data-peer] *:is(:user-invalid, [data-user-invalid])), [data-peer]:has(*:is(:user-invalid, [data-user-invalid])) ~ &, &:has(~ .peer *:is(:user-invalid, [data-user-invalid])), .peer:has(*:is(:user-invalid, [data-user-invalid])) ~ &` | | `_peerValid` | `&:has(~ [data-peer]:is(:valid, [data-valid])), [data-peer]:is(:valid, [data-valid]) ~ &, &:has(~ .peer:is(:valid, [data-valid])), .peer:is(:valid, [data-valid]) ~ &, &:has(~ [data-peer] *:is(:valid, [data-valid])), [data-peer]:has(*:is(:valid, [data-valid])) ~ &, &:has(~ .peer *:is(:valid, [data-valid])), .peer:has(*:is(:valid, [data-valid])) ~ &` | | `_peerVertical` | `&:has(~ [data-peer]:is([data-orientation=vertical], [aria-orientation=vertical])), [data-peer]:is([data-orientation=vertical], [aria-orientation=vertical]) ~ &, &:has(~ .peer:is([data-orientation=vertical], [aria-orientation=vertical])), .peer:is([data-orientation=vertical], [aria-orientation=vertical]) ~ &, &:has(~ [data-peer] *:is([data-orientation=vertical], [aria-orientation=vertical])), [data-peer]:has(*:is([data-orientation=vertical], [aria-orientation=vertical])) ~ &, &:has(~ .peer *:is([data-orientation=vertical], [aria-orientation=vertical])), .peer:has(*:is([data-orientation=vertical], [aria-orientation=vertical])) ~ &` | | `_pressed` | `&:is([data-pressed], [aria-pressed=true])` | | `_range` | `&:is([data-range])` | | `_reject` | `&[data-reject]` | | `_ripple` | `& .ui-ripple` | | `_rtl` | `[dir=rtl] &` | | `_selected` | `&:is([data-selected], [aria-selected=true])` | | `_start` | `&:is([data-start], [data-group-start])` | # Text Styles --- title: Text Styles description: "Yamada UI provides features to create reusable styles." --- # Text Styles Yamada UI provides features to create reusable styles. ## Overview Text styles are tokens that are used to reuse text styles across the project. The styles defined in the theme are [here](https://github.com/yamada-ui/yamada-ui/blob/main/packages/react/src/theme/styles/text-styles.ts). ```tsx Mono ``` ```tsx export const textStyles = defineStyles.textStyle({ ghost: { color: "colorScheme.outline", }, mono: { fontFamily: "mono", fontWeight: "medium", letterSpacing: "widest", whiteSpace: "nowrap", }, outline: { color: "colorScheme.outline", }, solid: { color: "colorScheme.contrast", }, subtle: { color: "colorScheme.fg", }, surface: { color: "colorScheme.fg", }, }) ``` ## Customize ### Generate a Theme Use the [CLI](https://yamada-ui.com/docs/theming/cli.md) to generate a theme. :::warning Before running the following commands, you need to install `@yamada-ui/cli` and execute the `init` command. For more details, please see [here](https://yamada-ui.com/docs/get-started/cli.md). ::: ```bash pnpm yamada-cli theme ``` ```bash npm yamada-cli theme ``` ```bash yarn yamada-cli theme ``` ```bash bun yamada-cli theme ``` ### Change the Style Change the `styles/text-styles.ts` in the generated theme. ```tsx import { defineStyles } from "@yamada-ui/react" export const textStyles = defineStyles.textStyle({ gradient: { bgClip: "text", bgGradient: "linear(to-l, #7928CA, #FF0080)", fontSize: "5xl", w: "full", }, ghost: { color: "colorScheme.outline", }, mono: { fontFamily: "mono", fontWeight: "medium", letterSpacing: "widest", whiteSpace: "nowrap", }, outline: { color: "colorScheme.outline", }, solid: { color: "colorScheme.contrast", }, subtle: { color: "colorScheme.fg", }, surface: { color: "colorScheme.fg", }, }) ``` ### Update the Provider Set the generated theme to `UIProvider`. ```tsx import { UIProvider } from "@workspaces/ui" import { theme } from "@workspace/theme" const App = () => { return ( ) } ``` ### Use Text Style Set the value to `textStyle`. ```tsx ``` # Breakpoints --- title: Breakpoints description: "Learn how to customize breakpoints." --- # Breakpoints Learn how to customize breakpoints. :::tip Responsive design overview is [here](https://yamada-ui.com/docs/styling/responsive-design.md). ::: ## Overview Breakpoints are tokens used for responsive design, such as [Responsive Design](https://yamada-ui.com/docs/styling/responsive-design.md). The breakpoints defined in the theme are [here](https://github.com/yamada-ui/yamada-ui/blob/main/packages/react/src/theme/tokens/breakpoints.ts). ```tsx export const breakpoints = defineTokens.breakpoints({ sm: "30em", md: "48em", lg: "61em", xl: "80em", "2xl": "90em", }) ``` ## Customize ### Generate a Theme Use the [CLI](https://yamada-ui.com/docs/theming/cli.md) to generate a theme. :::warning Before running the following commands, you need to install `@yamada-ui/cli` and execute the `init` command. For more details, please see [here](https://yamada-ui.com/docs/get-started/cli.md). ::: ```bash pnpm yamada-cli theme ``` ```bash npm yamada-cli theme ``` ```bash yarn yamada-cli theme ``` ```bash bun yamada-cli theme ``` ### Change the Token Change the `tokens/breakpoints.ts` in the generated theme. ```tsx import { defineTokens } from "@yamada-ui/react" export const breakpoints = defineTokens.breakpoints({ sm: "27em", // [!code highlight] md: "48em", lg: "61em", xl: "80em", "2xl": "90em", }) ``` ### Update the Provider Set the generated theme to the `UIProvider`. ```tsx import { UIProvider } from "@workspaces/ui" import { theme } from "@workspace/theme" const App = () => { return ( ) } ``` ## Media Queries By default, the responsive design uses the `@media(max-width)` media query. ```tsx const config = defineConfig({ breakpoint: { direction: "up" } }) const Component: FC<{ query: string }> = ({ query }) => { const breakpoint = useBreakpoint() return ( The breakpoint when using{" "} {query} {" "} is "{breakpoint}". ) } return ( ) ``` If you want to use the `@media(min-width)` media query, set the `breakpoint.direction` to `"up"` in the config. ### Change the Config Change the `config.ts` in the generated theme. ```tsx import { defineConfig } from "@yamada-ui/react" export const config = defineConfig({ css: { varPrefix: "ui" }, breakpoint: { direction: "up", identifier: "@media screen" }, // [!code highlight] defaultColorMode: "light", defaultThemeScheme: "base", notice: { duration: 5000 }, theme: { responsive: true }, }) ``` ### Update the Provider Set the generated theme to `UIProvider`. ```tsx import { UIProvider } from "@workspaces/ui" import { theme, config } from "@workspace/theme" const App = () => { return ( ) } ``` ## Container Queries The responsive design uses the media query. If you want to use the container query, set the `breakpoint.identifier` to `"@container"` in the config. ```tsx const containerRef = useRef(null) const config = defineConfig({ breakpoint: { containerRef, identifier: "@container" }, }) const Component: FC<{ query: string }> = ({ query }) => { const breakpoint = useBreakpoint() return ( The breakpoint when using{" "} {query} {" "} is "{breakpoint}". ) } return ( ) ``` # Cascade Layers --- title: Cascade Layers description: "Learn how to customize CSS Cascade Layers." --- # Cascade Layers Learn how to customize CSS Cascade Layers. :::tip Cascade Layers overview is [here](https://yamada-ui.com/docs/styling/cascade-layers.md). ::: ## Customize ### Generate a Theme Use the [CLI](https://yamada-ui.com/docs/theming/cli.md) to generate a theme. :::warning Before running the following commands, you need to install `@yamada-ui/cli` and execute the `init` command. For more details, please see [here](https://yamada-ui.com/docs/get-started/cli.md). ::: ```bash pnpm yamada-cli theme ``` ```bash npm yamada-cli theme ``` ```bash yarn yamada-cli theme ``` ```bash bun yamada-cli theme ``` ### Change the Config Change the `config.ts` in the generated theme. ```tsx import type { LayersConfig } from "@yamada-ui/react" import { defineConfig } from "@yamada-ui/react" export const layers: LayersConfig = { tokens: { name: "tokens", order: 0 }, reset: { name: "reset", order: 1 }, global: { name: "global", order: 2 }, base: { name: "base", order: 3 }, size: { name: "size", order: 4 }, variant: { name: "variant", order: 5 }, props: { name: "props", order: 6 }, compounds: { name: "compounds", order: 7 }, } export const config = defineConfig({ css: { layers, varPrefix: "ui" }, breakpoint: { direction: "down", identifier: "@media screen" }, defaultColorMode: "dark", defaultThemeScheme: "base", notice: { duration: 5000 }, theme: { responsive: true }, }) ``` ### Update the Provider Set the generated theme to `UIProvider`. ```tsx import { UIProvider } from "@workspaces/ui" import { theme, config } from "@workspace/theme" const App = () => { return ( ) } ``` ## Disable To disable the cascade layers, set `css.layers` to `false`. ```tsx import { defineConfig } from "@yamada-ui/react" export const config = defineConfig({ css: { layers: false, varPrefix: "ui" }, // [!code highlight] breakpoint: { direction: "down", identifier: "@media screen" }, defaultColorMode: "dark", defaultThemeScheme: "base", notice: { duration: 5000 }, theme: { responsive: true }, }) ``` # CLI --- title: CLI description: "Learn how to generate themes using CLI commands." --- # CLI Learn how to generate themes using CLI commands. ## Usage :::warning Before running the following commands, you need to install `@yamada-ui/cli` and execute the `init` command. For more details, please see [here](https://yamada-ui.com/docs/get-started/cli.md). ::: ### Generate a Theme When you run the `theme` command, the theme will be generated at the specified path. ```bash pnpm yamada-cli theme ``` ```bash npm yamada-cli theme ``` ```bash yarn yamada-cli theme ``` ```bash bun yamada-cli theme ``` :::note If you don't specify a path, the theme will be generated in `./theme`. ::: ```bash Usage: pnpm yamada-cli theme [options] [path] generate theme to your project. Arguments: path path to the theme directory. Options: --cwd current working directory. -c, --config path to the config file. (default: "ui.json") -o, --overwrite overwrite existing directory. (default: false) -j, --js use js instead of ts. -y, --yes skip all confirmation prompts. (default: false) -p, --package-name package name (for monorepo). -s, --src use src/ directory. --no-src do not use src/ directory. -i, --install install dependencies when choice is monorepo. --no-install do not install dependencies when choice is monorepo. -f, --format format the output files. --no-format do not format the output files. -l, --lint lint the output files. --no-lint do not lint the output files. -t, --tag tag for the registries (e.g. dev, next). -h, --help display help for command ``` ### Check the Differences When you run the `diff` command, you can check the difference between the local and remote themes. ```bash pnpm yamada-cli diff theme ``` ```bash npm yamada-cli diff theme ``` ```bash yarn yamada-cli diff theme ``` ```bash bun yamada-cli diff theme ``` ```bash Usage: pnpm yamada-cli diff [options] [component] check for updates against the registry. Arguments: component component to check. Options: --cwd current working directory. -c, --config path to the config file. (default: "ui.json") -s, --sequential run tasks sequentially. (default: false) -d, --detail show detailed changes. (default: false) -y, --yes skip all confirmation prompts. (default: false) -u, --update update files when there are file diff. --no-update do not update files when there are file diff. -i, --install install dependencies when updating files. --no-install do not install dependencies when updating files. -t, --tag tag for the registries (e.g. dev, next). -h, --help display help for command ``` ### Update the theme When you run the `update` command, the theme will be updated. ```bash pnpm yamada-cli update theme ``` ```bash npm yamada-cli update theme ``` ```bash yarn yamada-cli update theme ``` ```bash bun yamada-cli update theme ``` ```bash Usage: pnpm yamada-cli update [options] [components...] update components in your project. Arguments: components components to update. Options: --cwd current working directory. -c, --config path to the config file. (default: "ui.json") -s, --sequential run tasks sequentially. (default: false) -F, --force force update, overwriting local changes. (default: false) -y, --yes skip all confirmation prompts. (default: false) -i, --install install dependencies. --no-install do not install dependencies. -f, --format format the output files. --no-format do not format the output files. -l, --lint lint the output files. --no-lint do not lint the output files. -t, --tag tag for the registries (e.g. dev, next). -h, --help display help for command ``` ### Update typings When you run the `tokens` command, you can update the customized theme typings. This typings are used for [Style Props](https://yamada-ui.com/docs/styling/style-props.md). ```bash pnpm yamada-cli tokens ``` ```bash npm yamada-cli tokens ``` ```bash yarn yamada-cli tokens ``` ```bash bun yamada-cli tokens ``` :::note If you don't specify a path, the `theme.path` will be used. ::: ```bash Usage: pnpm yamada-cli tokens [options] [path] generate theme typings. Arguments: path path to the theme file. Options: --cwd current working directory. -c, --config path to the config file. (default: "ui.json") -o, --out output path. -f, --format format the output file. --no-format do not format the output file. -l, --lint lint the output file. --no-lint do not lint the output file. --internal generate internal tokens. (default: false) -h, --help display help for command ``` # Color Mode --- title: Color Mode description: "Learn how to customize color mode." --- # Color Mode Learn how to customize color mode. :::tip Color Mode overview is [here](https://yamada-ui.com/docs/styling/color-mode.md). ::: ## Customize By default, the color mode is set to `"light"`. If you want to use `"dark"` or `"system"`, set the value to `config.defaultColorMode`. ### Generate a Theme Use the [CLI](https://yamada-ui.com/docs/theming/cli.md) to generate a theme. :::warning Before running the following commands, you need to install `@yamada-ui/cli` and execute the `init` command. For more details, please see [here](https://yamada-ui.com/docs/get-started/cli.md). ::: ```bash pnpm yamada-cli theme ``` ```bash npm yamada-cli theme ``` ```bash yarn yamada-cli theme ``` ```bash bun yamada-cli theme ``` ### Change the Config Change the `config.ts` in the generated theme. ```tsx import { defineConfig } from "@yamada-ui/react" export const config = defineConfig({ css: { varPrefix: "ui" }, breakpoint: { direction: "down", identifier: "@media screen" }, defaultColorMode: "dark", // [!code highlight] defaultThemeScheme: "base", notice: { duration: 5000 }, theme: { responsive: true }, }) ``` ### Update the Provider Set the generated theme to `UIProvider`. ```tsx import { UIProvider } from "@workspaces/ui" import { theme, config } from "@workspace/theme" const App = () => { return ( ) } ``` # Customization --- title: Customization description: "Learn how to customize the theme of Yamada UI." --- # Customization Learn how to customize the theme of Yamada UI. ## Setup ### Generate a Theme Use the [CLI](https://yamada-ui.com/docs/theming/cli.md) to generate a theme. :::warning Before running the following commands, you need to install `@yamada-ui/cli` and execute the `init` command. For more details, please see [here](https://yamada-ui.com/docs/get-started/cli.md). ::: ```bash pnpm yamada-cli theme ``` ```bash npm yamada-cli theme ``` ```bash yarn yamada-cli theme ``` ```bash bun yamada-cli theme ``` ### Update the Provider Set the generated theme to `UIProvider`. ```tsx import { UIProvider } from "@workspaces/ui" import { theme } from "@workspace/theme" const App = () => { return ( ) } ``` ## Change the Color Scheme To change the color scheme that is applied to the entire project, change the `styles/global-style.ts`. ```tsx import { defineStyles } from "@yamada-ui/react" export const globalStyle = defineStyles.globalStyle({ "*, *::before, *::after": { borderColor: "border", borderStyle: "solid", borderWidth: "0", focusVisibleRing: "outline", fontFeatureSettings: '"cv11"', overflowWrap: "break-word", }, "*::placeholder, *[data-placeholder]": { color: "fg.subtle", }, body: { colorScheme: "blue", // [!code highlight] bg: "bg", color: "fg", fontFamily: "body", lineHeight: "moderate", overflowX: "hidden", transitionDuration: "moderate", transitionProperty: "background-color", }, }) ``` ## Add a Color Scheme To add a color scheme that is used in the project, change the `semantic-tokens/color-schemes.ts`. ```tsx import { defineSemanticTokens } from "@yamada-ui/react" export const colorSchemes = defineSemanticTokens.colorSchemes({ accent: "cyan", // [!code highlight] danger: "red", error: "red", info: "blue", link: "blue", mono: ["black", "white"], primary: ["black", "white"], secondary: "gray", success: "green", warning: "orange", }) ``` ## Change the Background Color of the Application To change the background color of the application, change the `semantic-tokens/colors.ts`. ```tsx import { defineSemanticTokens } from "@yamada-ui/react" export const colors = defineSemanticTokens.colors({ ... black: { base: "#000000", // [!code highlight] bg: "#f8f8f8", contrast: "white", emphasized: "black.200", fg: "black.800", ghost: "black.100/50", muted: "black.100", outline: "black.900", solid: "black", subtle: "black.50", }, white: { base: "#fafafa", // [!code highlight] bg: "#161616", contrast: "black", emphasized: "white.400/50", fg: "white.900", ghost: "white.200/50", muted: "white.300/50", outline: "white.800", solid: "white", subtle: "white.200/50", }, ... }) ``` # Theming --- title: Theming description: "The theme of Yamada UI is customizable and ensures the consistency of the application's design." --- # Theming The theme of Yamada UI is customizable and ensures the consistency of the application's design. ## Styles Here's a list of all the styles available in the library. - [Global Styles](https://yamada-ui.com/docs/theming/styles/global-styles.md) - [Reset Styles](https://yamada-ui.com/docs/theming/styles/reset-styles.md) - [Layer Styles](https://yamada-ui.com/docs/theming/styles/layer-styles.md) - [Text Styles](https://yamada-ui.com/docs/theming/styles/text-styles.md) ## Design Tokens Here's a list of all the design tokens available in the library. - [Animations](https://yamada-ui.com/docs/theming/tokens/animations.md) - [Aspect Ratios](https://yamada-ui.com/docs/theming/tokens/aspect-ratios.md) - [Blurs](https://yamada-ui.com/docs/theming/tokens/blurs.md) - [Borders](https://yamada-ui.com/docs/theming/tokens/borders.md) - [Breakpoints](https://yamada-ui.com/docs/theming/tokens/breakpoints.md) - [Colors](https://yamada-ui.com/docs/theming/tokens/colors.md) - [Color Schemes](https://yamada-ui.com/docs/theming/tokens/color-schemes.md) - [Durations](https://yamada-ui.com/docs/theming/tokens/durations.md) - [Easings](https://yamada-ui.com/docs/theming/tokens/easings.md) - [Font Sizes](https://yamada-ui.com/docs/theming/tokens/font-sizes.md) - [Font Weights](https://yamada-ui.com/docs/theming/tokens/font-weights.md) - [Fonts](https://yamada-ui.com/docs/theming/tokens/fonts.md) - [Gradients](https://yamada-ui.com/docs/theming/tokens/gradients.md) - [Keyframes](https://yamada-ui.com/docs/theming/tokens/keyframes.md) - [Letter Spacings](https://yamada-ui.com/docs/theming/tokens/letter-spacings.md) - [Line Heights](https://yamada-ui.com/docs/theming/tokens/line-heights.md) - [Radii](https://yamada-ui.com/docs/theming/tokens/radii.md) - [Shadows](https://yamada-ui.com/docs/theming/tokens/shadows.md) - [Sizes](https://yamada-ui.com/docs/theming/tokens/sizes.md) - [Spaces](https://yamada-ui.com/docs/theming/tokens/spaces.md) - [Z Indices](https://yamada-ui.com/docs/theming/tokens/z-indices.md) # Switching Themes --- title: Switching Themes description: "Yamada UI provides the functionality for users to switch themes." --- # Switching Themes Yamada UI provides the functionality for users to switch themes. ## Setup ### Generate a Theme Use the [CLI](https://yamada-ui.com/docs/theming/cli.md) to generate a theme. :::warning Before running the following commands, you need to install `@yamada-ui/cli` and execute the `init` command. For more details, please see [here](https://yamada-ui.com/docs/get-started/cli.md). ::: ```bash pnpm yamada-cli theme ``` ```bash npm yamada-cli theme ``` ```bash yarn yamada-cli theme ``` ```bash bun yamada-cli theme ``` ### Add a Theme Change the `index.ts` in the generated theme. ```tsx import { defineTheme } from "@yamada-ui/react" import { semanticTokens } from "./semantic-tokens" import { styles } from "./styles" import { tokens } from "./tokens" export { config } from "./config" export const theme = defineTheme({ styles, ...tokens, semanticTokens, themeSchemes: { blue: { semanticTokens: { colorSchemes: { primary: "blue" } } }, red: { semanticTokens: { colorSchemes: { primary: "red" } } }, green: { semanticTokens: { colorSchemes: { primary: "green" } } }, }, }) export type Theme = typeof theme ``` ### Update the Provider Set the generated theme to `UIProvider`. ```tsx import { UIProvider } from "@workspaces/ui" import { theme } from "@workspace/theme" const App = () => { return ( ) } ``` ### Add a Logic Use `useTheme` to switch themes. `useTheme` returns the `themeScheme` and `changeThemeScheme` to change the theme scheme. ```tsx const { themeScheme, changeThemeScheme } = useTheme() return ( The current scheme is "{themeScheme}" Primary Secondary Primary Secondary ) ``` ## Change the Default Theme Scheme To change the default theme scheme, set the value to `config.ts` in `defaultThemeScheme`. ### Change the Config Change the `config.ts` in the generated theme. ```tsx import { defineConfig } from "@yamada-ui/react" export const config = defineConfig({ css: { varPrefix: "ui" }, breakpoint: { direction: "down", identifier: "@media screen" }, defaultColorMode: "dark", defaultThemeScheme: "blue", // [!code highlight] notice: { duration: 5000 }, theme: { responsive: true }, }) ``` ### Update the Provider Set the generated theme to `UIProvider`. ```tsx import { UIProvider } from "@workspaces/ui" import { theme, config } from "@workspace/theme" const App = () => { return ( ) } ``` # Next.js (App) --- title: Next.js (App) description: "A guide for installing and using Yamada UI with Next.js app directory." --- # Next.js (App) A guide for installing and using Yamada UI with Next.js app directory. ## Installation ### Create application Create Next.js application. ```bash pnpm create next-app my-app --typescript ``` ```bash npx create-next-app my-app --typescript ``` ```bash yarn create next-app my-app --typescript ``` ```bash bun create next-app my-app --typescript ``` ### Setup Running the command will create the necessary files and folders in your project. ```bash pnpm dlx @yamada-ui/cli init ``` ```bash npx @yamada-ui/cli init ``` ```bash yarn dlx @yamada-ui/cli init ``` ```bash bunx @yamada-ui/cli init ``` ### Install the package Install `@workspaces/ui` to your application. ```bash pnpm add "@workspaces/ui@workspace:*" ``` ```bash npm install "@workspaces/ui@workspace:*" ``` ```bash yarn add "@workspaces/ui@workspace:*" ``` ```bash bun add "@workspaces/ui@workspace:*" ``` ### Add provider After installing, add `UIProvider` to the root of your application. To suppress hydration errors, add `suppressHydrationWarning` to the `html` and `body` tags. ```tsx import { UIProvider } from "@workspaces/ui" export default function RootLayout({ children, }: { children: React.ReactNode }) { return ( {children} ) } ``` ### Use components After adding `UIProvider`, you can use the components in your application. ```tsx import { Button } from "@workspaces/ui" export default function Home() { return } ``` That's it! You've successfully set up Yamada UI. ## Scripts ### ColorModeScript To use [Color Mode](https://yamada-ui.com/docs/theming/color-mode.md), you need to add `ColorModeScript` to the `body` to ensure it works correctly. This is because color mode is implemented using `localStorage` or `cookies`, and adding the script ensures proper synchronization when the page loads. ```tsx import { UIProvider, ColorModeScript } from "@workspaces/ui" export default function RootLayout({ children, }: { children: React.ReactNode }) { return ( {children} ) } ``` If you change the `defaultColorMode` in your [config](https://yamada-ui.com/docs/theming/configuration/overview.md), set the `defaultValue` prop on `ColorModeScript`. ```tsx import { UIProvider, ColorModeScript } from "@workspaces/ui" import { config } from "@workspaces/theme" export default function RootLayout({ children, }: { children: React.ReactNode }) { return ( {children} ) } ``` ### ThemeSchemeScript To use [theme switching](https://yamada-ui.com/docs/theming/switching-themes.md), you need to add `ThemeSchemeScript` to the `body` to ensure it works correctly. This is because theme switching is implemented using `localStorage` or `cookies`, and adding the script ensures proper synchronization when the page loads. ```tsx import { UIProvider, ThemeSchemeScript } from "@workspaces/ui" export default function RootLayout({ children, }: { children: React.ReactNode }) { return ( {children} ) } ``` If you change the `defaultThemeScheme` in your [config](https://yamada-ui.com/docs/theming/configuration/overview.md), set the `defaultValue` prop on `ThemeSchemeScript`. ```tsx import { UIProvider, ThemeSchemeScript } from "@workspaces/ui" import { config } from "@workspaces/theme" export default function RootLayout({ children, }: { children: React.ReactNode }) { return ( {children} ) } ``` ### Use cookies Using cookies allows you to ensure proper operation even on server-side rendering. :::warning Using [cookies](https://nextjs.org/docs/app/api-reference/functions/cookies) will opt into [dynamic rendering](https://nextjs.org/docs/app/getting-started/partial-prerendering#dynamic-rendering). ::: ```tsx import { UIProvider, ColorModeScript, ThemeSchemeScript } from "@workspaces/ui" import { cookies } from "next/headers" export default function RootLayout({ children, }: { children: React.ReactNode }) { const cookieStore = await cookies() return ( {children} ) } ``` ## Component Integration You can integrate Next.js components such as [Link](https://nextjs.org/docs/app/api-reference/components/link) and [Image](https://nextjs.org/docs/app/api-reference/components/image) with Yamada UI components. ### Link ```tsx "use client" import type { ButtonProps, HTMLRefAttributes, IconButtonProps, LinkProps, Merge, } from "@workspaces/ui" import type { FC } from "react" import type { LinkProps as OriginalLinkProps } from "next/link" import { Button, IconButton, Link } from "@workspaces/ui" import OriginalLink from "next/link" export interface NextLinkProps extends Omit< Merge>, "as" > {} export const NextLink: FC = ({ href, children, ...rest }) => { return ( {children} ) } export interface NextLinkButtonProps extends Omit, "as" | "ref">, HTMLRefAttributes<"a"> {} export const NextLinkButton: FC = (props) => { return } ``` That's it! You've successfully set up Yamada UI. ## Scripts ### ColorModeScript To use [Color Mode](https://yamada-ui.com/docs/theming/color-mode.md), you need to add `ColorModeScript` to the `body` to ensure it works correctly. This is because color mode is implemented using `localStorage` or `cookies`, and adding the script ensures proper synchronization when the page loads. #### Add Script ```tsx import { Html, Head, Main, NextScript } from "next/document" import { ColorModeScript } from "@workspaces/ui" export default function Document() { return (
) } ``` If you change the `defaultColorMode` in your [config](https://yamada-ui.com/docs/theming/configuration/overview.md), set the `defaultValue` prop on `ColorModeScript`. ```tsx import { Html, Head, Main, NextScript } from "next/document" import { ColorModeScript } from "@workspaces/ui" import { config } from "@workspace/theme" export default function Document() { return (
) } ``` #### Add getServerSideProps To share `getServerSideProps` across multiple pages, define `getServerSideSharedProps`. ```tsx import { GetServerSidePropsContext } from "next" export const getServerSideSharedProps = ({ req, }: GetServerSidePropsContext) => { return { props: { cookies: req.headers.cookie ?? "", }, } } ``` ```tsx import { getServerSideSharedProps } from "@/get-server-side-props" import { Button } from "@workspaces/ui" export const getServerSideProps = getServerSideSharedProps export default function Home() { return } ``` #### Update Provider ```tsx import { UIProvider } from "@workspaces/ui" import type { AppProps } from "next/app" export default function App({ Component, pageProps }: AppProps) { const { cookie } = pageProps return ( ) } ``` ### ThemeSchemeScript To use [theme switching](https://yamada-ui.com/docs/theming/switching-themes.md), you need to add `ThemeSchemeScript` to the `body` to ensure it works correctly. This is because theme switching is implemented using `localStorage` or `cookies`, and adding the script ensures proper synchronization when the page loads. #### Add Script ```tsx import { Html, Head, Main, NextScript } from "next/document" import { ThemeSchemeScript } from "@workspaces/ui" export default function Document() { return (
) } ``` If you change the `defaultThemeScheme` in your [config](https://yamada-ui.com/docs/theming/configuration/overview.md), set the `defaultValue` prop on `ThemeSchemeScript`. ```tsx import { Html, Head, Main, NextScript } from "next/document" import { ThemeSchemeScript } from "@workspaces/ui" import { config } from "@workspace/theme" export default function Document() { return (
) } ``` #### Add getServerSideProps To share `getServerSideProps` across multiple pages, define `getServerSideSharedProps`. ```tsx import { GetServerSidePropsContext } from "next" export const getServerSideSharedProps = ({ req, }: GetServerSidePropsContext) => { return { props: { cookies: req.headers.cookie ?? "", }, } } ``` ```tsx import { getServerSideSharedProps } from "@/get-server-side-props" import { Button } from "@workspaces/ui" export const getServerSideProps = getServerSideSharedProps export default function Home() { return } ``` #### Update Provider ```tsx import { UIProvider } from "@workspaces/ui" import type { AppProps } from "next/app" export default function App({ Component, pageProps }: AppProps) { const { cookie } = pageProps return ( ) } ``` ## Component Integration You can integrate Next.js components such as [Link](https://nextjs.org/docs/pages/api-reference/components/link) and [Image](https://nextjs.org/docs/pages/api-reference/components/image) with Yamada UI components. ### Link ```tsx import type { ButtonProps, HTMLRefAttributes, IconButtonProps, LinkProps, Merge, } from "@workspaces/ui" import type { FC } from "react" import type { LinkProps as OriginalLinkProps } from "next/link" import { Button, IconButton, Link } from "@workspaces/ui" import OriginalLink from "next/link" export interface NextLinkProps extends Omit< Merge>, "as" > {} export const NextLink: FC = ({ href, children, ...rest }) => { return ( {children} ) } export interface NextLinkButtonProps extends Omit, "as" | "ref">, HTMLRefAttributes<"a"> {} export const NextLinkButton: FC = (props) => { return } ``` That's it! You've successfully set up Yamada UI. ## Scripts ### ColorModeScript To use [Color Mode](https://yamada-ui.com/docs/theming/color-mode.md), you need to add `ColorModeScript` to the `body` to ensure it works correctly. This is because color mode is implemented using `localStorage` or `cookies`, and adding the script ensures proper synchronization when the page loads. ```tsx import { data, Meta, Outlet, Scripts, ScrollRestoration, useRouteLoaderData, } from "react-router" import { ColorModeScript, UIProvider } from "@workspaces/ui" import type { Route } from "./+types/root" export async function loader({ request }: Route.LoaderArgs) { const cookie = request.headers.get("cookie") ?? "" return data({ cookie }) } export function Layout({ children }: { children: React.ReactNode }) { const { cookie } = useRouteLoaderData("root") return ( {children} ) } export default function App() { return } ``` If you change the `defaultColorMode` in your [config](https://yamada-ui.com/docs/theming/configuration/overview.md), set the `defaultValue` prop on `ColorModeScript`. ```tsx import { data, Meta, Outlet, Scripts, ScrollRestoration, useRouteLoaderData, } from "react-router" import { ColorModeScript, UIProvider } from "@workspaces/ui" import type { Route } from "./+types/root" import { config } from "@workspace/theme" export async function loader({ request }: Route.LoaderArgs) { const cookie = request.headers.get("cookie") ?? "" return data({ cookie }) } export function Layout({ children }: { children: React.ReactNode }) { const { cookie } = useRouteLoaderData("root") return ( {children} ) } export default function App() { return } ``` ### ThemeSchemeScript To use [theme switching](https://yamada-ui.com/docs/theming/switching-themes.md), you need to add `ThemeSchemeScript` to the `body` to ensure it works correctly. This is because theme switching is implemented using `localStorage` or `cookies`, and adding the script ensures proper synchronization when the page loads. ```tsx import { data, Meta, Outlet, Scripts, ScrollRestoration, useRouteLoaderData, } from "react-router" import { ThemeSchemeScript, UIProvider } from "@workspaces/ui" import type { Route } from "./+types/root" export async function loader({ request }: Route.LoaderArgs) { const cookie = request.headers.get("cookie") ?? "" return data({ cookie }) } export function Layout({ children }: { children: React.ReactNode }) { const { cookie } = useRouteLoaderData("root") return ( {children} ) } export default function App() { return } ``` If you change the `defaultThemeScheme` in your [config](https://yamada-ui.com/docs/theming/configuration/overview.md), set the `defaultValue` prop on `ThemeSchemeScript`. ```tsx import { data, Meta, Outlet, Scripts, ScrollRestoration, useRouteLoaderData, } from "react-router" import { ThemeSchemeScript, UIProvider } from "@workspaces/ui" import type { Route } from "./+types/root" import { config } from "@workspace/theme" export async function loader({ request }: Route.LoaderArgs) { const cookie = request.headers.get("cookie") ?? "" return data({ cookie }) } export function Layout({ children }: { children: React.ReactNode }) { const { cookie } = useRouteLoaderData("root") return ( {children} ) } export default function App() { return } ``` ## Component Integration You can integrate React Router components such as [Link](https://reactrouter.com/api/components/Link) with Yamada UI components. ### Link ```tsx import type { ButtonProps, HTMLRefAttributes, IconButtonProps, LinkProps, Merge, } from "@workspaces/ui" import type { FC } from "react" import type { LinkProps as OriginalLinkProps } from "react-router" import { Button, IconButton, Link } from "@workspaces/ui" import { Link as OriginalLink } from "react-router" export interface RouterLinkProps extends Merge {} export const RouterLink: FC = (props) => { return } export interface RouterLinkButtonProps extends Omit, "as" | "ref">, HTMLRefAttributes<"a"> {} export const RouterLinkButton: FC = (props) => { return } ``` That's it! You've successfully set up Yamada UI. ## Scripts ### ColorModeScript To use [Color Mode](https://yamada-ui.com/docs/theming/color-mode.md), you need to add `ColorModeScript` to the `body` to ensure it works correctly. This is because color mode is implemented using `localStorage` or `cookies`, and adding the script ensures proper synchronization when the page loads. ```tsx title="vite.config.ts" {2,7,9-21,29} import viteReact from "@vitejs/plugin-react" import type { Plugin } from "vite" import { defineConfig } from "vite" import { devtools } from "@tanstack/devtools-vite" import { tanstackRouter } from "@tanstack/router-plugin/vite" import { COLOR_MODE_STORAGE_KEY, getStorageScript } from "@workspaces/ui" function injectColorModeScript(): Plugin { return { name: "inject-color-mode-script", transformIndexHtml(html) { const content = getStorageScript( "colorMode", COLOR_MODE_STORAGE_KEY, )({ defaultValue: "light" }) return html.replace("", ``) }, } } const config = defineConfig({ plugins: [ devtools(), tanstackRouter({ target: "react", autoCodeSplitting: true }), viteReact(), injectColorModeScript(), ], resolve: { tsconfigPaths: true }, }) export default config ``` If you change the `defaultColorMode` in your [config](https://yamada-ui.com/docs/theming/configuration/overview.md), set the `defaultValue` prop on `ColorModeScript`. ```tsx title="vite.config.ts" {8,17} import viteReact from "@vitejs/plugin-react" import type { Plugin } from "vite" import { defineConfig } from "vite" import { devtools } from "@tanstack/devtools-vite" import { tanstackRouter } from "@tanstack/router-plugin/vite" import { COLOR_MODE_STORAGE_KEY, getStorageScript } from "@workspaces/ui" import { config as themeConfig } from "@workspaces/theme" function injectColorModeScript(): Plugin { return { name: "inject-color-mode-script", transformIndexHtml(html) { const content = getStorageScript( "colorMode", COLOR_MODE_STORAGE_KEY, )({ defaultValue: themeConfig.defaultColorMode }) return html.replace("", ``) }, } } const config = defineConfig({ plugins: [ devtools(), tanstackRouter({ target: "react", autoCodeSplitting: true }), viteReact(), injectColorModeScript(), ], resolve: { tsconfigPaths: true }, }) export default config ``` ### ThemeSchemeScript To use [theme switching](https://yamada-ui.com/docs/theming/switching-themes.md), you need to add `ThemeSchemeScript` to the `body` to ensure it works correctly. This is because theme switching is implemented using `localStorage` or `cookies`, and adding the script ensures proper synchronization when the page loads. ```tsx title="vite.config.ts" {2,7,9-21,29} import viteReact from "@vitejs/plugin-react" import type { Plugin } from "vite" import { defineConfig } from "vite" import { devtools } from "@tanstack/devtools-vite" import { tanstackRouter } from "@tanstack/router-plugin/vite" import { THEME_SCHEME_STORAGE_KEY, getStorageScript } from "@workspaces/ui" function injectThemeSchemeScript(): Plugin { return { name: "inject-theme-scheme-script", transformIndexHtml(html) { const content = getStorageScript( "themeScheme", THEME_SCHEME_STORAGE_KEY, )({ defaultValue: "base" }) return html.replace("", ``) }, } } const config = defineConfig({ plugins: [ devtools(), tanstackRouter({ target: "react", autoCodeSplitting: true }), viteReact(), injectThemeSchemeScript(), ], resolve: { tsconfigPaths: true }, }) export default config ``` If you change the `defaultThemeScheme` in your [config](https://yamada-ui.com/docs/theming/configuration/overview.md), set the `defaultValue` prop on `ThemeSchemeScript`. ```tsx title="vite.config.ts" {8,17} import viteReact from "@vitejs/plugin-react" import type { Plugin } from "vite" import { defineConfig } from "vite" import { devtools } from "@tanstack/devtools-vite" import { tanstackRouter } from "@tanstack/router-plugin/vite" import { THEME_SCHEME_STORAGE_KEY, getStorageScript } from "@workspaces/ui" import { config as themeConfig } from "@workspaces/theme" function injectThemeSchemeScript(): Plugin { return { name: "inject-theme-scheme-script", transformIndexHtml(html) { const content = getStorageScript( "themeScheme", THEME_SCHEME_STORAGE_KEY, )({ defaultValue: themeConfig.defaultThemeScheme }) return html.replace("", ``) }, } } const config = defineConfig({ plugins: [ devtools(), tanstackRouter({ target: "react", autoCodeSplitting: true }), viteReact(), injectThemeSchemeScript(), ], resolve: { tsconfigPaths: true }, }) export default config ``` ## Component Integration You can integrate TanStack Router components such as [Link](https://tanstack.com/router/latest/docs/guide/navigation#link-component) with Yamada UI components. ### Link ```tsx import type { LinkComponent } from "@tanstack/react-router" import { createLink } from "@tanstack/react-router" import { Button, IconButton, Link } from "@workspaces/ui" const CreatedLink = createLink(Link) export const RouterLink: LinkComponent = (props) => { return } const CreatedLinkButton = createLink(Button) export const RouterLinkButton: LinkComponent = ( props, ) => { return } const CreatedLinkIconButton = createLink(IconButton) export const RouterLinkIconButton: LinkComponent< typeof CreatedLinkIconButton > = (props) => { return } ``` # TanStack Start --- title: TanStack Start description: "A guide for installing and using Yamada UI with TanStack Start projects." --- # TanStack Start A guide for installing and using Yamada UI with TanStack Start projects. ## Installation ### Create application Create TanStack Start application. ```bash pnpm create @tanstack/start my-app ``` ```bash npx create @tanstack/start my-app ``` ```bash yarn create @tanstack/start my-app ``` ```bash bun create @tanstack/start my-app ``` ### Setup Running the command will create the necessary files and folders in your project. ```bash pnpm dlx @yamada-ui/cli init ``` ```bash npx @yamada-ui/cli init ``` ```bash yarn dlx @yamada-ui/cli init ``` ```bash bunx @yamada-ui/cli init ``` ### Install the package Install `@workspaces/ui` to your application. ```bash pnpm add "@workspaces/ui@workspace:*" ``` ```bash npm install "@workspaces/ui@workspace:*" ``` ```bash yarn add "@workspaces/ui@workspace:*" ``` ```bash bun add "@workspaces/ui@workspace:*" ``` ### Add provider After installing, add `UIProvider` to the root of your application. To suppress hydration errors, add `suppressHydrationWarning` to the `html` and `body` tags. ```tsx import { HeadContent, Scripts, createRootRoute } from "@tanstack/react-router" import { TanStackRouterDevtoolsPanel } from "@tanstack/react-router-devtools" import { TanStackDevtools } from "@tanstack/react-devtools" import { UIProvider } from "@workspaces/ui" export const Route = createRootRoute({ head: () => ({ meta: [ { charSet: "utf-8" }, { name: "viewport", content: "width=device-width, initial-scale=1" }, { title: "TanStack Start Starter" }, ], }), shellComponent: RootDocument, }) function RootDocument({ children }: { children: React.ReactNode }) { return ( {children} , }, ]} /> ) } ``` ### Use components After adding `UIProvider`, you can use the components in your application. ```tsx import { createFileRoute } from "@tanstack/react-router" import { Button } from "@workspaces/ui" export const Route = createFileRoute("/")({ component: App }) function App() { return } ``` That's it! You've successfully set up Yamada UI. ## Scripts ### ColorModeScript To use [Color Mode](https://yamada-ui.com/docs/theming/color-mode.md), you need to add `ColorModeScript` to the `body` to ensure it works correctly. This is because color mode is implemented using `localStorage` or `cookies`, and adding the script ensures proper synchronization when the page loads. ```tsx import { HeadContent, Scripts, createRootRoute } from "@tanstack/react-router" import { TanStackRouterDevtoolsPanel } from "@tanstack/react-router-devtools" import { TanStackDevtools } from "@tanstack/react-devtools" import { ColorModeScript, UIProvider } from "@workspaces/ui" import { createServerFn } from "@tanstack/react-start" import { getRequestHeader } from "@tanstack/react-start/server" const getCookie = createServerFn({ method: "GET" }).handler(async () => { return getRequestHeader("cookie") ?? "" }) export const Route = createRootRoute({ loader: async () => ({ cookie: await getCookie(), }), head: () => ({ meta: [ { charSet: "utf-8" }, { name: "viewport", content: "width=device-width, initial-scale=1" }, { title: "TanStack Start Starter" }, ], }), shellComponent: RootDocument, }) function RootDocument({ children }: { children: React.ReactNode }) { const { cookie } = Route.useLoaderData() return ( {children} , }, ]} /> ) } ``` If you change the `defaultColorMode` in your [config](https://yamada-ui.com/docs/theming/configuration/overview.md), set the `defaultValue` prop on `ColorModeScript`. ```tsx import { HeadContent, Scripts, createRootRoute } from "@tanstack/react-router" import { TanStackRouterDevtoolsPanel } from "@tanstack/react-router-devtools" import { TanStackDevtools } from "@tanstack/react-devtools" import { ColorModeScript, UIProvider } from "@workspaces/ui" import { createServerFn } from "@tanstack/react-start" import { getRequestHeader } from "@tanstack/react-start/server" import { config } from "@workspaces/theme" const getCookie = createServerFn({ method: "GET" }).handler(async () => { return getRequestHeader("cookie") ?? "" }) export const Route = createRootRoute({ loader: async () => ({ cookie: await getCookie(), }), head: () => ({ meta: [ { charSet: "utf-8" }, { name: "viewport", content: "width=device-width, initial-scale=1" }, { title: "TanStack Start Starter" }, ], }), shellComponent: RootDocument, }) function RootDocument({ children }: { children: React.ReactNode }) { const { cookie } = Route.useLoaderData() return ( {children} , }, ]} /> ) } ``` ### ThemeSchemeScript To use [theme switching](https://yamada-ui.com/docs/theming/switching-themes.md), you need to add `ThemeSchemeScript` to the `body` to ensure it works correctly. This is because theme switching is implemented using `localStorage` or `cookies`, and adding the script ensures proper synchronization when the page loads. ```tsx import { HeadContent, Scripts, createRootRoute } from "@tanstack/react-router" import { TanStackRouterDevtoolsPanel } from "@tanstack/react-router-devtools" import { TanStackDevtools } from "@tanstack/react-devtools" import { ThemeSchemeScript, UIProvider } from "@workspaces/ui" import { createServerFn } from "@tanstack/react-start" import { getRequestHeader } from "@tanstack/react-start/server" const getCookie = createServerFn({ method: "GET" }).handler(async () => { return getRequestHeader("cookie") ?? "" }) export const Route = createRootRoute({ loader: async () => ({ cookie: await getCookie(), }), head: () => ({ meta: [ { charSet: "utf-8" }, { name: "viewport", content: "width=device-width, initial-scale=1" }, { title: "TanStack Start Starter" }, ], }), shellComponent: RootDocument, }) function RootDocument({ children }: { children: React.ReactNode }) { const { cookie } = Route.useLoaderData() return ( {children} , }, ]} /> ) } ``` If you change the `defaultThemeScheme` in your [config](https://yamada-ui.com/docs/theming/configuration/overview.md), set the `defaultValue` prop on `ThemeSchemeScript`. ```tsx import { HeadContent, Scripts, createRootRoute } from "@tanstack/react-router" import { TanStackRouterDevtoolsPanel } from "@tanstack/react-router-devtools" import { TanStackDevtools } from "@tanstack/react-devtools" import { ThemeSchemeScript, UIProvider } from "@workspaces/ui" import { createServerFn } from "@tanstack/react-start" import { getRequestHeader } from "@tanstack/react-start/server" import { config } from "@workspaces/theme" const getCookie = createServerFn({ method: "GET" }).handler(async () => { return getRequestHeader("cookie") ?? "" }) export const Route = createRootRoute({ loader: async () => ({ cookie: await getCookie(), }), head: () => ({ meta: [ { charSet: "utf-8" }, { name: "viewport", content: "width=device-width, initial-scale=1" }, { title: "TanStack Start Starter" }, ], }), shellComponent: RootDocument, }) function RootDocument({ children }: { children: React.ReactNode }) { const { cookie } = Route.useLoaderData() return ( {children} , }, ]} /> ) } ``` ## Component Integration You can integrate TanStack Start components such as [Link](https://tanstack.com/router/latest/docs/guide/navigation#link-component) with Yamada UI components. ### Link ```tsx import type { LinkComponent } from "@tanstack/react-router" import { createLink } from "@tanstack/react-router" import { Button, IconButton, Link } from "@workspaces/ui" const CreatedLink = createLink(Link) export const RouterLink: LinkComponent = (props) => { return } const CreatedLinkButton = createLink(Button) export const RouterLinkButton: LinkComponent = ( props, ) => { return } const CreatedLinkIconButton = createLink(IconButton) export const RouterLinkIconButton: LinkComponent< typeof CreatedLinkIconButton > = (props) => { return } ``` # Vite --- title: Vite description: "A guide for installing and using Yamada UI with Vite.js projects" --- # Vite A guide for installing and using Yamada UI with Vite.js projects ## Installation ### Create application Create Vite application. ```bash pnpm create vite my-app --template react-ts ``` ```bash npm create vite my-app -- --template react-ts ``` ```bash yarn create vite my-app --template react-ts ``` ```bash bun create vite my-app --template react-ts ``` ### Setup Running the command will create the necessary files and folders in your project. ```bash pnpm dlx @yamada-ui/cli init ``` ```bash npx @yamada-ui/cli init ``` ```bash yarn dlx @yamada-ui/cli init ``` ```bash bunx @yamada-ui/cli init ``` ### Install the package Install `@workspaces/ui` to your application. ```bash pnpm add "@workspaces/ui@workspace:*" ``` ```bash npm install "@workspaces/ui@workspace:*" ``` ```bash yarn add "@workspaces/ui@workspace:*" ``` ```bash bun add "@workspaces/ui@workspace:*" ``` ### Add provider After installing, add `UIProvider` to the root of your application. ```tsx import { StrictMode } from "react" import { createRoot } from "react-dom/client" import App from "./App.tsx" import { UIProvider } from "@workspaces/ui" createRoot(document.getElementById("root")!).render( , ) ``` ### Use components After adding `UIProvider`, you can use the components in your application. ```tsx import { Button } from "@workspaces/ui" function App() { return } export default App ``` That's it! You've successfully set up Yamada UI. ## Scripts ### ColorModeScript To use [Color Mode](https://yamada-ui.com/docs/theming/color-mode.md), you need to add `ColorModeScript` to the `body` to ensure it works correctly. This is because color mode is implemented using `localStorage` or `cookies`, and adding the script ensures proper synchronization when the page loads. ```ts title="vite.config.ts" {1,4-18,22} import type { Plugin } from "vite" import { defineConfig } from "vite" import react from "@vitejs/plugin-react" import { COLOR_MODE_STORAGE_KEY, getStorageScript } from "@workspaces/ui" function injectColorModeScript(): Plugin { return { name: "inject-color-mode-script", transformIndexHtml(html) { const content = getStorageScript( "colorMode", COLOR_MODE_STORAGE_KEY, )({ defaultValue: "light" }) return html.replace("", ``) }, } } // https://vite.dev/config/ export default defineConfig({ plugins: [react(), injectColorModeScript()], }) ``` If you change the `defaultColorMode` in your [config](https://yamada-ui.com/docs/theming/configuration/overview.md), set the `defaultValue` prop on `ColorModeScript`. ```ts title="vite.config.ts" {5,14} import type { Plugin } from "vite" import { defineConfig } from "vite" import react from "@vitejs/plugin-react" import { COLOR_MODE_STORAGE_KEY, getStorageScript } from "@workspaces/ui" import { config } from "@workspace/theme" function injectColorModeScript(): Plugin { return { name: "inject-color-mode-script", transformIndexHtml(html) { const content = getStorageScript( "colorMode", COLOR_MODE_STORAGE_KEY, )({ defaultValue: config.defaultColorMode }) return html.replace("", ``) }, } } // https://vite.dev/config/ export default defineConfig({ plugins: [react(), injectColorModeScript()], }) ``` ### ThemeSchemeScript To use [theme switching](https://yamada-ui.com/docs/theming/switching-themes.md), you need to add `ThemeSchemeScript` to the `body` to ensure it works correctly. This is because theme switching is implemented using `localStorage` or `cookies`, and adding the script ensures proper synchronization when the page loads. ```ts title="vite.config.ts" {1,4-18,22} import type { Plugin } from "vite" import { defineConfig } from "vite" import react from "@vitejs/plugin-react" import { getStorageScript, THEME_SCHEME_STORAGE_KEY } from "@workspaces/ui" function injectThemeSchemeScript(): Plugin { return { name: "inject-theme-scheme-scripts", transformIndexHtml(html) { const content = getStorageScript( "themeScheme", THEME_SCHEME_STORAGE_KEY, )({ defaultValue: "base" }) return html.replace("", ``) }, } } // https://vite.dev/config/ export default defineConfig({ plugins: [react(), injectThemeSchemeScript()], }) ``` If you change the `defaultThemeScheme` in your [config](https://yamada-ui.com/docs/theming/configuration/overview.md), set the `defaultValue` prop on `ThemeSchemeScript`. ```ts title="vite.config.ts" {5,14} import type { Plugin } from "vite" import { defineConfig } from "vite" import react from "@vitejs/plugin-react" import { getStorageScript, THEME_SCHEME_STORAGE_KEY } from "@workspaces/ui" import { config } from "@workspace/theme" function injectThemeSchemeScript(): Plugin { return { name: "inject-theme-scheme-scripts", transformIndexHtml(html) { const content = getStorageScript( "themeScheme", THEME_SCHEME_STORAGE_KEY, )({ defaultValue: config.defaultThemeScheme }) return html.replace("", ``) }, } } // https://vite.dev/config/ export default defineConfig({ plugins: [react(), injectThemeSchemeScript()], }) ``` # Airy --- title: Airy description: "`Airy` is a component that provides a smooth animation to switch between two elements." links: - style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/airy/airy.style.ts - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/airy - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-airy--basic --- # Airy `Airy` is a component that provides a smooth animation to switch between two elements. ```tsx } to={} /> ``` ## Usage ```tsx import { Airy } from "@yamada-ui/react" ``` ```tsx import { Airy } from "@/components/ui" ``` ```tsx import { Airy } from "@workspaces/ui" ``` ```tsx ``` ### Change the Duration To change the duration, set a numerical value (seconds) to `duration`. ```tsx } to={} /> ``` ### Delay If you want to delay the switch, set a numerical value (seconds) to `delay`. ```tsx } to={} /> ``` ### Disable To disable, set `disabled` to `true`. ```tsx } to={} /> ``` ### Read-Only To ready-Only, set `readOnly` to `true`. ```tsx } to={} /> ``` ### Control ```tsx const [value, onChange] = useState("to") return ( } to={} value={value} onChange={onChange} /> ) ``` ## Props | Prop | Default | Type | Description | | -------------- | -------- | ------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | | `as` | - | `keyof IntrinsicElements` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `defaultValue` | `"from"` | `KeyframeIdent` | You can set the initial state. | | `delay` | `0` | `number` | The animation delay. | | `disabled` | `false` | `boolean` | If `true`, the component is disabled. | | `duration` | `0.2` | `number` | The animation duration. | | `from` | - | `ReactNode` | Passing React elements to "from" is required. | | `onChange` | - | `(value: KeyframeIdent) => void` | This is a callback function that is called when the animation state changes. | | `readOnly` | `false` | `boolean` | If `true`, the component is readonly. | | `to` | - | `ReactNode` | Passing React elements to "to" is required. | | `value` | - | `KeyframeIdent` | Use this when you want to control the animation from outside the component. | ## Accessibility The `Airy` follows the [WAI-ARIA - Button Pattern](https://www.w3.org/WAI/ARIA/apg/patterns/button/) for accessibility. When `aria-label` is set, it will be read aloud by screen readers. ```tsx } to={} /> ``` ### Keyboard Navigation | Key | Description | State | | ---------------- | ------------------------------------- | ----- | | `Enter`, `Space` | When element has focus, activates it. | - | ## Similar Components - [Flip](https://yamada-ui.com/docs/components/flip.md): `Flip` is a component that provides an animation to switch between two elements while flipping. - [Motion](https://yamada-ui.com/docs/components/motion.md): `Motion` is a convenient component that extends the Yamada UI Style Props to `Motion`. - [Ripple](https://yamada-ui.com/docs/components/ripple.md): `Ripple` is a component that adds a ripple effect to elements, allowing users to recognize when they have clicked. - [Rotate](https://yamada-ui.com/docs/components/rotate.md): `Rotate` is a component that provides an animation to switch between two elements while rotating. - [Collapse](https://yamada-ui.com/docs/components/collapse.md): `Collapse` is a component that allows you to expand or collapse an element for display. - [Fade](https://yamada-ui.com/docs/components/fade.md): `Fade` is a component that gradually shows or hides an element. - [FadeScale](https://yamada-ui.com/docs/components/fade-scale.md): `FadeScale` is a component that gradually scales up to reveal or scales down to hide an element. - [Skeleton](https://yamada-ui.com/docs/components/skeleton.md): `Skeleton` is a component that acts as a placeholder until content is loaded. ## Uses Components & Hooks - [Motion](https://yamada-ui.com/docs/components/motion.md): `Motion` is a convenient component that extends the Yamada UI Style Props to `Motion`. # Collapse --- title: Collapse description: "`Collapse` is a component that allows you to expand or collapse an element for display." links: - style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/collapse/collapse.style.ts - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/collapse - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-collapse--basic --- # Collapse `Collapse` is a component that allows you to expand or collapse an element for display. ```tsx const [open, { toggle }] = useBoolean() return ( クリリンのことか……クリリンのことかーーーっ!!!!! ) ``` ## Usage ```tsx import { Collapse } from "@yamada-ui/react" ``` ```tsx import { Collapse } from "@/components/ui" ``` ```tsx import { Collapse } from "@workspaces/ui" ``` ```tsx ``` ### Change the Duration To change the duration, set a number (in seconds) to `duration`. ```tsx const [open, { toggle }] = useBoolean() return ( クリリンのことか……クリリンのことかーーーっ!!!!! ) ``` ### Unmount on Exit To unmount the component when it is not visible, set `unmountOnExit` to `true`. ```tsx const [open, { toggle }] = useBoolean() return ( クリリンのことか……クリリンのことかーーーっ!!!!! 私の戦闘力は530000です。ですがもちろんフルパワーであなたと戦う気はありませんからご心配なく…… ) ``` ### Disable Opacity Animation To disable the opacity animation, set `animationOpacity` to `false`. ```tsx const [open, { toggle }] = useBoolean() return ( クリリンのことか……クリリンのことかーーーっ!!!!! 私の戦闘力は530000です。ですがもちろんフルパワーであなたと戦う気はありませんからご心配なく…… ) ``` ### Add a Starting Height To add a starting height, set a string or number to `startingHeight`. ```tsx const [open, { toggle }] = useBoolean() return ( 私の戦闘力は530000です。
ですがもちろんフルパワーであなたと戦う気はありませんからご心配なく……
) ``` ## Props | Prop | Default | Type | Description | | ------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `as` | - | `keyof IntrinsicElements` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `enter` | - | `any` | Custom `enter`. | | `exit` | - | `any` | Custom `exit`. A target to animate to when this component is removed from the tree. This component **must** be the first animatable child of an `AnimatePresence` to enable this exit animation. This limitation exists because React doesn't allow components to defer unmounting until after an animation is complete. Once this limitation is fixed, the `AnimatePresence` component will be unnecessary. | | `initial` | - | `any` | Custom `initial`. Properties, variant label or array of variant labels to start in. Set to `false` to initialise with the values in `animate` (disabling the mount animation) | | `animationOpacity` | `true` | `boolean` | If `true`, the opacity of the content will be animated. | | `delay` | `0` | `MotionLifecycleProps \| number` | Custom `delay` definition for `enter` and `exit`. | | `duration` | `0.2` | `MotionLifecycleProps \| number` | Custom `duration` definition for `enter` and `exit`. | | `endingHeight` | `"auto"` | `number \| string` | The height you want the content in its expanded state. | | `open` | - | `boolean` | Show the component. triggers when enter or exit states. | | `startingHeight` | `0` | `number \| string` | The height you want the content in its collapsed state. | | `transition` | - | `MotionLifecycleProps` | Custom `transition` definition for `enter` and `exit`. | | `transitionEnd` | - | `MotionLifecycleProps` | Custom `transitionEnd` definition for `enter` and `exit`. | | `unmountOnExit` | - | `boolean` | If `true`, the element will unmount when `open={false}` and animation is done. | ## Similar Components - [Fade](https://yamada-ui.com/docs/components/fade.md): `Fade` is a component that gradually shows or hides an element. - [FadeScale](https://yamada-ui.com/docs/components/fade-scale.md): `FadeScale` is a component that gradually scales up to reveal or scales down to hide an element. - [Slide](https://yamada-ui.com/docs/components/slide.md): `Slide` is a component that shows or hides an element from the corners of the page. - [SlideFade](https://yamada-ui.com/docs/components/slide-fade.md): `SlideFade` is a component that gradually shows or hides an element while moving it from a specified position. - [Accordion](https://yamada-ui.com/docs/components/accordion.md): `Accordion` is a component for a list that displays information in an expandable or collapsible manner. - [Airy](https://yamada-ui.com/docs/components/airy.md): `Airy` is a component that provides a smooth animation to switch between two elements. - [Drawer](https://yamada-ui.com/docs/components/drawer.md): `Drawer` is a component for a panel that appears from the edge of the screen. - [Flip](https://yamada-ui.com/docs/components/flip.md): `Flip` is a component that provides an animation to switch between two elements while flipping. ## Uses Components & Hooks - [Motion](https://yamada-ui.com/docs/components/motion.md): `Motion` is a convenient component that extends the Yamada UI Style Props to `Motion`. ## Used By Components & Hooks - [Accordion](https://yamada-ui.com/docs/components/accordion.md): `Accordion` is a component for a list that displays information in an expandable or collapsible manner. - [Sidebar](https://yamada-ui.com/docs/components/sidebar.md): `Sidebar` is a component used to display a list of items in a sidebar. - [Tree](https://yamada-ui.com/docs/components/tree.md): `Tree` is a component used to display hierarchical data structures in an expandable tree format. # FadeScale --- title: FadeScale description: "`FadeScale` is a component that gradually scales up to reveal or scales down to hide an element." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/fade-scale - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-fadescale--basic --- # FadeScale `FadeScale` is a component that gradually scales up to reveal or scales down to hide an element. ```tsx const [open, { toggle }] = useBoolean() return ( その打球、消えるよ ) ``` ## Usage ```tsx import { FadeScale } from "@yamada-ui/react" ``` ```tsx import { FadeScale } from "@/components/ui" ``` ```tsx import { FadeScale } from "@workspaces/ui" ``` ```tsx ``` ### Change the initial scale value To change the initial scale value, set a number to `scale`. The element will scale based on this value, starting from and shrinking to it. The default is `0.95`. ```tsx const [open, { toggle }] = useBoolean() return ( その打球、消えるよ ) ``` ### Change the Duration To change the duration, set a number (in seconds) to `duration`. ```tsx const [open, { toggle }] = useBoolean() return ( その打球、消えるよ ) ``` ### Unmount on Exit To unmount the component when it is not visible, set `unmountOnExit` to `true`. ```tsx const [open, { toggle }] = useBoolean() return ( その打球、消えるよ 俺はたった今からデータを捨てる!そして俺は過去を凌駕する! ) ``` ## Props | Prop | Default | Type | Description | | --------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `as` | - | `keyof IntrinsicElements` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `enter` | - | `any` | Custom `enter`. | | `exit` | - | `any` | Custom `exit`. A target to animate to when this component is removed from the tree. This component **must** be the first animatable child of an `AnimatePresence` to enable this exit animation. This limitation exists because React doesn't allow components to defer unmounting until after an animation is complete. Once this limitation is fixed, the `AnimatePresence` component will be unnecessary. | | `initial` | - | `any` | Custom `initial`. Properties, variant label or array of variant labels to start in. Set to `false` to initialise with the values in `animate` (disabling the mount animation) | | `delay` | `0` | `MotionLifecycleProps \| number` | Custom `delay` definition for `enter` and `exit`. | | `duration` | `0.2` | `MotionLifecycleProps \| number` | Custom `duration` definition for `enter` and `exit`. | | `open` | - | `boolean` | Show the component. triggers when enter or exit states. | | `reverse` | `true` | `boolean` | If `true`, the element will transition back to exit state. | | `scale` | `0.95` | `number` | The initial scale of the element. | | `transition` | - | `MotionLifecycleProps` | Custom `transition` definition for `enter` and `exit`. | | `transitionEnd` | - | `MotionLifecycleProps` | Custom `transitionEnd` definition for `enter` and `exit`. | | `unmountOnExit` | - | `boolean` | If `true`, the element will unmount when `open={false}` and animation is done. | ## Similar Components - [Collapse](https://yamada-ui.com/docs/components/collapse.md): `Collapse` is a component that allows you to expand or collapse an element for display. - [Fade](https://yamada-ui.com/docs/components/fade.md): `Fade` is a component that gradually shows or hides an element. - [Slide](https://yamada-ui.com/docs/components/slide.md): `Slide` is a component that shows or hides an element from the corners of the page. - [SlideFade](https://yamada-ui.com/docs/components/slide-fade.md): `SlideFade` is a component that gradually shows or hides an element while moving it from a specified position. - [Accordion](https://yamada-ui.com/docs/components/accordion.md): `Accordion` is a component for a list that displays information in an expandable or collapsible manner. - [Airy](https://yamada-ui.com/docs/components/airy.md): `Airy` is a component that provides a smooth animation to switch between two elements. - [Drawer](https://yamada-ui.com/docs/components/drawer.md): `Drawer` is a component for a panel that appears from the edge of the screen. - [Flip](https://yamada-ui.com/docs/components/flip.md): `Flip` is a component that provides an animation to switch between two elements while flipping. ## Uses Components & Hooks - [Motion](https://yamada-ui.com/docs/components/motion.md): `Motion` is a convenient component that extends the Yamada UI Style Props to `Motion`. ## Used By Components & Hooks - [Popover](https://yamada-ui.com/docs/components/popover.md): `Popover` is a component that floats around an element to display information. # Fade --- title: Fade description: "`Fade` is a component that gradually shows or hides an element." links: - style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/fade/fade.style.ts - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/fade - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-fade--basic --- # Fade `Fade` is a component that gradually shows or hides an element. ```tsx const [open, { toggle }] = useBoolean() return ( その打球、消えるよ ) ``` ## Usage ```tsx import { Fade } from "@yamada-ui/react" ``` ```tsx import { Fade } from "@/components/ui" ``` ```tsx import { Fade } from "@workspaces/ui" ``` ```tsx ``` ### Change the Duration To change the duration, set a number (in seconds) to `duration`. ```tsx const [open, { toggle }] = useBoolean() return ( その打球、消えるよ ) ``` ### Unmount on Exit To unmount the component when it is not visible, set `unmountOnExit` to `true`. ```tsx const [open, { toggle }] = useBoolean() return ( その打球、消えるよ 俺はたった今からデータを捨てる!そして俺は過去を凌駕する! ) ``` ## Props | Prop | Default | Type | Description | | --------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `as` | - | `keyof IntrinsicElements` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `enter` | - | `any` | Custom `enter`. | | `exit` | - | `any` | Custom `exit`. A target to animate to when this component is removed from the tree. This component **must** be the first animatable child of an `AnimatePresence` to enable this exit animation. This limitation exists because React doesn't allow components to defer unmounting until after an animation is complete. Once this limitation is fixed, the `AnimatePresence` component will be unnecessary. | | `initial` | - | `any` | Custom `initial`. Properties, variant label or array of variant labels to start in. Set to `false` to initialise with the values in `animate` (disabling the mount animation) | | `delay` | `0` | `MotionLifecycleProps \| number` | Custom `delay` definition for `enter` and `exit`. | | `duration` | `0.2` | `MotionLifecycleProps \| number` | Custom `duration` definition for `enter` and `exit`. | | `open` | - | `boolean` | Show the component. triggers when enter or exit states. | | `transition` | - | `MotionLifecycleProps` | Custom `transition` definition for `enter` and `exit`. | | `transitionEnd` | - | `MotionLifecycleProps` | Custom `transitionEnd` definition for `enter` and `exit`. | | `unmountOnExit` | - | `boolean` | If `true`, the element will unmount when `open={false}` and animation is done. | ## Similar Components - [Collapse](https://yamada-ui.com/docs/components/collapse.md): `Collapse` is a component that allows you to expand or collapse an element for display. - [FadeScale](https://yamada-ui.com/docs/components/fade-scale.md): `FadeScale` is a component that gradually scales up to reveal or scales down to hide an element. - [Slide](https://yamada-ui.com/docs/components/slide.md): `Slide` is a component that shows or hides an element from the corners of the page. - [SlideFade](https://yamada-ui.com/docs/components/slide-fade.md): `SlideFade` is a component that gradually shows or hides an element while moving it from a specified position. - [Accordion](https://yamada-ui.com/docs/components/accordion.md): `Accordion` is a component for a list that displays information in an expandable or collapsible manner. - [Airy](https://yamada-ui.com/docs/components/airy.md): `Airy` is a component that provides a smooth animation to switch between two elements. - [Drawer](https://yamada-ui.com/docs/components/drawer.md): `Drawer` is a component for a panel that appears from the edge of the screen. - [Flip](https://yamada-ui.com/docs/components/flip.md): `Flip` is a component that provides an animation to switch between two elements while flipping. ## Uses Components & Hooks - [Motion](https://yamada-ui.com/docs/components/motion.md): `Motion` is a convenient component that extends the Yamada UI Style Props to `Motion`. ## Used By Components & Hooks - [Drawer](https://yamada-ui.com/docs/components/drawer.md): `Drawer` is a component for a panel that appears from the edge of the screen. - [Dropzone](https://yamada-ui.com/docs/components/dropzone.md): `Dropzone` is a component used for uploading files via drag and drop. - [Modal](https://yamada-ui.com/docs/components/modal.md): `Modal` is a component that is displayed over the main content to focus the user's attention solely on the information. # Flip --- title: Flip description: "`Flip` is a component that provides an animation to switch between two elements while flipping." links: - style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/flip/flip.style.ts - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/flip - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-flip--basic --- # Flip `Flip` is a component that provides an animation to switch between two elements while flipping. ```tsx } to={} /> ``` ## Usage ```tsx import { Flip } from "@yamada-ui/react" ``` ```tsx import { Flip } from "@/components/ui" ``` ```tsx import { Flip } from "@workspaces/ui" ``` ```tsx ``` ### Change Direction To change the direction, set `orientation` to `"horizontal"` or `"vertical"`. By default, `"horizontal"` is set. ```tsx } to={} /> ``` ### Change the Duration To change the duration, set a numerical value (seconds) to `duration`. ```tsx } to={} /> ``` ### Delay If you want to delay the switch, set a numerical value (seconds) to `delay`. ```tsx } to={} /> ``` ### Disable To disable, set `disabled` to `true`. ```tsx } to={} /> ``` ### Read-Only To ready-Only, set `readOnly` to `true`. ```tsx } to={} /> ``` ### Control ```tsx const [value, onChange] = useState("from") return ( } to={} value={value} onChange={onChange} /> ) ``` ## Props | Prop | Default | Type | Description | | -------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | | `as` | - | `keyof IntrinsicElements` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `defaultValue` | `"from"` | `KeyframeIdent` | You can set the initial state. | | `delay` | `0` | `number` | The animation delay. | | `disabled` | `false` | `boolean` | If `true`, the component is disabled. | | `duration` | `0.4` | `number` | The animation duration. | | `from` | - | `ReactNode` | Passing React elements to "from" is required. | | `onChange` | - | `(value: KeyframeIdent) => void` | This is a callback function that is called when the animation state changes. | | `orientation` | `"horizontal"` | `Orientation` | The orientation of the flip effect. Determines whether the flip occurs horizontally or vertically. | | `readOnly` | `false` | `boolean` | If `true`, the component is readonly. | | `to` | - | `ReactNode` | Passing React elements to "to" is required. | | `value` | - | `KeyframeIdent` | Use this when you want to control the animation from outside the component. | ## Accessibility The `Flip` follows the [WAI-ARIA - Button Pattern](https://www.w3.org/WAI/ARIA/apg/patterns/button/) for accessibility. When `aria-label` is set, it will be read aloud by screen readers. ```tsx } to={} /> ``` ### Keyboard Navigation | Key | Description | State | | ---------------- | ------------------------------------- | ----- | | `Enter`, `Space` | When element has focus, activates it. | - | ## Similar Components - [Airy](https://yamada-ui.com/docs/components/airy.md): `Airy` is a component that provides a smooth animation to switch between two elements. - [Motion](https://yamada-ui.com/docs/components/motion.md): `Motion` is a convenient component that extends the Yamada UI Style Props to `Motion`. - [Ripple](https://yamada-ui.com/docs/components/ripple.md): `Ripple` is a component that adds a ripple effect to elements, allowing users to recognize when they have clicked. - [Rotate](https://yamada-ui.com/docs/components/rotate.md): `Rotate` is a component that provides an animation to switch between two elements while rotating. - [Collapse](https://yamada-ui.com/docs/components/collapse.md): `Collapse` is a component that allows you to expand or collapse an element for display. - [Fade](https://yamada-ui.com/docs/components/fade.md): `Fade` is a component that gradually shows or hides an element. - [FadeScale](https://yamada-ui.com/docs/components/fade-scale.md): `FadeScale` is a component that gradually scales up to reveal or scales down to hide an element. - [Skeleton](https://yamada-ui.com/docs/components/skeleton.md): `Skeleton` is a component that acts as a placeholder until content is loaded. ## Uses Components & Hooks - [Motion](https://yamada-ui.com/docs/components/motion.md): `Motion` is a convenient component that extends the Yamada UI Style Props to `Motion`. # Loading --- title: Loading description: "`Loading` is a component displayed during waiting times, such as when data is being loaded." links: - style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/loading/loading.style.ts - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/loading - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-loading--basic --- # Loading `Loading` is a component displayed during waiting times, such as when data is being loaded. ```tsx ``` ## Usage ```tsx import { Loading } from "@yamada-ui/react" ``` ```tsx import { Loading } from "@/components/ui" ``` ```tsx import { Loading } from "@workspaces/ui" ``` ```tsx ``` ### Change Variant ```tsx ``` ### Change Size ```tsx ``` ### Use Suspense ```tsx const SuspendButton = ({ children }: { children: React.ReactNode }) => { const [suspend, setSuspend] = useState(false) if (suspend) { throw new Promise((resolve) => { setTimeout(() => { setSuspend(false) resolve() }, 2000) }) } return ( ) } return ( {([loadingScheme, color]) => ( {loadingScheme} )} ) ``` ## Props ### Loading.Audio | Prop | Default | Type | Description | | ---------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `duration` | - | `IconProps["dur"]` | The CSS `dur` property. | | `secondaryColor` | - | `"-moz-initial" \| "AccentColor" \| "AccentColorText" \| "ActiveBorder" \| "ActiveCaption" \| "ActiveText" \| "aliceblue" \| "amber.100" \| "amber.200" \| "amber.300" ...` | The CSS `color` property. | ### Loading.Circles | Prop | Default | Type | Description | | ---------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `duration` | - | `IconProps["dur"]` | The CSS `dur` property. | | `secondaryColor` | - | `"-moz-initial" \| "AccentColor" \| "AccentColorText" \| "ActiveBorder" \| "ActiveCaption" \| "ActiveText" \| "aliceblue" \| "amber.100" \| "amber.200" \| "amber.300" ...` | The CSS `color` property. | ### Loading.Dots | Prop | Default | Type | Description | | ---------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `duration` | - | `IconProps["dur"]` | The CSS `dur` property. | | `secondaryColor` | - | `"-moz-initial" \| "AccentColor" \| "AccentColorText" \| "ActiveBorder" \| "ActiveCaption" \| "ActiveText" \| "aliceblue" \| "amber.100" \| "amber.200" \| "amber.300" ...` | The CSS `color` property. | ### Loading.Grid | Prop | Default | Type | Description | | ---------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `duration` | - | `IconProps["dur"]` | The CSS `dur` property. | | `secondaryColor` | - | `"-moz-initial" \| "AccentColor" \| "AccentColorText" \| "ActiveBorder" \| "ActiveCaption" \| "ActiveText" \| "aliceblue" \| "amber.100" \| "amber.200" \| "amber.300" ...` | The CSS `color` property. | ### Loading.Oval | Prop | Default | Type | Description | | ---------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `duration` | - | `IconProps["dur"]` | The CSS `dur` property. | | `secondaryColor` | - | `"-moz-initial" \| "AccentColor" \| "AccentColorText" \| "ActiveBorder" \| "ActiveCaption" \| "ActiveText" \| "aliceblue" \| "amber.100" \| "amber.200" \| "amber.300" ...` | The CSS `color` property. | ### Loading.Puff | Prop | Default | Type | Description | | ---------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `duration` | - | `IconProps["dur"]` | The CSS `dur` property. | | `secondaryColor` | - | `"-moz-initial" \| "AccentColor" \| "AccentColorText" \| "ActiveBorder" \| "ActiveCaption" \| "ActiveText" \| "aliceblue" \| "amber.100" \| "amber.200" \| "amber.300" ...` | The CSS `color` property. | ### Loading.Rings | Prop | Default | Type | Description | | ---------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `duration` | - | `IconProps["dur"]` | The CSS `dur` property. | | `secondaryColor` | - | `"-moz-initial" \| "AccentColor" \| "AccentColorText" \| "ActiveBorder" \| "ActiveCaption" \| "ActiveText" \| "aliceblue" \| "amber.100" \| "amber.200" \| "amber.300" ...` | The CSS `color` property. | ### Loading.Suspense | Prop | Default | Type | Description | | --------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `loadingProps` | - | `LoadingProps` | The loading props. | | `loadingScheme` | - | `LoadingScheme` | The loading scheme. | ## Similar Components - [CircleProgress](https://yamada-ui.com/docs/components/circle-progress.md): `CircleProgress` is a component that displays progress in a circular progress bar. - [Progress](https://yamada-ui.com/docs/components/progress.md): `Progress` is a component for visually indicating progress. - [Skeleton](https://yamada-ui.com/docs/components/skeleton.md): `Skeleton` is a component that acts as a placeholder until content is loaded. - [Tip](https://yamada-ui.com/docs/components/tip.md): `Tip` is a component that displays supplementary information with a built-in icon trigger. ## Uses Components & Hooks - [Icon](https://yamada-ui.com/docs/components/icon.md): `Icon` is a general icon component that can be used in your projects. - [Motion](https://yamada-ui.com/docs/components/motion.md): `Motion` is a convenient component that extends the Yamada UI Style Props to `Motion`. - [Text](https://yamada-ui.com/docs/components/text.md): `Text` is a component that represents a paragraph of text. By default, it renders a `p` element. - [Portal](https://yamada-ui.com/docs/components/portal.md): `Portal` is a component that renders elements outside of the current `DOM` hierarchy. - [Center](https://yamada-ui.com/docs/components/center.md): `Center` is a component that aligns the child elements in the center within the component. - [useTimeout](https://yamada-ui.com/docs/hooks/use-timeout.md): `useTimeout` is a custom hook that executes a function after a specified number of milliseconds. ## Used By Components & Hooks - [Alert](https://yamada-ui.com/docs/components/alert.md): `Alert` is a component that conveys information to the user. - [Button](https://yamada-ui.com/docs/components/button.md): `Button` is an interactive component that allows users to perform actions such as submitting forms and toggling modals. - [Dropzone](https://yamada-ui.com/docs/components/dropzone.md): `Dropzone` is a component used for uploading files via drag and drop. - [Sidebar](https://yamada-ui.com/docs/components/sidebar.md): `Sidebar` is a component used to display a list of items in a sidebar. - [Tree](https://yamada-ui.com/docs/components/tree.md): `Tree` is a component used to display hierarchical data structures in an expandable tree format. - [useAsyncCallback](https://yamada-ui.com/docs/hooks/use-async-callback.md): `useAsyncCallback` is a custom hook for managing asynchronous callbacks. # Motion --- title: Motion description: "`Motion` is a convenient component that extends the Yamada UI Style Props to `Motion`." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/motion - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-motion-animation--basic --- # Motion `Motion` is a convenient component that extends the Yamada UI Style Props to `Motion`. ```tsx
``` ## Usage ```tsx import { Motion } from "@yamada-ui/react" ``` ```tsx import { Motion } from "@/components/ui" ``` ```tsx import { Motion } from "@workspaces/ui" ``` :::note `Motion` uses [Motion](https://motion.dev) internally. If you want to know more about the component's features, please refer to [this](https://motion.dev/docs/react-motion-component). ::: - `initial`: The initial state of the component. - `animate`: The animation executed when the component is mounted or updated. - `exit`: The animation executed when the component is unmounted. - `transition`: The object that sets the duration and delay. :::note The style object used in `initial`・`animate`・`exit` is not a [Style Props](https://yamada-ui.com/docs/styling/style-props.md) of Yamada UI. Please refer to the [Motion](https://motion.dev) documentation for the properties of the style object. ::: :::warning To enable the animation of `exit`, the component must be a child element of [AnimatePresence](https://motion.dev/docs/react-animate-presence). ::: ### Variants Variants are useful for implementing dynamic animations. You can also orchestrate animations. ```tsx const [visible, { toggle }] = useBoolean() return ( Look at me! ) ``` :::note Variants' animation to know more about the animation of variants, please refer to [this](https://motion.dev/docs/react-animation#variants). ::: ### Use AnimatePresence In React, when a component is unmounted, the animation is not maintained. By using [AnimatePresence](https://motion.dev/docs/react-animate-presence), the component is not unmounted until the animation ends. ```tsx const [visible, { toggle }] = useBoolean() return (
{visible ? ( Enabled "AnimatePresence" ) : null} {visible ? ( Disabled "AnimatePresence" ) : null}
) ``` ### Keyframes By setting the value to an array, you can set the keyframes. Each frame is processed at equal intervals. You can override this by setting an array of intervals to `transition`'s `times`. ```tsx
``` ### Gestures [Hover](#hover)・[Click/Tap](#clicktap)・[Focus](#focus) to detect and execute animations. #### Hover - `whileHover`: The animation executed when the pointer is moved over the component. - `onHoverStart`: The callback function executed when the pointer is moved over the component. - `onHoverEnd`: The callback function executed when the pointer is moved away from the component. ```tsx console.log("Hover starts")} onHoverEnd={(ev) => console.log("Hover ends")} > Hover me! ``` :::note Hover's animation to know more about the animation of hover, please refer to [this](https://motion.dev/docs/react-hover-animation). ::: #### Click/Tap - `whileTap`: The animation executed when the pointer is clicked or tapped on the component. - `onTapStart`: The callback function executed when the pointer starts pressing the component. - `onTap`: The callback function executed when the pointer is released inside the component. - `onTapCancel`: The callback function executed when the pointer is released outside the component. ```tsx console.log("Tap starts")} onTap={(ev) => console.log("Tap")} onTapCancel={(ev) => console.log("Tap cancels")} > Click and Tap me! ``` :::note Click/Tap's animation to know more about the animation of click/tap, please refer to [this](https://motion.dev/docs/react-gestures#tap). ::: #### Focus - `whileFocus`: The animation executed when the component is focused. ```tsx Focus me! ``` :::note Focus's animation to know more about the animation of focus, please refer to [this](https://motion.dev/docs/react-gestures#focus). ::: ### Drag To enable the dragging of the component, set `drag` to `true`. Or set `"x"` or `"y"` to follow only the x-axis or y-axis. - `whileDrag`: The animation executed when the component is dragged. - `onDrag`: The callback function executed when the component is dragged. - `onDragStart`: The callback function executed when the component starts dragging. - `onDragEnd`: The callback function executed when the component ends dragging. ```tsx
{(drag) => ( console.log("Drag", "x:", point.x, "y:", point.y) } onDragStart={(ev, { point }) => console.log("Drag starts", "x:", point.x, "y:", point.y) } onDragEnd={(ev, { point }) => console.log("Drag ends", "x:", point.x, "y:", point.y) } > {drag === true ? "Drag me!" : drag === "x" ? "Only X" : "Only Y"} )}
``` :::note Drag's animation to know more about the animation of drag, please refer to [this](https://motion.dev/docs/react-drag). ::: #### Limit the possible area To limit the possible area, set the value (pixels) to `top`・`bottom`・`left`・`right` of `dragConstraints`. ```tsx
Only Right & Bottom
``` Or, you can limit the possible area by setting `ref`. ```tsx const ref = useRef(null) return (
Drag me!
) ``` #### Set elasticity To set elasticity, set the object with the value (pixels) set to `top`・`bottom`・`left`・`right` of `dragElastic` to `true` or a number. ```tsx const ref = useRef(null) return (
Drag me!
) ``` #### Set momentum To set momentum, set the boolean value to `dragMomentum`. ```tsx const ref = useRef(null) return (
Drag me!
) ``` #### Limit the direction To limit the direction, set `dragDirectionLock` to `true`. ```tsx preview functional client const [direction, setDirection] = useState<"x" | "y" | null>(null) return (
setDirection(direction)} onDragEnd={() => setDirection(null)} > Drag me!
) ``` ### Scroll - `whileInView`: The animation executed when the component is in the viewport. - `viewport`: The object that sets the detection method of the viewport. - `once`: If `true`, the animation is executed when the component enters the viewport for the first time. - `root`: If you set the scrollable element (`ref`), the element is used as the viewport instead of `window`. - `margin`: The margin to add to the viewport. - `amount`: `"some"`・`"all"`・number to set the height of the element that needs to intersect with the viewport. - `onViewportEnter`: The callback function executed when the component enters the viewport. - `onViewportLeave`: The callback function executed when the component leaves the viewport. ```tsx const ref = useRef(null) return ( Scroll me!
{(once) => ( console.log("Scroll entires", entry)} onViewportLeave={(entry) => console.log("Scroll leaves", entry)} > {once ? "Once me!" : "You found me!"} )}
) ``` ## Configuration To set the common settings for `Motion` throughout the project, use [MotionConfig](https://motion.dev/docs/react-motion-config). ```tsx import { MotionConfig } from "motion/react" import { UIProvider } from "@yamada-ui/react" const App = () => { return ( ) } ``` ## Similar Components - [Airy](https://yamada-ui.com/docs/components/airy.md): `Airy` is a component that provides a smooth animation to switch between two elements. - [Flip](https://yamada-ui.com/docs/components/flip.md): `Flip` is a component that provides an animation to switch between two elements while flipping. - [Ripple](https://yamada-ui.com/docs/components/ripple.md): `Ripple` is a component that adds a ripple effect to elements, allowing users to recognize when they have clicked. - [Rotate](https://yamada-ui.com/docs/components/rotate.md): `Rotate` is a component that provides an animation to switch between two elements while rotating. - [Collapse](https://yamada-ui.com/docs/components/collapse.md): `Collapse` is a component that allows you to expand or collapse an element for display. - [Fade](https://yamada-ui.com/docs/components/fade.md): `Fade` is a component that gradually shows or hides an element. - [FadeScale](https://yamada-ui.com/docs/components/fade-scale.md): `FadeScale` is a component that gradually scales up to reveal or scales down to hide an element. - [Skeleton](https://yamada-ui.com/docs/components/skeleton.md): `Skeleton` is a component that acts as a placeholder until content is loaded. ## Used By Components & Hooks - [Accordion](https://yamada-ui.com/docs/components/accordion.md): `Accordion` is a component for a list that displays information in an expandable or collapsible manner. - [ActionBar](https://yamada-ui.com/docs/components/action-bar.md): `ActionBar` is a component that is used to display a bottom action bar with a set of actions. - [Airy](https://yamada-ui.com/docs/components/airy.md): `Airy` is a component that provides a smooth animation to switch between two elements. - [Collapse](https://yamada-ui.com/docs/components/collapse.md): `Collapse` is a component that allows you to expand or collapse an element for display. - [Drawer](https://yamada-ui.com/docs/components/drawer.md): `Drawer` is a component for a panel that appears from the edge of the screen. - [Fade](https://yamada-ui.com/docs/components/fade.md): `Fade` is a component that gradually shows or hides an element. - [FadeScale](https://yamada-ui.com/docs/components/fade-scale.md): `FadeScale` is a component that gradually scales up to reveal or scales down to hide an element. - [Flip](https://yamada-ui.com/docs/components/flip.md): `Flip` is a component that provides an animation to switch between two elements while flipping. - [Loading](https://yamada-ui.com/docs/components/loading.md): `Loading` is a component displayed during waiting times, such as when data is being loaded. - [Modal](https://yamada-ui.com/docs/components/modal.md): `Modal` is a component that is displayed over the main content to focus the user's attention solely on the information. - [Popover](https://yamada-ui.com/docs/components/popover.md): `Popover` is a component that floats around an element to display information. - [Reorder](https://yamada-ui.com/docs/components/reorder.md): `Reorder` is a component that allows you to change the order of items using drag and drop. - [Ripple](https://yamada-ui.com/docs/components/ripple.md): `Ripple` is a component that adds a ripple effect to elements, allowing users to recognize when they have clicked. - [Rotate](https://yamada-ui.com/docs/components/rotate.md): `Rotate` is a component that provides an animation to switch between two elements while rotating. - [SegmentedControl](https://yamada-ui.com/docs/components/segmented-control.md): `SegmentedControl` is a component used for allowing users to select one option from multiple choices. - [Sidebar](https://yamada-ui.com/docs/components/sidebar.md): `Sidebar` is a component used to display a list of items in a sidebar. - [Slide](https://yamada-ui.com/docs/components/slide.md): `Slide` is a component that shows or hides an element from the corners of the page. - [SlideFade](https://yamada-ui.com/docs/components/slide-fade.md): `SlideFade` is a component that gradually shows or hides an element while moving it from a specified position. - [Snacks](https://yamada-ui.com/docs/components/snacks.md): `Snacks` is a component for controlling notifications used in forms and other similar situations. - [Tooltip](https://yamada-ui.com/docs/components/tooltip.md): `Tooltip` is a component that displays short information, such as supplementary details for an element. - [Tree](https://yamada-ui.com/docs/components/tree.md): `Tree` is a component used to display hierarchical data structures in an expandable tree format. # Ripple --- title: Ripple description: "`Ripple` is a component that adds a ripple effect to elements, allowing users to recognize when they have clicked." links: - style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/ripple/ripple.style.ts - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/ripple --- # Ripple `Ripple` is a component that adds a ripple effect to elements, allowing users to recognize when they have clicked. ```tsx const { onClick, ...rippleProps } = useRipple() return (
Button
) ``` :::warning You need to set `position: relative` and `overflow: hidden` on the parent element of `Ripple`. ::: ## Usage ```tsx import { Ripple, useRipple } from "@yamada-ui/react" ``` ```tsx import { Ripple, useRipple } from "@/components/ui" ``` ```tsx import { Ripple, useRipple } from "@workspaces/ui" ``` ```tsx ``` ### Change the Color To change the color, set a color to `color`. By default, `currentColor` is set. ```tsx const { onClick, ...rippleProps } = useRipple() return (
Button
) ``` ### Disable Ripple To disable, set `disabled` to `true`. ```tsx const { onClick, ...rippleProps } = useRipple({ disabled: true }) return (
Button
) ``` Alternatively, you can disable it by setting `disabled` to `true` on `Ripple`. ```tsx const { onClick, ...rippleProps } = useRipple() return (
Button
) ``` ## Props | Prop | Default | Type | Description | | ------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- | | `as` | - | `DOMElement` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `onClear` | - | `(key: Key) => void` | The callback invoked when a ripple is cleared. | | `ripples` | - | `RippleOptions[]` | The ripples to use. | | `disabled` | `false` | `boolean` | If `true`, disable ripple effects when pressing a element. | ## Similar Components - [Airy](https://yamada-ui.com/docs/components/airy.md): `Airy` is a component that provides a smooth animation to switch between two elements. - [Flip](https://yamada-ui.com/docs/components/flip.md): `Flip` is a component that provides an animation to switch between two elements while flipping. - [Motion](https://yamada-ui.com/docs/components/motion.md): `Motion` is a convenient component that extends the Yamada UI Style Props to `Motion`. - [Rotate](https://yamada-ui.com/docs/components/rotate.md): `Rotate` is a component that provides an animation to switch between two elements while rotating. - [Collapse](https://yamada-ui.com/docs/components/collapse.md): `Collapse` is a component that allows you to expand or collapse an element for display. - [Fade](https://yamada-ui.com/docs/components/fade.md): `Fade` is a component that gradually shows or hides an element. - [FadeScale](https://yamada-ui.com/docs/components/fade-scale.md): `FadeScale` is a component that gradually scales up to reveal or scales down to hide an element. - [Skeleton](https://yamada-ui.com/docs/components/skeleton.md): `Skeleton` is a component that acts as a placeholder until content is loaded. ## Uses Components & Hooks - [Motion](https://yamada-ui.com/docs/components/motion.md): `Motion` is a convenient component that extends the Yamada UI Style Props to `Motion`. ## Used By Components & Hooks - [Button](https://yamada-ui.com/docs/components/button.md): `Button` is an interactive component that allows users to perform actions such as submitting forms and toggling modals. # Rotate --- title: Rotate description: "`Rotate` is a component that provides an animation to switch between two elements while rotating." links: - style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/rotate/rotate.style.ts - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/rotate - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-rotate--basic --- # Rotate `Rotate` is a component that provides an animation to switch between two elements while rotating. ```tsx } to={} /> ``` ## Usage ```tsx import { Rotate } from "@yamada-ui/react" ``` ```tsx import { Rotate } from "@/components/ui" ``` ```tsx import { Rotate } from "@workspaces/ui" ``` ```tsx ``` ### Change Rotate To change the rotate, set `rotate` to a numerical value. By default, `45` is set. ```tsx } to={} /> ``` ### Change Duration To change the duration, set a numerical value (seconds) to `duration`. ```tsx } to={} /> ``` ### Delay If you want to delay the switch, set a numerical value (seconds) to `delay`. ```tsx } to={} /> ``` ### Disable To disable, set `disabled` to `true`. ```tsx } to={} /> ``` ### Read-Only To ready-Only, set `readOnly` to `true`. ```tsx } to={} /> ``` ### Control ```tsx const [value, onChange] = useState("from") return ( } to={} value={value} onChange={onChange} /> ) ``` ## Props | Prop | Default | Type | Description | | -------------- | -------- | ------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | | `as` | - | `keyof IntrinsicElements` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `defaultValue` | `"from"` | `KeyframeIdent` | You can set the initial state. | | `delay` | `0` | `number` | The animation delay. | | `disabled` | `false` | `boolean` | If `true`, the component is disabled. | | `duration` | `0.4` | `number` | The animation duration. | | `from` | - | `ReactNode` | Passing React elements to "from" is required. | | `onChange` | - | `(value: KeyframeIdent) => void` | This is a callback function that is called when the animation state changes. | | `readOnly` | `false` | `boolean` | If `true`, the component is readonly. | | `rotate` | `45` | `number` | The animation rotation. | | `to` | - | `ReactNode` | Passing React elements to "to" is required. | | `value` | - | `KeyframeIdent` | Use this when you want to control the animation from outside the component. | ## Accessibility The `Rotate` follows the [WAI-ARIA - Button Pattern](https://www.w3.org/WAI/ARIA/apg/patterns/button/) for accessibility. When `aria-label` is set, it will be read aloud by screen readers. ```tsx } to={} /> ``` ### Keyboard Navigation | Key | Description | State | | ---------------- | ------------------------------------- | ----- | | `Enter`, `Space` | When element has focus, activates it. | - | ## Similar Components - [Airy](https://yamada-ui.com/docs/components/airy.md): `Airy` is a component that provides a smooth animation to switch between two elements. - [Flip](https://yamada-ui.com/docs/components/flip.md): `Flip` is a component that provides an animation to switch between two elements while flipping. - [Motion](https://yamada-ui.com/docs/components/motion.md): `Motion` is a convenient component that extends the Yamada UI Style Props to `Motion`. - [Ripple](https://yamada-ui.com/docs/components/ripple.md): `Ripple` is a component that adds a ripple effect to elements, allowing users to recognize when they have clicked. - [Collapse](https://yamada-ui.com/docs/components/collapse.md): `Collapse` is a component that allows you to expand or collapse an element for display. - [Fade](https://yamada-ui.com/docs/components/fade.md): `Fade` is a component that gradually shows or hides an element. - [FadeScale](https://yamada-ui.com/docs/components/fade-scale.md): `FadeScale` is a component that gradually scales up to reveal or scales down to hide an element. - [Skeleton](https://yamada-ui.com/docs/components/skeleton.md): `Skeleton` is a component that acts as a placeholder until content is loaded. ## Uses Components & Hooks - [Motion](https://yamada-ui.com/docs/components/motion.md): `Motion` is a convenient component that extends the Yamada UI Style Props to `Motion`. # Skeleton --- title: Skeleton description: "`Skeleton` is a component that acts as a placeholder until content is loaded." links: - style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/skeleton/skeleton.style.ts - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/skeleton - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-skeleton--basic --- # Skeleton `Skeleton` is a component that acts as a placeholder until content is loaded. ```tsx ``` ## Usage ```tsx import { Skeleton, SkeletonCircle, SkeletonText } from "@yamada-ui/react" ``` ```tsx import { Skeleton, SkeletonCircle, SkeletonText } from "@/components/ui" ``` ```tsx import { Skeleton, SkeletonCircle, SkeletonText } from "@workspaces/ui" ``` ```tsx ``` ### Change Variant ```tsx {(variant) => ( )} ``` ### Change Size ```tsx ``` Additionally, by passing child elements, you can match the width and height. ```tsx Badge Badge ``` ### Change Blink Color To change the blink color, use the `startColor` and `endColor` properties. ```tsx ``` ### Change Text Gap To change the gap between text lines, set the `gap` property. ```tsx ``` ### Specify Number of Lines To specify the number of lines, set a numeric value to `lineClamp`. ```tsx ``` ### Change Blink Duration To change the blink duration, set a numeric value (seconds) to `duration`. ```tsx ``` ### Display Child Elements To display child elements, pass `false` to `loading`. ```tsx const { loading } = useAsync(() => wait(3000)) return ( プリン つぶらな 瞳が 揺れるとき 眠たくなるような 不思議で 気持ちの良い 歌を 歌う。 ) ``` ### Change Fade In Duration To change the fade in duration, set a numeric value (seconds) to `fadeDuration`. ```tsx const { loading } = useAsync(() => wait(3000)) return ( プリン つぶらな 瞳が 揺れるとき 眠たくなるような 不思議で 気持ちの良い 歌を 歌う。 ) ``` ## Props ### Skeleton | Prop | Default | Type | Description | | -------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `variant` | `"pulse"` | `"none" \| "pulse" \| "shine"` | The variant of the component. | | `duration` | - | `number \| string` | The animation duration in seconds. | | `endColor` | - | `"-moz-initial" \| "AccentColor" \| "AccentColorText" \| "ActiveBorder" \| "ActiveCaption" \| "ActiveText" \| "aliceblue" \| "amber.100" \| "amber.200" \| "amber.300" ...` | The color at the animation end. | | `fadeDuration` | - | `number \| string` | The fade in duration in seconds. Requires `loaded` toggled to `true` in order to see the transition. | | `fitContent` | `false` | `boolean` | If `true`, the skeleton will take the width of it's children. | | `startColor` | - | `"-moz-initial" \| "AccentColor" \| "AccentColorText" \| "ActiveBorder" \| "ActiveCaption" \| "ActiveText" \| "aliceblue" \| "amber.100" \| "amber.200" \| "amber.300" ...` | The color at the animation start. | ### SkeletonCircle | Prop | Default | Type | Description | | -------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `variant` | - | `"none" \| "pulse" \| "shine"` | The variant of the component. | | `duration` | - | `number \| string` | The animation duration in seconds. | | `endColor` | - | `"-moz-initial" \| "AccentColor" \| "AccentColorText" \| "ActiveBorder" \| "ActiveCaption" \| "ActiveText" \| "aliceblue" \| "amber.100" \| "amber.200" \| "amber.300" ...` | The color at the animation end. | | `fadeDuration` | - | `number \| string` | The fade in duration in seconds. Requires `loaded` toggled to `true` in order to see the transition. | | `fitContent` | `false` | `boolean` | If `true`, the skeleton will take the width of it's children. | | `startColor` | - | `"-moz-initial" \| "AccentColor" \| "AccentColorText" \| "ActiveBorder" \| "ActiveCaption" \| "ActiveText" \| "aliceblue" \| "amber.100" \| "amber.200" \| "amber.300" ...` | The color at the animation start. | ### SkeletonText | Prop | Default | Type | Description | | -------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `variant` | - | `"none" \| "pulse" \| "shine"` | The variant of the component. | | `duration` | - | `string \| number` | The animation duration in seconds. | | `endColor` | - | `"-moz-initial" \| "AccentColor" \| "AccentColorText" \| "ActiveBorder" \| "ActiveCaption" \| "ActiveText" \| "aliceblue" \| "amber.100" \| "amber.200" \| "amber.300" ...` | The color at the animation end. | | `fadeDuration` | - | `string \| number` | The fade in duration in seconds. Requires `loaded` toggled to `true` in order to see the transition. | | `fitContent` | `false` | `boolean` | If `true`, the skeleton will take the width of it's children. | | `lineClamp` | - | `number` | The number of lines to display. | | `rootProps` | - | `HTMLStyledProps` | Props for the root element. | | `startColor` | - | `"-moz-initial" \| "AccentColor" \| "AccentColorText" \| "ActiveBorder" \| "ActiveCaption" \| "ActiveText" \| "aliceblue" \| "amber.100" \| "amber.200" \| "amber.300" ...` | The color at the animation start. | ## Similar Components - [Airy](https://yamada-ui.com/docs/components/airy.md): `Airy` is a component that provides a smooth animation to switch between two elements. - [EmptyState](https://yamada-ui.com/docs/components/empty-state.md): `EmptyState` is a component used to display when a resource is empty or unavailable. - [Flip](https://yamada-ui.com/docs/components/flip.md): `Flip` is a component that provides an animation to switch between two elements while flipping. - [Loading](https://yamada-ui.com/docs/components/loading.md): `Loading` is a component displayed during waiting times, such as when data is being loaded. - [Motion](https://yamada-ui.com/docs/components/motion.md): `Motion` is a convenient component that extends the Yamada UI Style Props to `Motion`. - [Ripple](https://yamada-ui.com/docs/components/ripple.md): `Ripple` is a component that adds a ripple effect to elements, allowing users to recognize when they have clicked. - [Rotate](https://yamada-ui.com/docs/components/rotate.md): `Rotate` is a component that provides an animation to switch between two elements while rotating. - [Alert](https://yamada-ui.com/docs/components/alert.md): `Alert` is a component that conveys information to the user. # SlideFade --- title: SlideFade description: "`SlideFade` is a component that gradually shows or hides an element while moving it from a specified position." links: - style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/slide-fade/slide-fade.style.ts - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/slide-fade - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-slidefade--basic --- # SlideFade `SlideFade` is a component that gradually shows or hides an element while moving it from a specified position. ```tsx const [open, { toggle }] = useBoolean() return ( クラスは最低じゃないぞ!メンバーが最低なだけだ! ) ``` ## Usage ```tsx import { SlideFade } from "@yamada-ui/react" ``` ```tsx import { SlideFade } from "@/components/ui" ``` ```tsx import { SlideFade } from "@workspaces/ui" ``` ```tsx ``` ### Change the Duration To change the duration, set a number (in seconds) to `duration`. ```tsx const [open, { toggle }] = useBoolean() return ( 確かにアイツは勉強ができない。でもな、学力が低いからといって、全てが決まるわけじゃないだろう? ) ``` ### Change the Position To change the position, specify a string or number for `offsetX` or `offsetY`. ```tsx const [open, { toggle }] = useBoolean() return ( ……私、このクラスの皆が好きなんです。人の為に一生懸命な皆のいる、Fクラスが ……女は胸じゃないのに。アキの、バカ…… ) ``` ### Unmount on Exit To unmount the component when it is not visible, set `unmountOnExit` to `true`. ```tsx const [open, { toggle }] = useBoolean() return ( 考えすぎではないかのぅ。メイド服くらい人間一度は着るものじゃ ) ``` ### Delay To delay the animation, set a number (in seconds) to `delay`. ```tsx const [open, { toggle }] = useBoolean() return ( たとえ許されない行為であろうとも自分の気持ちは偽れない。正直に言おう、今僕は…純粋に欲望のために女子風呂を覗きたいッ!! ) ``` ## Props | Prop | Default | Type | Description | | --------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `as` | - | `keyof IntrinsicElements` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `enter` | - | `any` | Custom `enter`. | | `exit` | - | `any` | Custom `exit`. A target to animate to when this component is removed from the tree. This component **must** be the first animatable child of an `AnimatePresence` to enable this exit animation. This limitation exists because React doesn't allow components to defer unmounting until after an animation is complete. Once this limitation is fixed, the `AnimatePresence` component will be unnecessary. | | `initial` | - | `any` | Custom `initial`. Properties, variant label or array of variant labels to start in. Set to `false` to initialise with the values in `animate` (disabling the mount animation) | | `delay` | `0` | `MotionLifecycleProps \| number` | Custom `delay` definition for `enter` and `exit`. | | `duration` | `0.2` | `MotionLifecycleProps \| number` | Custom `duration` definition for `enter` and `exit`. | | `offsetX` | `0` | `number \| string` | The offset on the horizontal or `x` axis. | | `offsetY` | `8` | `number \| string` | The offset on the vertical or `y` axis. | | `open` | - | `boolean` | Show the component. triggers when enter or exit states. | | `reverse` | `true` | `boolean` | If `true`, the element will be transitioned back to the offset when it leaves. Otherwise, it'll only fade out. | | `transition` | - | `MotionLifecycleProps` | Custom `transition` definition for `enter` and `exit`. | | `transitionEnd` | - | `MotionLifecycleProps` | Custom `transitionEnd` definition for `enter` and `exit`. | | `unmountOnExit` | - | `boolean` | If `true`, the element will unmount when `open={false}` and animation is done. | ## Similar Components - [Collapse](https://yamada-ui.com/docs/components/collapse.md): `Collapse` is a component that allows you to expand or collapse an element for display. - [Fade](https://yamada-ui.com/docs/components/fade.md): `Fade` is a component that gradually shows or hides an element. - [FadeScale](https://yamada-ui.com/docs/components/fade-scale.md): `FadeScale` is a component that gradually scales up to reveal or scales down to hide an element. - [Slide](https://yamada-ui.com/docs/components/slide.md): `Slide` is a component that shows or hides an element from the corners of the page. - [Accordion](https://yamada-ui.com/docs/components/accordion.md): `Accordion` is a component for a list that displays information in an expandable or collapsible manner. - [Airy](https://yamada-ui.com/docs/components/airy.md): `Airy` is a component that provides a smooth animation to switch between two elements. - [Drawer](https://yamada-ui.com/docs/components/drawer.md): `Drawer` is a component for a panel that appears from the edge of the screen. - [Flip](https://yamada-ui.com/docs/components/flip.md): `Flip` is a component that provides an animation to switch between two elements while flipping. ## Uses Components & Hooks - [Motion](https://yamada-ui.com/docs/components/motion.md): `Motion` is a convenient component that extends the Yamada UI Style Props to `Motion`. ## Used By Components & Hooks - [Popover](https://yamada-ui.com/docs/components/popover.md): `Popover` is a component that floats around an element to display information. # Slide --- title: Slide description: "`Slide` is a component that shows or hides an element from the corners of the page." links: - style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/slide/slide.style.ts - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/slide - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-slide--basic --- # Slide `Slide` is a component that shows or hides an element from the corners of the page. ```tsx const [open, { toggle }] = useBoolean() return ( <> クリリンのことか……クリリンのことかーーーっ!!!!! ) ``` ## Usage ```tsx import { Slide } from "@yamada-ui/react" ``` ```tsx import { Slide } from "@/components/ui" ``` ```tsx import { Slide } from "@workspaces/ui" ``` ```tsx ``` ### Change Placement To change the placement, set `placement` to `"block-start"`, `"block-end"`, `"inline-start"`, or `"inline-end"`. Default is `"inline-end"`. ```tsx const placements = ["block-start", "block-end", "inline-start", "inline-end"] const [placement, setPlacement] = useState("inline-end") const [open, { toggle }] = useBoolean() return ( {placements.map((value) => ( ))} クリリンのことか……クリリンのことかーーーっ!!!!! ) ``` ### Change Duration To change the duration, set a number (in seconds) to `duration`. Default is `{ enter: 0.4, exit: 0.3 }`. ```tsx const [open, { toggle }] = useBoolean() return ( <> クリリンのことか……クリリンのことかーーーっ!!!!! ) ``` ### Unmount on Exit To unmount the component when it is not visible, set `unmountOnExit` to `true`. ```tsx const [open, { toggle }] = useBoolean() return ( <> クリリンのことか……クリリンのことかーーーっ!!!!! ) ``` ### Delay If you want to delay the switch, set a numerical value (seconds) to `delay`. ```tsx const [open, { toggle }] = useBoolean() return ( <> クリリンのことか……クリリンのことかーーーっ!!!!! ) ``` ## Props | Prop | Default | Type | Description | | --------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `as` | - | `keyof IntrinsicElements` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `enter` | - | `any` | Custom `enter`. | | `exit` | - | `any` | Custom `exit`. A target to animate to when this component is removed from the tree. This component **must** be the first animatable child of an `AnimatePresence` to enable this exit animation. This limitation exists because React doesn't allow components to defer unmounting until after an animation is complete. Once this limitation is fixed, the `AnimatePresence` component will be unnecessary. | | `initial` | - | `any` | Custom `initial`. Properties, variant label or array of variant labels to start in. Set to `false` to initialise with the values in `animate` (disabling the mount animation) | | `delay` | `0` | `MotionLifecycleProps \| number` | Custom `delay` definition for `enter` and `exit`. | | `duration` | `0.2` | `MotionLifecycleProps \| number` | Custom `duration` definition for `enter` and `exit`. | | `open` | - | `boolean` | Show the component. triggers when enter or exit states. | | `transition` | - | `MotionLifecycleProps` | Custom `transition` definition for `enter` and `exit`. | | `transitionEnd` | - | `MotionLifecycleProps` | Custom `transitionEnd` definition for `enter` and `exit`. | | `unmountOnExit` | - | `boolean` | If `true`, the element will unmount when `open={false}` and animation is done. | ## Similar Components - [Collapse](https://yamada-ui.com/docs/components/collapse.md): `Collapse` is a component that allows you to expand or collapse an element for display. - [Fade](https://yamada-ui.com/docs/components/fade.md): `Fade` is a component that gradually shows or hides an element. - [FadeScale](https://yamada-ui.com/docs/components/fade-scale.md): `FadeScale` is a component that gradually scales up to reveal or scales down to hide an element. - [SlideFade](https://yamada-ui.com/docs/components/slide-fade.md): `SlideFade` is a component that gradually shows or hides an element while moving it from a specified position. - [Accordion](https://yamada-ui.com/docs/components/accordion.md): `Accordion` is a component for a list that displays information in an expandable or collapsible manner. - [Airy](https://yamada-ui.com/docs/components/airy.md): `Airy` is a component that provides a smooth animation to switch between two elements. - [Drawer](https://yamada-ui.com/docs/components/drawer.md): `Drawer` is a component for a panel that appears from the edge of the screen. - [Flip](https://yamada-ui.com/docs/components/flip.md): `Flip` is a component that provides an animation to switch between two elements while flipping. ## Uses Components & Hooks - [Motion](https://yamada-ui.com/docs/components/motion.md): `Motion` is a convenient component that extends the Yamada UI Style Props to `Motion`. - [useValue](https://yamada-ui.com/docs/hooks/use-value.md): `useValue` is a custom hook that combines `useBreakpointValue` and `useColorModeValue`. ## Used By Components & Hooks - [Drawer](https://yamada-ui.com/docs/components/drawer.md): `Drawer` is a component for a panel that appears from the edge of the screen. # AreaChart --- title: AreaChart description: "`AreaChart` is a component for drawing area charts to compare multiple sets of data." links: - style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/chart/area-chart.style.ts - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/chart - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-chart-areachart--basic --- # AreaChart `AreaChart` is a component for drawing area charts to compare multiple sets of data. ```tsx interface Data { date: string desktop: number mobile: number tablet: number } const series = useMemo[]>( () => AreaChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo( () => [ { date: "2026-03-01", desktop: faker.number.int({ max: 2000, min: 1000 }), mobile: faker.number.int({ max: 4000, min: 3000 }), tablet: faker.number.int({ max: 3000, min: 2000 }), }, { date: "2026-04-01", desktop: faker.number.int({ max: 2000, min: 1000 }), mobile: faker.number.int({ max: 4000, min: 3000 }), tablet: faker.number.int({ max: 3000, min: 2000 }), }, { date: "2026-05-01", desktop: faker.number.int({ max: 2000, min: 1000 }), mobile: faker.number.int({ max: 4000, min: 3000 }), tablet: faker.number.int({ max: 3000, min: 2000 }), }, { date: "2026-06-01", desktop: faker.number.int({ max: 2000, min: 1000 }), mobile: faker.number.int({ max: 4000, min: 3000 }), tablet: faker.number.int({ max: 3000, min: 2000 }), }, { date: "2026-07-01", desktop: faker.number.int({ max: 2000, min: 1000 }), mobile: faker.number.int({ max: 4000, min: 3000 }), tablet: faker.number.int({ max: 3000, min: 2000 }), }, { date: "2026-08-01", desktop: faker.number.int({ max: 2000, min: 1000 }), mobile: faker.number.int({ max: 4000, min: 3000 }), tablet: faker.number.int({ max: 3000, min: 2000 }), }, ], [], ) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ## Usage ```tsx import { AreaChart } from "@yamada-ui/react" ``` ```tsx import { AreaChart } from "@/components/ui" ``` ```tsx import { AreaChart } from "@workspaces/ui" ``` ```tsx ``` ### Composition ```tsx const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value).format("MMM")} /> dayjs(value as string).format("MMM")} /> ) ``` ### Change Size ```tsx const series = useMemo[]>( () => AreaChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( {(size, index) => ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> )} ) ``` ### Change Color Scheme ```tsx const series = useMemo[]>( () => AreaChart.mergeSeries( [{ dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }], "blue", ), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Change Color ```tsx const series = useMemo[]>( () => [ { dataKey: "desktop", color: "blue" }, { dataKey: "tablet", color: "green" }, { dataKey: "mobile", color: "red" }, ], [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Add Gradient To add a gradient, set `withGradient` or `areaProps.withGradient` to `true`. The default is `false`. ```tsx const series = useMemo[]>( () => AreaChart.mergeSeries( [{ dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }], "blue", ), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Change Type To change the type, set `type` in `series` or `areaProps.type` to `"monotone"`, `"linear"`, etc. The default is `"monotone"`. ```tsx const series = useMemo[]>( () => AreaChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( {(type, index) => ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> )} ) ``` ### Stacked To stack the series, set `stackId` or `areaProps.stackId` to a string. ```tsx const series = useMemo[]>( () => [ { dataKey: "desktop", color: "blue" }, { dataKey: "tablet", color: "green" }, { dataKey: "mobile", color: "red" }, ], [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Percent To make the series a percentage, set `stackId` or `areaProps.stackId` to a string and set `chartProps.stackOffset` to `"expand"`. ```tsx const series = useMemo[]>( () => [ { dataKey: "desktop", color: "blue" }, { dataKey: "tablet", color: "green" }, { dataKey: "mobile", color: "red" }, ], [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Add Y Axis To add the Y axis, set `withYAxis` to `true`. The default is `false`. ```tsx const series = useMemo[]>( () => AreaChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` To change the orientation of the Y axis, set `yAxisProps.orientation` to `"start"` or `"end"`. The default is `"start"`. ```tsx const series = useMemo[]>( () => AreaChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} yAxisProps={{ orientation: "end" }} /> ) ``` ### Add Legend To add the legend, set `withLegend` to `true`. The default is `false`. To change the placement of the legend, set `legendProps.placement` to `"start-start"`, `"end-end"`, etc. The default is `"start-end"`. ```tsx const series = useMemo[]>( () => [ { dataKey: "desktop", color: "blue" }, { dataKey: "tablet", color: "green" }, { dataKey: "mobile", color: "red" }, ], [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Change Name To change the name of the tooltip or legend, set `name` to a string in `series`. ```tsx const series = useMemo[]>( () => [ { dataKey: "desktop", name: "Desktop", color: "blue" }, { dataKey: "tablet", name: "Tablet", color: "green" }, { dataKey: "mobile", name: "Mobile", color: "red" }, ], [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Change Grid To change the grid, set `horizontal` and `vertical` to a boolean in `gridProps`. ```tsx const series = useMemo[]>( () => AreaChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( {(value, index) => ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> )} ) ``` ### Add Dot To add a dot, set `dot` of `series` or `areaProps.dot` to `true`. The default is `false`. ```tsx const series = useMemo[]>( () => AreaChart.mergeSeries([{ dataKey: "desktop" }]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Add Label To add a label, set `label` of `series` or `areaProps.label` to `true`. The default is `false`. ```tsx const series = useMemo[]>( () => AreaChart.mergeSeries([{ dataKey: "desktop" }]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Add Unit To add a unit, use `formatter` or `tickFormatter` or set `unit` to a string. ```tsx preview functional const series = useMemo[]>( () => AreaChart.mergeSeries([{ dataKey: "desktop" }]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( `${(Number(value) / 1000).toFixed(1)}k`, }, }} chartProps={{ margin: { right: 16 } }} tooltipProps={{ formatter: (value) => `${(Number(value) / 1000).toFixed(1)}k`, labelFormatter: (value) => dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} yAxisProps={{ domain: [0, 10000], tickFormatter: (value) => (value / 1000).toFixed(1), ticks: [0, 2500, 5000, 7500, 10000], unit: "k", }} /> ) ``` ### Sync To sync the chart, set `syncId` to a string. ```tsx const series = useMemo[]>( () => AreaChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Format To format the chart, use `formatter` or `tickFormatter` etc. ```tsx const series = useMemo[]>( () => AreaChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( [ Number(value).toLocaleString(), toTitleCase(name), ], labelFormatter: (value) => dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} yAxisProps={{ tickFormatter: (value) => value.toLocaleString(), }} /> ) ``` ### Add Reference Line ```tsx const series = useMemo[]>( () => AreaChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} > ) ``` ### Add Tick Line To add a tick line, set `tickLine` to `true` in `xAxisProps` or `yAxisProps`. The default is `false`. ```tsx const series = useMemo[]>( () => AreaChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), tickLine: true, }} yAxisProps={{ tickFormatter: (value) => value.toLocaleString(), tickLine: true, }} /> ) ``` ### Add Axis Label To add an axis label, set `label` to a string in `xAxisProps` or `yAxisProps`. The default is `false`. ```tsx const series = useMemo[]>( () => AreaChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", label: "Date", tickFormatter: (value) => dayjs(value).format("MMM"), }} yAxisProps={{ label: "Value" }} /> ) ``` ### Set Domain To set the domain, set `domain` to an array in `yAxisProps`. To set the ticks, set `ticks` to an array in `yAxisProps`. ```tsx const series = useMemo[]>( () => AreaChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} yAxisProps={{ domain: [0, 10000], ticks: [0, 2500, 5000, 7500, 10000], }} /> ) ``` ### Add Tooltip Cursor To add a tooltip cursor, set `cursor` to `true` in `tooltipProps`. The default is `false`. ```tsx const series = useMemo[]>( () => AreaChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value).format("MMM"), }} /> ) ``` ### Hide X Axis To hide the X axis, set `withXAxis` to `false`. The default is `true`. ```tsx const series = useMemo[]>( () => AreaChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( null }} /> ) ``` ### Hide Active Dot To hide the active dot, set `activeDot` or `areaProps.activeDot` to `false`. The default is `true`. ```tsx const series = useMemo[]>( () => AreaChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Hide Tooltip To hide the tooltip, set `withTooltip` to `false`. The default is `true`. ```tsx const series = useMemo[]>( () => AreaChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value).format("MMM"), }} /> ) ``` ### Customize Axis ```tsx const series = useMemo[]>( () => AreaChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", label: { color: ["red", "blue"] }, tick: { color: ["red", "blue"] }, tickFormatter: (value) => dayjs(value).format("MMM"), tickLine: { color: ["red", "blue"] }, }} yAxisProps={{ label: { color: ["red", "blue"] }, tick: { color: ["red", "blue"] }, tickLine: { color: ["red", "blue"] }, }} /> ) ``` ### Customize Dot ```tsx const series = useMemo[]>( () => AreaChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet", dot: { fill: "blue" } }, { dataKey: "mobile", dot: { fill: ["white", "black"], stroke: "red", strokeWidth: 1 }, }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), contentProps: { withSwatch: false }, }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Customize Active Dot ```tsx const series = useMemo[]>( () => AreaChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), contentProps: { withSwatch: false }, }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Customize Label ```tsx const series = useMemo[]>( () => [{ color: "blue", dataKey: "desktop" }], [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), contentProps: { withSwatch: false }, }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} yAxisProps={{ domain: [0, 10000], ticks: [0, 2500, 5000, 7500, 10000], }} /> ) ``` ### Customize Grid ```tsx const series = useMemo[]>( () => AreaChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), contentProps: { withSwatch: false }, }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Customize Tooltip Cursor ```tsx const series = useMemo[]>( () => AreaChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ## Accessibility ### Keyboard Navigation | Key | Description | State | | ------------ | ---------------------------------------------------------- | -------------------- | | `ArrowRight` | Moves to the next data point and displays the tooltip. | `withTooltip={true}` | | `ArrowLeft` | Moves to the previous data point and displays the tooltip. | `withTooltip={true}` | | `Enter` | Toggles the tooltip display for the active data point. | `withTooltip={true}` | ### ARIA Roles and Attributes | Component | Role and Attribute | Usage | | --------- | -------------------- | -------------------------------------- | | `svg` | `role="application"` | Indicates that this is an application. | ## Props # BarChart --- title: BarChart description: "`BarChart` is a component for drawing bar charts to compare multiple sets of data." links: - style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/chart/bar-chart.style.ts - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/chart - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-chart-barchart--basic --- # BarChart `BarChart` is a component for drawing bar charts to compare multiple sets of data. ```tsx interface Data { date: string desktop: number mobile: number tablet: number } const series = useMemo[]>( () => BarChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo( () => [ { date: "2026-03-01", desktop: faker.number.int({ max: 5000, min: 1000 }), mobile: faker.number.int({ max: 5000, min: 1000 }), tablet: faker.number.int({ max: 5000, min: 1000 }), }, { date: "2026-04-01", desktop: faker.number.int({ max: 5000, min: 1000 }), mobile: faker.number.int({ max: 5000, min: 1000 }), tablet: faker.number.int({ max: 5000, min: 1000 }), }, { date: "2026-05-01", desktop: faker.number.int({ max: 5000, min: 1000 }), mobile: faker.number.int({ max: 5000, min: 1000 }), tablet: faker.number.int({ max: 5000, min: 1000 }), }, { date: "2026-06-01", desktop: faker.number.int({ max: 5000, min: 1000 }), mobile: faker.number.int({ max: 5000, min: 1000 }), tablet: faker.number.int({ max: 5000, min: 1000 }), }, { date: "2026-07-01", desktop: faker.number.int({ max: 5000, min: 1000 }), mobile: faker.number.int({ max: 5000, min: 1000 }), tablet: faker.number.int({ max: 5000, min: 1000 }), }, { date: "2026-08-01", desktop: faker.number.int({ max: 5000, min: 1000 }), mobile: faker.number.int({ max: 5000, min: 1000 }), tablet: faker.number.int({ max: 5000, min: 1000 }), }, ], [], ) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ## Usage ```tsx import { BarChart } from "@yamada-ui/react" ``` ```tsx import { BarChart } from "@/components/ui" ``` ```tsx import { BarChart } from "@workspaces/ui" ``` ```tsx ``` ### Composition ```tsx const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM")} /> dayjs(value).format("MMM")} /> ) ``` ### Change Size ```tsx const series = useMemo[]>( () => BarChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( {(size, index) => ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> )} ) ``` ### Change Color Scheme ```tsx const series = useMemo[]>( () => BarChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Change Color ```tsx const series = useMemo[]>( () => [ { dataKey: "desktop", color: "red" }, { dataKey: "tablet", color: "blue" }, { dataKey: "mobile", color: "green" }, ], [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Range To display a range, set the values of the `data` items as `[min, max]` arrays. ```tsx const series = useMemo[]>( () => [{ dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }], [], ) const data = useMemo( () => Array.from({ length: 6 }, (_, index) => ({ date: dayjs().add(index, "month").format("YYYY-MM-DD"), desktop: [ faker.number.int({ min: 1000, max: 2000 }), faker.number.int({ min: 4000, max: 5000 }), ], mobile: [ faker.number.int({ min: 1000, max: 2000 }), faker.number.int({ min: 4000, max: 5000 }), ], tablet: [ faker.number.int({ min: 1000, max: 2000 }), faker.number.int({ min: 4000, max: 5000 }), ], })), [], ) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Stacked To stack the series, set `stackId` in `series` or `barProps.stackId` to a string. ```tsx const series = useMemo[]>( () => [ { dataKey: "desktop", color: "red" }, { dataKey: "tablet", color: "blue", radius: [0, 0, 4, 4], stackId: "stack", }, { dataKey: "mobile", color: "green", radius: [4, 4, 0, 0], stackId: "stack", }, ], [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Percent To make the series a percentage, set `stackId` or `barProps.stackId` to a string and set `chartProps.stackOffset` to `"expand"`. ```tsx preview functional const series = useMemo[]>( () => [ { dataKey: "desktop", color: "red" }, { dataKey: "tablet", color: "blue" }, { dataKey: "mobile", color: "green" }, ], [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} yAxisProps={{ tickFormatter: (value) => `${(Number(value) * 100).toFixed(0)}%`, }} /> ) ``` ### Add Y Axis To add the Y axis, set `withYAxis` to `true`. The default is `false`. ```tsx const series = useMemo[]>( () => BarChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` To change the orientation of the Y axis, set `yAxisProps.orientation` to `"start"` or `"end"`. The default is `"start"`. ```tsx const series = useMemo[]>( () => BarChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} yAxisProps={{ orientation: "end" }} /> ) ``` ### Add Legend To add the legend, set `withLegend` to `true`. The default is `false`. To change the placement of the legend, set `legendProps.placement` to `"start-start"`, `"end-end"`, etc. The default is `"start-end"`. ```tsx const series = useMemo[]>( () => [ { dataKey: "desktop", color: "red" }, { dataKey: "tablet", color: "blue" }, { dataKey: "mobile", color: "green" }, ], [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Change Name To change the name of the tooltip or legend, set `name` to a string in `series`. ```tsx const series = useMemo[]>( () => [ { dataKey: "desktop", name: "Desktop", color: "red" }, { dataKey: "tablet", name: "Tablet", color: "blue" }, { dataKey: "mobile", name: "Mobile", color: "green" }, ], [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Change Grid To change the grid, set `horizontal` and `vertical` to a boolean in `gridProps`. ```tsx const series = useMemo[]>( () => BarChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( {(value, index) => ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> )} ) ``` ### Add Label To add a label, set `label` of `series` or `barProps.label` to `true`. The default is `false`. ```tsx const series = useMemo[]>( () => BarChart.mergeSeries([{ dataKey: "desktop" }]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Add Unit To add a unit, use `formatter` or `tickFormatter` or set `unit` to a string. ```tsx preview functional const series = useMemo[]>( () => BarChart.mergeSeries([{ dataKey: "desktop" }]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( `${(Number(value) / 1000).toFixed(1)}k`, }, }} chartProps={{ margin: { right: 16 } }} tooltipProps={{ formatter: (value) => `${(Number(value) / 1000).toFixed(1)}k`, labelFormatter: (value) => dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} yAxisProps={{ domain: [0, 10000], tickFormatter: (value) => (value / 1000).toFixed(1), ticks: [0, 2500, 5000, 7500, 10000], unit: "k", }} /> ) ``` ### Vertical To make the chart vertical, set `layout` to `"vertical"` in `chartProps` and adjust the type of the axes. ```tsx const series = useMemo[]>( () => BarChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ type: "number" }} yAxisProps={{ type: "category", dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Sync To sync the chart, set `syncId` to a string. ```tsx const series = useMemo[]>( () => BarChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Format To format the chart, use `formatter` or `tickFormatter` etc. ```tsx const series = useMemo[]>( () => BarChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( [ Number(value).toLocaleString(), toTitleCase(name), ], labelFormatter: (value) => dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} yAxisProps={{ tickFormatter: (value) => value.toLocaleString() }} /> ) ``` ### Add Reference Line ```tsx const series = useMemo[]>( () => BarChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} > ) ``` ### Add Tick Line To add a reference line, set `tickLine` to `true` in `xAxisProps` or `yAxisProps`. The default is `false`. ```tsx const series = useMemo[]>( () => BarChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), tickLine: true, }} yAxisProps={{ tickLine: true }} /> ) ``` ### Add Axis Label To add an axis label, set `label` to a string in `xAxisProps` or `yAxisProps`. The default is `false`. ```tsx const series = useMemo[]>( () => BarChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", label: "Date", tickFormatter: (value) => dayjs(value).format("MMM"), }} yAxisProps={{ label: "Value" }} /> ) ``` ### Set Domain To set the domain, set `domain` to an array in `yAxisProps`. To set the ticks, set `ticks` to an array in `yAxisProps`. ```tsx const series = useMemo[]>( () => BarChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} yAxisProps={{ domain: [0, 5000], ticks: [0, 1000, 2000, 3000, 4000, 5000], }} /> ) ``` ### Change Gap To change the gap, set `barCategoryGap` and `barGap` in `chartProps` to a number or string. ```tsx const series = useMemo[]>( () => BarChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Change Radius To change the radius, set `radius` in `series` or `barProps.radius` to a number or an array. ```tsx const series = useMemo[]>( () => [ { color: "red", dataKey: "desktop", radius: 8 }, { color: "blue", dataKey: "tablet", radius: [0, 0, 8, 8], stackId: "stack", }, { color: "green", dataKey: "mobile", radius: [8, 8, 0, 0], stackId: "stack", }, ], [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Add Tooltip Cursor To add a tooltip cursor, set `cursor` to `true` in `tooltipProps`. The default is `false`. ```tsx const series = useMemo[]>( () => BarChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Hide X Axis To hide the X axis, set `withXAxis` to `false`. The default is `true`. ```tsx const series = useMemo[]>( () => BarChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( null }} /> ) ``` ### Hide Tooltip To hide the tooltip, set `withTooltip` to `false`. The default is `true`. ```tsx const series = useMemo[]>( () => BarChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value).format("MMM"), }} /> ) ``` ### Customize Axis ```tsx const series = useMemo[]>( () => BarChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", label: { color: ["red", "blue"] }, tick: { color: ["red", "blue"] }, tickFormatter: (value) => dayjs(value).format("MMM"), tickLine: { color: ["red", "blue"] }, }} yAxisProps={{ label: { color: ["red", "blue"] }, tick: { color: ["red", "blue"] }, tickLine: { color: ["red", "blue"] }, }} /> ) ``` ### Customize Label ```tsx const series = useMemo[]>( () => [{ color: "blue", dataKey: "desktop" }], [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), contentProps: { withSwatch: false }, }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} yAxisProps={{ domain: [0, 10000], ticks: [0, 2500, 5000, 7500, 10000], }} /> ) ``` ### Customize Grid ```tsx const series = useMemo[]>( () => BarChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), contentProps: { withSwatch: false }, }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Customize Tooltip Cursor ```tsx const series = useMemo[]>( () => BarChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ## Accessibility ### Keyboard Navigation | Key | Description | State | | ------------ | ---------------------------------------------------------- | -------------------- | | `ArrowRight` | Moves to the next data point and displays the tooltip. | `withTooltip={true}` | | `ArrowLeft` | Moves to the previous data point and displays the tooltip. | `withTooltip={true}` | | `Enter` | Toggles the tooltip display for the active data point. | `withTooltip={true}` | ### ARIA Roles and Attributes | Component | Role and Attribute | Usage | | --------- | -------------------- | -------------------------------------- | | `svg` | `role="application"` | Indicates that this is an application. | ## Props # ComposedChart --- title: ComposedChart description: "`ComposedChart` is a component for drawing composed charts to compare multiple sets of data." links: - style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/chart/composed-chart.style.ts - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/chart - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-chart-composedchart--basic --- # ComposedChart `ComposedChart` is a component for drawing composed charts to compare multiple sets of data. ```tsx interface Data { date: string desktop: number mobile: number tablet: number } const series = useMemo( () => ComposedChart.mergeSeries([ [ "bar", { dataKey: "desktop" }, ] satisfies ComposedChart.ComposedProps, [ "area", { dataKey: "tablet" }, ] satisfies ComposedChart.ComposedProps, [ "line", { dataKey: "mobile" }, ] satisfies ComposedChart.ComposedProps, ]), [], ) const data = useMemo( () => [ { date: "2026-03-01", desktop: faker.number.int({ max: 5000, min: 1000 }), mobile: faker.number.int({ max: 5000, min: 1000 }), tablet: faker.number.int({ max: 5000, min: 1000 }), }, { date: "2026-04-01", desktop: faker.number.int({ max: 5000, min: 1000 }), mobile: faker.number.int({ max: 5000, min: 1000 }), tablet: faker.number.int({ max: 5000, min: 1000 }), }, { date: "2026-05-01", desktop: faker.number.int({ max: 5000, min: 1000 }), mobile: faker.number.int({ max: 5000, min: 1000 }), tablet: faker.number.int({ max: 5000, min: 1000 }), }, { date: "2026-06-01", desktop: faker.number.int({ max: 5000, min: 1000 }), mobile: faker.number.int({ max: 5000, min: 1000 }), tablet: faker.number.int({ max: 5000, min: 1000 }), }, { date: "2026-07-01", desktop: faker.number.int({ max: 5000, min: 1000 }), mobile: faker.number.int({ max: 5000, min: 1000 }), tablet: faker.number.int({ max: 5000, min: 1000 }), }, { date: "2026-08-01", desktop: faker.number.int({ max: 5000, min: 1000 }), mobile: faker.number.int({ max: 5000, min: 1000 }), tablet: faker.number.int({ max: 5000, min: 1000 }), }, ], [], ) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ## Usage :```tsx import { ComposedChart } from "@yamada-ui/react" ```` ```tsx import { ComposedChart } from "@/components/ui" ```` ````tsx import { ComposedChart } from "@workspaces/ui" ```: ```tsx ```` ### Composition ```tsx const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM")} /> dayjs(value).format("MMM")} /> ) ``` ### Change Size ```tsx const series = useMemo( () => ComposedChart.mergeSeries([ [ "bar", { dataKey: "desktop" }, ] satisfies ComposedChart.ComposedProps, [ "area", { dataKey: "tablet" }, ] satisfies ComposedChart.ComposedProps, [ "line", { dataKey: "mobile" }, ] satisfies ComposedChart.ComposedProps, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( {(size, index) => ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> )} ) ``` ### Change Color Scheme ```tsx const series = useMemo( () => ComposedChart.mergeSeries( [ [ "bar", { dataKey: "desktop" }, ] satisfies ComposedChart.ComposedProps, [ "area", { dataKey: "tablet" }, ] satisfies ComposedChart.ComposedProps, [ "line", { dataKey: "mobile" }, ] satisfies ComposedChart.ComposedProps, ], "blue", ), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Change Color ```tsx const series = useMemo[]>( () => [ ["bar", { color: "blue", dataKey: "desktop" }], ["area", { color: "green", dataKey: "tablet" }], ["line", { color: "red", dataKey: "mobile" }], ], [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Add Y Axis To add a Y axis, set `withYAxis` to `true`. The default is `false`. ```tsx const series = useMemo( () => ComposedChart.mergeSeries([ [ "bar", { dataKey: "desktop" }, ] satisfies ComposedChart.ComposedProps, [ "area", { dataKey: "tablet" }, ] satisfies ComposedChart.ComposedProps, [ "line", { dataKey: "mobile" }, ] satisfies ComposedChart.ComposedProps, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` To change the Y axis orientation, set `orientation` in `yAxisProps` to `"start"` or `"end"`. The default is `"start"`. ```tsx const series = useMemo( () => ComposedChart.mergeSeries([ [ "bar", { dataKey: "desktop" }, ] satisfies ComposedChart.ComposedProps, [ "area", { dataKey: "tablet" }, ] satisfies ComposedChart.ComposedProps, [ "line", { dataKey: "mobile" }, ] satisfies ComposedChart.ComposedProps, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} yAxisProps={{ orientation: "end" }} /> ) ``` ### Add Legend To add a legend, set `withLegend` to `true`. The default is `false`. To change the legend placement, set `placement` in `legendProps` to `"start-start"`, `"end-end"`, etc. The default is `"start-end"`. ```tsx const series = useMemo[]>( () => [ ["bar", { color: "blue", dataKey: "desktop" }], ["area", { color: "green", dataKey: "tablet" }], ["line", { color: "red", dataKey: "mobile" }], ], [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Change Name To change the name of the tooltip or legend, set `name` in `series`. ```tsx const series = useMemo[]>( () => [ ["bar", { name: "Desktop", color: "blue", dataKey: "desktop" }], ["area", { name: "Tablet", color: "green", dataKey: "tablet" }], ["line", { name: "Mobile", color: "red", dataKey: "mobile" }], ], [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Change Grid To change the grid, set `horizontal` and `vertical` to a boolean in `gridProps`. ```tsx const series = useMemo( () => ComposedChart.mergeSeries([ [ "bar", { dataKey: "desktop" }, ] satisfies ComposedChart.ComposedProps, [ "area", { dataKey: "tablet" }, ] satisfies ComposedChart.ComposedProps, [ "line", { dataKey: "mobile" }, ] satisfies ComposedChart.ComposedProps, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( {(value, index) => ( dayjs(value).format("MMM"), }} /> )} ) ``` ### Change Line Type To change the type, set `type` in `series` or `lineProps.type` or `areaProps.type` to `"monotone"`, `"linear"`, etc. The default is `"monotone"`. ```tsx const series = useMemo( () => ComposedChart.mergeSeries([ [ "bar", { dataKey: "desktop" }, ] satisfies ComposedChart.ComposedProps, [ "area", { dataKey: "tablet" }, ] satisfies ComposedChart.ComposedProps, [ "line", { dataKey: "mobile" }, ] satisfies ComposedChart.ComposedProps, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( {(type, index) => ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> )} ) ``` ### Add Line Dot To add a dot to the line, set `dot` in `series` or `lineProps.dot` or `areaProps.dot` to `true`. The default is `false`. ```tsx const series = useMemo( () => ComposedChart.mergeSeries([ [ "bar", { dataKey: "desktop" }, ] satisfies ComposedChart.ComposedProps, [ "area", { dataKey: "tablet" }, ] satisfies ComposedChart.ComposedProps, [ "line", { dataKey: "mobile" }, ] satisfies ComposedChart.ComposedProps, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Range Bar To add a range bar, set the value to an `[min, max]` array in the data item. ```tsx const series = useMemo( () => ComposedChart.mergeSeries([ [ "bar", { dataKey: "desktop" }, ] satisfies ComposedChart.ComposedProps, [ "area", { dataKey: "tablet" }, ] satisfies ComposedChart.ComposedProps, [ "line", { dataKey: "mobile" }, ] satisfies ComposedChart.ComposedProps, ]), [], ) const data = useMemo( () => Array.from({ length: 6 }, (_, index) => ({ date: dayjs().add(index, "month").format("YYYY-MM-DD"), desktop: [ faker.number.int({ min: 1000, max: 2000 }), faker.number.int({ min: 4000, max: 5000 }), ], mobile: faker.number.int({ min: 1000, max: 5000 }), tablet: faker.number.int({ min: 1000, max: 5000 }), })), [], ) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Stacked Bar To stack the bars, set `stackId` in `series` or `barProps.stackId` to a string. ```tsx const series = useMemo( () => ComposedChart.mergeSeries([ ["bar", { dataKey: "desktop", radius: [0, 0, 4, 4] }], ["bar", { dataKey: "tablet", radius: [4, 4, 0, 0] }], ["line", { dataKey: "mobile" }], ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Change Bar Size To change the bar size, set `barSize` in `series` or `barProps.barSize` to a number. The default is `40`. ```tsx const series = useMemo( () => ComposedChart.mergeSeries([ [ "bar", { dataKey: "desktop" }, ] satisfies ComposedChart.ComposedProps, [ "area", { dataKey: "tablet" }, ] satisfies ComposedChart.ComposedProps, [ "line", { dataKey: "mobile" }, ] satisfies ComposedChart.ComposedProps, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Change Bar Radius To change the bar radius, set `radius` in `series` or `barProps.radius` to a number or an array. ```tsx const series = useMemo( () => ComposedChart.mergeSeries([ [ "bar", { dataKey: "desktop" }, ] satisfies ComposedChart.ComposedProps, [ "area", { dataKey: "tablet" }, ] satisfies ComposedChart.ComposedProps, [ "line", { dataKey: "mobile" }, ] satisfies ComposedChart.ComposedProps, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Change Bar Gap To change the bar gap, set `barGap` in `chartProps` and `barSize` in `barProps` to a number or string. ```tsx const series = useMemo( () => ComposedChart.mergeSeries([ ["bar", { dataKey: "desktop" }], ["bar", { dataKey: "tablet" }], ["line", { dataKey: "mobile" }], ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Show Label To show the label, set `label` in `series` or `lineProps.label` or `areaProps.label` or `barProps.label` to `true`. The default is `false`. ```tsx const series = useMemo( () => ComposedChart.mergeSeries([ [ "bar", { dataKey: "desktop" }, ] satisfies ComposedChart.ComposedProps, [ "area", { dataKey: "tablet" }, ] satisfies ComposedChart.ComposedProps, [ "line", { dataKey: "mobile" }, ] satisfies ComposedChart.ComposedProps, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} yAxisProps={{ domain: [0, 10000], ticks: [0, 2500, 5000, 7500, 10000] }} /> ) ``` ### Add Unit To add a unit, use `formatter` or `tickFormatter` or set `unit` to a string. ```tsx preview functional const series = useMemo( () => ComposedChart.mergeSeries([ [ "bar", { dataKey: "desktop" }, ] satisfies ComposedChart.ComposedProps, [ "area", { dataKey: "tablet" }, ] satisfies ComposedChart.ComposedProps, [ "line", { dataKey: "mobile" }, ] satisfies ComposedChart.ComposedProps, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( `${(Number(value) / 1000).toFixed(1)}k` }, }} tooltipProps={{ formatter: (value) => `${(Number(value) / 1000).toFixed(1)}k`, labelFormatter: (value) => dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} yAxisProps={{ domain: [0, 10000], tickFormatter: (value) => (value / 1000).toFixed(1), ticks: [0, 2500, 5000, 7500, 10000], unit: "k", }} /> ) ``` ### Sync To sync the charts, set `syncId` to a string. ```tsx const series = useMemo( () => ComposedChart.mergeSeries([ [ "bar", { dataKey: "desktop" }, ] satisfies ComposedChart.ComposedProps, [ "area", { dataKey: "tablet" }, ] satisfies ComposedChart.ComposedProps, [ "line", { dataKey: "mobile" }, ] satisfies ComposedChart.ComposedProps, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Format To format the chart, use `formatter` or `tickFormatter` etc. ```tsx const series = useMemo( () => ComposedChart.mergeSeries([ [ "bar", { dataKey: "desktop" }, ] satisfies ComposedChart.ComposedProps, [ "area", { dataKey: "tablet" }, ] satisfies ComposedChart.ComposedProps, [ "line", { dataKey: "mobile" }, ] satisfies ComposedChart.ComposedProps, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( [ Number(value).toLocaleString(), toTitleCase(name), ], labelFormatter: (value) => dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} yAxisProps={{ tickFormatter: (value) => value.toLocaleString() }} /> ) ``` ### Add Reference Line ```tsx const series = useMemo( () => ComposedChart.mergeSeries([ [ "bar", { dataKey: "desktop" }, ] satisfies ComposedChart.ComposedProps, [ "area", { dataKey: "tablet" }, ] satisfies ComposedChart.ComposedProps, [ "line", { dataKey: "mobile" }, ] satisfies ComposedChart.ComposedProps, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} > ) ``` ### Add Tick Line To add a tick line to the axis, set `tickLine` in `xAxisProps` or `yAxisProps` to `true`. The default is `false`. ```tsx const series = useMemo( () => ComposedChart.mergeSeries([ [ "bar", { dataKey: "desktop" }, ] satisfies ComposedChart.ComposedProps, [ "area", { dataKey: "tablet" }, ] satisfies ComposedChart.ComposedProps, [ "line", { dataKey: "mobile" }, ] satisfies ComposedChart.ComposedProps, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), tickLine: true, }} yAxisProps={{ tickLine: true }} /> ) ``` ### Add Axis Label To add a label to the axis, set `label` in `xAxisProps` or `yAxisProps` to a string. The default is `false`. ```tsx const series = useMemo( () => ComposedChart.mergeSeries([ [ "bar", { dataKey: "desktop" }, ] satisfies ComposedChart.ComposedProps, [ "area", { dataKey: "tablet" }, ] satisfies ComposedChart.ComposedProps, [ "line", { dataKey: "mobile" }, ] satisfies ComposedChart.ComposedProps, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", label: "Date", tickFormatter: (value) => dayjs(value).format("MMM"), }} yAxisProps={{ label: "Value" }} /> ) ``` ### Set Domain To set the range, set `domain` to an array in `yAxisProps`. To set the interval, set `ticks` to an array in `yAxisProps`. ```tsx const series = useMemo( () => ComposedChart.mergeSeries([ [ "bar", { dataKey: "desktop" }, ] satisfies ComposedChart.ComposedProps, [ "area", { dataKey: "tablet" }, ] satisfies ComposedChart.ComposedProps, [ "line", { dataKey: "mobile" }, ] satisfies ComposedChart.ComposedProps, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} yAxisProps={{ domain: [0, 5000], ticks: [0, 1000, 2000, 3000, 4000, 5000] }} /> ) ``` ### Add Tooltip Cursor To add a tooltip cursor, set `cursor` to `true` in `tooltipProps`. The default is `false`. ```tsx const series = useMemo( () => ComposedChart.mergeSeries([ [ "bar", { dataKey: "desktop" }, ] satisfies ComposedChart.ComposedProps, [ "area", { dataKey: "tablet" }, ] satisfies ComposedChart.ComposedProps, [ "line", { dataKey: "mobile" }, ] satisfies ComposedChart.ComposedProps, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Hide X Axis To hide the X axis, set `withXAxis` to `false`. The default is `true`. ```tsx const series = useMemo( () => ComposedChart.mergeSeries([ [ "bar", { dataKey: "desktop" }, ] satisfies ComposedChart.ComposedProps, [ "area", { dataKey: "tablet" }, ] satisfies ComposedChart.ComposedProps, [ "line", { dataKey: "mobile" }, ] satisfies ComposedChart.ComposedProps, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( null }} /> ) ``` ### Hide Active Dot To hide the active dot, set `activeDot` in `series` or `lineProps.activeDot` or `areaProps.activeDot` to `false`. The default is `true`. ```tsx const series = useMemo( () => ComposedChart.mergeSeries([ [ "bar", { dataKey: "desktop" }, ] satisfies ComposedChart.ComposedProps, [ "area", { dataKey: "tablet" }, ] satisfies ComposedChart.ComposedProps, [ "line", { dataKey: "mobile" }, ] satisfies ComposedChart.ComposedProps, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Hide Tooltip To hide the tooltip, set `withTooltip` to `false`. The default is `true`. ```tsx const series = useMemo( () => ComposedChart.mergeSeries([ [ "bar", { dataKey: "desktop" }, ] satisfies ComposedChart.ComposedProps, [ "area", { dataKey: "tablet" }, ] satisfies ComposedChart.ComposedProps, [ "line", { dataKey: "mobile" }, ] satisfies ComposedChart.ComposedProps, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value).format("MMM"), }} /> ) ``` ## Accessibility ### Keyboard Navigation | Key | Description | State | | ------------ | ---------------------------------------------------------- | -------------------- | | `ArrowRight` | Moves to the next data point and displays the tooltip. | `withTooltip={true}` | | `ArrowLeft` | Moves to the previous data point and displays the tooltip. | `withTooltip={true}` | | `Enter` | Toggles the tooltip display for the active data point. | `withTooltip={true}` | ### ARIA Roles and Attributes | Component | Role and Attribute | Usage | | --------- | -------------------- | -------------------------------------- | | `svg` | `role="application"` | Indicates that this is an application. | ## Props # DonutChart --- title: DonutChart description: "`DonutChart` is a component for drawing donut charts to compare multiple sets of data." links: - style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/chart/donut-chart.style.ts - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/chart - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-chart-donutchart--basic --- # DonutChart `DonutChart` is a component for drawing donut charts to compare multiple sets of data. ```tsx interface Data { browser: string visits: number fill?: CSSProps["fill"] } const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => DonutChart.mergeData([ { browser: "chrome", visits: faker.number.int({ max: 5000, min: 1000 }), }, { browser: "edge", visits: faker.number.int({ max: 5000, min: 1000 }), }, { browser: "firefox", visits: faker.number.int({ max: 5000, min: 1000 }), }, { browser: "opera", visits: faker.number.int({ max: 5000, min: 1000 }), }, { browser: "safari", visits: faker.number.int({ max: 5000, min: 1000 }), }, { browser: "other", visits: faker.number.int({ max: 5000, min: 1000 }), }, ]), [], ) return ``` ## Usage ```tsx import { DonutChart } from "@yamada-ui/react" ``` ```tsx import { DonutChart } from "@/components/ui" ``` ```tsx import { DonutChart } from "@workspaces/ui" ``` ```tsx ``` ### Composition ```tsx const data = useMemo( () => createPolarChartData().map((item, index) => ({ ...item, fill: ["cyan", "green", "orange", "red", "blue", "gray"][index], })), [], ) return ( Donut Chart ) ``` ### Change Size ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => DonutChart.mergeData(createPolarChartData()), [], ) return ( {(size, index) => ( )} ) ``` ### Change Color ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => DonutChart.mergeData(createPolarChartData(), "blue"), [], ) return ``` ### Change Sector Colors ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => createPolarChartData().map((item, index) => ({ ...item, fill: ["cyan", "green", "orange", "red", "blue", "gray"][index], })), [], ) return ``` ### Hide Sector Stroke To hide sector stroke lines, set `sectorStroke` to `"none"`. ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => createPolarChartData().map((item, index) => ({ ...item, fill: ["cyan", "green", "orange", "red", "blue", "gray"][index], })), [], ) return ``` ### Add Legend To add the legend, set `withLegend` to `true`. The default is `false`. To change the placement of the legend, set `legendProps.placement` to `"start-start"`, `"end-end"`, etc. The default is `"start-end"`. ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => createPolarChartData().map((item, index) => ({ ...item, fill: ["cyan", "green", "orange", "red", "blue", "gray"][index], })), [], ) return ``` ### Display Multiple Donuts To display multiple donuts in one chart, set multiple entries in `series`. ```tsx const series = useMemo[]>( () => [ { dataKey: "visits", innerRadius: "80%", nameKey: "browser", }, { dataKey: "downloads", nameKey: "browser", innerRadius: "50%", outerRadius: "70%", }, ], [], ) const data = useMemo( () => DonutChart.mergeData(createPolarChartData()), [], ) return ``` ### Add Label To display labels, set `label` of `series` or `donutProps.label` to `true`. The default is `false`. ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => createPolarChartData().map((item, index) => ({ ...item, fill: ["cyan", "green", "orange", "red", "blue", "gray"][index], })), [], ) return ( ) ``` ### Add Label Line To display label lines, set `labelLine` of `series` or `donutProps.labelLine` to `true`. The default is `false`. ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => createPolarChartData().map((item, index) => ({ ...item, fill: ["cyan", "green", "orange", "red", "blue", "gray"][index], })), [], ) return ( ) ``` ### Change Label Offset To change the label offset, set `label.offset` of `series` or `donutProps.label.offset` to a number. The default is `0`. ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => createPolarChartData().map((item, index) => ({ ...item, fill: ["cyan", "green", "orange", "red", "blue", "gray"][index], })), [], ) return ( ) ``` ### Add Label List To display values with label list, set `labelList` to `true` of `series` or `donutProps.labelList`. The default is `false`. ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => createPolarChartData().map((item, index) => ({ ...item, fill: ["cyan", "green", "orange", "red", "blue", "gray"][index], })), [], ) return ( ) ``` ### Center Label ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => DonutChart.mergeData(createPolarChartData()), [], ) const total = useMemo( () => data.reduce((acc, { visits }) => acc + visits, 0), [data], ) return ( Visitors { if (!viewBox) return null if (!("cx" in viewBox) || !("cy" in viewBox)) return null return ( {total.toLocaleString()} Visitors ) }} /> ) ``` ### Change Padding Angle To change the padding angle, set `paddingAngle` of `series` or `donutProps.paddingAngle` to a number. The default is `0`. ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => DonutChart.mergeData(createPolarChartData()), [], ) return ( ) ``` ### Change Start Angle To change the start angle, set `startAngle` of `series` or `donutProps.startAngle` to a number. The default is `90`. ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => DonutChart.mergeData(createPolarChartData()), [], ) return ( ) ``` ### Change End Angle To change the end angle, set `endAngle` of `series` or `donutProps.endAngle` to a number. The default is `-270`. ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => DonutChart.mergeData(createPolarChartData()), [], ) return ( ) ``` ### Change Inner Radius To change the inner radius, set `innerRadius` of `series` or `donutProps.innerRadius` to a number or string. The default is `"70%"`. ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => DonutChart.mergeData(createPolarChartData()), [], ) return ( ) ``` ### Change Outer Radius To change the outer radius, set `outerRadius` of `series` or `donutProps.outerRadius` to a number or string. The default is `"100%"`. ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => DonutChart.mergeData(createPolarChartData()), [], ) return ( ) ``` ### Sync To sync charts, set `syncId` to a string. ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => DonutChart.mergeData(createPolarChartData()), [], ) return ( ) ``` ### Format To format values and labels, use `formatter`. ```tsx preview functional const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => createPolarChartData().map((item, index) => ({ ...item, fill: ["cyan", "green", "orange", "red", "blue", "gray"][index], })), [], ) return ( `${(percent * 100).toFixed(0)}%`, }, labelLine: true, labelList: { color: "white", formatter: (value) => (isString(value) ? toTitleCase(value) : value), }, }} tooltipProps={{ formatter: (value, name = "") => [ Number(value).toLocaleString(), toTitleCase(name), ], }} /> ) ``` ### Hide Tooltip To hide the tooltip, set `withTooltip` to `false`. The default is `true`. ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => DonutChart.mergeData(createPolarChartData()), [], ) return ``` ## Accessibility ### Keyboard Navigation | Key | Description | State | | ------------ | ---------------------------------------------------------- | -------------------- | | `ArrowRight` | Moves to the next data point and displays the tooltip. | `withTooltip={true}` | | `ArrowLeft` | Moves to the previous data point and displays the tooltip. | `withTooltip={true}` | | `Enter` | Toggles the tooltip display for the active data point. | `withTooltip={true}` | ### ARIA Roles and Attributes | Component | Role and Attribute | Usage | | --------- | -------------------- | -------------------------------------- | | `svg` | `role="application"` | Indicates that this is an application. | ## Props # LineChart --- title: LineChart description: "`LineChart` is a component for drawing line charts to compare multiple sets of data." links: - style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/chart/line-chart.style.ts - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/chart - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-chart-linechart--basic --- # LineChart `LineChart` is a component for drawing line charts to compare multiple sets of data. ```tsx interface Data { date: string desktop: number mobile: number tablet: number } const series = useMemo[]>( () => LineChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo( () => [ { date: "2026-03-01", desktop: faker.number.int({ max: 5000, min: 1000 }), mobile: faker.number.int({ max: 5000, min: 1000 }), tablet: faker.number.int({ max: 5000, min: 1000 }), }, { date: "2026-04-01", desktop: faker.number.int({ max: 5000, min: 1000 }), mobile: faker.number.int({ max: 5000, min: 1000 }), tablet: faker.number.int({ max: 5000, min: 1000 }), }, { date: "2026-05-01", desktop: faker.number.int({ max: 5000, min: 1000 }), mobile: faker.number.int({ max: 5000, min: 1000 }), tablet: faker.number.int({ max: 5000, min: 1000 }), }, { date: "2026-06-01", desktop: faker.number.int({ max: 5000, min: 1000 }), mobile: faker.number.int({ max: 5000, min: 1000 }), tablet: faker.number.int({ max: 5000, min: 1000 }), }, { date: "2026-07-01", desktop: faker.number.int({ max: 5000, min: 1000 }), mobile: faker.number.int({ max: 5000, min: 1000 }), tablet: faker.number.int({ max: 5000, min: 1000 }), }, { date: "2026-08-01", desktop: faker.number.int({ max: 5000, min: 1000 }), mobile: faker.number.int({ max: 5000, min: 1000 }), tablet: faker.number.int({ max: 5000, min: 1000 }), }, ], [], ) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ## Usage ```tsx import { LineChart } from "@yamada-ui/react" ``` ```tsx import { LineChart } from "@/components/ui" ``` ```tsx import { LineChart } from "@workspaces/ui" ``` ```tsx ``` ### Composition ```tsx const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM")} /> dayjs(value).format("MMM")} /> ) ``` ### Change Size ```tsx const series = useMemo[]>( () => LineChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( {(size, index) => ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> )} ) ``` ### Change Color Scheme ```tsx const series = useMemo[]>( () => LineChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Change Color ```tsx const series = useMemo[]>( () => [ { dataKey: "desktop", color: "red" }, { dataKey: "tablet", color: "blue" }, { dataKey: "mobile", color: "green" }, ], [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Change Type To change the type, set `type` in `series` or `lineProps.type` to `"monotone"`, `"linear"`, etc. The default is `"monotone"`. ```tsx const series = useMemo[]>( () => LineChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( {(type, index) => ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> )} ) ``` ### Add Y Axis To add the Y axis, set `withYAxis` to `true`. The default is `false`. ```tsx const series = useMemo[]>( () => LineChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` To change the orientation of the Y axis, set `yAxisProps.orientation` to `"start"` or `"end"`. The default is `"start"`. ```tsx const series = useMemo[]>( () => LineChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} yAxisProps={{ orientation: "end" }} /> ) ``` ### Add Legend To add the legend, set `withLegend` to `true`. The default is `false`. To change the placement of the legend, set `legendProps.placement` to `"start-start"`, `"end-end"`, etc. The default is `"start-end"`. ```tsx const series = useMemo[]>( () => [ { dataKey: "desktop", color: "red" }, { dataKey: "tablet", color: "blue" }, { dataKey: "mobile", color: "green" }, ], [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Change Name To change item names in the tooltip or legend, set `name` in `series`. ```tsx const series = useMemo[]>( () => [ { dataKey: "desktop", name: "Desktop", color: "red" }, { dataKey: "tablet", name: "Tablet", color: "blue" }, { dataKey: "mobile", name: "Mobile", color: "green" }, ], [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Change Grid To change the grid, set booleans in `gridProps.horizontal` and `gridProps.vertical`. ```tsx const series = useMemo[]>( () => LineChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( {(value, index) => ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> )} ) ``` ### Add Dot To add dots, set `dot` of `series` or `lineProps.dot` to `true`. The default is `false`. ```tsx const series = useMemo[]>( () => LineChart.mergeSeries([{ dataKey: "desktop" }]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Add Label To add labels, set `label` of `series` or `lineProps.label` to `true`. The default is `false`. ```tsx const series = useMemo[]>( () => LineChart.mergeSeries([{ dataKey: "desktop" }]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Add Unit To add units, use `formatter`, `tickFormatter`, or set a string in `unit`. ```tsx preview functional const series = useMemo[]>( () => LineChart.mergeSeries([{ dataKey: "desktop" }]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( `${(Number(value) / 1000).toFixed(1)}k`, }, }} tooltipProps={{ formatter: (value) => `${(Number(value) / 1000).toFixed(1)}k`, labelFormatter: (value) => dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} yAxisProps={{ domain: [0, 10000], tickFormatter: (value) => (value / 1000).toFixed(1), ticks: [0, 2500, 5000, 7500, 10000], unit: "k", }} /> ) ``` ### Sync To sync charts, set `syncId` to a string. ```tsx const series = useMemo[]>( () => LineChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Format To format values, use `formatter`, `tickFormatter`, etc. ```tsx const series = useMemo[]>( () => LineChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( [ Number(value).toLocaleString(), toTitleCase(name), ], labelFormatter: (value) => dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} yAxisProps={{ tickFormatter: (value) => value.toLocaleString(), }} /> ) ``` ### Add Reference Line ```tsx const series = useMemo[]>( () => LineChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} > ) ``` ### Add Tick Line To add tick lines, set `xAxisProps.tickLine` or `yAxisProps.tickLine` to `true`. The default is `false`. ```tsx const series = useMemo[]>( () => LineChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), tickLine: true, }} yAxisProps={{ tickLine: true }} /> ) ``` ### Add Axis Label To add axis labels, set a string in `xAxisProps.label` or `yAxisProps.label`. The default is `false`. ```tsx const series = useMemo[]>( () => LineChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", label: "Date", tickFormatter: (value) => dayjs(value).format("MMM"), }} yAxisProps={{ label: "Value" }} /> ) ``` ### Set Domain To set the range, set `yAxisProps.domain` to `[min, max]`. To set the interval, set an array in `yAxisProps.ticks`. ```tsx const series = useMemo[]>( () => LineChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} yAxisProps={{ domain: [0, 5000], ticks: [0, 1000, 2000, 3000, 4000, 5000], }} /> ) ``` ### Add Tooltip Cursor To add a tooltip cursor, set `tooltipProps.cursor` to `true`. The default is `false`. ```tsx const series = useMemo[]>( () => LineChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Hide X Axis To hide the X axis, set `withXAxis` to `false`. The default is `true`. ```tsx const series = useMemo[]>( () => LineChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( null }} /> ) ``` ### Hide Active Dot To hide active dots, set `activeDot` in `series` or `lineProps.activeDot` to `false`. The default is `true`. ```tsx const series = useMemo[]>( () => LineChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Hide Tooltip To hide the tooltip, set `withTooltip` to `false`. The default is `true`. ```tsx const series = useMemo[]>( () => LineChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value).format("MMM"), }} /> ) ``` ### Customize Axis ```tsx const series = useMemo[]>( () => LineChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", label: { color: ["red", "blue"] }, tick: { color: ["red", "blue"] }, tickFormatter: (value) => dayjs(value).format("MMM"), tickLine: { color: ["red", "blue"] }, }} yAxisProps={{ label: { color: ["red", "blue"] }, tick: { color: ["red", "blue"] }, tickLine: { color: ["red", "blue"] }, }} /> ) ``` ### Customize Dot ```tsx const series = useMemo[]>( () => LineChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet", dot: { fill: "blue" } }, { dataKey: "mobile", dot: { fill: ["white", "black"], stroke: "red", strokeWidth: 1 }, }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), contentProps: { withSwatch: false }, }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Customize Active Dot ```tsx const series = useMemo[]>( () => LineChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), contentProps: { withSwatch: false }, }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Customize Label ```tsx const series = useMemo[]>( () => [{ color: "blue", dataKey: "desktop" }], [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), contentProps: { withSwatch: false }, }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} yAxisProps={{ domain: [0, 10000], ticks: [0, 2500, 5000, 7500, 10000], }} /> ) ``` ### Customize Grid ```tsx const series = useMemo[]>( () => LineChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), contentProps: { withSwatch: false }, }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ### Customize Tooltip Cursor ```tsx const series = useMemo[]>( () => LineChart.mergeSeries([ { dataKey: "desktop" }, { dataKey: "tablet" }, { dataKey: "mobile" }, ]), [], ) const data = useMemo(() => createCartesianChartData(), []) return ( dayjs(value as string).format("MMM"), }} xAxisProps={{ dataKey: "date", tickFormatter: (value) => dayjs(value).format("MMM"), }} /> ) ``` ## Accessibility ### Keyboard Navigation | Key | Description | State | | ------------ | ---------------------------------------------------------- | -------------------- | | `ArrowRight` | Moves to the next data point and displays the tooltip. | `withTooltip={true}` | | `ArrowLeft` | Moves to the previous data point and displays the tooltip. | `withTooltip={true}` | | `Enter` | Toggles the tooltip display for the active data point. | `withTooltip={true}` | ### ARIA Roles and Attributes | Component | Role and Attribute | Usage | | --------- | -------------------- | -------------------------------------- | | `svg` | `role="application"` | Indicates that this is an application. | ## Props # PieChart --- title: PieChart description: "`PieChart` is a component for drawing pie charts to compare multiple sets of data." links: - style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/chart/pie-chart.style.ts - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/chart - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-chart-piechart--basic --- # PieChart `PieChart` is a component for drawing pie charts to compare multiple sets of data. ```tsx interface Data { browser: string visits: number fill?: CSSProps["fill"] } const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => PieChart.mergeData([ { browser: "chrome", visits: faker.number.int({ max: 5000, min: 1000 }), }, { browser: "edge", visits: faker.number.int({ max: 5000, min: 1000 }), }, { browser: "firefox", visits: faker.number.int({ max: 5000, min: 1000 }), }, { browser: "opera", visits: faker.number.int({ max: 5000, min: 1000 }), }, { browser: "safari", visits: faker.number.int({ max: 5000, min: 1000 }), }, { browser: "other", visits: faker.number.int({ max: 5000, min: 1000 }), }, ]), [], ) return ``` ## Usage ```tsx import { PieChart } from "@yamada-ui/react" ``` ```tsx import { PieChart } from "@/components/ui" ``` ```tsx import { PieChart } from "@workspaces/ui" ``` ```tsx ``` ### Composition ```tsx const data = useMemo( () => createPolarChartData().map((item, index) => ({ ...item, fill: ["cyan", "green", "orange", "red", "blue", "gray"][index], })), [], ) return ( ) ``` ### Change Size ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => PieChart.mergeData(createPolarChartData()), [], ) return ( {(size, index) => ( )} ) ``` ### Change Color ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => PieChart.mergeData(createPolarChartData(), "blue"), [], ) return ``` ### Change Sector Colors ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => createPolarChartData().map((item, index) => ({ ...item, fill: ["cyan", "green", "orange", "red", "blue", "gray"][index], })), [], ) return ``` ### Hide Sector Stroke To hide sector stroke lines, set `sectorStroke` to `"none"`. ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => createPolarChartData().map((item, index) => ({ ...item, fill: ["cyan", "green", "orange", "red", "blue", "gray"][index], })), [], ) return ``` ### Add Legend To add the legend, set `withLegend` to `true`. The default is `false`. ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => createPolarChartData().map((item, index) => ({ ...item, fill: ["cyan", "green", "orange", "red", "blue", "gray"][index], })), [], ) return ``` To change the placement of the legend, set `legendProps.placement` to `"start-start"`, `"end-end"`, etc. The default is `"start-end"`. ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => createPolarChartData().map((item, index) => ({ ...item, fill: ["cyan", "green", "orange", "red", "blue", "gray"][index], })), [], ) return ``` ### Display Multiple Pies ```tsx const series = useMemo[]>( () => [ { dataKey: "visits", innerRadius: "80%", nameKey: "browser", }, { dataKey: "downloads", nameKey: "browser", outerRadius: "70%", }, ], [], ) const data = useMemo( () => PieChart.mergeData(createPolarChartData()), [], ) return ``` ### Add Label To display labels, set `label` or `pieProps.label` to `true`. The default is `false`. ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => createPolarChartData().map((item, index) => ({ ...item, fill: ["cyan", "green", "orange", "red", "blue", "gray"][index], })), [], ) return ``` ### Add Label Line To display label lines, set `labelLine` of `series` or `pieProps.labelLine` to `true`. The default is `false`. ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => createPolarChartData().map((item, index) => ({ ...item, fill: ["cyan", "green", "orange", "red", "blue", "gray"][index], })), [], ) return ( ) ``` ### Change Label Offset To change the label offset, set `label.offset` of `series` or `pieProps.label.offset` to a number. The default is `0`. ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => createPolarChartData().map((item, index) => ({ ...item, fill: ["cyan", "green", "orange", "red", "blue", "gray"][index], })), [], ) return ( ) ``` ### Add Label List To display values with label list, set `labelList` of `series` or `pieProps.labelList` to `true`. The default is `false`. ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => createPolarChartData().map((item, index) => ({ ...item, fill: ["cyan", "green", "orange", "red", "blue", "gray"][index], })), [], ) return ( ) ``` ### Change Padding Angle To change the padding angle, set `paddingAngle` of `series` or `pieProps.paddingAngle` to a number. The default is `0`. ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => PieChart.mergeData(createPolarChartData()), [], ) return ( ) ``` ### Change Start Angle To change the start angle, set `startAngle` of `series` or `pieProps.startAngle` to a number. The default is `90`. ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => PieChart.mergeData(createPolarChartData()), [], ) return ( ) ``` ### Change End Angle To change the end angle, set `endAngle` of `series` or `pieProps.endAngle` to a number. The default is `-270`. ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => PieChart.mergeData(createPolarChartData()), [], ) return ( ) ``` ### Change Inner Radius To change the inner radius, set `innerRadius` of `series` or `pieProps.innerRadius` to a number or string. The default is `"0%"`. ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => PieChart.mergeData(createPolarChartData()), [], ) return ( ) ``` ### Change Outer Radius To change the outer radius, set `outerRadius` of `series` or `pieProps.outerRadius` to a number or string. The default is `"100%"`. ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => PieChart.mergeData(createPolarChartData()), [], ) return ( ) ``` ### Sync To sync charts, set `syncId` to a string. ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => PieChart.mergeData(createPolarChartData()), [], ) return ( ) ``` ### Format To format values and labels, use `formatter`. ```tsx preview functional const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => createPolarChartData().map((item, index) => ({ ...item, fill: ["cyan", "green", "orange", "red", "blue", "gray"][index], })), [], ) return ( `${(percent * 100).toFixed(0)}%`, }, labelLine: true, labelList: { color: "white", formatter: (value) => (isString(value) ? toTitleCase(value) : value), }, }} tooltipProps={{ formatter: (value, name = "") => [ Number(value).toLocaleString(), toTitleCase(name), ], }} /> ) ``` ### Hide Tooltip To hide the tooltip, set `withTooltip` to `false`. The default is `true`. ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => PieChart.mergeData(createPolarChartData()), [], ) return ``` ## Accessibility ### Keyboard Navigation | Key | Description | State | | ------------ | ---------------------------------------------------------- | -------------------- | | `ArrowRight` | Moves to the next data point and displays the tooltip. | `withTooltip={true}` | | `ArrowLeft` | Moves to the previous data point and displays the tooltip. | `withTooltip={true}` | | `Enter` | Toggles the tooltip display for the active data point. | `withTooltip={true}` | ### ARIA Roles and Attributes | Component | Role and Attribute | Usage | | --------- | -------------------- | -------------------------------------- | | `svg` | `role="application"` | Indicates that this is an application. | ## Props # RadarChart --- title: RadarChart description: "`RadarChart` is a component for drawing radar charts to compare multiple sets of data." links: - style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/chart/radar-chart.style.ts - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/chart - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-chart-radarchart--basic --- # RadarChart `RadarChart` is a component for drawing radar charts to compare multiple sets of data. ```tsx interface Data { browser: string visits: number downloads: number fill?: CSSProps["fill"] } const series = useMemo[]>( () => RadarChart.mergeSeries([{ dataKey: "visits" }, { dataKey: "downloads" }]), [], ) const data = useMemo( () => [ { browser: "chrome", visits: faker.number.int({ max: 5000, min: 1000 }), downloads: faker.number.int({ max: 5000, min: 1000 }), }, { browser: "edge", visits: faker.number.int({ max: 5000, min: 1000 }), downloads: faker.number.int({ max: 5000, min: 1000 }), }, { browser: "firefox", visits: faker.number.int({ max: 5000, min: 1000 }), downloads: faker.number.int({ max: 5000, min: 1000 }), }, { browser: "opera", visits: faker.number.int({ max: 5000, min: 1000 }), downloads: faker.number.int({ max: 5000, min: 1000 }), }, { browser: "safari", visits: faker.number.int({ max: 5000, min: 1000 }), downloads: faker.number.int({ max: 5000, min: 1000 }), }, { browser: "other", visits: faker.number.int({ max: 5000, min: 1000 }), downloads: faker.number.int({ max: 5000, min: 1000 }), }, ], [], ) return ``` ## Usage ```tsx import { RadarChart } from "@yamada-ui/react" ``` ```tsx import { RadarChart } from "@/components/ui" ``` ```tsx import { RadarChart } from "@workspaces/ui" ``` ```tsx ``` ### Composition ```tsx const data = useMemo(() => createPolarChartData(), []) return ( ) ``` ### Change Size ```tsx const series = useMemo[]>( () => RadarChart.mergeSeries([{ dataKey: "visits" }, { dataKey: "downloads" }]), [], ) const data = useMemo(() => createPolarChartData(), []) return ( {(size, index) => ( )} ) ``` ### Change Color Scheme ```tsx const series = useMemo[]>( () => RadarChart.mergeSeries( [{ dataKey: "visits" }, { dataKey: "downloads" }], "blue", ), [], ) const data = useMemo(() => createPolarChartData(), []) return ``` ### Change Color ```tsx const series = useMemo[]>( () => [ { color: "red", dataKey: "visits" }, { color: "green", dataKey: "downloads" }, ], [], ) const data = useMemo(() => createPolarChartData(), []) return ``` ### Add Radius Axis To add the radius axis, set `withRadiusAxis` to `true`. The default is `false`. ```tsx const series = useMemo[]>( () => RadarChart.mergeSeries( [{ dataKey: "visits" }, { dataKey: "downloads" }], "blue", ), [], ) const data = useMemo(() => createPolarChartData(), []) return ( ) ``` ### Change Radius Axis Angle To change the radius axis angle, set `radiusAxisProps.angle` to the desired angle. The default is `90`. ```tsx const series = useMemo[]>( () => RadarChart.mergeSeries( [{ dataKey: "visits" }, { dataKey: "downloads" }], "blue", ), [], ) const data = useMemo(() => createPolarChartData(), []) return ( ) ``` ### Add Legend To add the legend, set `withLegend` to `true`. To change the placement, set `legendProps.placement`. ```tsx const series = useMemo[]>( () => [ { color: "red", dataKey: "visits" }, { color: "green", dataKey: "downloads" }, ], [], ) const data = useMemo(() => createPolarChartData(), []) return ( ) ``` ### Add Label To display labels, set `label` or `radarProps.label` to `true`. The default is `false`. ```tsx const series = useMemo[]>( () => [{ color: "blue", dataKey: "visits" }], [], ) const data = useMemo(() => createPolarChartData(), []) return ( ) ``` ### Change Grid Type To change the grid type, set `gridProps.gridType` to `"polygon"` or `"circle"`. ```tsx const series = useMemo[]>( () => RadarChart.mergeSeries([{ dataKey: "visits" }, { dataKey: "downloads" }]), [], ) const data = useMemo(() => createPolarChartData(), []) return ( {(gridType, index) => ( )} ) ``` ### Fill Grid ```tsx const series = useMemo[]>( () => RadarChart.mergeSeries([{ dataKey: "visits" }, { dataKey: "downloads" }]), [], ) const data = useMemo(() => createPolarChartData(), []) return ( {(gridType, index) => ( )} ) ``` ### Display Line Only ```tsx const series = useMemo[]>( () => [ { color: "red", dataKey: "visits" }, { color: "green", dataKey: "downloads" }, ], [], ) const data = useMemo(() => createPolarChartData(), []) return ( ) ``` ### Add Dot To display dots, set `dot` or `radarProps.dot` to `true`. ```tsx const series = useMemo[]>( () => RadarChart.mergeSeries([{ dataKey: "visits" }, { dataKey: "downloads" }]), [], ) const data = useMemo(() => createPolarChartData(), []) return ( ) ``` ### Sync To sync charts, set `syncId` to a string. ```tsx const series = useMemo[]>( () => RadarChart.mergeSeries([{ dataKey: "visits" }, { dataKey: "downloads" }]), [], ) const data = useMemo(() => createPolarChartData(), []) return ( ) ``` ### Format To format the chart, use `formatter` or `tickFormatter` etc. ```tsx const series = useMemo[]>( () => [{ color: "blue", dataKey: "visits" }], [], ) const data = useMemo(() => createPolarChartData(), []) return ( toTitleCase(value) }} data={data} nameKey="browser" radarProps={{ dot: true, label: { formatter: (value) => Number(value).toLocaleString() }, }} series={series} tooltipProps={{ formatter: (value, name = "") => [ Number(value).toLocaleString(), toTitleCase(name), ], labelFormatter: (value) => toTitleCase(isString(value) ? value : ""), }} /> ) ``` ### Add Angle Axis Line To display the axis line of the angle axis, set `angleAxisProps.axisLine` to `true`. ```tsx const series = useMemo[]>( () => RadarChart.mergeSeries([{ dataKey: "visits" }, { dataKey: "downloads" }]), [], ) const data = useMemo(() => createPolarChartData(), []) return ( ) ``` ### Add Angle Axis Tick Line To display tick lines of the angle axis, set `angleAxisProps.tickLine` to `true`. ```tsx const series = useMemo[]>( () => RadarChart.mergeSeries([{ dataKey: "visits" }, { dataKey: "downloads" }]), [], ) const data = useMemo(() => createPolarChartData(), []) return ( ) ``` ### Set Domain To set the value range, set `radiusAxisProps.domain` to an array in `radiusAxisProps`. To set the ticks, set `radiusAxisProps.ticks` to an array in `radiusAxisProps`. ```tsx const series = useMemo[]>( () => RadarChart.mergeSeries([{ dataKey: "visits" }, { dataKey: "downloads" }]), [], ) const data = useMemo(() => createPolarChartData(), []) return ( ) ``` ### Add Tooltip Cursor To display the tooltip cursor, set `tooltipProps.cursor` to `true`. ```tsx const series = useMemo[]>( () => RadarChart.mergeSeries([{ dataKey: "visits" }, { dataKey: "downloads" }]), [], ) const data = useMemo(() => createPolarChartData(), []) return ( ) ``` ### Hide Angle Axis To hide the angle axis, set `withAngleAxis` to `false`. The default is `true`. ```tsx const series = useMemo[]>( () => RadarChart.mergeSeries([{ dataKey: "visits" }, { dataKey: "downloads" }]), [], ) const data = useMemo(() => createPolarChartData(), []) return ( ) ``` ### Hide Grid To hide the grid, set `withGrid` to `false`. The default is `true`. ```tsx const series = useMemo[]>( () => RadarChart.mergeSeries([{ dataKey: "visits" }, { dataKey: "downloads" }]), [], ) const data = useMemo(() => createPolarChartData(), []) return ( ) ``` ### Hide Active Dot To hide active dots, set `activeDot` or `radarProps.activeDot` to `false`. ```tsx const series = useMemo[]>( () => RadarChart.mergeSeries([{ dataKey: "visits" }, { dataKey: "downloads" }]), [], ) const data = useMemo(() => createPolarChartData(), []) return ( ) ``` ### Hide Tooltip To hide the tooltip, set `withTooltip` to `false`. The default is `true`. ```tsx const series = useMemo[]>( () => RadarChart.mergeSeries([{ dataKey: "visits" }, { dataKey: "downloads" }]), [], ) const data = useMemo(() => createPolarChartData(), []) return ( ) ``` ### Customize Dot ```tsx const series = useMemo[]>( () => RadarChart.mergeSeries([ { dataKey: "visits", dot: { fill: "blue" } }, { dataKey: "downloads" }, ]), [], ) const data = useMemo(() => createPolarChartData(), []) return ( ) ``` ### Customize Active Dot ```tsx const series = useMemo[]>( () => RadarChart.mergeSeries([{ dataKey: "visits" }, { dataKey: "downloads" }]), [], ) const data = useMemo(() => createPolarChartData(), []) return ( ) ``` ### Customize Label ```tsx const series = useMemo[]>( () => [{ color: "blue", dataKey: "visits" }], [], ) const data = useMemo(() => createPolarChartData(), []) return ( ) ``` ### Customize Tooltip Cursor ```tsx const series = useMemo[]>( () => RadarChart.mergeSeries([{ dataKey: "visits" }, { dataKey: "downloads" }]), [], ) const data = useMemo(() => createPolarChartData(), []) return ( ) ``` ## Accessibility ### Keyboard Navigation | Key | Description | State | | ------------ | ---------------------------------------------------------- | -------------------- | | `ArrowRight` | Moves to the next data point and displays the tooltip. | `withTooltip={true}` | | `ArrowLeft` | Moves to the previous data point and displays the tooltip. | `withTooltip={true}` | | `Enter` | Toggles the tooltip display for the active data point. | `withTooltip={true}` | ### ARIA Roles and Attributes | Component | Role and Attribute | Usage | | --------- | -------------------- | -------------------------------------- | | `svg` | `role="application"` | Indicates that this is an application. | ## Props # RadialChart --- title: RadialChart description: "`RadialChart` is a component for drawing radial charts to compare multiple sets of data." links: - style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/chart/radial-chart.style.ts - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/chart - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-chart-radialchart--basic --- # RadialChart `RadialChart` is a component for drawing radial charts to compare multiple sets of data. ```tsx interface Data { browser: string visits: number fill?: CSSProps["fill"] } const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => RadialChart.mergeData([ { browser: "chrome", visits: faker.number.int({ max: 5000, min: 1000 }), }, { browser: "edge", visits: faker.number.int({ max: 5000, min: 1000 }), }, { browser: "firefox", visits: faker.number.int({ max: 5000, min: 1000 }), }, { browser: "opera", visits: faker.number.int({ max: 5000, min: 1000 }), }, { browser: "safari", visits: faker.number.int({ max: 5000, min: 1000 }), }, { browser: "other", visits: faker.number.int({ max: 5000, min: 1000 }), }, ]), [], ) return ``` ## Usage ```tsx import { RadialChart } from "@yamada-ui/react" ``` ```tsx import { RadialChart } from "@/components/ui" ``` ```tsx import { RadialChart } from "@workspaces/ui" ``` ```tsx ``` ### Composition ```tsx const data = useMemo(() => RadialChart.mergeData(createPolarChartData()), []) return ( ) ``` ### Change Size ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo(() => RadialChart.mergeData(createPolarChartData()), []) return ( {(size, index) => ( )} ) ``` ### Change Color ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => RadialChart.mergeData(createPolarChartData(), "blue"), [], ) return ``` ### Change Sector Colors ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => createPolarChartData().map((item, index) => ({ ...item, fill: ["cyan", "green", "orange", "red", "blue", "gray"][index], })), [], ) return ``` ### Add Legend To add the legend, set `withLegend` to `true`. To change placement, set `legendProps.placement` to `"start-start"`, `"end-end"`, etc. The default is `"start-end"`. ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => createPolarChartData().map((item, index) => ({ ...item, fill: ["cyan", "green", "orange", "red", "blue", "gray"][index], })), [], ) return ``` ### Add Label To display labels, set `label` or `radialProps.label` to `true`. The default is `false`. ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => RadialChart.mergeData(createPolarChartData(), "blue"), [], ) return ( ) ``` ### Add Label List To display label list, set `labelList` or `radialProps.labelList` to `true`. The default is `false`. ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo(() => RadialChart.mergeData(createPolarChartData()), []) return ( ) ``` ### Add Center Label ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => RadialChart.mergeData([ { browser: "chrome", visits: faker.number.int({ max: 5000, min: 1000 }) }, { browser: "edge", visits: faker.number.int({ max: 5000, min: 1000 }) }, { browser: "safari", visits: faker.number.int({ max: 5000, min: 1000 }) }, ]), [], ) const total = useMemo( () => data.reduce((acc, { visits }) => acc + visits, 0), [data], ) return ( Visitors { if (!viewBox) return null if (!("cx" in viewBox) || !("cy" in viewBox)) return null return ( {total.toLocaleString()} Visitors ) }} /> ) ``` ### Change Start Angle To change the start angle, set `startAngle` to a number. The default is `90`. ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo(() => RadialChart.mergeData(createPolarChartData()), []) return ``` ### Change End Angle To change the end angle, set `endAngle` to a number. The default is `-270`. ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo(() => RadialChart.mergeData(createPolarChartData()), []) return ``` ### Change Inner Radius To change the inner radius, set `innerRadius` to a number or string. The default is `"20%"`. ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo(() => RadialChart.mergeData(createPolarChartData()), []) return ``` ### Change Outer Radius To change the outer radius, set `outerRadius` to a number or string. The default is `"90%"`. ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo(() => RadialChart.mergeData(createPolarChartData()), []) return ``` ### Change Corner Radius To round sector corners, set `cornerRadius` to a number. ```tsx const series = useMemo[]>( () => [{ cornerRadius: 9999, dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo(() => RadialChart.mergeData(createPolarChartData()), []) return ``` ### Change Gap To change the gap between bars, set `barCategoryGap` to a number or string. The default is `"10%"`. ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo(() => RadialChart.mergeData(createPolarChartData()), []) return ( ) ``` ### Stacked ```tsx const series = useMemo( () => [ { color: "blue.500", dataKey: "desktop", nameKey: "browser" }, { color: "blue.300", dataKey: "mobile", nameKey: "browser" }, ], [], ) const data = useMemo( () => [ { browser: "chrome", desktop: faker.number.int({ max: 3000, min: 2000 }), mobile: faker.number.int({ max: 5000, min: 4000 }), }, ], [], ) const total = useMemo( () => data.reduce((acc, { desktop, mobile }) => acc + desktop + mobile, 0), [data], ) return ( [ Number(value).toLocaleString(), toTitleCase(isString(data.dataKey) ? data.dataKey : ""), ], }} > { if (!viewBox) return null if (!("cx" in viewBox) || !("cy" in viewBox)) return null return ( {total.toLocaleString()} Visitors ) }} /> ) ``` ### Sync To sync charts, set `syncId` to a string. ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo(() => RadialChart.mergeData(createPolarChartData()), []) return ( ) ``` ### Format To format the chart, use `formatter`. ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo( () => RadialChart.mergeData(createPolarChartData(), "blue"), [], ) return ( Number(value).toLocaleString(), }, labelList: { formatter: (value) => (isString(value) ? toTitleCase(value) : value), }, }} series={series} tooltipProps={{ formatter: (value, name = "") => [ Number(value).toLocaleString(), toTitleCase(name), ], }} /> ) ``` ### Hide Tooltip To hide the tooltip, set `withTooltip` to `false`. The default is `true`. ```tsx const series = useMemo[]>( () => [{ dataKey: "visits", nameKey: "browser" }], [], ) const data = useMemo(() => RadialChart.mergeData(createPolarChartData()), []) return ``` ## Accessibility ### Keyboard Navigation | Key | Description | State | | ------------ | ---------------------------------------------------------- | -------------------- | | `ArrowRight` | Moves to the next data point and displays the tooltip. | `withTooltip={true}` | | `ArrowLeft` | Moves to the previous data point and displays the tooltip. | `withTooltip={true}` | | `Enter` | Toggles the tooltip display for the active data point. | `withTooltip={true}` | ### ARIA Roles and Attributes | Component | Role and Attribute | Usage | | --------- | -------------------- | -------------------------------------- | | `svg` | `role="application"` | Indicates that this is an application. | ## Props # ClientOnly --- title: ClientOnly description: "`ClientOnly` is a component that renders its children only on the client side." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/client-only - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-clientonly--basic --- # ClientOnly `ClientOnly` is a component that renders its children only on the client side. ```tsx } /> ``` ## Usage ```tsx import { ClientOnly } from "@yamada-ui/react" ``` ```tsx import { ClientOnly } from "@/components/ui" ``` ```tsx import { ClientOnly } from "@workspaces/ui" ``` ```tsx ``` ### Fallback To render a loading state while child elements are being prepared, use the `fallback` prop. ```tsx }> } /> ``` ### Render Prop When your component accesses browser-only APIs like `window`, `document`, `localStorage`, use the render prop pattern. This pattern ensures that components accessing browser APIs are evaluated only on the client side, preventing hydration mismatches and server-side errors.\ It can also be used for rendering heavy components that are not needed on the server side. ```tsx }> {() => ( Current URL: {window.location.href} Screen width: {window.innerWidth}px )} ``` :::warning While you can pass components directly, be careful with components that access browser APIs. ::: ```tsx /* This may cause server-side errors */ }> /* This is safe */ }> {() => } ``` ## Props | Prop | Default | Type | Description | | ---------- | ------- | --------------------- | -------------------------------------------------------------------------------------------------------------- | | `children` | - | `ReactNodeOrFunction` | The content to render on the client side. **Note:** Use the function pattern when accessing browser-only APIs. | | `fallback` | - | `ReactNode` | The fallback content to render while the component is mounting on the client side. | ## Similar Components - [Show](https://yamada-ui.com/docs/components/show.md): `Show` is a component that shows or hides its children based on a condition. - [For](https://yamada-ui.com/docs/components/for.md): `For` is a component used to loop over an array and render a component for each item. - [Format](https://yamada-ui.com/docs/components/format.md): `Format` is used to format dates, numbers, and bytes according to a specific locale. - [Portal](https://yamada-ui.com/docs/components/portal.md): `Portal` is a component that renders elements outside of the current `DOM` hierarchy. - [Slot](https://yamada-ui.com/docs/components/slot.md): `Slot` is a component that merges its props onto its immediate child. ## Uses Components & Hooks - [Show](https://yamada-ui.com/docs/components/show.md): `Show` is a component that shows or hides its children based on a condition. # FocusLock --- title: FocusLock description: "`FocusLock` is a component that improves accessibility by restricting focus within elements such as modals and dialogs, and locking the focus within that range." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/focus-lock --- # FocusLock `FocusLock` is a component that improves accessibility by restricting focus within elements such as modals and dialogs, and locking the focus within that range. ```tsx const { open, onToggle } = useDisclosure() return ( ) ``` ## Usage ```tsx import { FocusLock } from "@yamada-ui/react" ``` ```tsx import { FocusLock } from "@/components/ui" ``` ```tsx import { FocusLock } from "@workspaces/ui" ``` ```tsx ``` ## Props | Prop | Default | Type | Description | | ----------------------- | ------- | -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `autoFocus` | `false` | `boolean` | If `true`, the first focusable element within the `children` will auto-focused once `FocusLock` mounts. | | `contentRef` | - | `RefObject` | The `ref` of the wrapper for which the focus-lock wraps. | | `disabled` | `false` | `boolean` | If `true`, focus trapping will be disabled. | | `finalFocusRef` | - | `RefObject` | `ref` of the element to return focus to when `FocusLock` unmounts. | | `initialFocusRef` | - | `RefObject` | `ref` of the element to receive focus initially. | | `lockFocusAcrossFrames` | `false` | `boolean` | Enables aggressive focus capturing within iframes. - If `true`: keep focus in the lock, no matter where lock is active. - If `false`: allows focus to move outside of iframe. | | `persistentFocus` | `false` | `boolean` | If `true`, disables text selections inside, and outside focus lock. | | `restoreFocus` | `false` | `boolean` | If `true`, focus will be restored to the element that triggered the `FocusLock` once it unmounts. | ## Similar Components - [VisuallyHidden](https://yamada-ui.com/docs/components/visually-hidden.md): `VisuallyHidden` is a common technique used in web accessibility to hide content from the visual client, but keep it readable for screen readers. ## Used By Components & Hooks - [Drawer](https://yamada-ui.com/docs/components/drawer.md): `Drawer` is a component for a panel that appears from the edge of the screen. - [Modal](https://yamada-ui.com/docs/components/modal.md): `Modal` is a component that is displayed over the main content to focus the user's attention solely on the information. - [Portal](https://yamada-ui.com/docs/components/portal.md): `Portal` is a component that renders elements outside of the current `DOM` hierarchy. # For --- title: For description: "`For` is a component used to loop over an array and render a component for each item." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/for - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-for--basic --- # For `For` is a component used to loop over an array and render a component for each item. ```tsx const items = useMemo( () => [ { name: "竈門炭治郎", breathing: ["水の呼吸", "日の呼吸"] }, { name: "我妻善逸", breathing: ["雷の呼吸"] }, { name: "嘴平伊之助", breathing: ["獣の呼吸"] }, ], [], ) return ( {({ name, breathing }, index) => ( {name} {breathing.join(", ")} )} ) ``` ## Usage ```tsx import { For } from "@yamada-ui/react" ``` ```tsx import { For } from "@/components/ui" ``` ```tsx import { For } from "@workspaces/ui" ``` ```tsx ``` ### Fallback Use the `fallback` prop to render a fallback component when the array is empty or undefined. ```tsx } /> } > {(item, index) => {item}} ``` ### Filter Use the `filter` prop to filter the array items. ```tsx const items = useMemo( () => [ { name: "竈門炭治郎", breathing: ["水の呼吸", "日の呼吸"] }, { name: "我妻善逸", breathing: ["雷の呼吸"] }, { name: "嘴平伊之助", breathing: ["獣の呼吸"] }, ], [], ) return ( breathing.length == 1}> {({ name, breathing }, index) => ( {name} {breathing.join(", ")} )} ) ``` ### Sort Use the `sort` prop to sort the array items. ```tsx const items = useMemo( () => [ { name: "竈門炭治郎", breathing: ["水の呼吸", "日の呼吸"] }, { name: "我妻善逸", breathing: ["雷の呼吸"] }, { name: "嘴平伊之助", breathing: ["獣の呼吸"] }, ], [], ) return ( a.breathing.length - b.breathing.length}> {({ name, breathing }, index) => ( {name} {breathing.join(", ")} )} ) ``` ### Change Offset To start from a specific element in the array, set the starting position in `offset`. ```tsx const items = useMemo( () => [ { name: "竈門炭治郎", breathing: ["水の呼吸", "日の呼吸"] }, { name: "我妻善逸", breathing: ["雷の呼吸"] }, { name: "嘴平伊之助", breathing: ["獣の呼吸"] }, ], [], ) return ( {({ name, breathing }, index) => ( {name} {breathing.join(", ")} )} ) ``` ### Limit Display Count To limit the number of items displayed, set the `limit`. ```tsx const items = useMemo( () => [ { name: "竈門炭治郎", breathing: ["水の呼吸", "日の呼吸"] }, { name: "我妻善逸", breathing: ["雷の呼吸"] }, { name: "嘴平伊之助", breathing: ["獣の呼吸"] }, ], [], ) return ( {({ name, breathing }, index) => ( {name} {breathing.join(", ")} )} ) ``` ### Reverse Order To reverse the order, set `reverse` to `true`. ```tsx const items = useMemo( () => [ { name: "竈門炭治郎", breathing: ["水の呼吸", "日の呼吸"] }, { name: "我妻善逸", breathing: ["雷の呼吸"] }, { name: "嘴平伊之助", breathing: ["獣の呼吸"] }, ], [], ) return ( {({ name, breathing }, index) => ( {name} {breathing.join(", ")} )} ) ``` ## Props | Prop | Default | Type | Description | | ---------- | ------- | ---------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `children` | - | `(value: Y, index: number, array: Y[]) => ReactNode` | The render function to render each item in the array. | | `each` | - | `readonly Y[] \| undefined \| Y[]` | The array to iterate over. | | `fallback` | - | `ReactNode` | The fallback content to render when the array is empty. | | `filter` | - | `(value: Y, index: number, array: Y[]) => boolean` | A function that returns a boolean indicating whether the item should be included in the render result. | | `limit` | - | `number` | The maximum number of items to include in the render result. | | `offset` | `0` | `number` | The number of items to skip before including them in the render result. | | `reverse` | `false` | `boolean` | The boolean value to determine the order of the items in the array. If `true`, the items will be reversed. If `sortBy` is provided, inversion is applied to the sorted array. | | `sort` | - | `(a: Y, b: Y) => number` | The function to sort the items in the array. If function is provided, the items will be sorted based on the return value. If `reverse` is `true`, the inversion is applied to the sorted array. | ## Similar Components - [Format](https://yamada-ui.com/docs/components/format.md): `Format` is used to format dates, numbers, and bytes according to a specific locale. - [Portal](https://yamada-ui.com/docs/components/portal.md): `Portal` is a component that renders elements outside of the current `DOM` hierarchy. - [Slot](https://yamada-ui.com/docs/components/slot.md): `Slot` is a component that merges its props onto its immediate child. - [ClientOnly](https://yamada-ui.com/docs/components/client-only.md): `ClientOnly` is a component that renders its children only on the client side. - [Show](https://yamada-ui.com/docs/components/show.md): `Show` is a component that shows or hides its children based on a condition. # Format --- title: Format description: "`Format` is used to format dates, numbers, and bytes according to a specific locale." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/format - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-format --- # Format `Format` is used to format dates, numbers, and bytes according to a specific locale. ```tsx ``` ## Usage ```tsx import { Format } from "@yamada-ui/react" ``` ```tsx import { Format } from "@/components/ui" ``` ```tsx import { Format } from "@workspaces/ui" ``` ```tsx ``` ### Dates :::note `Format.DateTime` internally uses [Intl.DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat). ::: #### Changing the Locale To change the locale, set a value for [locale](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#locales). ```tsx en-US ja-JP de-DE fr-FR zh-CN ``` #### Converting to Year To convert to year, set a value for [year](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#year). ```tsx ``` #### Converting to Month To convert to month, set a value for [month](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#month). ```tsx ``` #### Converting to Day To convert to day, set a value for [day](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#day). ```tsx ``` #### Converting to Weekday To convert to weekday, set a value for [weekday](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#weekday). ```tsx ``` ### Numbers :::note `Format.Number` internally uses [Intl.NumberFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat). ::: #### Changing the Locale To change the locale, set a value for [locale](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#locales). ```tsx en-US ja-JP de-DE fr-FR zh-CN ``` #### Converting to Currency To convert to currency, set `"currency"` for [style](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#style). ```tsx USD EUR JPY ``` #### Converting to Units To convert to units, set `"unit"` for [style](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#style). ```tsx ``` #### Converting to Percent To convert to percent, set `"percent"` for [style](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#style). ```tsx ``` #### Converting Notation To convert notation, set a value for [notation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#notation). ```tsx ``` #### Controlling Decimal Places To control the number of decimal places, use [minimumFractionDigits](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#minimumfractiondigits) and [maximumFractionDigits](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#maximumfractiondigits). ```tsx ``` #### Disabling Grouping To disable grouping, set `false` for [useGrouping](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#usegrouping). ```tsx ``` #### Changing the Sign Display To change the sign display, set a value for [signDisplay](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#signdisplay). ```tsx ``` ### Bytes :::note `Format.Byte` internally uses [Intl.NumberFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat). ::: #### Automatic Unit Selection `Format.Byte` automatically selects the most appropriate unit (`byte`, `kB`, `MB`, `GB`, `TB`) based on the byte value size. ```tsx ``` #### Changing the Locale To change the locale, set a value for [locale](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#locales). ```tsx en-US ja-JP de-DE fr-FR zh-CN ``` #### Unit Format To convert units, set `unit` to either `"byte"` or `"bit"`. The default is `"byte"`. ```tsx Bytes Bits ``` #### Changing the Unit Display To change the unit display, set a value for [unitDisplay](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#unitdisplay). ```tsx Short Narrow Long ``` ### Set the Locale for the Entire Application If you want to set the locale for the entire application, set the `locale` for the `UIProvider`. ```tsx import { UIProvider } from "@yamada-ui/react" const App = () => { return ( ) } ``` ## Props ### Format.Byte | Prop | Default | Type | Description | | ------------- | --------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `value` | - | `number` | The byte size to format | | `locale` | `"en-US"` | `AnyString \| Locale` | The locale string to use for formatting. | | `unit` | - | `"bit" \| "byte"` | The unit granularity to display | | `unitDisplay` | - | `"long" \| "narrow" \| "short"` | The unit display | ### Format.DateTime | Prop | Default | Type | Description | | ------------- | --------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `value` | - | `Date` | The date time to format | | `locale` | `"en-US"` | `AnyString \| Locale` | The locale string to use for formatting. | ### Format.Number | Prop | Default | Type | Description | | ------------- | --------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `value` | - | `number` | The numeric value to be formatted. | | `locale` | `"en-US"` | `AnyString \| Locale` | The locale string to use for formatting. | ## Similar Components - [For](https://yamada-ui.com/docs/components/for.md): `For` is a component used to loop over an array and render a component for each item. - [Portal](https://yamada-ui.com/docs/components/portal.md): `Portal` is a component that renders elements outside of the current `DOM` hierarchy. - [Slot](https://yamada-ui.com/docs/components/slot.md): `Slot` is a component that merges its props onto its immediate child. - [ClientOnly](https://yamada-ui.com/docs/components/client-only.md): `ClientOnly` is a component that renders its children only on the client side. - [Show](https://yamada-ui.com/docs/components/show.md): `Show` is a component that shows or hides its children based on a condition. ## Used By Components & Hooks - [Calendar](https://yamada-ui.com/docs/components/calendar.md): `Calendar` is a component for displaying or selecting dates in a calendar. - [DatePicker](https://yamada-ui.com/docs/components/date-picker.md): `DatePicker` is a component used for users to select a date. # Portal --- title: Portal description: "`Portal` is a component that renders elements outside of the current `DOM` hierarchy." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/portal --- # Portal `Portal` is a component that renders elements outside of the current `DOM` hierarchy. ```tsx <> 元の世界 ナツキ・スバル ``` ## Usage ```tsx import { Portal } from "@yamada-ui/react" ``` ```tsx import { Portal } from "@/components/ui" ``` ```tsx import { Portal } from "@workspaces/ui" ``` ```tsx ``` ### Change the destination To change the destination, set the `ref` of the destination to `containerRef`. By default, it transfers to the end of `document.body`. ```tsx const containerRef = useRef(null) return ( 元の世界 ナツキ・スバル エミリアたん ) ``` ### Disable portaling To disable forwarding, set `disabled` to `true`. ```tsx <> 元の世界 ナツキ・スバル ``` ## Props | Prop | Default | Type | Description | | -------------- | ------- | -------------------------------- | ---------------------------------------------------------------- | | `containerRef` | - | `RefObject` | The `ref` to the component where the portal will be attached to. | | `disabled` | - | `boolean` | If `true`, the forwarding will be disabled. | ## Similar Components - [For](https://yamada-ui.com/docs/components/for.md): `For` is a component used to loop over an array and render a component for each item. - [Format](https://yamada-ui.com/docs/components/format.md): `Format` is used to format dates, numbers, and bytes according to a specific locale. - [Slot](https://yamada-ui.com/docs/components/slot.md): `Slot` is a component that merges its props onto its immediate child. - [ClientOnly](https://yamada-ui.com/docs/components/client-only.md): `ClientOnly` is a component that renders its children only on the client side. - [Show](https://yamada-ui.com/docs/components/show.md): `Show` is a component that shows or hides its children based on a condition. ## Used By Components & Hooks - [ActionBar](https://yamada-ui.com/docs/components/action-bar.md): `ActionBar` is a component that is used to display a bottom action bar with a set of actions. - [Drawer](https://yamada-ui.com/docs/components/drawer.md): `Drawer` is a component for a panel that appears from the edge of the screen. - [Dropzone](https://yamada-ui.com/docs/components/dropzone.md): `Dropzone` is a component used for uploading files via drag and drop. - [FileButton](https://yamada-ui.com/docs/components/file-button.md): `FileButton` is a button component used for users to select files. - [FileInput](https://yamada-ui.com/docs/components/file-input.md): `FileInput` is a component used for users to select files. - [Loading](https://yamada-ui.com/docs/components/loading.md): `Loading` is a component displayed during waiting times, such as when data is being loaded. - [Modal](https://yamada-ui.com/docs/components/modal.md): `Modal` is a component that is displayed over the main content to focus the user's attention solely on the information. - [Popover](https://yamada-ui.com/docs/components/popover.md): `Popover` is a component that floats around an element to display information. - [Toggle](https://yamada-ui.com/docs/components/toggle.md): `Toggle` is a component that has two states: on or off. - [Tooltip](https://yamada-ui.com/docs/components/tooltip.md): `Tooltip` is a component that displays short information, such as supplementary details for an element. # Show --- title: Show description: "`Show` is a component that shows or hides its children based on a condition." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/show - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-show--basic --- # Show `Show` is a component that shows or hides its children based on a condition. ```tsx インビジブルガール 葉隠透 ``` ## Usage ```tsx import { Show } from "@yamada-ui/react" ``` ```tsx import { Show } from "@/components/ui" ``` ```tsx import { Show } from "@workspaces/ui" ``` ```tsx ``` ### Render Conditionally To conditionally render content, set the `when` prop to a boolean value. ```tsx const [isVisible, setIsVisible] = useState(true) return ( インビジブルガール 葉隠透 ) ``` ### With Fallback To render fallback content when the condition is false, use the `fallback` prop. ```tsx const [isVisible, setIsVisible] = useState(false) return ( 衣服}> インビジブルガール 葉隠透 ) ``` ## Props | Prop | Default | Type | Description | | ---------- | ------- | ------------------------ | --------------------------------------------------- | | `children` | - | `ReactNodeOrFunction` | The children to render if `when` is `true` | | `fallback` | - | `ReactNode` | The fallback content to render if `when` is `false` | | `when` | - | `null \| Y` | If `true`, it'll render the `children` prop | ## Similar Components - [ClientOnly](https://yamada-ui.com/docs/components/client-only.md): `ClientOnly` is a component that renders its children only on the client side. - [For](https://yamada-ui.com/docs/components/for.md): `For` is a component used to loop over an array and render a component for each item. - [Format](https://yamada-ui.com/docs/components/format.md): `Format` is used to format dates, numbers, and bytes according to a specific locale. - [Portal](https://yamada-ui.com/docs/components/portal.md): `Portal` is a component that renders elements outside of the current `DOM` hierarchy. - [Slot](https://yamada-ui.com/docs/components/slot.md): `Slot` is a component that merges its props onto its immediate child. ## Used By Components & Hooks - [ClientOnly](https://yamada-ui.com/docs/components/client-only.md): `ClientOnly` is a component that renders its children only on the client side. # Slot --- title: Slot description: "`Slot` is a component that merges its props onto its immediate child." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/slot - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-slot--basic --- # Slot `Slot` is a component that merges its props onto its immediate child. ```tsx const Button = ({ asChild, ...props }) => { const Component = asChild ? Slot : "button" return } return ( ) ``` ## Usage ```tsx import { Slot, Slottable } from "@yamada-ui/react" ``` ```tsx import { Slot, Slottable } from "@/components/ui" ``` ```tsx import { Slot, Slottable } from "@workspaces/ui" ``` ```tsx ``` ### Multiple Children `Slot` only accepts a single child element. If you want to accept multiple children, use `Slottable`. ```tsx const Button = ({ asChild, children, endIcon, startIcon, ...props }) => { const Component = asChild ? Slot : "button" return ( {startIcon} {children} {endIcon} ) } return ( ) ``` ## Similar Components - [For](https://yamada-ui.com/docs/components/for.md): `For` is a component used to loop over an array and render a component for each item. - [Format](https://yamada-ui.com/docs/components/format.md): `Format` is used to format dates, numbers, and bytes according to a specific locale. - [Portal](https://yamada-ui.com/docs/components/portal.md): `Portal` is a component that renders elements outside of the current `DOM` hierarchy. - [ClientOnly](https://yamada-ui.com/docs/components/client-only.md): `ClientOnly` is a component that renders its children only on the client side. - [Show](https://yamada-ui.com/docs/components/show.md): `Show` is a component that shows or hides its children based on a condition. # VisuallyHidden --- title: VisuallyHidden description: "`VisuallyHidden` is a common technique used in web accessibility to hide content from the visual client, but keep it readable for screen readers." links: - style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/visually-hidden/visually-hidden.style.ts - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/visually-hidden - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-visuallyhidden--basic --- # VisuallyHidden `VisuallyHidden` is a common technique used in web accessibility to hide content from the visual client, but keep it readable for screen readers. ```tsx Checkmark ``` ## Usage ```tsx import { VisuallyHidden } from "@yamada-ui/react" ``` ```tsx import { VisuallyHidden } from "@/components/ui" ``` ```tsx import { VisuallyHidden } from "@workspaces/ui" ``` ```tsx Hidden content ``` It is used to visually hide elements, but it is accessible in screen readers. By default, it renders a `span` element. ## Props | Prop | Default | Type | Description | | ------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | ## Similar Components - [FocusLock](https://yamada-ui.com/docs/components/focus-lock.md): `FocusLock` is a component that improves accessibility by restricting focus within elements such as modals and dialogs, and locking the focus within that range. # Customization --- title: Customization description: "Learn how to customize the configuration of Yamada UI." --- # Customization Learn how to customize the configuration of Yamada UI. To change the prefix of CSS variables, set the value to `css.varPrefix`. ### Generate a Theme Use the [CLI](https://yamada-ui.com/docs/theming/cli.md) to generate a theme. :::warning Before running the following commands, you need to install `@yamada-ui/cli` and execute the `init` command. For more details, please see [here](https://yamada-ui.com/docs/get-started/cli.md). ::: ```bash pnpm yamada-cli theme ``` ```bash npm yamada-cli theme ``` ```bash yarn yamada-cli theme ``` ```bash bun yamada-cli theme ``` ### Change the Config Change the `config.ts` in the generated theme. ```tsx import { defineConfig } from "@yamada-ui/react" export const config = defineConfig({ css: { varPrefix: "custom" }, // [!code highlight] breakpoint: { direction: "down", identifier: "@media screen" }, defaultColorMode: "dark", defaultThemeScheme: "base", notice: { duration: 5000 }, theme: { responsive: true }, }) ``` ### Update the Provider Set the generated theme to `UIProvider`. ```tsx import { UIProvider } from "@workspaces/ui" import { theme, config } from "@workspace/theme" const App = () => { return ( ) } ``` # Overview --- title: Overview description: "The configuration of Yamada UI is a global setting used in various parts of the system." --- # Overview The configuration of Yamada UI is a global setting used in various parts of the system. The configuration defined in the theme are [here](https://github.com/yamada-ui/yamada-ui/blob/main/packages/react/src/theme/config.ts). ```tsx import { defineConfig } from "@yamada-ui/react" export const config = defineConfig({ css: { varPrefix: "ui" }, breakpoint: { direction: "down", identifier: "@media screen" }, defaultColorMode: "light", defaultThemeScheme: "base", notice: { duration: 5000 }, theme: { responsive: true }, }) ``` ## Properties | Property | Default | Description | | --------------------------------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `css.layers` | - | [Cascade layers](https://yamada-ui.com/docs/theming/cascade-layers.md) settings. | | `css.varPrefix` | `"ui"` | CSS variable prefix. | | `breakpoint.base` | `"9999px"` | Breakpoint base value. | | `breakpoint.containerRef` | - | [Container query](https://yamada-ui.com/docs/theming/breakpoints.md#container-query) reference when using the container query. | | `breakpoint.direction` | `"down"` | [Responsive design](https://yamada-ui.com/docs/styling/responsive-design.md) adopted [media query](https://yamada-ui.com/docs/theming/breakpoints.md#media-query). | | `breakpoint.identifier` | `"@media screen"` | Media query to use for breakpoints. | | `defaultColorMode` | `"light"` | Default [color mode](https://yamada-ui.com/docs/theming/color-mode.md). | | `defaultThemeScheme` | `"base"` | Default [theme scheme](https://yamada-ui.com/docs/theming/switching-themes.md). | | `theme.responsive` | `false` | Apply [responsive design](https://yamada-ui.com/docs/styling/responsive-design.md) to theme tokens. | | `disableTransitionOnChange` | `false` | Disable `transition` when changing the color mode or theme. | | `loading.screen.blockScrollOnMount` | `true` | Lock scrolling when [loading](https://yamada-ui.com/docs/hooks/use-loading.md) is displayed. | | `loading.screen.allowPinchZoom` | `false` | Handle zoom or pinch gestures on iOS devices when scrolling is locked. | | `loading.screen.loadingScheme` | `"oval"` | Scheme of [loading](https://yamada-ui.com/docs/hooks/use-loading.md). | | `loading.screen.duration` | `null` | Duration of [loading](https://yamada-ui.com/docs/hooks/use-loading.md). | | `loading.screen.loadingCount` | `0` | Initial count of [loading](https://yamada-ui.com/docs/hooks/use-loading.md). | | `loading.page.blockScrollOnMount` | `true` | Lock scrolling when [loading](https://yamada-ui.com/docs/hooks/use-loading.md) is displayed. | | `loading.page.allowPinchZoom` | `false` | Handle zoom or pinch gestures on iOS devices when scrolling is locked. | | `loading.page.loadingScheme` | `"oval"` | Scheme of [loading](https://yamada-ui.com/docs/hooks/use-loading.md). | | `loading.page.duration` | `null` | Duration of [loading](https://yamada-ui.com/docs/hooks/use-loading.md). | | `loading.page.loadingCount` | `0` | Initial count of [loading](https://yamada-ui.com/docs/hooks/use-loading.md). | | `loading.background.blockScrollOnMount` | `false` | Lock scrolling when [loading](https://yamada-ui.com/docs/hooks/use-loading.md) is displayed. | | `loading.background.allowPinchZoom` | `false` | Handle zoom or pinch gestures on iOS devices when scrolling is locked. | | `loading.background.loadingScheme` | `"oval"` | Scheme of [loading](https://yamada-ui.com/docs/hooks/use-loading.md). | | `loading.background.duration` | `null` | Duration of [loading](https://yamada-ui.com/docs/hooks/use-loading.md). | | `loading.background.loadingCount` | `0` | Initial count of [loading](https://yamada-ui.com/docs/hooks/use-loading.md). | | `notice.closable` | `true` | Enable to close [notice](https://yamada-ui.com/docs/hooks/use-notice.md). | | `notice.closeStrategy` | `["click", "drag"]` | Close strategy for the [notice](https://yamada-ui.com/docs/hooks/use-notice.md). | | `notice.duration` | `5000` | Duration of [notice](https://yamada-ui.com/docs/hooks/use-notice.md). | | `notice.expand` | `false` | Expand [notice](https://yamada-ui.com/docs/hooks/use-notice.md). | | `notice.limit` | `3` | Maximum number of [notice](https://yamada-ui.com/docs/hooks/use-notice.md). | | `notice.placement` | `"start"` | Placement of [notice](https://yamada-ui.com/docs/hooks/use-notice.md). | | `snacks.closable` | `true` | Enable close button on [snacks](https://yamada-ui.com/docs/components/snacks.md). | | `snacks.duration` | `5000` | Duration of [snacks](https://yamada-ui.com/docs/components/snacks.md). | | `snacks.limit` | - | Maximum number of [snacks](https://yamada-ui.com/docs/components/snacks.md). | | `snacks.placement` | `"start"` | Placement of [snacks](https://yamada-ui.com/docs/components/snacks.md). | | `snacks.startIndex` | `0` | Start `z-index` of [snacks](https://yamada-ui.com/docs/components/snacks.md). | # Accordion --- title: Accordion description: "`Accordion` is a component for a list that displays information in an expandable or collapsible manner." links: - style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/accordion/accordion.style.ts - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/accordion - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-accordion--basic --- # Accordion `Accordion` is a component for a list that displays information in an expandable or collapsible manner. ```tsx 地球の人里離れた山奥に住む尻尾の生えた少年・孫悟空はある日、西の都からやって来た少女・ブルマと出会う。そこで、7つ集めると神龍(シェンロン)が現れ、どんな願いでも一つだけ叶えてくれるというドラゴンボールの存在を、さらに育ての親である孫悟飯の形見として大切に持っていた球がその1つ「四星球(スーシンチュウ)」であることを知り、ブルマと共に残りのドラゴンボールを探す旅に出る。 天下一武道会終了後、ピラフ一味によって復活したピッコロ大魔王によって、クリリンや亀仙人など悟空の仲間たちや多くの武道家たちが殺される。悟空は仇を討つため、道中に出会ったヤジロベーや仙猫カリンの協力を得て命を賭して潜在する力を引き出し、ピッコロ大魔王に闘いを挑み勝利する。闘いの後、悟空はピッコロ大魔王に殺された神龍や仲間たちの復活のため天界へ向かい、ドラゴンボールの創造者である神に会う。そこで神龍復活の条件として、神の下で天界で修行することとなった。 ピッコロ(マジュニア)との闘いから約5年後、息子の孫悟飯を儲けて平和な日々を過ごしていた悟空のもとに、実兄・ラディッツが宇宙より来襲し、自分が惑星ベジータの戦闘民族・サイヤ人であることを知らされる。さらわれた孫悟飯を助けるため悟空は宿敵ピッコロと手を組み、自らの命と引き換えにラディッツを倒すが、約1年後にはさらに強力なサイヤ人たちがドラゴンボールを求めて地球に来襲することを知る。 ``` ## Usage ```tsx import { Accordion } from "@yamada-ui/react" ``` ```tsx import { Accordion } from "@/components/ui" ``` ```tsx import { Accordion } from "@workspaces/ui" ``` ```tsx ``` :::tip If you need to expand or collapse a single item and it is clear that multiple items will not be displayed in the future, use [Collapse](https://yamada-ui.com/docs/components/collapse.md). ::: ### Use items ```tsx const items = useMemo( () => [ { button: "孫悟空少年編", children: "地球の人里離れた山奥に住む尻尾の生えた少年・孫悟空はある日、西の都からやって来た少女・ブルマと出会う。そこで、7つ集めると神龍(シェンロン)が現れ、どんな願いでも一つだけ叶えてくれるというドラゴンボールの存在を、さらに育ての親である孫悟飯の形見として大切に持っていた球がその1つ「四星球(スーシンチュウ)」であることを知り、ブルマと共に残りのドラゴンボールを探す旅に出る。", }, { button: "ピッコロ大魔王編", children: "天下一武道会終了後、ピラフ一味によって復活したピッコロ大魔王によって、クリリンや亀仙人など悟空の仲間たちや多くの武道家たちが殺される。悟空は仇を討つため、道中に出会ったヤジロベーや仙猫カリンの協力を得て命を賭して潜在する力を引き出し、ピッコロ大魔王に闘いを挑み勝利する。闘いの後、悟空はピッコロ大魔王に殺された神龍や仲間たちの復活のため天界へ向かい、ドラゴンボールの創造者である神に会う。そこで神龍復活の条件として、神の下で天界で修行することとなった。", }, { button: "サイヤ人編", children: "ピッコロ(マジュニア)との闘いから約5年後、息子の孫悟飯を儲けて平和な日々を過ごしていた悟空のもとに、実兄・ラディッツが宇宙より来襲し、自分が惑星ベジータの戦闘民族・サイヤ人であることを知らされる。さらわれた孫悟飯を助けるため悟空は宿敵ピッコロと手を組み、自らの命と引き換えにラディッツを倒すが、約1年後にはさらに強力なサイヤ人たちがドラゴンボールを求めて地球に来襲することを知る。", }, ], [], ) return ``` ### Change Variant ```tsx {(variant, index) => ( 地球の人里離れた山奥に住む尻尾の生えた少年・孫悟空はある日、西の都からやって来た少女・ブルマと出会う。そこで、7つ集めると神龍(シェンロン)が現れ、どんな願いでも一つだけ叶えてくれるというドラゴンボールの存在を、さらに育ての親である孫悟飯の形見として大切に持っていた球がその1つ「四星球(スーシンチュウ)」であることを知り、ブルマと共に残りのドラゴンボールを探す旅に出る。 天下一武道会終了後、ピラフ一味によって復活したピッコロ大魔王によって、クリリンや亀仙人など悟空の仲間たちや多くの武道家たちが殺される。悟空は仇を討つため、道中に出会ったヤジロベーや仙猫カリンの協力を得て命を賭して潜在する力を引き出し、ピッコロ大魔王に闘いを挑み勝利する。闘いの後、悟空はピッコロ大魔王に殺された神龍や仲間たちの復活のため天界へ向かい、ドラゴンボールの創造者である神に会う。そこで神龍復活の条件として、神の下で天界で修行することとなった。 ピッコロ(マジュニア)との闘いから約5年後、息子の孫悟飯を儲けて平和な日々を過ごしていた悟空のもとに、実兄・ラディッツが宇宙より来襲し、自分が惑星ベジータの戦闘民族・サイヤ人であることを知らされる。さらわれた孫悟飯を助けるため悟空は宿敵ピッコロと手を組み、自らの命と引き換えにラディッツを倒すが、約1年後にはさらに強力なサイヤ人たちがドラゴンボールを求めて地球に来襲することを知る。 )} ``` ### Set a Specific Item to be Expanded by Default To have a specific item expanded by default, set the item's `index` to `defaultIndex`. ```tsx 地球の人里離れた山奥に住む尻尾の生えた少年・孫悟空はある日、西の都からやって来た少女・ブルマと出会う。そこで、7つ集めると神龍(シェンロン)が現れ、どんな願いでも一つだけ叶えてくれるというドラゴンボールの存在を、さらに育ての親である孫悟飯の形見として大切に持っていた球がその1つ「四星球(スーシンチュウ)」であることを知り、ブルマと共に残りのドラゴンボールを探す旅に出る。 天下一武道会終了後、ピラフ一味によって復活したピッコロ大魔王によって、クリリンや亀仙人など悟空の仲間たちや多くの武道家たちが殺される。悟空は仇を討つため、道中に出会ったヤジロベーや仙猫カリンの協力を得て命を賭して潜在する力を引き出し、ピッコロ大魔王に闘いを挑み勝利する。闘いの後、悟空はピッコロ大魔王に殺された神龍や仲間たちの復活のため天界へ向かい、ドラゴンボールの創造者である神に会う。そこで神龍復活の条件として、神の下で天界で修行することとなった。 ピッコロ(マジュニア)との闘いから約5年後、息子の孫悟飯を儲けて平和な日々を過ごしていた悟空のもとに、実兄・ラディッツが宇宙より来襲し、自分が惑星ベジータの戦闘民族・サイヤ人であることを知らされる。さらわれた孫悟飯を助けるため悟空は宿敵ピッコロと手を組み、自らの命と引き換えにラディッツを倒すが、約1年後にはさらに強力なサイヤ人たちがドラゴンボールを求めて地球に来襲することを知る。 ``` ### Expand Multiple Items To expand multiple items, set `multiple` to `true`. ```tsx 地球の人里離れた山奥に住む尻尾の生えた少年・孫悟空はある日、西の都からやって来た少女・ブルマと出会う。そこで、7つ集めると神龍(シェンロン)が現れ、どんな願いでも一つだけ叶えてくれるというドラゴンボールの存在を、さらに育ての親である孫悟飯の形見として大切に持っていた球がその1つ「四星球(スーシンチュウ)」であることを知り、ブルマと共に残りのドラゴンボールを探す旅に出る。 天下一武道会終了後、ピラフ一味によって復活したピッコロ大魔王によって、クリリンや亀仙人など悟空の仲間たちや多くの武道家たちが殺される。悟空は仇を討つため、道中に出会ったヤジロベーや仙猫カリンの協力を得て命を賭して潜在する力を引き出し、ピッコロ大魔王に闘いを挑み勝利する。闘いの後、悟空はピッコロ大魔王に殺された神龍や仲間たちの復活のため天界へ向かい、ドラゴンボールの創造者である神に会う。そこで神龍復活の条件として、神の下で天界で修行することとなった。 ピッコロ(マジュニア)との闘いから約5年後、息子の孫悟飯を儲けて平和な日々を過ごしていた悟空のもとに、実兄・ラディッツが宇宙より来襲し、自分が惑星ベジータの戦闘民族・サイヤ人であることを知らされる。さらわれた孫悟飯を助けるため悟空は宿敵ピッコロと手を組み、自らの命と引き換えにラディッツを倒すが、約1年後にはさらに強力なサイヤ人たちがドラゴンボールを求めて地球に来襲することを知る。 ``` ### Enable Toggling To enable toggling, set `toggle` to `true`. ```tsx 地球の人里離れた山奥に住む尻尾の生えた少年・孫悟空はある日、西の都からやって来た少女・ブルマと出会う。そこで、7つ集めると神龍(シェンロン)が現れ、どんな願いでも一つだけ叶えてくれるというドラゴンボールの存在を、さらに育ての親である孫悟飯の形見として大切に持っていた球がその1つ「四星球(スーシンチュウ)」であることを知り、ブルマと共に残りのドラゴンボールを探す旅に出る。 天下一武道会終了後、ピラフ一味によって復活したピッコロ大魔王によって、クリリンや亀仙人など悟空の仲間たちや多くの武道家たちが殺される。悟空は仇を討つため、道中に出会ったヤジロベーや仙猫カリンの協力を得て命を賭して潜在する力を引き出し、ピッコロ大魔王に闘いを挑み勝利する。闘いの後、悟空はピッコロ大魔王に殺された神龍や仲間たちの復活のため天界へ向かい、ドラゴンボールの創造者である神に会う。そこで神龍復活の条件として、神の下で天界で修行することとなった。 ピッコロ(マジュニア)との闘いから約5年後、息子の孫悟飯を儲けて平和な日々を過ごしていた悟空のもとに、実兄・ラディッツが宇宙より来襲し、自分が惑星ベジータの戦闘民族・サイヤ人であることを知らされる。さらわれた孫悟飯を助けるため悟空は宿敵ピッコロと手を組み、自らの命と引き換えにラディッツを倒すが、約1年後にはさらに強力なサイヤ人たちがドラゴンボールを求めて地球に来襲することを知る。 ``` ### Hide Icon To hide the icon, set `iconHidden` to `true`. ```tsx 地球の人里離れた山奥に住む尻尾の生えた少年・孫悟空はある日、西の都からやって来た少女・ブルマと出会う。そこで、7つ集めると神龍(シェンロン)が現れ、どんな願いでも一つだけ叶えてくれるというドラゴンボールの存在を、さらに育ての親である孫悟飯の形見として大切に持っていた球がその1つ「四星球(スーシンチュウ)」であることを知り、ブルマと共に残りのドラゴンボールを探す旅に出る。 天下一武道会終了後、ピラフ一味によって復活したピッコロ大魔王によって、クリリンや亀仙人など悟空の仲間たちや多くの武道家たちが殺される。悟空は仇を討つため、道中に出会ったヤジロベーや仙猫カリンの協力を得て命を賭して潜在する力を引き出し、ピッコロ大魔王に闘いを挑み勝利する。闘いの後、悟空はピッコロ大魔王に殺された神龍や仲間たちの復活のため天界へ向かい、ドラゴンボールの創造者である神に会う。そこで神龍復活の条件として、神の下で天界で修行することとなった。 ピッコロ(マジュニア)との闘いから約5年後、息子の孫悟飯を儲けて平和な日々を過ごしていた悟空のもとに、実兄・ラディッツが宇宙より来襲し、自分が惑星ベジータの戦闘民族・サイヤ人であることを知らされる。さらわれた孫悟飯を助けるため悟空は宿敵ピッコロと手を組み、自らの命と引き換えにラディッツを倒すが、約1年後にはさらに強力なサイヤ人たちがドラゴンボールを求めて地球に来襲することを知る。 ``` ### Disable an Item To disable a specific item, set `disabled`. ```tsx 地球の人里離れた山奥に住む尻尾の生えた少年・孫悟空はある日、西の都からやって来た少女・ブルマと出会う。そこで、7つ集めると神龍(シェンロン)が現れ、どんな願いでも一つだけ叶えてくれるというドラゴンボールの存在を、さらに育ての親である孫悟飯の形見として大切に持っていた球がその1つ「四星球(スーシンチュウ)」であることを知り、ブルマと共に残りのドラゴンボールを探す旅に出る。 天下一武道会終了後、ピラフ一味によって復活したピッコロ大魔王によって、クリリンや亀仙人など悟空の仲間たちや多くの武道家たちが殺される。悟空は仇を討つため、道中に出会ったヤジロベーや仙猫カリンの協力を得て命を賭して潜在する力を引き出し、ピッコロ大魔王に闘いを挑み勝利する。闘いの後、悟空はピッコロ大魔王に殺された神龍や仲間たちの復活のため天界へ向かい、ドラゴンボールの創造者である神に会う。そこで神龍復活の条件として、神の下で天界で修行することとなった。 ピッコロ(マジュニア)との闘いから約5年後、息子の孫悟飯を儲けて平和な日々を過ごしていた悟空のもとに、実兄・ラディッツが宇宙より来襲し、自分が惑星ベジータの戦闘民族・サイヤ人であることを知らされる。さらわれた孫悟飯を助けるため悟空は宿敵ピッコロと手を組み、自らの命と引き換えにラディッツを倒すが、約1年後にはさらに強力なサイヤ人たちがドラゴンボールを求めて地球に来襲することを知る。 ``` ### Customize Icon ```tsx }> 地球の人里離れた山奥に住む尻尾の生えた少年・孫悟空はある日、西の都からやって来た少女・ブルマと出会う。そこで、7つ集めると神龍(シェンロン)が現れ、どんな願いでも一つだけ叶えてくれるというドラゴンボールの存在を、さらに育ての親である孫悟飯の形見として大切に持っていた球がその1つ「四星球(スーシンチュウ)」であることを知り、ブルマと共に残りのドラゴンボールを探す旅に出る。 天下一武道会終了後、ピラフ一味によって復活したピッコロ大魔王によって、クリリンや亀仙人など悟空の仲間たちや多くの武道家たちが殺される。悟空は仇を討つため、道中に出会ったヤジロベーや仙猫カリンの協力を得て命を賭して潜在する力を引き出し、ピッコロ大魔王に闘いを挑み勝利する。闘いの後、悟空はピッコロ大魔王に殺された神龍や仲間たちの復活のため天界へ向かい、ドラゴンボールの創造者である神に会う。そこで神龍復活の条件として、神の下で天界で修行することとなった。 ピッコロ(マジュニア)との闘いから約5年後、息子の孫悟飯を儲けて平和な日々を過ごしていた悟空のもとに、実兄・ラディッツが宇宙より来襲し、自分が惑星ベジータの戦闘民族・サイヤ人であることを知らされる。さらわれた孫悟飯を助けるため悟空は宿敵ピッコロと手を組み、自らの命と引き換えにラディッツを倒すが、約1年後にはさらに強力なサイヤ人たちがドラゴンボールを求めて地球に来襲することを知る。 ``` If you want to switch icons based on the expansion and collapse state of an item, control it with `expanded` provided by `icon`. ```tsx (!expanded ? : )} > 地球の人里離れた山奥に住む尻尾の生えた少年・孫悟空はある日、西の都からやって来た少女・ブルマと出会う。そこで、7つ集めると神龍(シェンロン)が現れ、どんな願いでも一つだけ叶えてくれるというドラゴンボールの存在を、さらに育ての親である孫悟飯の形見として大切に持っていた球がその1つ「四星球(スーシンチュウ)」であることを知り、ブルマと共に残りのドラゴンボールを探す旅に出る。 天下一武道会終了後、ピラフ一味によって復活したピッコロ大魔王によって、クリリンや亀仙人など悟空の仲間たちや多くの武道家たちが殺される。悟空は仇を討つため、道中に出会ったヤジロベーや仙猫カリンの協力を得て命を賭して潜在する力を引き出し、ピッコロ大魔王に闘いを挑み勝利する。闘いの後、悟空はピッコロ大魔王に殺された神龍や仲間たちの復活のため天界へ向かい、ドラゴンボールの創造者である神に会う。そこで神龍復活の条件として、神の下で天界で修行することとなった。 ピッコロ(マジュニア)との闘いから約5年後、息子の孫悟飯を儲けて平和な日々を過ごしていた悟空のもとに、実兄・ラディッツが宇宙より来襲し、自分が惑星ベジータの戦闘民族・サイヤ人であることを知らされる。さらわれた孫悟飯を助けるため悟空は宿敵ピッコロと手を組み、自らの命と引き換えにラディッツを倒すが、約1年後にはさらに強力なサイヤ人たちがドラゴンボールを求めて地球に来襲することを知る。 ``` ### Customize Label ```tsx 孫悟空少年編 地球の人里離れた山奥に住む尻尾の生えた少年・孫悟空はある日、西の都からやって来た少女・ブルマと出会う。そこで、7つ集めると神龍(シェンロン)が現れ、どんな願いでも一つだけ叶えてくれるというドラゴンボールの存在を、さらに育ての親である孫悟飯の形見として大切に持っていた球がその1つ「四星球(スーシンチュウ)」であることを知り、ブルマと共に残りのドラゴンボールを探す旅に出る。 ピッコロ大魔王編 天下一武道会終了後、ピラフ一味によって復活したピッコロ大魔王によって、クリリンや亀仙人など悟空の仲間たちや多くの武道家たちが殺される。悟空は仇を討つため、道中に出会ったヤジロベーや仙猫カリンの協力を得て命を賭して潜在する力を引き出し、ピッコロ大魔王に闘いを挑み勝利する。闘いの後、悟空はピッコロ大魔王に殺された神龍や仲間たちの復活のため天界へ向かい、ドラゴンボールの創造者である神に会う。そこで神龍復活の条件として、神の下で天界で修行することとなった。 サイヤ人編 ピッコロ(マジュニア)との闘いから約5年後、息子の孫悟飯を儲けて平和な日々を過ごしていた悟空のもとに、実兄・ラディッツが宇宙より来襲し、自分が惑星ベジータの戦闘民族・サイヤ人であることを知らされる。さらわれた孫悟飯を助けるため悟空は宿敵ピッコロと手を組み、自らの命と引き換えにラディッツを倒すが、約1年後にはさらに強力なサイヤ人たちがドラゴンボールを求めて地球に来襲することを知る。 ``` ### Customize Panel ```tsx 地球の人里離れた山奥に住む尻尾の生えた少年・孫悟空はある日、西の都からやって来た少女・ブルマと出会う。そこで、7つ集めると神龍(シェンロン)が現れ、どんな願いでも一つだけ叶えてくれるというドラゴンボールの存在を、さらに育ての親である孫悟飯の形見として大切に持っていた球がその1つ「四星球(スーシンチュウ)」であることを知り、ブルマと共に残りのドラゴンボールを探す旅に出る。 天下一武道会終了後、ピラフ一味によって復活したピッコロ大魔王によって、クリリンや亀仙人など悟空の仲間たちや多くの武道家たちが殺される。悟空は仇を討つため、道中に出会ったヤジロベーや仙猫カリンの協力を得て命を賭して潜在する力を引き出し、ピッコロ大魔王に闘いを挑み勝利する。闘いの後、悟空はピッコロ大魔王に殺された神龍や仲間たちの復活のため天界へ向かい、ドラゴンボールの創造者である神に会う。そこで神龍復活の条件として、神の下で天界で修行することとなった。 ピッコロ(マジュニア)との闘いから約5年後、息子の孫悟飯を儲けて平和な日々を過ごしていた悟空のもとに、実兄・ラディッツが宇宙より来襲し、自分が惑星ベジータの戦闘民族・サイヤ人であることを知らされる。さらわれた孫悟飯を助けるため悟空は宿敵ピッコロと手を組み、自らの命と引き換えにラディッツを倒すが、約1年後にはさらに強力なサイヤ人たちがドラゴンボールを求めて地球に来襲することを知る。 ``` ### Control ```tsx const [index, onChange] = useState( undefined, ) return ( 地球の人里離れた山奥に住む尻尾の生えた少年・孫悟空はある日、西の都からやって来た少女・ブルマと出会う。そこで、7つ集めると神龍(シェンロン)が現れ、どんな願いでも一つだけ叶えてくれるというドラゴンボールの存在を、さらに育ての親である孫悟飯の形見として大切に持っていた球がその1つ「四星球(スーシンチュウ)」であることを知り、ブルマと共に残りのドラゴンボールを探す旅に出る。 天下一武道会終了後、ピラフ一味によって復活したピッコロ大魔王によって、クリリンや亀仙人など悟空の仲間たちや多くの武道家たちが殺される。悟空は仇を討つため、道中に出会ったヤジロベーや仙猫カリンの協力を得て命を賭して潜在する力を引き出し、ピッコロ大魔王に闘いを挑み勝利する。闘いの後、悟空はピッコロ大魔王に殺された神龍や仲間たちの復活のため天界へ向かい、ドラゴンボールの創造者である神に会う。そこで神龍復活の条件として、神の下で天界で修行することとなった。 ピッコロ(マジュニア)との闘いから約5年後、息子の孫悟飯を儲けて平和な日々を過ごしていた悟空のもとに、実兄・ラディッツが宇宙より来襲し、自分が惑星ベジータの戦闘民族・サイヤ人であることを知らされる。さらわれた孫悟飯を助けるため悟空は宿敵ピッコロと手を組み、自らの命と引き換えにラディッツを倒すが、約1年後にはさらに強力なサイヤ人たちがドラゴンボールを求めて地球に来襲することを知る。 ) ``` ## Props ### Accordion.Root | Prop | Default | Type | Description | | -------------- | --------- | ------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `variant` | `"plain"` | `"panel" \| "plain"` | The variant of the component. | | `defaultIndex` | - | `number \| number[]` | The initial index(es) of the accordion item to expand. | | `icon` | - | `ReactNodeOrFunction` | The accordion icon for all items to use. | | `iconHidden` | `false` | `boolean` | If `true`, hide the accordion icon for all items. | | `index` | - | `number \| number[]` | The index(es) of the accordion item to expand. | | `items` | - | `AccordionItem[]` | If provided, generate elements based on items. | | `multiple` | `false` | `boolean` | If `true`, multiple accordion items can be expanded at once. | | `onChange` | - | `(index: number \| number[]) => void` | The callback invoked when accordion items are expanded or collapsed. | | `toggle` | `false` | `boolean` | If `true`, any expanded accordion item can be collapsed again. | ### Accordion.Button | Prop | Default | Type | Description | | ---------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `containerProps` | - | `HTMLStyledProps` | Props the container element. | | `icon` | - | `ReactNodeOrFunction` | The accordion icon to use. | ### Accordion.Item | Prop | Default | Type | Description | | ------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `index` | - | `number` | The index of the accordion item. | | `button` | - | `ReactNodeOrFunction` | The accordion button to use. | | `children` | - | `ReactNodeOrFunction` | The accordion children to use. | | `disabled` | `false` | `boolean` | If `true`, the accordion item will be disabled. | | `icon` | - | `ReactNodeOrFunction` | The accordion icon to use. | ### Accordion.Panel | Prop | Default | Type | Description | | ------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `enter` | - | `any` | Custom `enter`. | | `exit` | - | `any` | Custom `exit`. A target to animate to when this component is removed from the tree. This component **must** be the first animatable child of an `AnimatePresence` to enable this exit animation. This limitation exists because React doesn't allow components to defer unmounting until after an animation is complete. Once this limitation is fixed, the `AnimatePresence` component will be unnecessary. | | `initial` | - | `any` | Custom `initial`. Properties, variant label or array of variant labels to start in. Set to `false` to initialise with the values in `animate` (disabling the mount animation) | | `animationOpacity` | `true` | `boolean` | If `true`, the opacity of the content will be animated. | | `delay` | `0` | `number \| MotionLifecycleProps` | Custom `delay` definition for `enter` and `exit`. | | `duration` | `0.2` | `number \| MotionLifecycleProps` | Custom `duration` definition for `enter` and `exit`. | | `endingHeight` | `"auto"` | `string \| number` | The height you want the content in its expanded state. | | `open` | - | `boolean` | Show the component. triggers when enter or exit states. | | `startingHeight` | `0` | `string \| number` | The height you want the content in its collapsed state. | | `transition` | - | `MotionLifecycleProps` | Custom `transition` definition for `enter` and `exit`. | | `transitionEnd` | - | `MotionLifecycleProps` | Custom `transitionEnd` definition for `enter` and `exit`. | | `unmountOnExit` | - | `boolean` | If `true`, the element will unmount when `open={false}` and animation is done. | ## Accessibility `Accordion` follows the [WAI-ARIA - Accordion Pattern](https://www.w3.org/WAI/ARIA/apg/patterns/accordion/) for accessibility. ### Keyboard Navigation | Key | Description | State | | ---------------- | ------------------------------------------------------------------------------------------------------------------- | ---------------------------------- | | `Tab` | Focuses the first item when focus moves to the accordion. Focuses the next item if already within the accordion. | - | | `Shift` + `Tab` | Focuses the previous item that is not disabled. | - | | `ArrowUp` | Focuses the previous item that is not disabled. If it's the first item, focuses the last item that is not disabled. | - | | `ArrowDown` | Focuses the next item that is not disabled. If it's the last item, focuses the first item that is not disabled. | - | | `Space`, `Enter` | Expands the panel of the focused item. | - | | | Expands the panel of the focused item and collapses it if it is already expanded. | `multiple={true}`, `toggle={true}` | | `Home` | Focuses the first item that is not disabled. | - | | `End` | Focuses the last item that is not disabled. | - | ### ARIA Roles and Attributes | Element | Roles and Attributes | Usage | | ----------------------------- | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `button.ui-accordion__button` | `id` | Used to associate with `div.ui-accordion__panel`. | | | `aria-controls` | Sets the `id` of the associated `div.ui-accordion__panel`. | | | `aria-disabled` | Sets to `"true"` if `Accordion.Item` is `disabled`, or if the panel of the item is expanded and the item cannot be collapsed (`Accordion.Root` does not have `multiple={true}` or `toggle={true}`). | | | `aria-expanded` | Sets to `"true"` when the panel of the item is expanded, and `"false"` when it is collapsed. | | `div.ui-accordion__panel` | `role="region"` | Indicates that it is a landmark region. | | | `id` | Used to associate with `button.ui-accordion__button`. | | | `aria-labelledby` | Sets the `id` of the associated `button.ui-accordion__button`. | ## Similar Components - [Collapse](https://yamada-ui.com/docs/components/collapse.md): `Collapse` is a component that allows you to expand or collapse an element for display. - [Fade](https://yamada-ui.com/docs/components/fade.md): `Fade` is a component that gradually shows or hides an element. - [FadeScale](https://yamada-ui.com/docs/components/fade-scale.md): `FadeScale` is a component that gradually scales up to reveal or scales down to hide an element. - [NativeAccordion](https://yamada-ui.com/docs/components/native-accordion.md): `NativeAccordion` is a component for a list that displays information in an expandable or collapsible manner using the HTML `details` element. - [Slide](https://yamada-ui.com/docs/components/slide.md): `Slide` is a component that shows or hides an element from the corners of the page. - [SlideFade](https://yamada-ui.com/docs/components/slide-fade.md): `SlideFade` is a component that gradually shows or hides an element while moving it from a specified position. - [Carousel](https://yamada-ui.com/docs/components/carousel.md): `Carousel` is a component that displays multiple elements like a slideshow. - [Tree](https://yamada-ui.com/docs/components/tree.md): `Tree` is a component used to display hierarchical data structures in an expandable tree format. ## Uses Components & Hooks - [NativeAccordion](https://yamada-ui.com/docs/components/native-accordion.md): `NativeAccordion` is a component for a list that displays information in an expandable or collapsible manner using the HTML `details` element. - [Collapse](https://yamada-ui.com/docs/components/collapse.md): `Collapse` is a component that allows you to expand or collapse an element for display. - [Motion](https://yamada-ui.com/docs/components/motion.md): `Motion` is a convenient component that extends the Yamada UI Style Props to `Motion`. - [Icon](https://yamada-ui.com/docs/components/icon.md): `Icon` is a general icon component that can be used in your projects. - [useDescendants](https://yamada-ui.com/docs/hooks/use-descendants.md): `useDescendants` is a custom hook that manages descendants. # ActionBar --- title: ActionBar description: "`ActionBar` is a component that is used to display a bottom action bar with a set of actions." links: - style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/action-bar/action-bar.style.ts - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/action-bar - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-action-bar--basic --- # ActionBar `ActionBar` is a component that is used to display a bottom action bar with a set of actions. ```tsx ``` ## Usage ```tsx import { ActionBar } from "@yamada-ui/react" ``` ```tsx import { ActionBar } from "@/components/ui" ``` ```tsx import { ActionBar } from "@workspaces/ui" ``` ```tsx ``` ### Use props ```tsx } trigger={} /> ``` ### Change Duration To change the duration, set `duration` to a numerical value (seconds). ```tsx ``` ### Change Placement To change the display position, set `placement` to `"start-center"`, `"end-start"`, etc. By default, `"end-center"` is set. ```tsx ``` ### Change Animation To change the show or hide animation, set `animationScheme` to `"block-start"`, `"inline-end"`, etc. By default, the animation is determined based on the `placement`. ```tsx ``` ### Custom Control ```tsx const { open, onClose, onOpen } = useDisclosure() return ( <> } open={open} onClose={onClose} /> ) ``` ## Props ### ActionBar.Root | Prop | Default | Type | Description | | ----------------- | --------- | ------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `animationScheme` | `"scale"` | `"block-end" \| "block-start" \| "inline-end" \| "inline-start" \| "none" \| "scale" ...` | The animation of the element. | | `closeOnEsc` | `true` | `boolean` | If `true`, the action bar will close when the `Esc` key is pressed. | | `content` | - | `ReactNode` | The action bar content to use. | | `defaultOpen` | - | `boolean` | If `true`, the element will be initially opened. | | `duration` | `0.1` | `MotionLifecycleProps \| number` | The animation duration. | | `onClose` | - | `() => void \| Promise` | Callback invoked to close the element. | | `onCloseComplete` | - | `() => void` | Callback function to run side effects after the action bar has closed. | | `onOpen` | - | `() => void \| Promise` | Callback invoked to open the element. | | `open` | - | `boolean` | If `true`, the element will be opened. | | `portalProps` | - | `Omit` | Props to be forwarded to the portal component. | | `trigger` | - | `ReactNode` | The action bar trigger to use. | ### ActionBar.CloseTrigger | Prop | Default | Type | Description | | ------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | ### ActionBar.Content | Prop | Default | Type | Description | | ------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | ### ActionBar.OpenTrigger | Prop | Default | Type | Description | | ------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | ### ActionBar.Separator | Prop | Default | Type | Description | | ------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | ## Accessibility The `ActionBar` follows the [WAI-ARIA - Dialog (Modal) Pattern](https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/) for accessibility. ### Keyboard Navigation | Key | Description | State | | -------- | ---------------------- | ----------------------------------- | | `Escape` | Closes the action bar. | `open={true}` + `closeOnEsc={true}` | ### ARIA Roles and Attributes | Element | Roles and Attributes | Usage | | -------------------------------------- | ------------------------ | -------------------------------------------------------------------------------- | | `section.ui-action-bar__content` | `role="dialog"` | Indicates that this is a dialog. | | | `id` | Used to associate with `button.ui-action-bar__trigger--open`. | | `button.ui-action-bar__trigger--open` | `aria-haspopup="dialog"` | Indicates that a dialog exists. | | | `aria-expanded` | Sets to `"true"` if the action bar is open, and `"false"` if it is closed. | | | `aria-controls` | If the action bar is open, sets to the `id` of `section.ui-action-bar__content`. | | | `aria-label` | Sets to `"Open action bar"`. | | `button.ui-action-bar__trigger--close` | `aria-label` | Sets to `"Close action bar"`. | ## Similar Components - [NativePopover](https://yamada-ui.com/docs/components/native-popover.md): `NativePopover` is a component that floats around an element to display information using the HTML Popover API. - [Popover](https://yamada-ui.com/docs/components/popover.md): `Popover` is a component that floats around an element to display information. - [Tooltip](https://yamada-ui.com/docs/components/tooltip.md): `Tooltip` is a component that displays short information, such as supplementary details for an element. - [Drawer](https://yamada-ui.com/docs/components/drawer.md): `Drawer` is a component for a panel that appears from the edge of the screen. - [Menu](https://yamada-ui.com/docs/components/menu.md): `Menu` is a component that displays a common dropdown menu. - [Modal](https://yamada-ui.com/docs/components/modal.md): `Modal` is a component that is displayed over the main content to focus the user's attention solely on the information. ## Uses Components & Hooks - [Motion](https://yamada-ui.com/docs/components/motion.md): `Motion` is a convenient component that extends the Yamada UI Style Props to `Motion`. - [Popover](https://yamada-ui.com/docs/components/popover.md): `Popover` is a component that floats around an element to display information. - [Portal](https://yamada-ui.com/docs/components/portal.md): `Portal` is a component that renders elements outside of the current `DOM` hierarchy. - [useValue](https://yamada-ui.com/docs/hooks/use-value.md): `useValue` is a custom hook that combines `useBreakpointValue` and `useColorModeValue`. - [useDisclosure](https://yamada-ui.com/docs/hooks/use-disclosure.md): `useDisclosure` is a custom hook that helps handle common open/close or toggle scenarios. It can be used to control components such as `Modal`, `Dialog`, `Drawer`, etc. # Alert --- title: Alert description: "`Alert` is a component that conveys information to the user." links: - style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/alert/alert.style.ts - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/alert - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-alert--basic --- # Alert `Alert` is a component that conveys information to the user. ```tsx セル か…完全体に………完全体になれさえすれば………!!! ``` ## Usage ```tsx import { Alert } from "@yamada-ui/react" ``` ```tsx import { Alert } from "@/components/ui" ``` ```tsx import { Alert } from "@workspaces/ui" ``` ```tsx ``` ### Change Status ```tsx {(status, index) => ( セル か…完全体に………完全体になれさえすれば………!!! )} ``` ### Change Variant ```tsx {(variant, index) => ( {variant !== "island" && } セル か…完全体に………完全体になれさえすれば………!!! )} ``` ### Change Color Scheme ```tsx {(row, index) => ( セル か…完全体に………完全体になれさえすれば………!!! )} ``` ### Change Loading Scheme ```tsx {(row, index) => ( セル か…完全体に………完全体になれさえすれば………!!! )} ``` ### Customize Layout ```tsx セル か…完全体に………完全体になれさえすれば………!!! セル か…完全体に………完全体になれさえすれば………!!! ``` ## Props ### Alert.Root | Prop | Default | Type | Description | | ------------- | --------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `variant` | `"plain"` | `"island" \| "plain" \| "solid" \| "subtle" \| "surface" ...` | The variant of the component. | | `status` | `"info"` | `StatusScheme` | The status of the alert. | ### Alert.Description | Prop | Default | Type | Description | | ------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | ### Alert.Icon | Prop | Default | Type | Description | | ------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | ### Alert.Loading | Prop | Default | Type | Description | | ---------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `duration` | - | `IconProps["dur"]` | The CSS `dur` property. | | `loadingScheme` | `"oval"` | `Loading.Scheme` | The loading scheme. | | `secondaryColor` | - | `"-moz-initial" \| "AccentColor" \| "AccentColorText" \| "ActiveBorder" \| "ActiveCaption" \| "ActiveText" \| "aliceblue" \| "amber.100" \| "amber.200" \| "amber.300" ...` | The CSS `color` property. | ### Alert.Title | Prop | Default | Type | Description | | ------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | ## Accessibility `Alert` follows the [WAI-ARIA - Alert Pattern](https://www.w3.org/WAI/ARIA/apg/patterns/alert/) for accessibility. ### ARIA Roles and Attributes | Element | Roles and Attributes | Usage | | -------------------- | -------------------- | ------------------------------ | | `div.ui-alert__root` | `role="alert"` | Indicates that it is an alert. | ## Similar Components - [Snacks](https://yamada-ui.com/docs/components/snacks.md): `Snacks` is a component for controlling notifications used in forms and other similar situations. - [Tip](https://yamada-ui.com/docs/components/tip.md): `Tip` is a component that displays supplementary information with a built-in icon trigger. - [EmptyState](https://yamada-ui.com/docs/components/empty-state.md): `EmptyState` is a component used to display when a resource is empty or unavailable. - [CircleProgress](https://yamada-ui.com/docs/components/circle-progress.md): `CircleProgress` is a component that displays progress in a circular progress bar. - [Progress](https://yamada-ui.com/docs/components/progress.md): `Progress` is a component for visually indicating progress. - [Skeleton](https://yamada-ui.com/docs/components/skeleton.md): `Skeleton` is a component that acts as a placeholder until content is loaded. - [Status](https://yamada-ui.com/docs/components/status.md): `Status` is component that indicate the status of a process or state. ## Uses Components & Hooks - [Icon](https://yamada-ui.com/docs/components/icon.md): `Icon` is a general icon component that can be used in your projects. - [Loading](https://yamada-ui.com/docs/components/loading.md): `Loading` is a component displayed during waiting times, such as when data is being loaded. - [Status](https://yamada-ui.com/docs/components/status.md): `Status` is component that indicate the status of a process or state. ## Used By Components & Hooks - [Snacks](https://yamada-ui.com/docs/components/snacks.md): `Snacks` is a component for controlling notifications used in forms and other similar situations. # AlphaSlider --- title: AlphaSlider description: "`AlphaSlider` is a component used to allow the user to select color transparency." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/alpha-slider - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-alphaslider--basic --- # AlphaSlider `AlphaSlider` is a component used to allow the user to select color transparency. ```tsx ``` ## Usage ```tsx import { AlphaSlider } from "@yamada-ui/react" ``` ```tsx import { AlphaSlider } from "@/components/ui" ``` ```tsx import { AlphaSlider } from "@workspaces/ui" ``` ```tsx ``` ### Change Size ```tsx {(size, index) => ( )} ``` ### Set Default Value To set a default value, set a value to `defaultValue`. ```tsx ``` ### Set Minimum and Maximum Values To set minimum and maximum values, set numbers to `min` or `max`. ```tsx ``` ### Change Orientation To change the orientation, set `orientation` to `"vertical"` or `"horizontal"`. The default is `"vertical"`. ```tsx ``` ### Change Shape ```tsx {(shape, index) => ( )} ``` ### Set Step Value To set the step value, set a value to `step`. ```tsx ``` ### Disable To disable, set `disabled` to `true`. ```tsx ``` ### Read-Only To make read-only, set `readOnly` to `true`. ```tsx ``` ### Display Tooltip ```tsx const [value, setValue] = useState(0.5) return ( ) ``` ### Handle Start and End Change Events To handle start and end change events, use `onChangeStart` and `onChangeEnd`. ```tsx const [value, onChange] = useState(0.5) const [startValue, onChangeStart] = useState(0.5) const [endValue, onChangeEnd] = useState(0.5) return ( Value: {value}, Start Value: {startValue}, End Value: {endValue} ) ``` ### Control ```tsx const [value, setValue] = useState(0.5) return ``` ## Props ### AlphaSlider.Root | Prop | Default | Type | Description | | ------------------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `size` | - | `"lg" \| "md" \| "sm" \| "xl" \| "xs"` | The size of the component. | | `variant` | - | `"outline" \| "solid"` | The variant of the component. | | `color` | - | `string` | The color used for the slider. | | `defaultValue` | - | `number` | The initial value of the slider. | | `disabled` | `false` | `boolean` | If `true`, the field will be disabled. | | `getAriaValueText` | - | `(value: number, index: number) => string \| undefined` | This is used to format the value so that screen readers can speak out a more human-friendly value. It is used to set the `aria-valuetext` property of the input. | | `indicatorFill` | - | `"-moz-initial" \| "AccentColor" \| "AccentColorText" \| "ActiveBorder" \| "ActiveCaption" \| "ActiveText" \| "aliceblue" \| "amber.100" \| "amber.200" \| "amber.300" ...` | The fill color of the indicator. | | `indicatorRounded` | - | `"-moz-initial" \| "2xl" \| "2xs" \| "3xl" \| "4xl" \| "full" \| "inherit" \| "initial" \| "l1" \| "l2" ...` | The rounded of the indicator. | | `inputProps` | - | `SliderInputProps` | Props for the input element. | | `invalid` | `false` | `boolean` | If `true`, the field will be invalid. | | `max` | `1` | `number` | The maximum allowed value of the slider. Cannot be less than min. | | `min` | `0` | `number` | The minimum allowed value of the slider. Cannot be greater than max. | | `name` | - | `string` | The name attribute of the hidden `input` field. This is particularly useful in forms. | | `onChange` | - | `(value: number) => void` | Function called whenever the slider value changes. | | `onChangeEnd` | - | `(value: number) => void` | Function called when the user is done selecting a new value. | | `onChangeStart` | - | `(value: number) => void` | Function called when the user starts selecting a new value. | | `overlayProps` | - | `AlphaSliderOverlayProps` | Props for the overlay element. | | `readOnly` | `false` | `boolean` | If `true`, the field will be readonly. | | `required` | `false` | `boolean` | If `true`, the field will be required. | | `step` | `0.01` | `number` | The step in which increments or decrements have to be made. | | `thumbProps` | - | `AlphaSliderThumbProps` | Props for the thumb element. | | `thumbRounded` | - | `"-moz-initial" \| "2xl" \| "2xs" \| "3xl" \| "4xl" \| "full" \| "inherit" \| "initial" \| "l1" \| "l2" ...` | The rounded of the thumb. | | `thumbSize` | - | `"-moz-fit-content" \| "-moz-initial" \| "-moz-max-content" \| "-moz-min-content" \| "-webkit-fit-content" \| "-webkit-max-content" \| "0.5" \| "1.5" \| "1" \| "1/12" ...` | The size of the thumb. | | `thumbStroke` | - | `"-moz-initial" \| "AccentColor" \| "AccentColorText" \| "ActiveBorder" \| "ActiveCaption" \| "ActiveText" \| "aliceblue" \| "amber.100" \| "amber.200" \| "amber.300" ...` | The stroke color of the thumb. | | `trackProps` | - | `AlphaSliderTrackProps` | Props for the track element. | | `trackRounded` | - | `"-moz-initial" \| "2xl" \| "2xs" \| "3xl" \| "4xl" \| "full" \| "inherit" \| "initial" \| "l1" \| "l2" ...` | The rounded of the track. | | `trackSize` | - | `"-moz-fit-content" \| "-moz-initial" \| "-moz-max-content" \| "-moz-min-content" \| "-webkit-fit-content" \| "-webkit-max-content" \| "0.5" \| "1.5" \| "1" \| "1/12" ...` | The size of the track. | | `value` | - | `number` | The value of the slider. | ### AlphaSlider.Overlay | Prop | Default | Type | Description | | ------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `layers` | - | `HTMLStyledProps[]` | The layers used for the overlay element. | ### AlphaSlider.Thumb | Prop | Default | Type | Description | | ------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `index` | - | `number` | The index of the thumb. | ### AlphaSlider.Track | Prop | Default | Type | Description | | ------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | ## Accessibility The `AlphaSlider` follows the [WAI-ARIA - Slider Pattern](https://www.w3.org/WAI/ARIA/apg/patterns/slider/) for accessibility. ### Keyboard Navigation | Key | Description | State | | ------------ | -------------------------------------------------------- | ----- | | `ArrowRight` | Increases the value based on the `step` value. | - | | `ArrowLeft` | Decreases the value based on the `step` value. | - | | `ArrowUp` | Increases the value based on the `step` value. | - | | `ArrowDown` | Decreases the value based on the `step` value. | - | | `Home` | Sets the value to `min`. | - | | `End` | Sets the value to `max`. | - | | `PageUp` | Increases the value based on the `min` and `max` values. | - | | `PageDown` | Decreases the value based on the `min` and `max` values. | - | ### ARIA Roles and Attributes | Element | Roles and Attributes | Usage | | ----------------------------------- | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | | `div.ui-alpha-slider__thumb` | `role="slider"` | Indicates that this is a slider. | | | `aria-label` | Sets `"Slider thumb"`. | | | `aria-orientation` | Sets `"horizontal"` or `"vertical"` based on the `orientation` value. Default is `"horizontal"`. | | | `aria-valuemin` | Sets the `min` value. Default is `0`. | | | `aria-valuemax` | Sets the `max` value. Default is `1`. | | | `aria-valuenow` | Sets the current value. | | | `aria-valuetext` | Sets the current value, such as `"18%"`. | | | `aria-describedby` | If this is within a `Field.Root` and `Field.Root` has an `errorMessage`, `helperMessage`, or a `Field.ErrorMessage`, `Field.HelperMessage`, sets its `id`. | | | `aria-readonly` | Set to `"true"` if `readOnly` is set. | | | `aria-disabled` | Set to `"true"` if `disabled` is set. | | | `aria-invalid` | Set to `"true"` if `invalid` is set. | | | `aria-required` | Set to `"true"` if `required` is set. | | `div.ui-alpha-slider__root > input` | `aria-hidden` | Excludes the element from the accessibility tree. | | | `aria-describedby` | If this is within a `Field.Root` and `Field.Root` has an `errorMessage`, `helperMessage`, or a `Field.ErrorMessage`, `Field.HelperMessage`, sets its `id`. | | | `aria-readonly` | Set to `"true"` if `readOnly` is set. | | | `aria-disabled` | Set to `"true"` if `disabled` is set. | | | `aria-invalid` | Set to `"true"` if `invalid` is set. | | | `aria-required` | Set to `"true"` if `required` is set. | ## Similar Components - [HueSlider](https://yamada-ui.com/docs/components/hue-slider.md): `HueSlider` is a component used to allow the user to select a color hue. - [SaturationSlider](https://yamada-ui.com/docs/components/saturation-slider.md): `SaturationSlider` is a component used to allow the user to select a color saturation. - [ColorSelector](https://yamada-ui.com/docs/components/color-selector.md): `ColorSelector` is a component used by the user to select a color. - [Slider](https://yamada-ui.com/docs/components/slider.md): `Slider` is a component used for allowing users to select a value from a range. - [ColorPicker](https://yamada-ui.com/docs/components/color-picker.md): `ColorPicker` is a component used by the user to select a color or enter an arbitrary color value. ## Uses Components & Hooks - [ColorSwatch](https://yamada-ui.com/docs/components/color-swatch.md): `ColorSwatch` is a component that displays color samples. - [HueSlider](https://yamada-ui.com/docs/components/hue-slider.md): `HueSlider` is a component used to allow the user to select a color hue. - [useValue](https://yamada-ui.com/docs/hooks/use-value.md): `useValue` is a custom hook that combines `useBreakpointValue` and `useColorModeValue`. ## Used By Components & Hooks - [ColorSelector](https://yamada-ui.com/docs/components/color-selector.md): `ColorSelector` is a component used by the user to select a color. # AspectRatio --- title: AspectRatio description: "`AspectRatio` is a component for embedding things like videos and maps while maintaining the aspect ratio." links: - style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/aspect-ratio/aspect-ratio.style.ts - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/aspect-ratio - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-aspectratio--basic --- # AspectRatio `AspectRatio` is a component for embedding things like videos and maps while maintaining the aspect ratio. ```tsx シン・ゴジラ ``` ## Usage ```tsx import { AspectRatio } from "@yamada-ui/react" ``` ```tsx import { AspectRatio } from "@/components/ui" ``` ```tsx import { AspectRatio } from "@workspaces/ui" ``` ```tsx ``` ### Using iframe ```tsx