ejmudi / react-autocomplete-hint

A React component for Autocomplete Hint.
https://ejmudi.github.io/react-autocomplete-hint/
MIT License
164 stars 16 forks source link

Allow styling of the Hint div itself #21

Closed ghost closed 2 years ago

ghost commented 3 years ago

Describe the solution you'd like I'd like an option that allows us to further style the Hint component itself, currently, I don't see a way of doing it so it remains at the fixed width which doesn't fit the current styling of my page

Describe alternatives you've considered Tried wrapping it around with a div to style the width

ejmudi commented 3 years ago

You could place the Hint component in a container div and specify the width you want on the container div.

The Hint component will have the same width with your container.

ghost commented 3 years ago

@ejmudi Not really a solution. As shown in this example

<div className={style.test}>
  <Hint options={options} allowTabFill={true}>
    <input
    value={formik.values.company}
    onChange={formik.handleChange}
    className={style.inputGeneral}
    name="company"
    type='text'
    />
  </Hint>
</div>

Wrapping the Hint in a div with this class

.test {
  background-color:black;
  width: 200%
}

Results in this Screenshot_2

The idea is for the Hint input to match the input above it

smartoryu commented 3 years ago

You could place the Hint component in a container div and specify the width you want on the container div.

The Hint component will have the same width with your container.

I see you already putting an inline style with 100% width on the input, but the div wrapper with className "rah-input-wrapper" is not so the width from our own div is not inherited. Should I fix it for you?

@ejmudi Not really a solution. As shown in this example

<div className={style.test}>
  <Hint options={options} allowTabFill={true}>
    <input
    value={formik.values.company}
    onChange={formik.handleChange}
    className={style.inputGeneral}
    name="company"
    type='text'
    />
  </Hint>
</div>

Wrapping the Hint in a div with this class

.test {
  background-color:black;
  width: 200%
}

Results in this Screenshot_2

The idea is for the Hint input to match the input above it

My current workaround is overwriting the style using the same className this wrapper used (rah-input-wrapper)

ejmudi commented 3 years ago

@smartoryu Sure, you can please go ahead and create a PR.

ejmudi commented 2 years ago

This is mostly likely resolved now by https://github.com/ejmudi/react-autocomplete-hint/pull/32 Closing!