Skip to content

Change Label Position on <Switch /> #6047

Answered by reidbarber
JaredDeanFP asked this question in Q&A
Discussion options

You must be logged in to vote

For React Aria Component's Switch, you control what gets rendered as the visual indicator. In the docs example, you would move the indicator after the label:

<Switch>
  Low power mode
  <div className="indicator" />
</Switch>

If you want to support both cases, you could make a prop on your wrapper that flips their positioning in render, or with CSS (i.e. flex-direction: row-reverse, or CSS grid)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@JaredDeanFP
Comment options

Answer selected by JaredDeanFP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants