Tabs

Tabs is a component that displays a list of tabs.

Tabs 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.Tabs
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.Tabs
items={[
{ value: 'all', label: '全部视频' },
{ value: 'personal', label: '个人视频' },
{ value: 'mutual', label: '互选视频' },
]}
value={value}
onChange={(_, value) => setValue(value)}
gap={28}
itemStyle={{ paddingBottom: '15px', fontWeight: 400, fontSize: '13px', lineHeight: '20px' }}
indicatorStyle={{ borderRadius: '0px' }}
/>

API

PropsDescriptionTypeDefault
indicatorClassNameThe class name of the indicatorstring""
indicatorStyleThe style of the indicatorReact.CSSProperties{}

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