Separator (구분선)
Separator는 콘텐츠를 시각적으로 구분하는 간단한 선 컴포넌트예요. orientation prop으로 가로나 세로 방향을 선택할 수 있고, thickness와 variant로 두께와 시각적 스타일을 조절할 수 있어요.
출처: 문서
본문
Import
import { Separator } from "heroui-native";
Anatomy
<Separator />
- Separator: 콘텐츠를 시각적으로 구분하는 간단한 선 컴포넌트예요. 가로나 세로로 배치할 수 있으며, 두께와 variant 스타일을 커스터마이징할 수 있어요.
Usage
Basic Usage
Separator 컴포넌트는 콘텐츠 섹션 사이에 시각적 구분을 만들어요.
<Separator />
Orientation
orientation prop으로 구분선의 방향을 제어해요.
<View>
<Text>Horizontal separator</Text>
<Separator orientation="horizontal" />
<Text>Content below</Text>
</View>
<View className="h-24 flex-row">
<Text>Left</Text>
<Separator orientation="vertical" />
<Text>Right</Text>
</View>
Variants
다양한 시각적 강조를 위해 thin과 thick variant 중에서 선택해요.
<Separator variant="thin" />
<Separator variant="thick" />
Custom Thickness
정밀한 제어를 위해 특정 두께 값을 설정해요.
<Separator thickness={1} />
<Separator thickness={5} />
<Separator thickness={10} />
Example
import { Separator, Surface } from 'heroui-native';
import { Text, View } from 'react-native';
export default function SeparatorExample() {
return (
<Surface variant="secondary" className="px-6 py-7">
<Text className="text-base font-medium text-foreground">
HeroUI Native
</Text>
<Text className="text-sm text-muted">
A modern React Native component library.
</Text>
<Separator className="my-4" />
<View className="flex-row items-center h-5">
<Text className="text-sm text-foreground">Components</Text>
<Separator orientation="vertical" className="mx-3" />
<Text className="text-sm text-foreground">Themes</Text>
<Separator orientation="vertical" className="mx-3" />
<Text className="text-sm text-foreground">Examples</Text>
</View>
</Surface>
);
}
GitHub 저장소에서 더 많은 예제를 볼 수 있어요.
API Reference
Separator
| prop | type | default | description |
|---|---|---|---|
variant |
'thin' | 'thick' |
'thin' |
구분선의 variant 스타일 |
orientation |
'horizontal' | 'vertical' |
'horizontal' |
구분선의 방향 |
thickness |
number |
undefined |
픽셀 단위의 커스텀 두께. 가로 방향은 높이, 세로 방향은 너비를 제어해요 |
className |
string |
undefined |
적용할 추가 CSS 클래스 |
...ViewProps |
ViewProps |
- | 모든 표준 React Native View prop을 지원해요 |