1.12.3 • Published 2 years ago

@patternfly/pfe-select v1.12.3

Weekly downloads
126
License
MIT
Repository
-
Last release
2 years ago

PatternFly Elements Select

The select component provides a way to create list of options in a form.

Read more about Select in the PatternFly Elements Select documentation

Installation

Load <pfe-select> via CDN:

<script src="https://unpkg.com/@patternfly/pfe-select?module"></script>

Or, if you are using NPM, install it

npm install @patternfly/pfe-select

Then once installed, import it to your application:

import '@patternfly/pfe-select';

Usage

There are 3 ways of providing options to your component:

  • Users can provide options using <select> element inside <pfe-select>
  • Users can set custom options as an array of objects on the element's options property
  • Users can append more options by using the element's addOptions() method

Note: <pfe-select> component can also be used in places where dropdowns are needed but its more suitable for forms. For dropdowns, <pfe-dropdown> is preferred.

With <select> element:

<pfe-select>
  <select>
    <option disabled>Please select an option</option>
    <option value="1">One</option>
    <option value="2">Two</option>
    <option value="3">Three</option>
  </select>
</pfe-select>

Without <select> element:

<pfe-select></pfe-select>

For custom options, use the options setter to set the options as shown in snippet below:

const select = document.querySelector("pfe-select");
select.options = [
  { text: "Please select an option", value: "", selected: true },
  { text: 'One', value: '1', selected: false },
  { text: 'Two', value: '2', selected: false },
  { text: 'Three', value: '3', selected: false}
];
2.0.0-next.5

2 years ago

2.0.0-next.4

2 years ago

2.0.0-next.2

3 years ago

2.0.0-next.3

3 years ago

2.0.0-next.1

3 years ago

1.12.3

3 years ago

2.0.0-next.0

3 years ago

1.12.2

3 years ago

1.12.1

3 years ago

1.12.0

3 years ago

1.11.2

3 years ago

1.11.1

3 years ago

1.11.0

3 years ago

1.10.1

3 years ago

1.10.0

3 years ago

1.9.3

3 years ago

1.9.1

3 years ago

1.9.2

3 years ago

1.9.0

3 years ago

1.8.0

4 years ago

1.7.0

4 years ago

1.6.0

4 years ago

1.5.1

4 years ago

1.5.0

4 years ago

1.4.0

4 years ago

1.3.4

4 years ago

1.3.3

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.0

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago