Picker

Pickers allow users to choose a single option from a collapsible list of options when space is limited.

installyarn add @adobe/react-spectrum
added3.0.0
usageimport {Picker, Item, Section} from '@adobe/react-spectrum'

Example#


<Picker label="Choose frequency">
  <Item key="rarely">Rarely</Item>
  <Item key="sometimes">Sometimes</Item>
  <Item key="always">Always</Item>
</Picker>
<Picker label="Choose frequency">
  <Item key="rarely">Rarely</Item>
  <Item key="sometimes">Sometimes</Item>
  <Item key="always">Always</Item>
</Picker>
<Picker label="Choose frequency">
  <Item key="rarely">
    Rarely
  </Item>
  <Item key="sometimes">
    Sometimes
  </Item>
  <Item key="always">
    Always
  </Item>
</Picker>

Content#


Picker follows the Collection Components API, accepting both static and dynamic collections. Similar to Menu, Picker accepts <Item> elements as children, each with a key prop. Basic usage of Picker, seen in the example above, shows multiple options populated with a string. Static collections, as in this example, can be used when the full list of options is known ahead of time.

Dynamic collections, as shown below, can be used when the options come from an external data source such as an API call, or update over time. Providing the data in this way allows Picker to automatically cache the rendering of each item, which dramatically improves performance.

As seen below, an iterable list of options is passed to the Picker using the items prop. Each item accepts a key prop, which is passed to the onSelectionChange handler to identify the selected item. Alternatively, if the item objects contain an id property, as shown in the example below, then this is used automatically and a key prop is not required. See the Events section for more detail on selection.

function Example() {
  let options = [
    { id: 1, name: 'Aardvark' },
    { id: 2, name: 'Cat' },
    { id: 3, name: 'Dog' },
    { id: 4, name: 'Kangaroo' },
    { id: 5, name: 'Koala' },
    { id: 6, name: 'Penguin' },
    { id: 7, name: 'Snake' },
    { id: 8, name: 'Turtle' },
    { id: 9, name: 'Wombat' }
  ];
  let [animalId, setAnimalId] = React.useState(null);

  return (
    <>
      <Picker
        label="Pick an animal"
        items={options}
        onSelectionChange={setAnimalId}
      >
        {(item) => <Item>{item.name}</Item>}
      </Picker>
      <p>Animal id: {animalId}</p>
    </>
  );
}
function Example() {
  let options = [
    { id: 1, name: 'Aardvark' },
    { id: 2, name: 'Cat' },
    { id: 3, name: 'Dog' },
    { id: 4, name: 'Kangaroo' },
    { id: 5, name: 'Koala' },
    { id: 6, name: 'Penguin' },
    { id: 7, name: 'Snake' },
    { id: 8, name: 'Turtle' },
    { id: 9, name: 'Wombat' }
  ];
  let [animalId, setAnimalId] = React.useState(null);

  return (
    <>
      <Picker
        label="Pick an animal"
        items={options}
        onSelectionChange={setAnimalId}
      >
        {(item) => <Item>{item.name}</Item>}
      </Picker>
      <p>Animal id: {animalId}</p>
    </>
  );
}
function Example() {
  let options = [
    {
      id: 1,
      name: 'Aardvark'
    },
    {
      id: 2,
      name: 'Cat'
    },
    {
      id: 3,
      name: 'Dog'
    },
    {
      id: 4,
      name: 'Kangaroo'
    },
    {
      id: 5,
      name: 'Koala'
    },
    {
      id: 6,
      name: 'Penguin'
    },
    {
      id: 7,
      name: 'Snake'
    },
    {
      id: 8,
      name: 'Turtle'
    },
    {
      id: 9,
      name: 'Wombat'
    }
  ];
  let [
    animalId,
    setAnimalId
  ] = React.useState(
    null
  );

  return (
    <>
      <Picker
        label="Pick an animal"
        items={options}
        onSelectionChange={setAnimalId}
      >
        {(item) => (
          <Item>
            {item.name}
          </Item>
        )}
      </Picker>
      <p>
        Animal id:{' '}
        {animalId}
      </p>
    </>
  );
}

Trays#

On mobile, Pickers automatically display in a tray instead of a popover to improve usability.

Internationalization#

To internationalize a Picker, a localized string should be passed to the children of each Item. For languages that are read right-to-left (e.g. Hebrew and Arabic), the layout of the Picker is automatically flipped.

Labeling#


Picker can be labeled using the label prop. If no label is provided, an alternative text label must be provided to identify the control for accessibility. This should be added using the aria-label prop. If the Picker is a required field, the isRequired and necessityIndicator props can be used to show a required state.

<Picker label="Choose frequency" isRequired necessityIndicator="icon">
  <Item key="rarely">Rarely</Item>
  <Item key="sometimes">Sometimes</Item>
  <Item key="always">Always</Item>
</Picker>
<Picker
  label="Choose frequency"
  isRequired
  necessityIndicator="icon"
>
  <Item key="rarely">Rarely</Item>
  <Item key="sometimes">Sometimes</Item>
  <Item key="always">Always</Item>
</Picker>
<Picker
  label="Choose frequency"
  isRequired
  necessityIndicator="icon"
>
  <Item key="rarely">
    Rarely
  </Item>
  <Item key="sometimes">
    Sometimes
  </Item>
  <Item key="always">
    Always
  </Item>
</Picker>
<Picker label="Choose frequency" isRequired necessityIndicator="label">
  <Item key="rarely">Rarely</Item>
  <Item key="sometimes">Sometimes</Item>
  <Item key="always">Always</Item>
</Picker>
<Picker
  label="Choose frequency"
  isRequired
  necessityIndicator="label"
>
  <Item key="rarely">Rarely</Item>
  <Item key="sometimes">Sometimes</Item>
  <Item key="always">Always</Item>
</Picker>
<Picker
  label="Choose frequency"
  isRequired
  necessityIndicator="label"
>
  <Item key="rarely">
    Rarely
  </Item>
  <Item key="sometimes">
    Sometimes
  </Item>
  <Item key="always">
    Always
  </Item>
</Picker>
<Picker label="Choose frequency" necessityIndicator="label">
  <Item key="rarely">Rarely</Item>
  <Item key="sometimes">Sometimes</Item>
  <Item key="always">Always</Item>
</Picker>
<Picker label="Choose frequency" necessityIndicator="label">
  <Item key="rarely">Rarely</Item>
  <Item key="sometimes">Sometimes</Item>
  <Item key="always">Always</Item>
