Skip to content
GitSiteEmail

The Segment.Button slot represents a single option within a Segment. It renders a clickable button with a transition.

Every component ships with the boilerplate. If you are working in your own project, add Segment with the Gameface CLI:

Terminal window
npx gameface-cli add Segment

The CLI pulls in whatever Segment depends on. To refresh an existing copy, update it instead.

To create a Segment.Button you need to wrap it in the Segment component and provide a value to it. You must also provide the selected prop to the Segment.Button you wish to be selected by default.

import Segment from '@components/Basic/Segment/Segment';
<>
<Segment>
<Segment.Button selected value="red">red</Segment.Button>
<Segment.Button value="green">green</Segment.Button>
<Segment.Button value="blue">blue</Segment.Button>
</Segment>
</>
Prop NameTypeDefaultDescription
styleJSX.CSSProperties{}Inline styles to apply directly to the component’s root element.
classstring""Additional CSS classes to apply to the component.
valuestringundefinedThe string value the Segment button is associated with.
selectedbooleanfalseSpecify if the Segment button is selected.
disabledbooleanfalseSpecify if the Segment button is disabled.
class-disabledstring""Additional CSS classes to apply to the button when disabled.

You can find examples of how to work with the Segment buttons in the Segment documentation.