placeholder property of select tag in antd not working

430 views reactjs
6

This is the code snippet I'm using. The placeholder is not showing in UI.

 <Select placeholder="Select A User Role">

                    <Option value='2'>Company Admin</Option>
                    <Option value='3'>Company User</Option>
                    </Select>

answered question

@DragonBorn SO means Ant Design's Select component.

1 Answer

13

You need to set the width to see it

<Select placeholder="Select A User Role" style={{ width: 200 }}>
  <Option value="2">Company Admin</Option>
  <Option value="3">Company User</Option>
</Select>

Working example: https://codesandbox.io/s/4w8yxqm7w4

posted this

Have an answer?

JD

Please login first before posting an answer.