</Picker>
<Picker
  label="Choose frequency"
  necessityIndicator="label"
>
  <Item key="rarely">
    Rarely
  </Item>
  <Item key="sometimes">
    Sometimes
  </Item>
  <Item key="always">
    Always
  </Item>
</Picker>

Selection#


Setting a selected option can be done by using the defaultSelectedKey or selectedKey prop. The selected key corresponds to the key of an item. See Events for more details on selection events. Additionally see the react-stately Selection docs for caveats regarding selection prop typing.

import type {Key} from '@adobe/react-spectrum';

function Example() {
  let options = [
    {name: 'Koala'},
    {name: 'Kangaroo'},
    {name: 'Platypus'},
    {name: 'Bald Eagle'},
    {name: 'Bison'},
    {name: 'Skunk'}
  ];
  let [animal, setAnimal] = React.useState<Key>("Bison");

  return (
    <Flex gap="size-150" wrap>
      <Picker
        label="Pick an animal (uncontrolled)"
        items={options}
        defaultSelectedKey="Bison">
        {item => <Item key={item.name}>{item.name}</Item>}
      </Picker>

      <Picker
        label="Pick an animal (controlled)"
        items={options}
        selectedKey={animal}
        onSelectionChange={selected => setAnimal(selected)}>
        {item => <Item key={item.name}>{item.name}</Item>}
      </Picker>
    </Flex>
  );
}
import type {Key} from '@adobe/react-spectrum';

function Example() {
  let options = [
    {name: 'Koala'},
    {name: 'Kangaroo'},
    {name: 'Platypus'},
    {name: 'Bald Eagle'},
    {name: 'Bison'},
    {name: 'Skunk'}
  ];
  let [animal, setAnimal] = React.useState<Key>("Bison");

  return (
    <Flex gap="size-150" wrap>
      <Picker
        label="Pick an animal (uncontrolled)"
        items={options}
        defaultSelectedKey="Bison">
        {item => <Item key={item.name}>{item.name}</Item>}
      </Picker>

      <Picker
        label="Pick an animal (controlled)"
        items={options}
        selectedKey={animal}
        onSelectionChange={selected => setAnimal(selected)}>
        {item => <Item key={item.name}>{item.name}</Item>}
      </Picker>
    </Flex>
  );
}
import type {Key} from '@adobe/react-spectrum';

function Example() {
  let options = [
    { name: 'Koala' },
    { name: 'Kangaroo' },
    { name: 'Platypus' },
    {
      name: 'Bald Eagle'
    },
    { name: 'Bison' },
    { name: 'Skunk' }
  ];
  let [
    animal,
    setAnimal
  ] = React.useState<
    Key
  >('Bison');

  return (
    <Flex
      gap="size-150"
      wrap
    >
      <Picker
        label="Pick an animal (uncontrolled)"
        items={options}
        defaultSelectedKey="Bison"
      >
        {(item) => (
          <Item
            key={item
              .name}
          >
            {item.name}
          </Item>
        )}
      </Picker>

      <Picker
        label="Pick an animal (controlled)"
        items={options}
        selectedKey={animal}
        onSelectionChange={(selected) =>
          setAnimal(
            selected
          )}
      >
        {(item) => (
          <Item
            key={item
              .name}
          >
            {item.name}
          </Item>
        )}
      </Picker>
    </Flex>
  );
}

HTML forms#

Picker supports the name prop for integration with HTML forms. The key of the selected item will be submitted to the server.

<Picker
  label="Favorite Animal"
  name="favoriteAnimalId">
  <Item key="panda">Panda</Item>
  <Item key="cat">Cat</Item>
  <Item key="dog">Dog</Item>
</Picker>
<Picker
  label="Favorite Animal"
  name="favoriteAnimalId">
  <Item key="panda">Panda</Item>
  <Item key="cat">Cat</Item>
  <Item key="dog">Dog</Item>
</Picker>
<Picker
  label="Favorite Animal"
  name="favoriteAnimalId">
  <Item key="panda">
    Panda
  </Item>
  <Item key="cat">
    Cat
  </Item>
  <Item key="dog">
    Dog
  </Item>
</Picker>

By default, interacting with an item in a Picker triggers onSelectionChange. Alternatively, items may be links to another page or website. This can be achieved by passing the href prop to the <Item> component. Link items in a Picker are not selectable.

<Picker label="Project">
  <Item href="https://example.com/" target="_blank">Create new…</Item>
  <Item>Proposal</Item>
  <Item>Budget</Item>
  <Item>Onboarding</Item>
</Picker>
<Picker label="Project">
  <Item href="https://example.com/" target="_blank">
    Create new…
  </Item>
  <Item>Proposal</Item>
  <Item>Budget</Item>
  <Item>Onboarding</Item>
</Picker>
<Picker label="Project">
  <Item
    href="https://example.com/"
    target="_blank"
  >
    Create new…
  </Item>
  <Item>Proposal</Item>
  <Item>Budget</Item>
  <Item>
    Onboarding
  </Item>
</Picker>

Client side routing#

The <Item> component works with frameworks and client side routers like Next.js and React Router. As with other React Spectrum components that support links, this works via the Provider component at the root of your app. See the client side routing guide to learn how to set this up.

Sections#


Picker supports sections in order to group options. Sections can be used by wrapping groups of items in a Section element. Each Section takes a title and key prop.

Static items#

<Picker label="Pick your favorite">
  <Section title="Animals">
    <Item key="Aardvark">Aardvark</Item>
    <Item key="Kangaroo">Kangaroo</Item>
    <Item key="Snake">Snake</Item>
  </Section>
  <Section title="People">
    <Item key="Danni">Danni</Item>
    <Item key="Devon">Devon</Item>
    <Item key="Ross">Ross</Item>
  </Section>
</Picker>
<Picker label="Pick your favorite">
  <Section title="Animals">
    <Item key="Aardvark">Aardvark</Item>
    <Item key="Kangaroo">Kangaroo</Item>
    <Item key="Snake">Snake</Item>
  </Section>
  <Section title="People">
    <Item key="Danni">Danni</Item>
    <Item key="Devon">Devon</Item>
    <Item key="Ross">Ross</Item>
  </Section>
