react-form-component icon indicating copy to clipboard operation
react-form-component copied to clipboard

Support in rtl?

Open yossimal95 opened this issue 1 year ago • 1 comments

Hi,

There is any support in right to left? (or maybe a way to insert costume css in order to do so..?)

Tanks!

yossimal95 avatar Apr 04 '24 07:04 yossimal95

I've been manage to solve it using the form's class name attribute. I added my own class and changed the style of the default class via my new class.

Tanks anyway..!

yossimal95 avatar Apr 04 '24 09:04 yossimal95

@yossimal95 Can you give the example? Development of react-form-component package has been reinitiated this month and i may consider adding new functions.

firflant avatar Nov 24 '24 12:11 firflant

Hi, Sure :-)

I added this CSS:

  direction: rtl;
}

.rtl input {
  direction: rtl;
  text-align: right;
}

.rtl label {
  direction: rtl;
  text-align: right;
}

Then, I added this JSX

const BasicExampleForm = ({ rtl }) => // rtl param..
  <Form fields={['name', 'email', 'type']} className={rtl && 'rtl'}> {/* using the rtl param */}
    <Input
      name='name'
      label='שלום?'
    />
    <Input
      name='email'
      type='email'
      label='E-mail'
    />
    <FormButton
      onClick={fields => console.log(fields)}
    >Save</FormButton>
  </Form>

Basically, it's okay, but I still need an option to change the Help notice to Hebrew..

image

yossimal95 avatar Nov 24 '24 13:11 yossimal95

@yossimal95 RTL support added to version 2.8.0. Activated by a dedicated theme typography setting:

<FormThemeProvider theme={{ typography: { direction: 'rtl' } }}>

firflant avatar Nov 24 '24 16:11 firflant

For error text labels, see textLabels part of the customizable theme object https://firflant.github.io/react-form-component/?path=/story/docs-theming--page

firflant avatar Nov 24 '24 16:11 firflant

@yossimal95 RTL support added to version 2.8.0. Activated by a dedicated theme typography setting:

<FormThemeProvider theme={{ typography: { direction: 'rtl' } }}>

Cool! Tnks..! I'll check it out🙏👍

yossimal95 avatar Nov 24 '24 16:11 yossimal95