0.6.5 • Published 4 months ago

@justeattakeaway/pie-select v0.6.5

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
4 months ago

@justeattakeaway/pie-select

Source Code | Design Documentation | NPM

@justeattakeaway/pie-select is a Web Component built using the Lit library. It offers a simple and accessible interactive select input component for web applications.

Table of Contents

Installation

To install any of our web components in your application, we would suggest following the getting started guide to set up your project.

Ideally, you should install the component using the @justeattakeaway/pie-webc package, which includes all of the components. Or you can install the individual component package.

Documentation

Properties

PropOptionsDescriptionDefault
size"small", "medium", "large"The size of the select component.medium
disabledbooleanWhether the select is disabled.false
assistiveTextstringAn optional assistive text to display below the select element. Must be provided when the status is error.undefined
status"default", "error"The status of the select component / assistive text.default
namestringThe name of the select (used as a key/value pair with value). This is required in order to work properly with forms.undefined
optionsarrayThe options to display in the select. Can be an array of option objects or option group objects. See Using the options prop for more details.[]

Using the options prop

The options prop accepts an array of option objects or option group objects:

Option objects
PropOptionsDescriptionDefault
tag"option"Must be option to identify this as an option.undefined
textstringThe text to display for the option.undefined
valuestringThe value for the option.undefined
disabledbooleanWhether the option is disabled.false
selectedbooleanWhether the option is selected by default.false
Option group objects
PropOptionsDescriptionDefault
tag"optgroup"Must be optgroup to identify this as an option group.undefined
labelstringThe label for the group.undefined
disabledbooleanWhether the entire group is disabled.false
optionsarrayArray of option objects within this group.[]

Slots

SlotDescription
leadingIconAn icon to display at the start of the select.

CSS Variables

This component does not expose any CSS variables for style overrides.

Events

EventDescription
changeFires when the selected option is changed.

Usage Examples

When using icons, we recommend using @justeattakeaway/pie-icons-webc to ensure consistency with the rest of the design system.

For HTML:

// import as module into a js file that will be loaded on the page where the component is used.
import '@justeattakeaway/pie-webc/components/select.js';
import '@justeattakeaway/pie-icons-webc/dist/IconPlaceholder.js';
<pie-select
    name="my-select"
    options="[
      { tag: 'option', text: 'Select an option' },
      { tag: 'option', text: 'Option 1', value: 'option1' }
    ]">
  <icon-placeholder slot="leadingIcon"></icon-placeholder>
</pie-select>

For Native JS Applications, Vue, Angular, Svelte, etc.:

// Vue templates (using Nuxt 3)
import '@justeattakeaway/pie-webc/components/select.js';
import '@justeattakeaway/pie-icons-webc/dist/IconPlaceholder.js';

<pie-select
    name="my-select"
    :options="[
      { tag: 'option', text: 'Select an option' },
      { tag: 'option', text: 'Option 1', value: 'option1' }
    ]">
<icon-placeholder slot="leadingIcon"></icon-placeholder>
</pie-select>

For React Applications:

import { PieSelect } from '@justeattakeaway/pie-webc/react/select.js';
import { IconPlaceholder } from '@justeattakeaway/pie-icons-webc/dist/react/IconPlaceholder.js';

<PieSelect
    name="my-select"
    options={[
      { tag: 'option', text: 'Select an option' },
      { tag: 'option', text: 'Option 1', value: 'option1' }
    ]}>
  <IconPlaceholder slot="leadingIcon"></IconPlaceholder>
</PieSelect>

Questions and Support

If you work at Just Eat Takeaway.com, please contact us on #help-designsystem. Otherwise, please raise an issue on Github.

Contributing

Check out our contributing guide for more information on local development and how to run specific component tests.

0.6.5

4 months ago

0.6.4

5 months ago

0.6.3

5 months ago

0.6.2

5 months ago

0.6.1

5 months ago

0.6.0

5 months ago

0.5.2

5 months ago

0.5.1

5 months ago

0.5.0

6 months ago

0.4.4

6 months ago

0.4.3

6 months ago

0.4.2

7 months ago

0.4.1

7 months ago

0.4.0

7 months ago

0.3.0

7 months ago

0.2.0

7 months ago

0.1.0

7 months ago

0.0.1

8 months ago