</Picker>
<Picker label="Pick your favorite">
  <Section title="Animals">
    <Item key="Aardvark">
      Aardvark
    </Item>
    <Item key="Kangaroo">
      Kangaroo
    </Item>
    <Item key="Snake">
      Snake
    </Item>
  </Section>
  <Section title="People">
    <Item key="Danni">
      Danni
    </Item>
    <Item key="Devon">
      Devon
    </Item>
    <Item key="Ross">
      Ross
    </Item>
  </Section>
</Picker>

Dynamic items#

Sections used with dynamic items are populated from a hierarchical data structure. Similarly to the props on Picker, Section takes an array of data using the items prop.

function Example() {
  let options = [
    {
      name: 'Australian',
      children: [
        { id: 2, name: 'Koala' },
        { id: 3, name: 'Kangaroo' },
        { id: 4, name: 'Platypus' }
      ]
    },
    {
      name: 'American',
      children: [
        { id: 6, name: 'Bald Eagle' },
        { id: 7, name: 'Bison' },
        { id: 8, name: 'Skunk' }
      ]
    }
  ];

  return (
    <Picker
      label="Pick an animal"
      items={options}
      onSelectionChange={(selected) => alert(selected)}
    >
      {(item) => (
        <Section key={item.name} items={item.children} title={item.name}>
          {(item) => <Item>{item.name}</Item>}
        </Section>
      )}
    </Picker>
  );
}
function Example() {
  let options = [
    {
      name: 'Australian',
      children: [
        { id: 2, name: 'Koala' },
        { id: 3, name: 'Kangaroo' },
        { id: 4, name: 'Platypus' }
      ]
    },
    {
      name: 'American',
      children: [
        { id: 6, name: 'Bald Eagle' },
        { id: 7, name: 'Bison' },
        { id: 8, name: 'Skunk' }
      ]
    }
  ];

  return (
    <Picker
      label="Pick an animal"
      items={options}
      onSelectionChange={(selected) => alert(selected)}
    >
      {(item) => (
        <Section
          key={item.name}
          items={item.children}
          title={item.name}
        >
          {(item) => <Item>{item.name}</Item>}
        </Section>
      )}
    </Picker>
  );
}
function Example() {
  let options = [
    {
      name: 'Australian',
      children: [
        {
          id: 2,
          name: 'Koala'
        },
        {
          id: 3,
          name:
            'Kangaroo'
        },
        {
          id: 4,
          name:
            'Platypus'
        }
      ]
    },
    {
      name: 'American',
      children: [
        {
          id: 6,
          name:
            'Bald Eagle'
        },
        {
          id: 7,
          name: 'Bison'
        },
        {
          id: 8,
          name: 'Skunk'
        }
      ]
    }
  ];

  return (
    <Picker
      label="Pick an animal"
      items={options}
      onSelectionChange={(selected) =>
        alert(selected)}
    >
      {(item) => (
        <Section
          key={item.name}
          items={item
            .children}
          title={item
            .name}
        >
          {(item) => (
            <Item>
              {item.name}
            </Item>
          )}
        </Section>
      )}
    </Picker>
  );
}

Events#


Picker supports selection via mouse, keyboard, and touch. You can handle all of these via the onSelectionChange prop. Picker will pass the selected key to the onSelectionChange handler.

The following example uses an onSelectionChange handler to update the selection stored in React state.

function StaticExample() {
  let [frequency, setFrequency] = React.useState(null);

  return (
    <>
      <Picker
        label="Choose frequency"
        onSelectionChange={(selected) => setFrequency(selected)}
      >
        <Item key="Rarely">Rarely</Item>
        <Item key="Sometimes">Sometimes</Item>
        <Item key="Always">Always</Item>
      </Picker>
      <p>You selected {frequency}</p>
    </>
  );
}
function StaticExample() {
  let [frequency, setFrequency] = React.useState(null);

  return (
    <>
      <Picker
        label="Choose frequency"
        onSelectionChange={(selected) =>
          setFrequency(selected)}
      >
        <Item key="Rarely">Rarely</Item>
        <Item key="Sometimes">Sometimes</Item>
        <Item key="Always">Always</Item>
      </Picker>
      <p>You selected {frequency}</p>
    </>
  );
}
function StaticExample() {
  let [
    frequency,
    setFrequency
  ] = React.useState(
    null
  );

  return (
    <>
      <Picker
        label="Choose frequency"
        onSelectionChange={(selected) =>
          setFrequency(
            selected
          )}
      >
        <Item key="Rarely">
          Rarely
        </Item>
        <Item key="Sometimes">
          Sometimes
        </Item>
        <Item key="Always">
          Always
        </Item>
      </Picker>
      <p>
        You selected{' '}
        {frequency}
      </p>
    </>
  );
}

When using Picker with dynamic items, selection works much the same way using key. However, if your data already has an id property (as is common with many data sets), Picker can use that id without needing to specify a key prop. The below example shows Picker using the id of each item from the items array as the selected value without the need for key. Note that key will always take precedence if set.

function DynamicExample() {
  let [animalId, setAnimalId] = React.useState(null);
  let options = [
    { id: 1, name: 'Aardvark' },
    { id: 2, name: 'Cat' },
    { id: 3, name: 'Dog' },
    { id: 4, name: 'Kangaroo' },
    { id: 5, name: 'Koala' },
    { id: 6, name: 'Penguin' },
    { id: 7, name: 'Snake' },
    { id: 8, name: 'Turtle' },
    { id: 9, name: 'Wombat' }
  ];

  return (
    <>
      <Picker
        label="Pick an animal"
        items={options}
        onSelectionChange={(selected) => setAnimalId(selected)}
      >
        {(item) => <Item>{item.name}</Item>}
      </Picker>
      <p>Your favorite animal has id: {animalId}</p>
    </>
  );
}
function DynamicExample() {
  let [animalId, setAnimalId] = React.useState(null);
  let options = [
    { id: 1, name: 'Aardvark' },
    { id: 2, name: 'Cat' },
    { id: 3, name: 'Dog' },
    { id: 4, name: 'Kangaroo' },
    { id: 5, name: 'Koala' },
    { id: 6, name: 'Penguin' },
    { id: 7, name: 'Snake' },
    { id: 8, name: 'Turtle' },
    { id: 9, name: 'Wombat' }
  ];

  return (
    <>
      <Picker
        label="Pick an animal"
        items={options}
        onSelectionChange={(selected) =>
          setAnimalId(selected)}
      >
        {(item) => <Item>{item.name}</Item>}
      </Picker>
      <p>Your favorite animal has id: {animalId}</p>
    </>
  );
}
function DynamicExample() {
  let [
    animalId,
    setAnimalId
  ] = React.useState(
    null
  );
  let options = [
    {
      id: 1,
      name: 'Aardvark'
    },
    {
      id: 2,
      name: 'Cat'
    },
    {
      id: 3,
      name: 'Dog'
    },
    {
      id: 4,
      name: 'Kangaroo'
    },
    {
      id: 5,
      name: 'Koala'
    },
    {
      id: 6,
      name: 'Penguin'
    },
    {
      id: 7,
      name: 'Snake'
    },
    {
      id: 8,
      name: 'Turtle'
    },
    {
      id: 9,
      name: 'Wombat'
    }
  ];

  return (
    <>
      <Picker
        label="Pick an animal"
        items={options}
        onSelectionChange={(selected) =>
          setAnimalId(
            selected
          )}
      >
        {(item) => (
          <Item>
            {item.name}
          </Item>
        )}
      </Picker>
      <p>
        Your favorite
        animal has id:
        {' '}
        {animalId}
      </p>
    </>
  );
}

