Skip to content

How can I set direction for a single component? #6334

Discussion options

You must be logged in to vote

Hi. I do it by defining a global CSS class like:

/* you can target label and error text by using the classNames provided at each component's styles API.
For instance, input style props: https://mantine.dev/core/input/?t=styles-api
Here I am just targeting the input field itself */
.ltr-input .mantine-TextInput-input {
  direction: ltr;
  text-align: left;
}

Then, when I need the input to be ltr I just use the className:

<TextInput
  className="ltr-input"
  label={l.dash.cust.createCustomerEmailLabel}
  {...form.getInputProps('email')}
/>

And the result looks like this:

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mohammad-reza-rahbar
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