--- title: DataList description: "`DataList` is used to display a list of data items." links: - style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/data-list/data-list.style.ts - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/data-list - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-datalist--basic --- ```tsx 白石うらら 入れ替わりの魔女 小田切寧々 虜の魔女 大塚芽子 思念(テレパシー)の魔女 猿島マリア 未来視の魔女 滝川ノア 過去視の魔女 飛鳥美琴 透明の魔女 西園寺リカ 記憶操作の魔女 ``` ## Usage ```tsx import { DataList } from "@yamada-ui/react" ``` ```tsx import { DataList } from "@/components/ui" ``` ```tsx import { DataList } from "@workspaces/ui" ``` ```tsx ``` ### Use items ```tsx const items = useMemo( () => [ { description: "入れ替わりの魔女", term: "白石うらら" }, { description: "虜の魔女", term: "小田切寧々" }, { description: "思念(テレパシー)の魔女", term: "大塚芽子" }, { description: "未来視の魔女", term: "猿島マリア" }, { description: "過去視の魔女", term: "滝川ノア" }, { description: "透明の魔女", term: "飛鳥美琴" }, { description: "記憶操作の魔女", term: "西園寺リカ" }, ], [], ) return ``` ### Change variant ```tsx const items = useMemo( () => [ { description: "入れ替わりの魔女", term: "白石うらら" }, { description: "虜の魔女", term: "小田切寧々" }, { description: "思念(テレパシー)の魔女", term: "大塚芽子" }, { description: "未来視の魔女", term: "猿島マリア" }, { description: "過去視の魔女", term: "滝川ノア" }, { description: "透明の魔女", term: "飛鳥美琴" }, { description: "記憶操作の魔女", term: "西園寺リカ" }, ], [], ) return ( }> ) ``` ### Change Size ```tsx const items = useMemo( () => [ { description: "入れ替わりの魔女", term: "白石うらら" }, { description: "虜の魔女", term: "小田切寧々" }, { description: "思念(テレパシー)の魔女", term: "大塚芽子" }, { description: "未来視の魔女", term: "猿島マリア" }, { description: "過去視の魔女", term: "滝川ノア" }, { description: "透明の魔女", term: "飛鳥美琴" }, { description: "記憶操作の魔女", term: "西園寺リカ" }, ], [], ) return ( }> ) ``` ### Change Orientation To change the orientation, set `orientation` to `"horizontal"` or `"vertical"`. The default is `"horizontal"`. ```tsx const items = useMemo( () => [ { description: "入れ替わりの魔女", term: "白石うらら" }, { description: "虜の魔女", term: "小田切寧々" }, { description: "思念(テレパシー)の魔女", term: "大塚芽子" }, { description: "未来視の魔女", term: "猿島マリア" }, { description: "過去視の魔女", term: "滝川ノア" }, { description: "透明の魔女", term: "飛鳥美琴" }, { description: "記憶操作の魔女", term: "西園寺リカ" }, ], [], ) return ( }> ) ``` ### Display Multiple Terms To display multiple terms, set an array to `term`. ```tsx const items = useMemo( () => [ { description: "入れ替わりの魔女", term: ["白石うらら", "清集院桃子"] }, { description: "虜の魔女", term: ["小田切寧々", "紺野つばさ"] }, { description: "思念(テレパシー)の魔女", term: ["大塚芽子", "萌黄ことり"], }, { description: "未来視の魔女", term: ["猿島マリア", "筑紫愛子"] }, { description: "過去視の魔女", term: ["滝川ノア", "姫川そら"] }, { description: "透明の魔女", term: ["飛鳥美琴", "菊池アカネ"] }, { description: "記憶操作の魔女", term: ["西園寺リカ", "虹野晴子"] }, ], [], ) return ``` ```tsx 白石うらら 清集院桃子 入れ替わりの魔女 小田切寧々 紺野つばさ 虜の魔女 大塚芽子 萌黄ことり 思念(テレパシー)の魔女 猿島マリア 筑紫愛子 未来視の魔女 滝川ノア 姫川そら 過去視の魔女 飛鳥美琴 菊池アカネ 透明の魔女 西園寺リカ 虹野晴子 記憶操作の魔女 ``` ### Display Multiple Descriptions To display multiple descriptions, set an array to `description`. ```tsx const items = useMemo( () => [ { description: ["入れ替わりの魔女", "絶望的味覚音痴"], term: "白石うらら", }, { description: ["虜の魔女", "得意教科は自称全教科"], term: "小田切寧々" }, { description: ["思念(テレパシー)の魔女", "若干腐女子の気がある"], term: "大塚芽子", }, { description: ["未来視の魔女", "服のセンスが独特な弟がいる"], term: "猿島マリア", }, { description: ["過去視の魔女", "数々の問題を起こしている"], term: "滝川ノア", }, { description: ["透明の魔女", "サディストの気がある"], term: "飛鳥美琴" }, { description: ["記憶操作の魔女", "学校でもノーパンで過ごしている"], term: "西園寺リカ", }, ], [], ) return ``` ```tsx 白石うらら 入れ替わりの魔女 絶望的味覚音痴 小田切寧々 虜の魔女 得意教科は自称全教科 大塚芽子 思念(テレパシー)の魔女 若干腐女子の気がある 猿島マリア 未来視の魔女 服のセンスが独特な弟がいる 滝川ノア 過去視の魔女 数々の問題を起こしている 飛鳥美琴 透明の魔女 サディストの気がある 西園寺リカ 記憶操作の魔女 学校でもノーパンで過ごしている ``` ### Customize Terms ```tsx const items = useMemo( () => [ { description: "入れ替わりの魔女", term: "白石うらら", termProps: { color: "blue" }, }, { description: "虜の魔女", term: "小田切寧々" }, { description: "思念(テレパシー)の魔女", term: "大塚芽子" }, { description: "未来視の魔女", term: "猿島マリア" }, { description: "過去視の魔女", term: "滝川ノア" }, { description: "透明の魔女", term: "飛鳥美琴" }, { description: "記憶操作の魔女", term: "西園寺リカ" }, ], [], ) return ( ) ``` ```tsx 白石うらら 入れ替わりの魔女 小田切寧々 虜の魔女 大塚芽子 思念(テレパシー)の魔女 猿島マリア 未来視の魔女 滝川ノア 過去視の魔女 飛鳥美琴 透明の魔女 西園寺リカ 記憶操作の魔女 ``` ### Customize Descriptions ```tsx const items = useMemo( () => [ { description: "入れ替わりの魔女", term: "白石うらら", descriptionProps: { color: "blue" }, }, { description: "虜の魔女", term: "小田切寧々" }, { description: "思念(テレパシー)の魔女", term: "大塚芽子" }, { description: "未来視の魔女", term: "猿島マリア" }, { description: "過去視の魔女", term: "滝川ノア" }, { description: "透明の魔女", term: "飛鳥美琴" }, { description: "記憶操作の魔女", term: "西園寺リカ" }, ], [], ) return ( ) ``` ```tsx 白石うらら 入れ替わりの魔女 小田切寧々 虜の魔女 大塚芽子 思念(テレパシー)の魔女 猿島マリア 未来視の魔女 滝川ノア 過去視の魔女 飛鳥美琴 透明の魔女 西園寺リカ 記憶操作の魔女 ``` ## Props ### DataList.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` | `"md"` | `"lg" \| "md" \| "sm"` | The size of the component. | | `variant` | `"subtle"` | `"bold" \| "grid" \| "subtle"` | The variant of the component. | | `descriptionProps` | - | `DataListDescriptionProps` | The props for the data list description component. | | `items` | - | `DataListItemProps[]` | If provided, generate elements based on items. | | `orientation` | `"horizontal"` | `"horizontal" \| "vertical"` | The orientation of the data list. | | `termProps` | - | `DataListTermProps` | The props for the data list term component. | ### DataList.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. | ### DataList.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. | | `description` | - | `ReactNode \| ReactNode[]` | The data list description to use. | | `descriptionProps` | - | `DataListDescriptionProps` | The props for the data list description component. | | `term` | - | `ReactNode \| ReactNode[]` | The data list term to use. | | `termProps` | - | `DataListTermProps` | The props for the data list term component. | ### DataList.Term | 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. |