Complex items#


Items within Picker also allow for additional content used to better communicate options. Icons, avatars, and descriptions can be added to the children of Item as shown in the example below. If a description is added, the prop slot="description" must be used to distinguish the different <Text> elements. See Icon's labeling section and Avatar's accessibility section for more information on how to label these elements.

<Picker label="Options">
  <Section title="Permission">
    <Item textValue="Read">
      <Book size="S" />
      <Text>Read</Text>
      <Text slot="description">Read Only</Text>
    </Item>
    <Item textValue="Write">
      <Draw size="S" />
      <Text>Write</Text>
      <Text slot="description">Read and Write Only</Text>
    </Item>
    <Item textValue="Admin">
      <BulkEditUsers size="S" />
      <Text>Admin</Text>
      <Text slot="description">Full access</Text>
    </Item>
  </Section>
</Picker>
<Picker label="Options">
  <Section title="Permission">
    <Item textValue="Read">
      <Book size="S" />
      <Text>Read</Text>
      <Text slot="description">Read Only</Text>
    </Item>
    <Item textValue="Write">
      <Draw size="S" />
      <Text>Write</Text>
      <Text slot="description">Read and Write Only</Text>
    </Item>
    <Item textValue="Admin">
      <BulkEditUsers size="S" />
      <Text>Admin</Text>
      <Text slot="description">Full access</Text>
    </Item>
  </Section>
</Picker>
<Picker label="Options">
  <Section title="Permission">
    <Item textValue="Read">
      <Book size="S" />
      <Text>Read</Text>
      <Text slot="description">
        Read Only
      </Text>
    </Item>
    <Item textValue="Write">
      <Draw size="S" />
      <Text>
        Write
      </Text>
      <Text slot="description">
        Read and Write
        Only
      </Text>
    </Item>
    <Item textValue="Admin">
      <BulkEditUsers size="S" />
      <Text>
        Admin
      </Text>
      <Text slot="description">
        Full access
      </Text>
    </Item>
  </Section>
</Picker>

With avatars#

<Picker label="Select a user">
  <Item textValue="User 1">
    <Avatar src="https://i.imgur.com/kJOwAdv.png" />
    <Text>User 1</Text>
  </Item>
  <Item textValue="User 2">
    <Avatar src="https://i.imgur.com/kJOwAdv.png" />
    <Text>User 2</Text>
  </Item>
  <Item textValue="User 3">
    <Avatar src="https://i.imgur.com/kJOwAdv.png" />
    <Text>User 3</Text>
  </Item>
  <Item textValue="User 4">
    <Avatar src="https://i.imgur.com/kJOwAdv.png" />
    <Text>User 4</Text>
  </Item>
</Picker>
<Picker label="Select a user">
  <Item textValue="User 1">
    <Avatar src="https://i.imgur.com/kJOwAdv.png" />
    <Text>User 1</Text>
  </Item>
  <Item textValue="User 2">
    <Avatar src="https://i.imgur.com/kJOwAdv.png" />
    <Text>User 2</Text>
  </Item>
  <Item textValue="User 3">
    <Avatar src="https://i.imgur.com/kJOwAdv.png" />
    <Text>User 3</Text>
  </Item>
  <Item textValue="User 4">
    <Avatar src="https://i.imgur.com/kJOwAdv.png" />
    <Text>User 4</Text>
  </Item>
</Picker>
<Picker label="Select a user">
  <Item textValue="User 1">
    <Avatar src="https://i.imgur.com/kJOwAdv.png" />
    <Text>User 1</Text>
  </Item>
  <Item textValue="User 2">
    <Avatar src="https://i.imgur.com/kJOwAdv.png" />
    <Text>User 2</Text>
  </Item>
  <Item textValue="User 3">
    <Avatar src="https://i.imgur.com/kJOwAdv.png" />
    <Text>User 3</Text>
  </Item>
  <Item textValue="User 4">
    <Avatar src="https://i.imgur.com/kJOwAdv.png" />
    <Text>User 4</Text>
  </Item>
</Picker>

Asynchronous loading#


Picker supports loading data asynchronously, and will display a progress circle when the isLoading prop is set. It also supports infinite scrolling to load more data on demand as the user scrolls, via the onLoadMore prop.

This example uses the useAsyncList hook to handle loading the data. See the docs for more information.

import {useAsyncList} from 'react-stately';

interface Pokemon {
  name: string;
}

function AsyncLoadingExample() {
  let list = useAsyncList<Pokemon>({
    async load({ signal, cursor }) {
      // If no cursor is available, then we're loading the first page.
      // Otherwise, the cursor is the next URL to load, as returned from the previous page.
      let res = await fetch(cursor || 'https://pokeapi.co/api/v2/pokemon', {
        signal
      });
      let json = await res.json();
      return {
        items: json.results,
        cursor: json.next
      };
    }
  });

  return (
    <Picker
      label="Pick a Pokemon"
      items={list.items}
      isLoading={list.isLoading}
      onLoadMore={list.loadMore}
    >
      {(item) => <Item key={item.name}>{item.name}</Item>}
    </Picker>
  );
}
import {useAsyncList} from 'react-stately';

interface Pokemon {
  name: string;
}

