Context
Sidebarμμ shadcn/uiμ Separator μ»΄ν¬λνΈλ₯Ό νμ©νλ€. λ°λΌμ μ΄λ₯Ό λΆμνκ³ μ΄ν΄ν νμκ° μμ΄ μ΄ κΈμ μμ±.
Agenda
β’
Separator μ»΄ν¬λνΈλ₯Ό λΆμνκ³ κ·Έ λ΄μ©μ μ΄ν΄νλ κ²μ λͺ©νλ‘ ν¨
Contents
import * as SeparatorPrimitive from '@radix-ui/react-separator';
import { cn } from '@ui/lib/utils';
import type * as React from 'react';
function Separator({
className,
orientation = 'horizontal',
decorative = true,
...props
}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
return (
<SeparatorPrimitive.Root
data-slot='separator'
decorative={decorative}
orientation={orientation}
className={cn(
'bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px',
className,
)}
{...props}
/>
);
}
export { Separator };
TypeScript
볡μ¬
shadcn/uiμ Separatorλ radix-uiμ Primitive Separatorλ₯Ό μ¬μ©ν΄ ꡬννλ€. orientationμ horizontal νΉμ verticalλ‘ λ°μ μΈλ‘, κ°λ‘ ꡬλΆμ μΌλ‘ μ€νμΌλ§ νλ€. decorative νλΌλ―Έν°λ trueμΌ λ λ¨μν μκ°μ μμλ‘λ§ μμ©νκ³ falseμ΄λ©΄ μλ―Έλ‘ μ μΌλ‘ μμ©νμ§ μλλ€.