Separator
콘텐츠를 가로 또는 세로로 구분해 주는 컴포넌트예요.
출처: Nuxt UI
본문
사용법
Separator 컴포넌트를 그대로 사용하면 콘텐츠를 구분할 수 있어요.
<template>
<USeparator />
</template>
Orientation
orientation prop으로 Separator의 방향을 바꿀 수 있어요. 기본값은 horizontal이에요.
<template>
<USeparator orientation="vertical" class="h-48" />
</template>
Label
label prop으로 Separator 가운데에 라벨을 표시할 수 있어요.
<template>
<USeparator label="Hello World" />
</template>
Position 4.8+
position prop으로 Separator 콘텐츠의 위치를 바꿀 수 있어요. 기본값은 center예요.
<template>
<USeparator position="start" label="Hello World" />
</template>
Icon
icon prop으로 Separator 가운데에 아이콘을 표시할 수 있어요.
<template>
<USeparator icon="i-simple-icons-nuxtdotjs" />
</template>
Avatar
avatar prop으로 Separator 가운데에 아바타를 표시할 수 있어요.
<template>
<USeparator :avatar="{
src: 'https://github.com/nuxt.png',
loading: 'lazy'
}" />
</template>
Color
color prop으로 Separator의 색상을 바꿀 수 있어요. 기본값은 neutral이에요.
<template>
<USeparator color="primary" type="solid" />
</template>
Type
type prop으로 Separator의 유형을 바꿀 수 있어요. 기본값은 solid예요.
<template>
<USeparator type="dashed" />
</template>
Size
size prop으로 Separator의 크기를 바꿀 수 있어요. 기본값은 xs예요.
<template>
<USeparator size="lg" />
</template>
API
Props
/**
* Props for the Separator component
*/
interface SeparatorProps {
/**
* The element or component this component should render as.
* @default 'div'
*/
as?: any;
/**
* Display a label on the separator.
*/
label?: string | undefined;
/**
* Display an icon on the separator.
*/
icon?: any;
/**
* Display an avatar on the separator.
*/
avatar?: AvatarProps | undefined;
/**
* @default 'neutral'
*/
color?: "error" | "neutral" | "primary" | "secondary" | "success" | "info" | "warning" | undefined;
/**
* @default 'xs'
*/
size?: "xs" | "sm" | "md" | "lg" | "xl" | undefined;
/**
* @default 'solid'
*/
type?: "solid" | "dashed" | "dotted" | undefined;
/**
* The orientation of the separator.
* @default 'horizontal'
*/
orientation?: "horizontal" | "vertical" | undefined;
/**
* The position of the content.
* @default 'center'
*/
position?: "center" | "start" | "end" | undefined;
ui?: { root?: SlotClass; border?: SlotClass; container?: SlotClass; icon?: SlotClass; avatar?: SlotClass; avatarSize?: SlotClass; label?: SlotClass; } | undefined;
/**
* Whether or not the component is purely decorative. <br>When `true`, accessibility-related attributes
* are updated so that that the rendered element is removed from the accessibility tree.
*/
decorative?: boolean | undefined;
}
Slots
/**
* Slots for the Separator component
*/
interface SeparatorSlots {
default(): any;
}
테마
export default defineAppConfig({
ui: {
separator: {
slots: {
root: 'flex items-center text-center',
border: '',
container: 'font-medium text-default flex',
icon: 'shrink-0 size-5',
avatar: 'shrink-0',
avatarSize: '2xs',
label: 'text-sm'
},
variants: {
color: {
primary: {
border: 'border-primary'
},
secondary: {
border: 'border-secondary'
},
success: {
border: 'border-success'
},
info: {
border: 'border-info'
},
warning: {
border: 'border-warning'
},
error: {
border: 'border-error'
},
neutral: {
border: 'border-default'
}
},
orientation: {
horizontal: {
root: 'w-full flex-row',
border: 'w-full',
container: 'whitespace-nowrap'
},
vertical: {
root: 'h-full flex-col',
border: 'h-full',
container: ''
}
},
size: {
xs: '',
sm: '',
md: '',
lg: '',
xl: ''
},
position: {
start: '',
center: '',
end: ''
},
type: {
solid: {
border: 'border-solid'
},
dashed: {
border: 'border-dashed'
},
dotted: {
border: 'border-dotted'
}
}
},
compoundVariants: [
{
orientation: 'horizontal',
position: 'start',
class: {
container: 'me-3'
}
},
{
orientation: 'horizontal',
position: 'center',
class: {
container: 'mx-3'
}
},
{
orientation: 'horizontal',
position: 'end',
class: {
container: 'ms-3'
}
},
{
orientation: 'vertical',
position: 'start',
class: {
container: 'mb-2'
}
},
{
orientation: 'vertical',
position: 'center',
class: {
container: 'my-2'
}
},
{
orientation: 'vertical',
position: 'end',
class: {
container: 'mt-2'
}
},
{
orientation: 'horizontal',
size: 'xs',
class: {
border: 'border-t'
}
},
{
orientation: 'horizontal',
size: 'sm',
class: {
border: 'border-t-[2px]'
}
},
{
orientation: 'horizontal',
size: 'md',
class: {
border: 'border-t-[3px]'
}
},
{
orientation: 'horizontal',
size: 'lg',
class: {
border: 'border-t-[4px]'
}
},
{
orientation: 'horizontal',
size: 'xl',
class: {
border: 'border-t-[5px]'
}
},
{
orientation: 'vertical',
size: 'xs',
class: {
border: 'border-s'
}
},
{
orientation: 'vertical',
size: 'sm',
class: {
border: 'border-s-[2px]'
}
},
{
orientation: 'vertical',
size: 'md',
class: {
border: 'border-s-[3px]'
}
},
{
orientation: 'vertical',
size: 'lg',
class: {
border: 'border-s-[4px]'
}
},
{
orientation: 'vertical',
size: 'xl',
class: {
border: 'border-s-[5px]'
}
}
],
defaultVariants: {
color: 'neutral',
size: 'xs',
type: 'solid'
}
}
}
})
변경 기록
사이트맵
전체 페이지 목록은 사이트맵에서 확인할 수 있어요.