React-select: Documentation: Request for example: How to use the getStyles function?

Created on 25 Oct 2018  路  3Comments  路  Source: JedWatson/react-select

I'd like to call getStyles to see how the placeholder text is styled. How would I do this? https://react-select.com/props#select-props

Most helpful comment

Assuming you're inside a custom Placeholder component that you've created, you can use it like this:

const Placeholder = (props) => {
  console.log(props.getStyles('placeholder', props));
  return <YourPlaceHolderStuff />;
}

All 3 comments

You can create a pass through override to see dump the styles.

const placeholderStyles = (base, state) => {
  console.log('placeholder styles', base);
  return base;
};

<Select {...otherProps} styles={{placeholder: placeholderStyles}} />

Assuming you're inside a custom Placeholder component that you've created, you can use it like this:

const Placeholder = (props) => {
  console.log(props.getStyles('placeholder', props));
  return <YourPlaceHolderStuff />;
}

Hello -

In an effort to sustain the react-select project going forward, we're closing old issues.

We understand this might be inconvenient but in the best interest of supporting the broader community we have to direct our efforts towards the current major version.

If you aren't using the latest version of react-select please consider upgrading to see if it resolves any issues you're having.

However, if you feel this issue is still relevant and you'd like us to review it - please leave a comment and we'll do our best to get back to you!

Was this page helpful?
0 / 5 - 0 ratings