404
404

Reputation: 277

Office UI Fabric React : Dropdown Component

How to change the CSS of label for Dropdown? Markup is as below:

<Dropdown
      placeHolder="Select Department"
      label="Department:"
      id="Basicdrop1"
      ariaLabel="Department"
      options={[

        { key: 'A', text: 'Option a' },
        { key: 'B', text: 'Option b' },
        { key: 'C', text: 'Option c'},
        { key: 'D', text: 'Option d' },
        { key: 'E', text: 'Option e' },
      ]}
      onFocus={() =>console.log('onFocus called')}
      onBlur={() =>console.log('onBlur called')}
      componentRef={this._basicDropdown}
    />

I want to make "Department" label bold.

Upvotes: 0

Views: 6465

Answers (1)

kevintcoughlin
kevintcoughlin

Reputation: 482

You can style the label by using the styles prop on <Dropdown/>. Here is a code sample which renders the label as bold:

<Fabric.Dropdown
  placeHolder="Select Department"
  label="Department:"
  id="Basicdrop1"
  ariaLabel="Department"
  options={[

    { key: 'A', text: 'Option a' },
    { key: 'B', text: 'Option b' },
    { key: 'C', text: 'Option c'},
    { key: 'D', text: 'Option d' },
    { key: 'E', text: 'Option e' },
  ]}
  onFocus={() =>console.log('onFocus called')}
  onBlur={() =>console.log('onBlur called')}
  componentRef={this._basicDropdown}
  styles={{ label: { fontWeight: 'bold' }}}
/>

References

Upvotes: 3

Related Questions