Change Label Position on <Switch /> #6047
Answered
by
reidbarber
JaredDeanFP
asked this question in
Q&A
-
Is there a simple way to change the Switch's label from being on the right to being on the left? |
Beta Was this translation helpful? Give feedback.
Answered by
reidbarber
Mar 12, 2024
Replies: 1 comment 1 reply
-
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. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
JaredDeanFP
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:
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)