All components

Input

Collect a short text value.

Examples

Collect a short text value

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

export function Example() {
  return (
    <>
      <Label htmlFor="project-name">Project name</Label>
      <Input id="project-name" name="project" placeholder="Operations console" maxLength={60} />
    </>
  );
}
Angular code
import { Component } from "@angular/core";
import { AccLabel, AccInput } from "@accelerate/angular/components";

@Component({
  selector: "app-example",
  imports: [
    AccLabel,
    AccInput,
  ],
  template: `
    <label accLabel for="project-name">Project name</label>
    <input accInput id="project-name" name="project" placeholder="Operations console" maxlength="60">
  `,
})
export class Example {}

Required email input

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

export function Example() {
  return (
    <>
      <Label htmlFor="reviewer-email">Reviewer email</Label>
      <Input id="reviewer-email" name="email" type="email" autoComplete="email" required />
    </>
  );
}
Angular code
import { Component } from "@angular/core";
import { AccLabel, AccInput } from "@accelerate/angular/components";

@Component({
  selector: "app-example",
  imports: [
    AccLabel,
    AccInput,
  ],
  template: `
    <label accLabel for="reviewer-email">Reviewer email</label>
    <input accInput id="reviewer-email" name="email" type="email" autocomplete="email" required>
  `,
})
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

Native input; passes through type, value, name, validation, disabled state and form bindings.

Import the React component Input from @accelerate/react/components. For Angular, add AccInput to the standalone component’s imports and use <input accInput>.

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

API reference

type / name
Use native input types and form field names.
maxlength / required
Use browser validation where appropriate.