function AsyncLoadingExample() {
  let list = useAsyncList<Pokemon>({
    async load({ signal, cursor }) {
      // If no cursor is available, then we're loading the first page.
      // Otherwise, the cursor is the next URL to load, as returned from the previous page.
      let res = await fetch(
        cursor || 'https://pokeapi.co/api/v2/pokemon',
        { signal }
      );
      let json = await res.json();
      return {
        items: json.results,
        cursor: json.next
      };
    }
  });

  return (
    <Picker
      label="Pick a Pokemon"
      items={list.items}
      isLoading={list.isLoading}
      onLoadMore={list.loadMore}
    >
      {(item) => <Item key={item.name}>{item.name}</Item>}
    </Picker>
  );
}
import {useAsyncList} from 'react-stately';

interface Pokemon {
  name: string;
}

function AsyncLoadingExample() {
  let list =
    useAsyncList<
      Pokemon
    >({
      async load(
        {
          signal,
          cursor
        }
      ) {
        // If no cursor is available, then we're loading the first page.
        // Otherwise, the cursor is the next URL to load, as returned from the previous page.
        let res =
          await fetch(
            cursor ||
              'https://pokeapi.co/api/v2/pokemon',
            { signal }
          );
        let json =
          await res
            .json();
        return {
          items:
            json.results,
          cursor:
            json.next
        };
      }
    });

  return (
    <Picker
      label="Pick a Pokemon"
      items={list.items}
      isLoading={list
        .isLoading}
      onLoadMore={list
        .loadMore}
    >
      {(item) => (
        <Item
          key={item.name}
        >
          {item.name}
        </Item>
      )}
    </Picker>
  );
}

Validation#


Picker supports the isRequired prop to ensure the user selects an option, as well as custom client and server-side validation. It can also be integrated with other form libraries. See the Forms guide to learn more.

When the Form component has the validationBehavior="native" prop, validation errors block form submission and are displayed as help text automatically.

import {Form, ButtonGroup, Button} from '@adobe/react-spectrum';

<Form validationBehavior="native" maxWidth="size-3000">
  <Picker label="Favorite animal" name="animal" isRequired>    <Item>Aardvark</Item>
    <Item>Cat</Item>
    <Item>Dog</Item>
    <Item>Kangaroo</Item>
    <Item>Panda</Item>
    <Item>Snake</Item>
  </Picker>
  <ButtonGroup>
    <Button type="submit" variant="primary">Submit</Button>
    <Button type="reset" variant="secondary">Reset</Button>
  </ButtonGroup>
</Form>
import {
  Button,
  ButtonGroup,
  Form
} from '@adobe/react-spectrum';

<Form validationBehavior="native" maxWidth="size-3000">
  <Picker
    label="Favorite animal"
    name="animal"
    isRequired
  >    <Item>Aardvark</Item>
    <Item>Cat</Item>
    <Item>Dog</Item>
    <Item>Kangaroo</Item>
    <Item>Panda</Item>
    <Item>Snake</Item>
  </Picker>
  <ButtonGroup>
    <Button type="submit" variant="primary">
      Submit
    </Button>
    <Button type="reset" variant="secondary">
      Reset
    </Button>
  </ButtonGroup>
</Form>
import {
  Button,
  ButtonGroup,
  Form
} from '@adobe/react-spectrum';

<Form
  validationBehavior="native"
  maxWidth="size-3000"
>
  <Picker
    label="Favorite animal"
    name="animal"
    isRequired
  >    <Item>
      Aardvark
    </Item>
    <Item>Cat</Item>
    <Item>Dog</Item>
    <Item>
      Kangaroo
    </Item>
    <Item>Panda</Item>
    <Item>Snake</Item>
  </Picker>
  <ButtonGroup>
    <Button
      type="submit"
      variant="primary"
    >
      Submit
    </Button>
    <Button
      type="reset"
      variant="secondary"
    >
      Reset
    </Button>
  </ButtonGroup>
</Form>

By default, Picker displays default validation messages provided by the browser. See Customizing error messages in the Forms guide to learn how to provide your own custom errors.

Props#


NameTypeDefaultDescription
childrenCollectionChildren<object>The contents of the collection.
isQuietbooleanWhether the textfield should be displayed with a quiet style.
alignAlignment'start'Alignment of the menu relative to the input target.
direction'bottom''top''bottom'Direction the menu will render relative to the Picker.
shouldFlipbooleantrueWhether the menu should automatically flip direction when space is limited.
menuWidthDimensionValueWidth of the menu. By default, matches width of the trigger. Note that the minimum width of the dropdown is always equal to the trigger's width.
autoFocusbooleanWhether the element should receive focus on render.
autoCompletestringDescribes the type of autocomplete functionality the input should provide if any. See MDN.
namestringThe name of the input, used when submitting an HTML form.
isOpenbooleanSets the open state of the menu.
defaultOpenbooleanSets the default open state of the menu.
itemsIterable<object>Item objects in the collection.
disabledKeysIterable<Key>The item keys that are disabled. These items cannot be selected, focused, or otherwise interacted with.
isDisabledbooleanWhether the input is disabled.
isRequiredbooleanWhether user input is required on the input before form submission.
isInvalidbooleanWhether the input value is invalid.
validationBehavior'aria''native''aria'

Whether to use native HTML form validation to prevent form submission when the value is missing or invalid, or mark the field as required or invalid via ARIA.

validate( (value: Key )) => ValidationErrortruenullundefined

A function that returns an error message if a given value is invalid. Validation errors are displayed to the user when the form is submitted if validationBehavior="native". For realtime validation, use the isInvalid prop instead.

