All components

Native Select

Choose a value using the platform picker.

Examples

Choose a value using the platform picker

React code
import { Label, NativeSelect } from "@accelerate/react/components";

export function Example() {
  return (
    <>
      <Label htmlFor="country">Region</Label>
      <NativeSelect id="country" name="region">
        <option value="americas">Americas</option>
        <option value="emea">EMEA</option>
        <option value="apac">Asia Pacific</option>
      </NativeSelect>
    </>
  );
}
Angular code
import { Component } from "@angular/core";
import { AccLabel, AccNativeSelect } from "@accelerate/angular/components";

@Component({
  selector: "app-example",
  imports: [
    AccLabel,
    AccNativeSelect,
  ],
  template: `
    <label accLabel for="country">Region</label>
    <select accNativeSelect id="country" name="region">
      <option value="americas">Americas</option>
      <option value="emea">EMEA</option>
      <option value="apac">Asia Pacific</option>
    </select>
  `,
})
export class Example {}

Installation

Source preview. The expanded component catalog is ahead of the public npm releases. To run these examples in your own application, use packages built from the SDK source used for the previews or a release that includes the APIs below.

React
@accelerate/ui@0.4.0 and @accelerate/react@0.4.0
Angular
@accelerate/ui@0.4.0 and @accelerate/angular@0.2.0

Load @accelerate/ui/theme.css and put acc-theme on the app or the region using Accelerator components. See the framework setup guide for the theme and adapter conventions.

Usage

Compose native options and option groups.

Import the React component NativeSelect from @accelerate/react/components. For Angular, add AccNativeSelect to the standalone component’s imports and use <select accNativeSelect>.

Examples use these React parts: Label, NativeSelect. The Angular examples show the corresponding directives and template hosts.

API reference

option / optgroup
Use the native option model.
name
Includes the selected value in the submitted form.