List
A component that represents content organized in horizontal rows.
import { List, ListDivider, ListItem } from "seed-design/ui/list";
import { ListHeader } from "seed-design/ui/list-header";
import {
IconILowercaseSerifCircleLine,
IconPersonCircleLine,
} from "@karrotmarket/react-monochrome-icon";
import { Icon, VStack } from "@seed-design/react";
export default function ListPreview() {
return (
<VStack width="360px">
<ListHeader as="h2">List header</ListHeader>
<List width="full">
<ListItem title="Basic list item" />
<ListDivider />
<ListItem
prefix={<Icon svg={<IconPersonCircleLine />} />}
title="List item with icon"
detail="Description with extra info"
suffix={<Icon svg={<IconILowercaseSerifCircleLine />} />}
/>
</List>
</VStack>
);
}Installation
npx @seed-design/cli@latest add ui:listpnpm dlx @seed-design/cli@latest add ui:listyarn dlx @seed-design/cli@latest add ui:listbun x @seed-design/cli@latest add ui:listInstall dependencies
npm install @seed-design/css @seed-design/reactyarn add @seed-design/css @seed-design/reactpnpm add @seed-design/css @seed-design/reactbun add @seed-design/css @seed-design/reactCopy the code below and paste it in
/**
* @file ui:list
* @requires @seed-design/react@^2.0.0
* @requires @seed-design/css@^2.0.0
**/
"use client";
import {
List as SeedList,
Divider as SeedDivider,
type DividerProps as SeedDividerProps,
} from "@seed-design/react";
import {
Checkbox as CheckboxPrimitive,
RadioGroup as RadioGroupPrimitive,
Switch as SwitchPrimitive,
} from "@seed-design/react/primitive";
import { listItem } from "@seed-design/css/recipes/list-item";
import * as React from "react";
export interface ListProps extends SeedList.RootProps {}
/**
* @see https://crispy.carrot-soft.tech/react/components/list
*/
export const List = SeedList.Root;
export interface ListItemProps
extends Omit<SeedList.ItemProps, "title" | "prefix" | "asChild" | "children"> {
title: React.ReactNode;
detail?: React.ReactNode;
prefix?: React.ReactNode;
suffix?: React.ReactNode;
}
/**
* @see https://crispy.carrot-soft.tech/react/components/list
*/
export const ListItem = React.forwardRef<HTMLLIElement, ListItemProps>(
({ title, detail, prefix, suffix, ...otherProps }, ref) => {
return (
<SeedList.Item ref={ref} {...otherProps}>
{prefix && <SeedList.Prefix>{prefix}</SeedList.Prefix>}
<SeedList.Content>
<SeedList.Title>{title}</SeedList.Title>
{detail && <SeedList.Detail>{detail}</SeedList.Detail>}
</SeedList.Content>
{suffix && <SeedList.Suffix>{suffix}</SeedList.Suffix>}
</SeedList.Item>
);
},
);
ListItem.displayName = "ListItem";
type ListItemBaseProps = Omit<SeedList.ItemProps, keyof React.HTMLAttributes<HTMLLIElement>>;
export interface ListButtonItemProps
extends Omit<
ListItemBaseProps & React.ButtonHTMLAttributes<HTMLButtonElement>,
"title" | "prefix" | "asChild" | "children"
> {
title: React.ReactNode;
detail?: React.ReactNode;
prefix?: React.ReactNode;
suffix?: React.ReactNode;
rootRef?: React.Ref<HTMLLIElement>;
rootProps?: React.HTMLAttributes<HTMLLIElement>;
}
/**
* @see https://crispy.carrot-soft.tech/react/components/list
*/
export const ListButtonItem = React.forwardRef<HTMLButtonElement, ListButtonItemProps>(
({ title, detail, prefix, suffix, alignItems, rootRef, rootProps, ...props }, ref) => {
const [variantProps, otherProps] = listItem.splitVariantProps(props);
const stateProps = React.useMemo(
() => ({ "data-disabled": otherProps.disabled ? "" : undefined }),
[otherProps.disabled],
);
return (
<SeedList.Item ref={rootRef} alignItems={alignItems} {...variantProps} {...rootProps}>
{prefix && <SeedList.Prefix {...stateProps}>{prefix}</SeedList.Prefix>}
<SeedList.Content asChild>
<button type="button" ref={ref} {...otherProps}>
<SeedList.Title {...stateProps}>{title}</SeedList.Title>
{detail && <SeedList.Detail {...stateProps}>{detail}</SeedList.Detail>}
</button>
</SeedList.Content>
{suffix && <SeedList.Suffix {...stateProps}>{suffix}</SeedList.Suffix>}
</SeedList.Item>
);
},
);
ListButtonItem.displayName = "ListButtonItem";
export interface ListLinkItemProps
extends Omit<
ListItemBaseProps & React.AnchorHTMLAttributes<HTMLAnchorElement>,
"title" | "prefix" | "asChild" | "children"
> {
title: React.ReactNode;
detail?: React.ReactNode;
prefix?: React.ReactNode;
suffix?: React.ReactNode;
rootRef?: React.Ref<HTMLLIElement>;
rootProps?: React.HTMLAttributes<HTMLLIElement>;
}
/**
* @see https://crispy.carrot-soft.tech/react/components/list
*/
export const ListLinkItem = React.forwardRef<HTMLAnchorElement, ListLinkItemProps>(
({ title, detail, prefix, suffix, alignItems, rootRef, rootProps, ...props }, ref) => {
const [variantProps, otherProps] = listItem.splitVariantProps(props);
return (
<SeedList.Item ref={rootRef} alignItems={alignItems} {...variantProps} {...rootProps}>
{prefix && <SeedList.Prefix>{prefix}</SeedList.Prefix>}
<SeedList.Content asChild>
<a ref={ref} {...otherProps}>
<SeedList.Title>{title}</SeedList.Title>
{detail && <SeedList.Detail>{detail}</SeedList.Detail>}
</a>
</SeedList.Content>
{suffix && <SeedList.Suffix>{suffix}</SeedList.Suffix>}
</SeedList.Item>
);
},
);
ListLinkItem.displayName = "ListLinkItem";
export interface ListSwitchItemProps
extends Omit<
ListItemBaseProps & SwitchPrimitive.RootProps,
"title" | "prefix" | "asChild" | "children"
> {
title: React.ReactNode;
detail?: React.ReactNode;
prefix?: React.ReactNode;
suffix?: React.ReactNode;
inputProps?: React.InputHTMLAttributes<HTMLInputElement>;
rootRef?: React.Ref<HTMLLabelElement>;
}
/**
* @see https://crispy.carrot-soft.tech/react/components/list
*/
export const ListSwitchItem = React.forwardRef<HTMLInputElement, ListSwitchItemProps>(
({ title, detail, prefix, suffix, inputProps, alignItems, rootRef, ...props }, ref) => {
const [variantProps, otherProps] = listItem.splitVariantProps(props);
return (
<SeedList.Item {...variantProps} alignItems={alignItems} asChild>
<SwitchPrimitive.Root ref={rootRef} {...otherProps}>
{prefix && <SeedList.Prefix>{prefix}</SeedList.Prefix>}
<SeedList.Content>
<SeedList.Title>{title}</SeedList.Title>
{detail && <SeedList.Detail>{detail}</SeedList.Detail>}
</SeedList.Content>
{suffix && <SeedList.Suffix>{suffix}</SeedList.Suffix>}
<SwitchPrimitive.HiddenInput ref={ref} {...inputProps} />
</SwitchPrimitive.Root>
</SeedList.Item>
);
},
);
ListSwitchItem.displayName = "ListSwitchItem";
export interface ListCheckItemProps
extends Omit<
ListItemBaseProps & CheckboxPrimitive.RootProps,
"title" | "prefix" | "asChild" | "children"
> {
title: React.ReactNode;
detail?: React.ReactNode;
prefix?: React.ReactNode;
suffix?: React.ReactNode;
inputProps?: React.InputHTMLAttributes<HTMLInputElement>;
rootRef?: React.Ref<HTMLLabelElement>;
}
/**
* @see https://crispy.carrot-soft.tech/react/components/list
*/
export const ListCheckItem = React.forwardRef<HTMLInputElement, ListCheckItemProps>(
({ title, detail, prefix, suffix, inputProps, alignItems, rootRef, ...props }, ref) => {
const [variantProps, otherProps] = listItem.splitVariantProps(props);
return (
<SeedList.Item {...variantProps} alignItems={alignItems} asChild>
<CheckboxPrimitive.Root ref={rootRef} {...otherProps}>
{prefix && <SeedList.Prefix>{prefix}</SeedList.Prefix>}
<SeedList.Content>
<SeedList.Title>{title}</SeedList.Title>
{detail && <SeedList.Detail>{detail}</SeedList.Detail>}
</SeedList.Content>
{suffix && <SeedList.Suffix>{suffix}</SeedList.Suffix>}
<CheckboxPrimitive.HiddenInput ref={ref} {...inputProps} />
</CheckboxPrimitive.Root>
</SeedList.Item>
);
},
);
ListCheckItem.displayName = "ListCheckItem";
export interface ListRadioItemProps
extends Omit<
ListItemBaseProps & RadioGroupPrimitive.ItemProps,
"title" | "prefix" | "asChild" | "children"
> {
title: React.ReactNode;
detail?: React.ReactNode;
prefix?: React.ReactNode;
suffix?: React.ReactNode;
inputProps?: React.InputHTMLAttributes<HTMLInputElement>;
rootRef?: React.Ref<HTMLLabelElement>;
}
/**
* @see https://crispy.carrot-soft.tech/react/components/list
*/
export const ListRadioItem = React.forwardRef<HTMLInputElement, ListRadioItemProps>(
({ title, detail, prefix, suffix, inputProps, alignItems, rootRef, ...props }, ref) => {
const [variantProps, otherProps] = listItem.splitVariantProps(props);
return (
<SeedList.Item {...variantProps} alignItems={alignItems} asChild>
<RadioGroupPrimitive.Item ref={rootRef} {...otherProps}>
{prefix && <SeedList.Prefix>{prefix}</SeedList.Prefix>}
<SeedList.Content>
<SeedList.Title>{title}</SeedList.Title>
{detail && <SeedList.Detail>{detail}</SeedList.Detail>}
</SeedList.Content>
{suffix && <SeedList.Suffix>{suffix}</SeedList.Suffix>}
<RadioGroupPrimitive.ItemHiddenInput ref={ref} {...inputProps} />
</RadioGroupPrimitive.Item>
</SeedList.Item>
);
},
);
ListRadioItem.displayName = "ListRadioItem";
export interface ListDividerProps extends SeedDividerProps {
/**
* @default "li"
*/
as?: SeedDividerProps["as"];
/**
* @default true
*/
"aria-hidden"?: SeedDividerProps["aria-hidden"];
}
/**
* @see https://crispy.carrot-soft.tech/react/components/list
*/
export const ListDivider = React.forwardRef<HTMLLIElement, ListDividerProps>(
({ as = "li", "aria-hidden": ariaHidden = true, ...props }, ref) => {
return (
<SeedDivider
as={as}
aria-hidden={ariaHidden}
ref={ref as React.ForwardedRef<HTMLHRElement>}
{...props}
/>
);
},
);
ListDivider.displayName = "ListDivider";
/**
* This file is a snippet from Crispy, helping you get started quickly with @seed-design/* packages.
* You can extend this snippet however you want.
*/
/**
* @file ui:list
* @requires @seed-design/react@^2.0.0
* @requires @seed-design/css@^2.0.0
**/
"use client";
import {
ListHeader as SeedListHeader,
type ListHeaderProps as SeedListHeaderProps,
} from "@seed-design/react";
export interface ListHeaderProps extends SeedListHeaderProps {}
/**
* @see https://crispy.carrot-soft.tech/react/components/list
*/
export const ListHeader = SeedListHeader;
/**
* This file is a snippet from Crispy, helping you get started quickly with @seed-design/* packages.
* You can extend this snippet however you want.
*/
Usage
import { ListHeader } from "seed-design/ui/list-header";
import { List, ListItem } from "seed-design/ui/list";
<VStack>
<ListHeader as="h2">List Header</ListHeader>
<List>
<ListItem title="List Item 1" />
<ListDivider />
<ListItem title="List Item 2" />
</List>
</VStack>Props
ListHeader
Prop
Type
List
Same as VStackProps.
List Items
Prop
Type
titleReact.ReactNodedetail?React.ReactNodeprefix?React.ReactNodesuffix?React.ReactNodealignItems?"flex-start" | "flex-end" | "center" | "stretch" | undefinedProp
Type
titleReact.ReactNodedetail?React.ReactNodeprefix?React.ReactNodesuffix?React.ReactNoderootRef?React.Ref<HTMLLIElement> | undefinedrootProps?React.HTMLAttributes<HTMLLIElement> | undefinedalignItems?"flex-start" | "flex-end" | "center" | "stretch" | undefinedProp
Type
titleReact.ReactNodedetail?React.ReactNodeprefix?React.ReactNodesuffix?React.ReactNoderootRef?React.Ref<HTMLLIElement> | undefinedrootProps?React.HTMLAttributes<HTMLLIElement> | undefinedalignItems?"flex-start" | "flex-end" | "center" | "stretch" | undefinedProp
Type
titleReact.ReactNodedetail?React.ReactNodeprefix?React.ReactNodesuffix?React.ReactNodeinputProps?React.InputHTMLAttributes<HTMLInputElement> | undefinedrootRef?React.Ref<HTMLLabelElement> | undefinedalignItems?"flex-start" | "flex-end" | "center" | "stretch" | undefineddefaultChecked?boolean | undefineddisabled?boolean | undefinedinvalid?boolean | undefinedrequired?boolean | undefinedchecked?boolean | undefinedonCheckedChange?((checked: boolean) => void) | undefinedProp
Type
titleReact.ReactNodedetail?React.ReactNodeprefix?React.ReactNodesuffix?React.ReactNodeinputProps?React.InputHTMLAttributes<HTMLInputElement> | undefinedrootRef?React.Ref<HTMLLabelElement> | undefinedalignItems?"flex-start" | "flex-end" | "center" | "stretch" | undefineddefaultChecked?boolean | undefineddisabled?boolean | undefinedinvalid?boolean | undefinedrequired?boolean | undefinedchecked?boolean | undefinedonCheckedChange?((checked: boolean) => void) | undefinedindeterminate?boolean | undefinedProp
Type
titleReact.ReactNodedetail?React.ReactNodeprefix?React.ReactNodesuffix?React.ReactNodeinputProps?React.InputHTMLAttributes<HTMLInputElement> | undefinedrootRef?React.Ref<HTMLLabelElement> | undefinedalignItems?"flex-start" | "flex-end" | "center" | "stretch" | undefineddisabled?boolean | undefinedvaluestringSame as DividerProps, but renders as <li aria-hidden></li> by default. If you change List to use fieldset or similar, please replace ListDivider with an appropriate tag as well.
Prop
Type
Examples
Using ListHeader
ListHeader is positioned outside the List.
import { List, ListButtonItem } from "seed-design/ui/list";
import { ListHeader } from "seed-design/ui/list-header";
import { ActionButton } from "seed-design/ui/action-button";
import {
IconChevronRightLine,
IconLockLine,
IconPersonCircleLine,
IconQuestionmarkCircleFill,
} from "@karrotmarket/react-monochrome-icon";
import { Divider, Icon, PrefixIcon, VStack } from "@seed-design/react";
export default function () {
return (
<VStack gap="x6" py="x6" width="360px">
<VStack>
<ListHeader as="h2" variant="mediumWeak">
variant="mediumWeak"
</ListHeader>
<List>
<ListButtonItem
title="내 계정"
detail="이메일과 연락처, 본인 인증 관리"
prefix={<Icon svg={<IconPersonCircleLine />} />}
suffix={<Icon svg={<IconChevronRightLine />} size="18px" />}
/>
<ListButtonItem
title="보안 · 인증 관리"
detail="비밀번호, 생체 인증 사용을 관리해요"
prefix={<Icon svg={<IconLockLine />} />}
suffix={<Icon svg={<IconChevronRightLine />} size="x4_5" />}
/>
</List>
</VStack>
<Divider />
<VStack>
<ListHeader as="h2" variant="boldSolid">
variant="boldSolid"
</ListHeader>
<List>
<ListButtonItem
title="내 계정"
detail="이메일과 연락처, 본인 인증 관리"
prefix={<Icon svg={<IconPersonCircleLine />} />}
suffix={<Icon svg={<IconChevronRightLine />} size="18px" />}
/>
<ListButtonItem
title="보안 · 인증 관리"
detail="비밀번호, 생체 인증 사용을 관리해요"
prefix={<Icon svg={<IconLockLine />} />}
suffix={<Icon svg={<IconChevronRightLine />} size="x4_5" />}
/>
</List>
</VStack>
<Divider />
<VStack>
<ListHeader>
<h2>List Header with Action Button</h2>
<ActionButton
variant="ghost"
size="small"
color="fg.neutralSubtle"
fontWeight="medium"
bleed="asPadding"
>
<PrefixIcon svg={<IconQuestionmarkCircleFill />} />
도움말
</ActionButton>
</ListHeader>
<List>
<ListButtonItem
title="내 계정"
detail="이메일과 연락처, 본인 인증 관리"
prefix={<Icon svg={<IconPersonCircleLine />} />}
suffix={<Icon svg={<IconChevronRightLine />} size="18px" />}
/>
<ListButtonItem
title="보안 · 인증 관리"
detail="비밀번호, 생체 인증 사용을 관리해요"
prefix={<Icon svg={<IconLockLine />} />}
suffix={<Icon svg={<IconChevronRightLine />} size="x4_5" />}
/>
</List>
</VStack>
</VStack>
);
}Affixes (Prefix/Suffix)
import {
IconArrowUpBracketDownFill,
IconILowercaseSerifCircleLine,
} from "@karrotmarket/react-monochrome-icon";
import { Icon } from "@seed-design/react";
import { useState } from "react";
import { ActionButton } from "seed-design/ui/action-button";
import { Avatar } from "seed-design/ui/avatar";
import { IdentityPlaceholder } from "seed-design/ui/identity-placeholder";
import { List, ListDivider, ListItem } from "seed-design/ui/list";
import { ToggleButton } from "seed-design/ui/toggle-button";
export default function ListAffixes() {
const [isToggleButtonPressed, setIsToggleButtonPressed] = useState(false);
return (
<List width="360px">
<ListItem
prefix={
<Avatar
size="48"
src="https://avatars.githubusercontent.com/u/54893898?v=4"
fallback={<IdentityPlaceholder />}
/>
}
title="Prefix에 Avatar 넣기"
detail="Amet elit ullamco magna."
/>
<ListDivider />
<ListItem
title="Prefix에 아이콘 넣기"
detail="Deserunt nulla elit est."
prefix={<Icon svg={<IconILowercaseSerifCircleLine />} />}
/>
<ListDivider />
<ListItem
title="Suffix에 Action Button 넣기"
detail="Veniam non est non ut consequat."
suffix={
<ActionButton variant="neutralWeak" size="xsmall">
액션 버튼
</ActionButton>
}
/>
<ListDivider />
<ListItem
title="Suffix에 Action Button (Ghost) 넣기"
detail="Deserunt nulla elit est."
suffix={
<ActionButton size="small" variant="ghost" layout="iconOnly" aria-label="공유">
<Icon svg={<IconArrowUpBracketDownFill />} />
</ActionButton>
}
/>
<ListDivider />
<ListItem
title="Suffix에 Toggle Button 넣기"
detail="Sit eu incididunt aute ea elit ex."
suffix={
<ToggleButton
size="xsmall"
pressed={isToggleButtonPressed}
onPressedChange={setIsToggleButtonPressed}
>
{isToggleButtonPressed ? "선택됨" : "토글 버튼"}
</ToggleButton>
}
/>
</List>
);
}Clickable List Items
You can make the entire list item clickable by using ListButtonItem or ListLinkItem.
If you include clickable elements in prefix or suffix, apply styles like z-index: 1, position: relative, and isolation: isolate so click events work separately from the list item. Crispy React components like ActionButton and ToggleButton do not require additional styling.
import {
IconArrowUpRightLine,
IconCheckmarkFill,
IconChevronRightLine,
IconPenHorizlineFill,
IconPlusFill,
IconSquare2StackedFill,
} from "@karrotmarket/react-monochrome-icon";
import { PrefixIcon, Icon, Box } from "@seed-design/react";
import { useCallback, useState } from "react";
import { List, ListDivider, ListItem, ListButtonItem, ListLinkItem } from "seed-design/ui/list";
import { ActionButton } from "seed-design/ui/action-button";
import { ToggleButton } from "seed-design/ui/toggle-button";
const href = "https://www.daangn.com";
export default function ListClickable() {
const [isSubscribed, setIsSubscribed] = useState(false);
const [isCopied, setIsCopied] = useState(false);
const onCopyClick = useCallback(() => {
navigator.clipboard.writeText(href);
setIsCopied(true);
setTimeout(() => setIsCopied(false), 2000);
}, []);
return (
<List width="full">
<ListItem
title="ListItem은 클릭할 수 없어요. 눌러보세요."
detail="우측의 Action Button만 클릭할 수 있어요"
suffix={
<ActionButton
variant="ghost"
size="xsmall"
color="fg.neutralMuted"
onClick={() => alert("편집 클릭됨")}
>
<PrefixIcon svg={<IconPenHorizlineFill />} />
편집
</ActionButton>
}
/>
<ListDivider />
<ListButtonItem
title="ListButtonItem은 클릭할 수 있어요. 눌러보세요."
detail="리스트 항목 전체와 우측의 Toggle Button 각각을 클릭할 수 있어요"
onClick={() => alert("리스트 아이템 클릭됨")}
suffix={
<>
<ToggleButton size="xsmall" pressed={isSubscribed} onPressedChange={setIsSubscribed}>
<PrefixIcon svg={isSubscribed ? <IconCheckmarkFill /> : <IconPlusFill />} />
{isSubscribed ? "모아보는 중" : "모아보기"}
</ToggleButton>
<Icon svg={<IconChevronRightLine />} />
</>
}
/>
<ListDivider />
<ListButtonItem
title="ListButtonItem은 클릭할 수 있어요. 눌러보세요."
detail="리스트 항목 전체와 우측의 커스텀 버튼 각각을 클릭할 수 있어요"
onClick={() => alert("리스트 아이템 클릭됨")}
suffix={
<>
<Box asChild bg="bg.brandSolid" color="palette.staticWhite" p="x1" borderRadius="r1_5">
<button
type="button"
onClick={() => alert("커스텀 버튼 클릭됨")}
style={{ zIndex: 1 }}
>
커스텀 버튼
</button>
</Box>
<Icon svg={<IconChevronRightLine />} />
</>
}
/>
<ListDivider />
<ListLinkItem
title="ListLinkItem도 클릭할 수 있어요. 눌러보세요."
detail="리스트 항목 전체와 우측의 Action Button 각각을 클릭할 수 있어요"
suffix={
<>
<ActionButton variant="neutralWeak" size="xsmall" onClick={onCopyClick}>
<PrefixIcon svg={isCopied ? <IconCheckmarkFill /> : <IconSquare2StackedFill />} />
{isCopied ? "복사됨" : "URL 복사"}
</ActionButton>
<Icon svg={<IconArrowUpRightLine />} />
</>
}
href={href}
target="_blank"
rel="noreferrer"
/>
</List>
);
}inputs in List Items
You can include input elements in list items by using ListSwitchItem, ListCheckItem, or ListRadioItem. In this case, place control elements like Switchmark, Checkmark, or Radiomark in the prefix or suffix area.
import { IconTrashcanLine } from "@karrotmarket/react-monochrome-icon";
import { IconSparkle2 } from "@karrotmarket/react-multicolor-icon";
import { Icon } from "@seed-design/react";
import { List, ListDivider, ListSwitchItem } from "seed-design/ui/list";
import { Switchmark } from "seed-design/ui/switch";
export default function ListSwitch() {
return (
<List width="360px">
<ListSwitchItem
title="삭제하기 전에 확인"
prefix={<Icon svg={<IconTrashcanLine />} />}
suffix={<Switchmark tone="neutral" />}
/>
<ListDivider />
<ListSwitchItem
title="메시지 요약"
detail="핵심 내용만 빠르게 확인해보세요."
prefix={<Icon svg={<IconSparkle2 />} />}
suffix={<Switchmark tone="neutral" />}
defaultChecked
/>
</List>
);
}import { Badge, HStack } from "@seed-design/react";
import { List, ListDivider, ListCheckItem } from "seed-design/ui/list";
import { Checkmark } from "seed-design/ui/checkbox";
export default function ListCheckbox() {
return (
<List as="fieldset" width="360px">
<ListCheckItem
title={
<HStack gap="x1_5">
<span>알림 수신 동의</span>
<Badge variant="weak">권장</Badge>
</HStack>
}
detail="푸시 알림을 받으시겠습니까?"
suffix={<Checkmark tone="neutral" size="large" />}
defaultChecked
/>
<ListDivider as="div" />
<ListCheckItem
prefix={<Checkmark tone="neutral" size="large" />}
title="마케팅 정보 수신 동의"
detail="마케팅 정보를 받으시겠습니까?"
defaultChecked
/>
<ListDivider as="div" />
<ListCheckItem
prefix={<Checkmark tone="neutral" size="large" variant="ghost" />}
title="Ghost Variant"
/>
</List>
);
}import { RadioGroup } from "@seed-design/react/primitive";
import { List, ListDivider, ListRadioItem } from "seed-design/ui/list";
import { Radiomark } from "seed-design/ui/radio-group";
export default function ListRadio() {
return (
<List width="360px" asChild>
<RadioGroup.Root defaultValue="option1" aria-label="옵션 선택">
<ListRadioItem
value="option1"
title="옵션 1"
detail="첫 번째 선택지"
suffix={<Radiomark tone="neutral" size="large" />}
/>
<ListDivider as="div" />
<ListRadioItem
prefix={<Radiomark tone="neutral" size="large" />}
value="option2"
title="옵션 2"
detail="두 번째 선택지"
/>
<ListDivider as="div" />
<ListRadioItem
prefix={<Radiomark tone="neutral" size="large" />}
value="option3"
title="옵션 3"
detail="세 번째 선택지"
/>
</RadioGroup.Root>
</List>
);
}Accessibility
List is <ul> by default. When using ListCheckItem and ListRadioItem, you should provide an appropriate role to List.
<List as="fieldset">
<ListCheckItem
suffix={<Checkmark size="large" />}
title="Agree to receive notifications"
detail="Do you want to receive push notifications?"
/>
<ListCheckItem
suffix={<Checkmark size="large" />}
title="Agree to receive marketing information"
detail="Do you want to receive marketing information?"
/>
</List><List asChild>
<RadioGroup.Root defaultValue="jjajang" aria-label="Lunch menu"> {/* <div role="radiogroup"> */}
<ListRadioItem
suffix={<Radiomark size="large" />}
value="jjajang"
title="Jjajang"
/>
<ListRadioItem
suffix={<Radiomark size="large" />}
value="jjamppong"
title="Jjamppong"
/>
</RadioGroup.Root>
</List>Disabled
import {
IconChevronRightLine,
IconPersonCircleLine,
IconSlashCircleLine,
} from "@karrotmarket/react-monochrome-icon";
import { Divider, Icon, VStack } from "@seed-design/react";
import { RadioGroup } from "@seed-design/react/primitive";
import { List, ListButtonItem, ListCheckItem, ListRadioItem } from "seed-design/ui/list";
import { Checkmark } from "seed-design/ui/checkbox";
import { Radiomark } from "seed-design/ui/radio-group";
export default function ListDisabled() {
return (
<VStack width="360px">
<List>
<ListButtonItem
prefix={<Icon svg={<IconPersonCircleLine />} />}
title="활성화된 ListButtonItem"
detail="Cupidatat et pariatur amet."
suffix={<Icon svg={<IconChevronRightLine />} />}
/>
</List>
<List as="fieldset">
<ListCheckItem
prefix={<Icon svg={<IconPersonCircleLine />} />}
title="활성화된 ListCheckItem"
suffix={<Checkmark tone="neutral" size="large" />}
/>
</List>
<List asChild>
<RadioGroup.Root defaultValue="foo" aria-label="옵션 선택">
<ListRadioItem
prefix={<Icon svg={<IconPersonCircleLine />} />}
title="활성화된 ListRadioItem"
suffix={<Radiomark tone="neutral" size="large" />}
value="foo"
/>
</RadioGroup.Root>
</List>
<Divider />
<List>
<ListButtonItem
disabled
prefix={<Icon svg={<IconSlashCircleLine />} />}
title="비활성화된 ListButtonItem"
detail="Cupidatat et pariatur amet."
suffix={<Icon svg={<IconChevronRightLine />} />}
/>
</List>
<List as="fieldset">
<ListCheckItem
disabled
prefix={<Icon svg={<IconSlashCircleLine />} />}
title="비활성화된 ListCheckItem"
suffix={<Checkmark tone="neutral" size="large" />}
/>
</List>
<List asChild>
<RadioGroup.Root defaultValue="foo" aria-label="옵션 선택">
<ListRadioItem
disabled
prefix={<Icon svg={<IconSlashCircleLine />} />}
title="비활성화된 ListRadioItem"
suffix={<Radiomark tone="neutral" size="large" />}
value="foo"
/>
</RadioGroup.Root>
</List>
</VStack>
);
}Variants
Highlighted
import { IconPersonCircleLine } from "@karrotmarket/react-monochrome-icon";
import { Box, Icon, VStack } from "@seed-design/react";
import { useState } from "react";
import { List, ListDivider, ListItem, ListButtonItem } from "seed-design/ui/list";
import { Switch } from "seed-design/ui/switch";
export default function ListHighlighted() {
const [highlighted, setHighlighted] = useState(true);
return (
<VStack width="360px" gap="x4">
<List>
<ListButtonItem
prefix={<Icon svg={<IconPersonCircleLine />} />}
title="버튼"
detail="Enim aute duis magna mollit aute sit aliquip duis ut tempor sunt."
onClick={() => {}}
/>
<ListDivider />
<ListButtonItem
highlighted
prefix={<Icon svg={<IconPersonCircleLine />} />}
title="하이라이트된 버튼"
detail="Enim aute duis magna mollit aute sit aliquip duis ut tempor sunt."
onClick={() => {}}
/>
<ListDivider />
<ListButtonItem
highlighted
disabled
prefix={<Icon svg={<IconPersonCircleLine />} />}
title="하이라이트 및 비활성화된 버튼"
detail="Enim aute duis magna mollit aute sit aliquip duis ut tempor sunt."
onClick={() => {}}
/>
</List>
<List>
<ListItem
prefix={<Icon svg={<IconPersonCircleLine />} />}
title="하이라이트"
highlighted={highlighted}
/>
</List>
<Box alignSelf="center">
<Switch
size="24"
tone="neutral"
label="highlight"
checked={highlighted}
onCheckedChange={setHighlighted}
/>
</Box>
</VStack>
);
}With Bottom Sheet
import {
BottomSheetBody,
BottomSheetContent,
BottomSheetFooter,
BottomSheetRoot,
BottomSheetTrigger,
} from "seed-design/ui/bottom-sheet";
import { ActionButton } from "seed-design/ui/action-button";
import { Checkmark } from "seed-design/ui/checkbox";
import { List, ListCheckItem } from "seed-design/ui/list";
import { PrefixIcon, VStack } from "@seed-design/react";
import { useState } from "react";
import { IconArrowClockwiseCircularFill } from "@karrotmarket/react-monochrome-icon";
const TYPES = ["버스", "지하철", "택시", "자전거", "도보"] as const;
export default function ListBottomSheet() {
const [isOpen, setIsOpen] = useState(false);
const [selectedTypes, setSelectedTypes] = useState<(typeof TYPES)[number][]>([]);
return (
<BottomSheetRoot open={isOpen} onOpenChange={setIsOpen}>
<BottomSheetTrigger asChild>
<ActionButton variant="neutralSolid">BottomSheet 열기</ActionButton>
</BottomSheetTrigger>
<BottomSheetContent title="교통수단" description="이동할 교통수단을 선택해주세요.">
<VStack asChild>
<form
onReset={(e) => {
e.preventDefault();
setSelectedTypes([]);
}}
onSubmit={(e) => {
e.preventDefault();
setIsOpen(false);
}}
>
<BottomSheetBody paddingX="0" asChild>
<List as="fieldset">
{TYPES.map((type) => (
<ListCheckItem
key={type}
title={type}
checked={selectedTypes.includes(type)}
prefix={<Checkmark tone="neutral" size="large" />}
onCheckedChange={() => {
setSelectedTypes((prev) =>
prev.includes(type) ? prev.filter((t) => t !== type) : [...prev, type],
);
}}
/>
))}
</List>
</BottomSheetBody>
<BottomSheetFooter>
<VStack gap="x2">
<ActionButton
size="large"
variant="neutralSolid"
disabled={selectedTypes.length === 0}
type="submit"
>
경로 찾기
</ActionButton>
<ActionButton
size="small"
variant="ghost"
disabled={selectedTypes.length === 0}
type="reset"
>
<PrefixIcon svg={<IconArrowClockwiseCircularFill />} />
초기화
</ActionButton>
</VStack>
</BottomSheetFooter>
</form>
</VStack>
</BottomSheetContent>
</BottomSheetRoot>
);
}Alignment
You can adjust the alignment of prefix and suffix using the alignItems prop.
import { List, ListItem } from "seed-design/ui/list";
import { HStack } from "@seed-design/react";
import { IdentityPlaceholder } from "seed-design/ui/identity-placeholder";
import { Avatar } from "seed-design/ui/avatar";
export default function ListAlignment() {
return (
<HStack width="full" align="flex-start" gap="x4">
<List>
<ListItem
prefix={<Avatar size="48" fallback={<IdentityPlaceholder />} />}
title="Prefix에 Avatar 넣기. Veniam elit velit esse ea incididunt sunt sit aute."
detail="Et proident sit ullamco ut voluptate. Voluptate eiusmod occaecat adipisicing quis qui esse."
/>
</List>
<List>
<ListItem
alignItems="flex-start"
prefix={<Avatar size="48" fallback={<IdentityPlaceholder />} />}
title="Prefix에 Avatar 넣고 상단으로 정렬하기. Veniam elit velit esse ea incididunt sunt sit aute."
detail="일반적으로 `title`이 길어질 때 `alignItems`를 `flex-start`로 설정합니다."
/>
</List>
</HStack>
);
}Border Radius
You can adjust the radius of list items applied in the active state by setting the itemBorderRadius prop on List. This is useful when the list is contained in a rounded container like a card.
import { List, ListCheckItem, ListRadioItem } from "seed-design/ui/list";
import { ListHeader } from "seed-design/ui/list-header";
import { Checkmark } from "seed-design/ui/checkbox";
import { Radiomark } from "seed-design/ui/radio-group";
import { HStack, VStack } from "@seed-design/react";
import { RadioGroup } from "@seed-design/react/primitive";
export default function ListBorderRadius() {
return (
<HStack
gap="x4"
bg="bg.layerBasement"
width="full"
grow
wrap
align="center"
justify="center"
p="x4"
>
<VStack
width="300px"
py="x1_5"
borderRadius="r3_5"
bg="bg.layerDefault"
borderWidth={1}
borderColor="stroke.neutralWeak"
>
<ListHeader as="h2">카드 borderRadius: r3_5</ListHeader>
<List as="fieldset" itemBorderRadius="r2">
<ListCheckItem
defaultChecked
title="borderRadius: r2"
suffix={<Checkmark size="large" tone="neutral" />}
/>
<ListCheckItem
title="borderRadius: r2"
suffix={<Checkmark size="large" tone="neutral" />}
/>
</List>
</VStack>
<VStack
width="300px"
px="x1"
py="x2_5"
borderRadius="22px"
bg="bg.layerDefault"
borderWidth={1}
borderColor="stroke.neutralWeak"
>
<ListHeader as="h2">카드 borderRadius: 22px</ListHeader>
<List asChild itemBorderRadius="r3">
<RadioGroup.Root defaultValue="0" aria-label="Border radius options">
<ListRadioItem
value="0"
title="borderRadius: r3"
suffix={<Radiomark size="large" tone="neutral" />}
/>
<ListRadioItem
value="1"
title="borderRadius: r3"
suffix={<Radiomark size="large" tone="neutral" />}
/>
</RadioGroup.Root>
</List>
</VStack>
</HStack>
);
}Customization and Composition
Usage
The List and ListHeader components provided in the @seed-design/react package are used with the following structure:
ListHeader
List.Root
└── List.Item
├── List.Prefix (optional)
├── List.Content
│ ├── List.Title
│ └── List.Detail (optional)
└── List.Suffix (optional)
└── List.Item
├── ...import { ListHeader, List, Icon } from "@seed-design/react";
<ListHeader>
My Information
</ListHeader>
<List.Root>
<List.Item>
<List.Prefix>
<Icon svg={<IconPersonCircleLine />} />
</List.Prefix>
<List.Content>
<List.Title>My Profile</List.Title>
<List.Detail>Manage my information displayed to others.</List.Detail>
</List.Content>
<List.Suffix>
<Icon svg={<IconArrowRightLine />} />
</List.Suffix>
</List.Item>
<List.Item>
{/* ... */}
</List.Item>
</List.Root>ListHeader: Header role displaying the list title or descriptionList.Root: Container role wrapping all list itemsList.Item: Individual list item. Defines the clickable areaList.Prefix: Starting area where icons, Avatar, Checkmark, etc. can be displayedList.Content: Central area for main contentList.Title: Title of the list itemList.Detail: Additional description or detailed information
List.Suffix: Ending area where icons, Action Button, Toggle Button, etc. can be displayed
Combining with appropriate semantic elements using the asChild prop
Composition
Learn more about the asChild prop.
Using asChild prop in List.Content
This is a pattern that can be used when you want to make the entire list item area a clickable button. In this case, be careful not to use the asChild prop on List.Item. If you put a button in List.Prefix or List.Suffix, invalid HTML is generated with nested button elements.
import { List as SeedList } from "@seed-design/react";
<SeedList.Item>
<SeedList.Content asChild>
<button type="button" onClick={() => alert("User clicked")}>
<SeedList.Title>User</SeedList.Title>
</button>
</SeedList.Content>
<SeedList.Suffix>
<ActionButton
size="xsmall"
variant="brandSolid"
onClick={() => alert("View clicked")}
>
View
</ActionButton>
</SeedList.Suffix>
</SeedList.Item>ListButtonItem and ListLinkItem provided as Snippet help implement this pattern easily.
import { ListButtonItem } from "seed-design/ui/list";
<ListButtonItem
onClick={() => alert("User clicked")}
title="User"
detail="6 items"
suffix={
<ActionButton
size="xsmall"
variant="brandSolid"
onClick={() => alert("View clicked")}
>
View
</ActionButton>
}
/>Using asChild prop in List.Item
This is a pattern that can be used when you want to make the entire list item area a label, and place Switchmark, Checkmark, or Radiomark in List.Prefix or List.Suffix.
import { List as SeedList } from "@seed-design/react";
import { Checkbox } from "@seed-design/react/primitive";
<SeedList.Item asChild> {/* <label> */}
<Checkbox.Root defaultChecked>
<SeedList.Content>
<SeedList.Title>Agree</SeedList.Title>
</SeedList.Content>
<SeedList.Suffix>
<Checkmark />
</SeedList.Suffix>
<Checkbox.HiddenInput />
</Checkbox.Root>
</SeedList.Item>ListSwitchItem, ListCheckItem, and ListRadioItem provided as Snippet help implement this pattern easily.
import { ListCheckItem } from "seed-design/ui/list";
<ListCheckItem
defaultChecked
title="Agree"
suffix={<Checkmark size="large" />}
/>