descriptionReactNodeA description for the field. Provides a hint such as specific requirements for what to choose.
errorMessageReactNode( (v: ValidationResult )) => ReactNodeAn error message for the field.
labelReactNodeThe content to display as the label.
placeholderstringTemporary text that occupies the text input when it is empty.
selectedKeyKeynullThe currently selected key in the collection (controlled).
defaultSelectedKeyKeyThe initial selected key in the collection (uncontrolled).
isLoadingbooleanWhether the items are currently loading.
labelPositionLabelPosition'top'The label's overall position relative to the element it is labeling.
labelAlignAlignment'start'The label's horizontal alignment relative to the element it is labeling.
necessityIndicatorNecessityIndicator'icon'Whether the required state should be shown as an icon or text.
contextualHelpReactNodeA ContextualHelp element to place next to the label.
Events
NameTypeDescription
onOpenChange( (isOpen: boolean )) => voidMethod that is called when the open state of the menu changes.
onSelectionChange( (key: Key )) => voidHandler that is called when the selection changes.
onFocus( (e: FocusEvent<Target> )) => voidHandler that is called when the element receives focus.
onBlur( (e: FocusEvent<Target> )) => voidHandler that is called when the element loses focus.
onFocusChange( (isFocused: boolean )) => voidHandler that is called when the element's focus status changes.
onKeyDown( (e: KeyboardEvent )) => voidHandler that is called when a key is pressed.
onKeyUp( (e: KeyboardEvent )) => voidHandler that is called when a key is released.
onLoadMore() => anyHandler that is called when more items should be loaded, e.g. while scrolling near the bottom.
Layout
NameTypeDescription
flexResponsive<stringnumberboolean>When used in a flex layout, specifies how the element will grow or shrink to fit the space available. See MDN.
flexGrowResponsive<number>When used in a flex layout, specifies how the element will grow to fit the space available. See MDN.
flexShrinkResponsive<number>When used in a flex layout, specifies how the element will shrink to fit the space available. See MDN.
flexBasisResponsive<numberstring>When used in a flex layout, specifies the initial main size of the element. See MDN.
alignSelfResponsive<'auto''normal''start''end''center''flex-start''flex-end''self-start''self-end''stretch'>Overrides the alignItems property of a flex or grid container. See MDN.
justifySelfResponsive<'auto''normal''start''end''flex-start''flex-end''self-start''self-end''center''left''right''stretch'>Specifies how the element is justified inside a flex or grid container. See MDN.
orderResponsive<number>The layout order for the element within a flex or grid container. See MDN.
gridAreaResponsive<string>When used in a grid layout, specifies the named grid area that the element should be placed in within the grid. See MDN.
gridColumnResponsive<string>When used in a grid layout, specifies the column the element should be placed in within the grid. See MDN.
gridRowResponsive<string>When used in a grid layout, specifies the row the element should be placed in within the grid. See MDN.
gridColumnStartResponsive<string>When used in a grid layout, specifies the starting column to span within the grid. See MDN.
gridColumnEndResponsive<string>When used in a grid layout, specifies the ending column to span within the grid. See MDN.
gridRowStartResponsive<string>When used in a grid layout, specifies the starting row to span within the grid. See MDN.
gridRowEndResponsive<string>When used in a grid layout, specifies the ending row to span within the grid. See MDN.
Spacing
NameTypeDescription
marginResponsive<DimensionValue>The margin for all four sides of the element. See MDN.
marginTopResponsive<DimensionValue>The margin for the top side of the element. See MDN.
marginBottomResponsive<DimensionValue>The margin for the bottom side of the element. See MDN.
marginStartResponsive<DimensionValue>The margin for the logical start side of the element, depending on layout direction. See MDN.
marginEndResponsive<DimensionValue>The margin for the logical end side of an element, depending on layout direction. See MDN.
marginXResponsive<DimensionValue>The margin for both the left and right sides of the element. See MDN.
marginYResponsive<DimensionValue>The margin for both the top and bottom sides of the element. See MDN.
Sizing
NameTypeDescription
widthResponsive<DimensionValue>The width of the element. See MDN.
minWidthResponsive<DimensionValue>The minimum width of the element. See MDN.
maxWidthResponsive<DimensionValue>The maximum width of the element. See MDN.
heightResponsive<DimensionValue>The height of the element. See MDN.
minHeightResponsive<DimensionValue>The minimum height of the element. See MDN.
maxHeightResponsive<DimensionValue>The maximum height of the element. See MDN.
Positioning
NameTypeDescription
positionResponsive<'static''relative''absolute''fixed''sticky'>Specifies how the element is positioned. See MDN.
topResponsive<DimensionValue>The top position for the element. See MDN.
bottomResponsive<DimensionValue>The bottom position for the element. See MDN.
leftResponsive<DimensionValue>The left position for the element. See MDN. Consider using start instead for RTL support.
rightResponsive<DimensionValue>The right position for the element. See MDN. Consider using start instead for RTL support.
startResponsive<DimensionValue>The logical start position for the element, depending on layout direction. See MDN.
endResponsive<DimensionValue>The logical end position for the element, depending on layout direction. See MDN.
zIndexResponsive<number>The stacking order for the element. See MDN.
isHiddenResponsive<boolean>Hides the element.
Accessibility
NameTypeDescription
idstringThe element's unique identifier. See MDN.
excludeFromTabOrderboolean

Whether to exclude the element from the sequential tab order. If true, the element will not be focusable via the keyboard by tabbing. This should be avoided except in rare scenarios where an alternative means of accessing the element or its functionality via the keyboard is available.

aria-labelstringDefines a string value that labels the current element.
aria-labelledbystringIdentifies the element (or elements) that labels the current element.
aria-describedbystringIdentifies the element (or elements) that describes the object.
aria-detailsstringIdentifies the element (or elements) that provide a detailed, extended description for the object.
Advanced
NameTypeDescription
UNSAFE_classNamestringSets the CSS className for the element. Only use as a last resort. Use style props instead.
UNSAFE_styleCSSPropertiesSets inline style for the element. Only use as a last resort. Use style props instead.

Visual options#


Label alignment and position#

By default, the label is positioned above the Picker. The labelPosition prop can be used to position the label to the side. The labelAlign prop can be used to align the label as "start" or "end". For left-to-right (LTR) languages, "start" refers to the left most edge of the Picker and "end" refers to the right most edge. For right-to-left (RTL) languages, this is flipped.

<Picker label="Choose frequency" labelPosition="side" labelAlign="end">
  <Item key="rarely">Rarely</Item>
  <Item key="sometimes">Sometimes</Item>
  <Item key="always">Always</Item>
</Picker>
<Picker
  label="Choose frequency"
  labelPosition="side"
  labelAlign="end"
>
  <Item key="rarely">Rarely</Item>
  <Item key="sometimes">Sometimes</Item>
  <Item key="always">Always</Item>
</Picker>
<Picker
  label="Choose frequency"
  labelPosition="side"
  labelAlign="end"
>
  <Item key="rarely">
    Rarely
  </Item>
  <Item key="sometimes">
    Sometimes
  </Item>
  <Item key="always">
    Always
  </Item>
</Picker>

Quiet#

<Picker label="Choose frequency" isQuiet>
  <Item key="rarely">Rarely</Item>
  <Item key="sometimes">Sometimes</Item>
  <Item key="always">Always</Item>
