logo

Segmented

Examples

The most basic usage.

expand code expand code

Disabled Segmented.

expand code expand code

Custom each Segmented Item by ReactNode.

expand code expand code

There are three sizes of an Segmented: large (40px), default (32px) and small (24px).

expand code expand code

Set icon without label for Segmented Item.

expand code expand code

block property will make the Segmented fit to its parent width.

expand code expand code

Controlled Segmented.

expand code expand code

Load options dynamically.

expand code expand code

Set icon for Segmented Item.

expand code expand code

Segmented API#

Property Description Type Default Value
DefaultValue ParameterDefault selected value TValue --
Disabled ParameterDisable all segments Boolean false
OnChange ParameterThe callback function that is triggered when the state changes EventCallback<TValue> --
Options ParameterOptions for the segments. Takes priority over AntDesign.Segmented`1.Labels IEnumerable<SegmentedOption<TValue>> --
Labels ParameterLabels for the segments IEnumerable<TValue> --
Size ParameterSize of the UI element SegmentedSize --
Value ParameterCurrently selected value TValue --
ValueChanged ParameterCallback executed when the selected segment changes EventCallback<TValue> --
ChildContent ParameterSegments. Takes priority over AntDesign.Segmented`1.Labels and AntDesign.Segmented`1.Options RenderFragment --
Block ParameterMake the component the width of the parent Boolean --
Id ParameterID for the component's HTML String Uniquely Generated ID
Class ParameterSpecifies one or more class names for an DOM element. String --
Style ParameterSpecifies an inline style for a DOM element. String --
RefBack ParameterA ForwardRef instance. You can get a reference to the internal DOM by using AntDesign.ForwardRef.Current. ForwardRef --

SegmentedItem API#

Property Description Type Default Value
Value ParameterValue of the segment item TValue --
Label ParameterLabel for the UI of the segment item String --
Disabled ParameterIf the segment is disabled Boolean false
ChildContent ParameterUI content to display in the segment. Takes priority over AntDesign.SegmentedItem`1.Label and AntDesign.SegmentedItem`1.Icon RenderFragment --
Icon ParameterIcon to display next to the label of the segment. Only used when AntDesign.SegmentedItem`1.ChildContent is not provided. String --
Id ParameterID for the component's HTML String Uniquely Generated ID
Class ParameterSpecifies one or more class names for an DOM element. String --
Style ParameterSpecifies an inline style for a DOM element. String --
RefBack ParameterA ForwardRef instance. You can get a reference to the internal DOM by using AntDesign.ForwardRef.Current. ForwardRef --
Popover Statistic
文档已更新,请点击 此处 更新。
A new version of this app is available. Click here to update.