logoAnt Design

⌘ K
  • 디자인
  • 개발
  • 컴포넌트
  • 블로그
  • 자료
5.21.3
  • Components Overview
  • General
    • Button
    • FloatButton
      5.0.0
    • Icon
    • Typography
  • Layout
    • Divider
    • Flex
      5.10.0
    • Grid
    • Layout
    • Space
    • Splitter
      5.21.0
  • Navigation
    • Anchor
    • Breadcrumb
    • Dropdown
    • Menu
    • Pagination
    • Steps
  • Data Entry
    • AutoComplete
    • Cascader
    • Checkbox
    • ColorPicker
      5.5.0
    • DatePicker
    • Form
    • Input
    • InputNumber
    • Mentions
    • Radio
    • Rate
    • Select
    • Slider
    • Switch
    • TimePicker
    • Transfer
    • TreeSelect
    • Upload
  • Data Display
    • Avatar
    • Badge
    • Calendar
    • Card
    • Carousel
    • Collapse
    • Descriptions
    • Empty
    • Image
    • List
    • Popover
    • QRCode
      5.1.0
    • Segmented
    • Statistic
    • Table
    • Tabs
    • Tag
    • Timeline
    • Tooltip
    • Tour
      5.0.0
    • Tree
  • Feedback
    • Alert
    • Drawer
    • Message
    • Modal
    • Notification
    • Popconfirm
    • Progress
    • Result
    • Skeleton
    • Spin
    • Watermark
      5.1.0
  • Other
    • Affix
    • App
      5.1.0
    • ConfigProvider
    • Util
      5.13.0

Segmented

Display multiple options and allow users to select a single option.
가져오기import{ Segmented }from"antd";
소스components/segmented
문서
이 페이지 수정변경 로그

Resources

Ant Design Charts
Ant Design Pro
Ant Design Pro Components
Ant Design Mobile
Ant Design Mini
Ant Design Landing-Landing Templates
Scaffolds-Scaffold Market
Umi-React Application Framework
dumi-Component doc generator
qiankun-Micro-Frontends Framework
ahooks-React Hooks Library
Ant Motion-Motion Solution
China Mirror 🇨🇳

Community

Awesome Ant Design
Medium
Twitter
yuque logoAnt Design in YuQue
Ant Design in Zhihu
Experience Cloud Blog
seeconf logoSEE Conf-Experience Tech Conference
Work with Us

Help

GitHub
Change Log
FAQ
Bug Report
Issues
Discussions
StackOverflow
SegmentFault

Ant XTech logoMore Products

yuque logoYuQue-Document Collaboration Platform
AntV logoAntV-Data Visualization
Egg logoEgg-Enterprise Node.js Framework
Kitchen logoKitchen-Sketch Toolkit
Galacean logoGalacean-Interactive Graphics Solution
xtech logoAnt Financial Experience Tech
Theme Editor
Made with ❤ by
Ant Group and Ant Design Community
loading

This component is available since antd@4.20.0.

When To Use

  • When displaying multiple options and user can select a single option;
  • When switching the selected option, the content of the associated area changes.

Examples

API

Common props ref:Common props

This component is available since antd@4.20.0

PropertyDescriptionTypeDefaultVersion
blockOption to fit width to its parent's widthbooleanfalse
defaultValueDefault selected valuestring | number
disabledDisable all segmentsbooleanfalse
onChangeThe callback function that is triggered when the state changesfunction(value: string | number)
optionsSet children optionalstring[] | number[] | SegmentedItemType[][]
sizeThe size of the Segmented.large | middle | smallmiddle
verticalOrientationbooleanfalse5.21.0
valueCurrently selected valuestring | number

SegmentedItemType

PropertyDescriptionTypeDefaultVersion
labelDisplay text for Segmented itemReactNode-
valueValue for Segmented itemstring | number-
iconDisplay icon for Segmented itemReactNode-
disabledDisabled state of segmented itembooleanfalse
classNameThe additional css classstring-

Design Token

컴포넌트 토큰어떻게 사용하나요?

토큰 이름설명타입기본값
itemActiveBg选项激活态背景颜色stringrgba(0, 0, 0, 0.15)
itemColor选项文本颜色stringrgba(0, 0, 0, 0.65)
itemHoverBg选项悬浮态背景颜色stringrgba(0, 0, 0, 0.06)
itemHoverColor选项悬浮态文本颜色stringrgba(0, 0, 0, 0.88)
itemSelectedBg选项选中时背景颜色string#ffffff
itemSelectedColor选项选中时文字颜色stringrgba(0, 0, 0, 0.88)
trackBgSegmented 控件容器背景色string#f5f5f5
trackPaddingSegmented 控件容器的 paddingstring | number2

글로벌 토큰어떻게 사용하나요?

Basic
codepen icon
External Link Icon
expand codeexpand code
Block Segmented
codepen icon
External Link Icon
expand codeexpand code
Controlled mode
codepen icon
External Link Icon
expand codeexpand code
Dynamic
codepen icon
External Link Icon
expand codeexpand code
With Icon
codepen icon
External Link Icon
expand codeexpand code
Controlled Synced mode
codepen icon
External Link Icon
expand codeexpand code
Custom component token
codepen icon
External Link Icon
expand codeexpand code
Vertical Direction
codepen icon
External Link Icon
expand codeexpand code
5.21.0
Disabled
codepen icon
External Link Icon
expand codeexpand code
Custom Render
codepen icon
External Link Icon
expand codeexpand code
Three sizes of Segmented
codepen icon
External Link Icon
expand codeexpand code
With Icon only
codepen icon
External Link Icon
expand codeexpand code
Consistent height
codepen icon
External Link Icon
expand codeexpand code
  
Lucy