</Picker>
<Picker label="Choose frequency" isQuiet>
  <Item key="rarely">Rarely</Item>
  <Item key="sometimes">Sometimes</Item>
  <Item key="always">Always</Item>
</Picker>
<Picker
  label="Choose frequency"
  isQuiet
>
  <Item key="rarely">
    Rarely
  </Item>
  <Item key="sometimes">
    Sometimes
  </Item>
  <Item key="always">
    Always
  </Item>
</Picker>

Disabled#

<Picker label="Choose frequency" isDisabled>
  <Item key="rarely">Rarely</Item>
  <Item key="sometimes">Sometimes</Item>
  <Item key="always">Always</Item>
</Picker>
<Picker label="Choose frequency" isDisabled>
  <Item key="rarely">Rarely</Item>
  <Item key="sometimes">Sometimes</Item>
  <Item key="always">Always</Item>
</Picker>
<Picker
  label="Choose frequency"
  isDisabled
>
  <Item key="rarely">
    Rarely
  </Item>
  <Item key="sometimes">
    Sometimes
  </Item>
  <Item key="always">
    Always
  </Item>
</Picker>

Help text#

View guidelines

Both a description and an error message can be supplied to a Picker. The description is always visible unless isInvalid is true and an error message is provided. The error message can be used to help the user fix their input quickly and should be specific to the detected error. All strings should be localized.

function Example() {
  let [animalId, setAnimalId] = React.useState(null);
  let options = [
    { id: 1, name: 'Aardvark' },
    { id: 2, name: 'Cat' },
    { id: 3, name: 'Dog' },
    { id: 4, name: 'Kangaroo' },
    { id: 5, name: 'Koala' },
    { id: 6, name: 'Penguin' },
    { id: 7, name: 'Snake' },
    { id: 8, name: 'Turtle' },
    { id: 9, name: 'Wombat' }
  ];
  let isValid = React.useMemo(() => animalId !== 2 && animalId !== 7, [
    animalId
  ]);

  return (
    <Picker
      isInvalid={!isValid}
      label="Favorite animal"
      description="Pick your favorite animal, you will be judged."
      errorMessage={animalId === 2
        ? 'The author of this example is a dog person.'
        : "Oh no it's a snake! Choose anything else."}
      items={options}
      selectedKey={animalId}
      onSelectionChange={(selected) => setAnimalId(selected)}
    >
      {(item) => <Item>{item.name}</Item>}
    </Picker>
  );
}
function Example() {
  let [animalId, setAnimalId] = React.useState(null);
  let options = [
    { id: 1, name: 'Aardvark' },
    { id: 2, name: 'Cat' },
    { id: 3, name: 'Dog' },
    { id: 4, name: 'Kangaroo' },
    { id: 5, name: 'Koala' },
    { id: 6, name: 'Penguin' },
    { id: 7, name: 'Snake' },
    { id: 8, name: 'Turtle' },
    { id: 9, name: 'Wombat' }
  ];
  let isValid = React.useMemo(
    () => animalId !== 2 && animalId !== 7,
    [animalId]
  );

  return (
    <Picker
      isInvalid={!isValid}
      label="Favorite animal"
      description="Pick your favorite animal, you will be judged."
      errorMessage={animalId === 2
        ? 'The author of this example is a dog person.'
        : "Oh no it's a snake! Choose anything else."}
      items={options}
      selectedKey={animalId}
      onSelectionChange={(selected) =>
        setAnimalId(selected)}
    >
      {(item) => <Item>{item.name}</Item>}
    </Picker>
  );
}
function Example() {
  let [
    animalId,
    setAnimalId
  ] = React.useState(
    null
  );
  let options = [
    {
      id: 1,
      name: 'Aardvark'
    },
    {
      id: 2,
      name: 'Cat'
    },
    {
      id: 3,
      name: 'Dog'
    },
    {
      id: 4,
      name: 'Kangaroo'
    },
    {
      id: 5,
      name: 'Koala'
    },
    {
      id: 6,
      name: 'Penguin'
    },
    {
      id: 7,
      name: 'Snake'
    },
    {
      id: 8,
      name: 'Turtle'
    },
    {
      id: 9,
      name: 'Wombat'
    }
  ];
  let isValid = React
    .useMemo(
      () =>
        animalId !== 2 &&
        animalId !== 7,
      [animalId]
    );

  return (
    <Picker
      isInvalid={!isValid}
      label="Favorite animal"
      description="Pick your favorite animal, you will be judged."
      errorMessage={animalId ===
          2
        ? 'The author of this example is a dog person.'
        : "Oh no it's a snake! Choose anything else."}
      items={options}
      selectedKey={animalId}
      onSelectionChange={(selected) =>
        setAnimalId(
          selected
        )}
    >
      {(item) => (
        <Item>
          {item.name}
        </Item>
      )}
    </Picker>
  );
}

Contextual help#

A ContextualHelp element may be placed next to the label to provide additional information or help about a Picker.

import {Content, ContextualHelp, Heading} from '@adobe/react-spectrum';

<Picker
  label="Engineering major"
  contextualHelp={
    <ContextualHelp variant="info">
      <Heading>Major changes</Heading>
      <Content>
        Once you have changed your major, you cannot change it back.
      </Content>
    </ContextualHelp>
  }
>
  <Item>Aerospace</Item>
  <Item>Mechanical</Item>
  <Item>Civil</Item>
  <Item>Nuclear</Item>
  <Item>Industrial</Item>
  <Item>Chemical</Item>
  <Item>Agricultural</Item>
  <Item>Electrical</Item>
</Picker>
import {
  Content,
  ContextualHelp,
  Heading
} from '@adobe/react-spectrum';

<Picker
  label="Engineering major"
  contextualHelp={
    <ContextualHelp variant="info">
      <Heading>Major changes</Heading>
      <Content>
        Once you have changed your major, you cannot
        change it back.
      </Content>
    </ContextualHelp>
  }
>
  <Item>Aerospace</Item>
  <Item>Mechanical</Item>
  <Item>Civil</Item>
  <Item>Nuclear</Item>
  <Item>Industrial</Item>
  <Item>Chemical</Item>
  <Item>Agricultural</Item>
  <Item>Electrical</Item>
</Picker>
import {
  Content,
  ContextualHelp,
  Heading
} from '@adobe/react-spectrum';

