Caption
안내 문구 앞에 강조 마커를 붙여 보여 주는 컴포넌트
마커 *는 CSS 가상 요소(::before)로 그려져 DOM에는 본문만 남고, 스크린 리더에는 읽히지 않도록 대체 텍스트를 비워 두었습니다.
기본 예시
텍스트
import { Caption } from '@bigmobility/vinyl-ui/caption';
export default function CaptionExample() {
return (
<Caption>텍스트</Caption>
);
}마커 변경
styled(Caption, …)로 감싸 _before의 content와 color를 지정하면 마커를 바꾸거나 없앨 수 있습니다. 마커 폭과 상관없이 마커와 본문 사이 간격은 같습니다.
기본 마커
교체된 마커
본문이 길어 여러 줄이 되어도 둘째 줄부터 본문 시작 위치에 맞춰집니다.
마커 없음
import { Caption } from '@bigmobility/vinyl-ui/caption';
import { styled } from 'styled-system/jsx';
const NoticeCaption = styled(Caption, {
base: { _before: { content: '"※" / ""' } },
});
const PlainCaption = styled(Caption, {
base: { _before: { content: 'none' } },
});
const Narrow = styled('div', {
base: { maxWidth: '32rem' },
});
export default function CaptionMarker() {
return (
<Narrow>
<Caption>기본 마커</Caption>
<NoticeCaption>교체된 마커</NoticeCaption>
<NoticeCaption>
본문이 길어 여러 줄이 되어도 둘째 줄부터 <b>본문 시작 위치</b>에 맞춰집니다.
</NoticeCaption>
<PlainCaption>마커 없음</PlainCaption>
</Narrow>
);
}Props
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
children | ReactNode | No | — | 마커 뒤에 표시할 본문 |