Divider

Divider is a component that displays a list of tabs separated by a divider.

Divider provides an animation effect based on clip-path. So if you want to add an image or icon, it is important to use svg rather than img.

Basic Usage

items prop for basic usage:

全部视频
个人视频
互选视频
全部视频
个人视频
互选视频
import Springen from 'springen';
const [value, setValue] = useState('all');
<Springen.Divider
items={[
{ value: 'all', label: '全部视频' },
{ value: 'personal', label: '个人视频' },
{ value: 'mutual', label: '互选视频' },
]}
value={value}
onChange={(_, value) => setValue(value)}
/>

Customize Each Item

itemClassName, itemStyle, activeItemClassName & activeItemStyle prop can be string/React.CSSProperties or function:

全部视频
个人视频
互选视频
全部视频
个人视频
互选视频
import Springen from 'springen';
const [value, setValue] = useState('all');
<Springen.Divider
items={[
{ value: 'all', label: '全部视频' },
{ value: 'personal', label: '个人视频' },
{ value: 'mutual', label: '互选视频' },
]}
value={value}
onChange={(_, value) => setValue(value)}
itemStyle={(_, index) => ({
fontSize: 16 - index * 2,
})}
activeItemStyle={{
textDecoration: 'underline',
textUnderlineOffset: 2,
}}
dividerStyle={{ background: 'transparent' }}
/>

API

PropsDescriptionTypeDefault
dividerClassNameThe className of the dividerstringundefined
dividerStyleThe style of the dividerReact.CSSPropertiesundefined

Common API (Tabs, ButtonGroup, Vertical, Divider, Tag)

PropsDescriptionTypeDefault
gapThe gap between the itemsnumberdiffers from component to component
activeColorThe color of the active itemstringvar(--springen-active-color)
colorThe color of the itemstringdiffers from component to component
itemsThe items of the componentSpringenItem[]undefined
valueThe value of the componentstringundefined
onChangeThe onChange of the component(e: React.MouseEvent<HTMLDivElement>, value: T) => voidundefined
itemClassNameThe className of the itemstring | ((item: SpringenItem<T>, index: number) => string)undefined
itemStyleThe style of the itemReact.CSSProperties | ((item: SpringenItem<T>, index: number) => React.CSSProperties)undefined
activeItemClassNameThe className of the active itemstring | ((item: SpringenItem<T>, index: number) => string)undefined
activeItemStyleThe style of the active itemReact.CSSProperties | ((item: SpringenItem<T>, index: number) => React.CSSProperties)undefined