<Picker
  label="Engineering major"
  contextualHelp={
    <ContextualHelp variant="info">
      <Heading>
        Major changes
      </Heading>
      <Content>
        Once you have
        changed your
        major, you
        cannot change
        it back.
      </Content>
    </ContextualHelp>
  }
>
  <Item>
    Aerospace
  </Item>
  <Item>
    Mechanical
  </Item>
  <Item>Civil</Item>
  <Item>Nuclear</Item>
  <Item>
    Industrial
  </Item>
  <Item>Chemical</Item>
  <Item>
    Agricultural
  </Item>
  <Item>
    Electrical
  </Item>
</Picker>

Custom widths#

<Flex direction="column" rowGap="size-150">
  <Picker label="Choose frequency" width="size-3600" maxWidth="100%">
    <Item key="rarely">Rarely</Item>
    <Item key="sometimes">Sometimes</Item>
    <Item key="always">Always</Item>
  </Picker>

  <Picker label="Choose animal" menuWidth="size-6000">
    <Item key="Emu">Emu</Item>
    <Item key="Kangaroo">Kangaroo</Item>
    <Item key="Platypus">Platypus</Item>
  </Picker>
</Flex>
<Flex direction="column" rowGap="size-150">
  <Picker
    label="Choose frequency"
    width="size-3600"
    maxWidth="100%"
  >
    <Item key="rarely">Rarely</Item>
    <Item key="sometimes">Sometimes</Item>
    <Item key="always">Always</Item>
  </Picker>
   <Picker label="Choose animal" menuWidth="size-6000">
    <Item key="Emu">Emu</Item>
    <Item key="Kangaroo">Kangaroo</Item>
    <Item key="Platypus">Platypus</Item>
  </Picker>
</Flex>
<Flex
  direction="column"
  rowGap="size-150"
>
  <Picker
    label="Choose frequency"
    width="size-3600"
    maxWidth="100%"
  >
    <Item key="rarely">
      Rarely
    </Item>
    <Item key="sometimes">
      Sometimes
    </Item>
    <Item key="always">
      Always
    </Item>
  </Picker>
   <Picker
    label="Choose animal"
    menuWidth="size-6000"
  >
    <Item key="Emu">
      Emu
    </Item>
    <Item key="Kangaroo">
      Kangaroo
    </Item>
    <Item key="Platypus">
      Platypus
    </Item>
  </Picker>
</Flex>

Align and direction#

<Flex direction="column" gap="size-150">
  <Picker label="Choose frequency" align="end" menuWidth="size-3000">
    <Item key="rarely">Rarely</Item>
    <Item key="sometimes">Sometimes</Item>
    <Item key="always">Always</Item>
  </Picker>

  <Picker label="Choose animal" direction="top">
    <Item key="Emu">Emu</Item>
    <Item key="Kangaroo">Kangaroo</Item>
    <Item key="Platypus">Platypus</Item>
  </Picker>
</Flex>
<Flex direction="column" gap="size-150">
  <Picker
    label="Choose frequency"
    align="end"
    menuWidth="size-3000"
  >
    <Item key="rarely">Rarely</Item>
    <Item key="sometimes">Sometimes</Item>
    <Item key="always">Always</Item>
  </Picker>
   <Picker label="Choose animal" direction="top">
    <Item key="Emu">Emu</Item>
    <Item key="Kangaroo">Kangaroo</Item>
    <Item key="Platypus">Platypus</Item>
  </Picker>
</Flex>
<Flex
  direction="column"
  gap="size-150"
>
  <Picker
    label="Choose frequency"
    align="end"
    menuWidth="size-3000"
  >
    <Item key="rarely">
      Rarely
    </Item>
    <Item key="sometimes">
      Sometimes
    </Item>
    <Item key="always">
      Always
    </Item>
  </Picker>
   <Picker
    label="Choose animal"
    direction="top"
  >
    <Item key="Emu">
      Emu
    </Item>
    <Item key="Kangaroo">
      Kangaroo
    </Item>
    <Item key="Platypus">
      Platypus
    </Item>
  </Picker>
</Flex>

The open state of the menu can be controlled via the defaultOpen and isOpen props

function Example() {
  let [open, setOpen] = React.useState(false);

  return (
    <Picker
      label="Frequency"
      isOpen={open}
      onOpenChange={setOpen}>
      <Item key="rarely">Rarely</Item>
      <Item key="sometimes">Sometimes</Item>
      <Item key="always">Always</Item>
    </Picker>
  );
}
function Example() {
  let [open, setOpen] = React.useState(false);

  return (
    <Picker
      label="Frequency"
      isOpen={open}
      onOpenChange={setOpen}>
      <Item key="rarely">Rarely</Item>
      <Item key="sometimes">Sometimes</Item>
      <Item key="always">Always</Item>
    </Picker>
  );
}
function Example() {
  let [open, setOpen] =
    React.useState(
      false
    );

  return (
    <Picker
      label="Frequency"
      isOpen={open}
      onOpenChange={setOpen}
    >
      <Item key="rarely">
        Rarely
      </Item>
      <Item key="sometimes">
        Sometimes
      </Item>
      <Item key="always">
        Always
      </Item>
    </Picker>
  );
}

Accessibility#


False positives#

Picker may trigger a known accessibility false positive from automated accessibility testing tools. This is because we include a visually hidden select element alongside the Picker to specifically aid with browser form autocomplete and hide it from screen readers via aria-hidden since users don't need to interact with the hidden select. We manage focus internally so that focusing this hidden select will always shift focus to the Picker's trigger button element instead. Automated accessibility testing tools have no way of knowing that we manage the focus in this way and thus throw this false positive.

To facilitate the suppression of this false positive, the data-a11y-ignore="aria-hidden-focus" data attribute is automatically applied to the problematic element and references the relevant AXE rule. Please use this data attribute to target the problematic element and exclude it from your automated accessibility tests as shown here.

Testing#


The Picker features an overlay that transitions in and out of the page as it is opened and closed. Depending on your device configuration, this overlay may render as a tray or a dropdown. Additionally, the Picker features automatic virtualization and may need specific mocks in a test environment to enable said virtualization properly. Please see the following sections in the testing docs for more information on how to handle these behaviors in your test suite.

Timers

Desktop vs Mobile

Virtualized Components

Long press

Please also refer to React Spectrum's test suite if you find that the above isn't sufficient when resolving issues in your own test cases.