4.8.1 • Published 3 years ago

@workday/canvas-kit-react-text-input v4.8.1

Weekly downloads
1,454
License
Apache-2.0
Repository
-
Last release
3 years ago

Canvas Kit Text Input

Canvas-styled React text input components.

Installation

yarn add @workday/canvas-kit-react

or

yarn add @workday/canvas-kit-react-text-input

TextInput

Usage

Simple Example

Note: While a base input component is provided in this package, it is not accessible when used as is. It should be used in tandem with FormField to be made fully accessible (see below).

import * as React from 'react';
import TextInput from '@workday/canvas-kit-react-text-input';

<TextInput placeholder="Placeholder" value={this.state.value} onChange={() => {}} />;

Accessible Example

import * as React from 'react';
import TextInput from '@workday/canvas-kit-react-text-input';
import FormField from '@workday/canvas-kit-react-form-field';

// Accessible default state
<FormField label="My Field" inputId="my-input-field">
  <TextInput placeholder="Placeholder" value={this.state.value} onChange={() => {}} />;
</FormField>

// Accessible error state
<FormField
  label="My Field"
  inputId="my-input-field"
  hintText="Helpful text to resolve error"
  hintId="my-input-field-error"
  error={FormField.ErrorType.Error}
>
  <TextInput placeholder="Placeholder" value={this.state.value} onChange={() => {}} />;
</FormField>

If use inside a FormField doesn't work for your use case, you can use the aria-labelledBy attribute.

import * as React from 'react';
import TextInput from '@workday/canvas-kit-react-text-input';
<label id="123">Label</label>
...
<TextInput placeholder="Placeholder" value={this.state.value} onChange={() => {}} aria-labelledBy="123" />;

Static Properties

ErrorType: ErrorType

<TextInput error={TextInput.ErrorType.Alert} />

Component Props

Required

label: string

The label text displayed for the input.

Optional

disabled: boolean

Whether or not the input is disabled.

Default: false


error: ErrorType

The type of error to display, if any.

TypeDescription
ErrorRed outline with error icon.
AlertYellow outline with alert icon.

Default: undefined


hasIcon: boolean

Whether or not the input will have an icon displayed. If yes, extra padding will be added to the right.

Default: false


inputRef: React.Ref<HTMLInputElement>

The ref callback for the inner input element.

Default: undefined


onChange: React.ChangeEventHandler<HTMLInputElement>

The callback fired when the value is changed.

Default: undefined


placeholder: string

Placeholder text to be displayed if there is no input value.

Default: ''


readOnly: boolean

If true, user will be unable to interact with the field.

Default: false


type: string

HTML5 input type

Default: text


value: any

Input value

Default: undefined


4.8.3

3 years ago

4.8.2

3 years ago

4.8.1

3 years ago

4.8.0

3 years ago

4.7.1-next.18

3 years ago

4.7.1-next.14

3 years ago

4.7.1-next.15

3 years ago

4.7.1-next.16

3 years ago

4.7.1-next.0

3 years ago

4.7.1-next.1

3 years ago

4.7.1-next.2

3 years ago

4.7.1-next.3

3 years ago

4.7.1-next.4

3 years ago

4.7.1-next.5

3 years ago

4.7.1-next.6

3 years ago

4.7.1-next.7

3 years ago

4.7.1-next.8

3 years ago

4.7.1-next.9

3 years ago

4.7.1-next.10

3 years ago

4.7.1-next.11

3 years ago

4.7.1-next.12

3 years ago

4.7.0

3 years ago

4.6.1-next.3

3 years ago

4.6.1-next.2

3 years ago

4.6.1-next.1

3 years ago

4.6.0

3 years ago

4.5.2-next.3

3 years ago

4.5.2-next.1

3 years ago

4.5.2-next.2

3 years ago

4.5.2-next.0

3 years ago

4.5.1

3 years ago

4.5.1-next.3

3 years ago

4.5.1-next.4

3 years ago

4.5.1-next.2

3 years ago

4.5.1-next.1

3 years ago

4.5.1-next.0

3 years ago

4.5.0

3 years ago

4.4.3-next.17

3 years ago

4.4.3-next.16

3 years ago

4.4.3-next.18

3 years ago

4.4.3-next.15

3 years ago

4.4.3-next.14

3 years ago

4.4.3-next.13

3 years ago

4.4.3-next.12

3 years ago

4.4.3-next.11

3 years ago

5.0.0-beta.0

3 years ago

4.4.3-next.10

3 years ago

4.4.3-next.9

3 years ago

4.4.3-next.8

3 years ago

4.4.3-next.7

3 years ago

4.4.3-next.6

3 years ago

4.4.3-next.5

3 years ago

4.4.3-next.4

3 years ago

4.4.3-next.3

3 years ago

4.4.3-next.0

3 years ago

4.4.3-next.1

3 years ago

4.4.2

3 years ago

4.4.2-next.4

3 years ago

4.4.2-next.3

3 years ago

4.4.2-next.2

3 years ago

4.4.1-next.4

3 years ago

4.4.1

3 years ago

4.4.1-next.3

3 years ago

4.4.1-next.2

3 years ago

4.4.1-next.1

3 years ago

4.4.1-next.0

3 years ago

4.3.2-next.6

3 years ago

4.4.0

3 years ago

4.3.2-next.4

3 years ago

4.3.2-next.3

3 years ago

4.3.2-next.5

3 years ago

4.3.2-next.2

3 years ago

4.3.2-next.1

3 years ago

4.3.2-next.0

3 years ago

4.3.1

4 years ago

4.3.1-next.4

4 years ago

4.3.1-next.3

4 years ago

4.3.1-next.2

4 years ago

4.3.1-next.1

4 years ago

4.3.1-next.0

4 years ago

4.3.0

4 years ago

4.1.3-next.28

4 years ago

4.1.3-next.27

4 years ago

4.1.3-next.26

4 years ago

4.1.3-next.25

4 years ago

4.1.3-next.24

4 years ago

4.1.3-next.23

4 years ago

4.1.3-next.22

4 years ago

4.1.3-next.21

4 years ago

4.1.3-next.20

4 years ago

4.1.3-next.17

4 years ago

4.1.3-next.18

4 years ago

4.1.3-next.16

4 years ago

4.2.0

4 years ago

4.1.3-next.13

4 years ago

4.1.3-next.10

4 years ago

4.1.3-next.11

4 years ago

4.1.3-next.12

4 years ago

4.1.3-next.8

4 years ago

4.1.3-next.9

4 years ago

4.1.3-next.6

4 years ago

4.1.3-next.7

4 years ago

4.1.3-next.4

4 years ago

4.1.3-next.3

4 years ago

4.1.3-next.0

4 years ago

4.1.3-next.1

4 years ago

4.1.2

4 years ago

4.0.3

4 years ago

4.1.2-next.0

4 years ago

4.0.2

4 years ago

4.1.1

4 years ago

4.1.1-next.5

4 years ago

4.1.1-next.4

4 years ago

4.1.1-next.3

4 years ago

4.1.1-next.0

4 years ago

4.1.1-next.2

4 years ago

4.0.1-next.18

4 years ago

4.1.0

4 years ago

4.0.1-next.17

4 years ago

4.0.1-next.16

4 years ago

4.0.1-next.15

4 years ago

4.0.1-next.14

4 years ago

4.0.1

4 years ago

3.9.1

4 years ago

4.0.1-next.12

4 years ago

4.0.1-next.11

4 years ago

4.0.1-next.10

4 years ago

4.0.1-next.9

4 years ago

4.0.1-next.7

4 years ago

4.0.1-next.8

4 years ago

4.0.1-next.6

4 years ago

4.0.1-next.5

4 years ago

4.0.1-next.4

4 years ago

4.0.1-next.1

4 years ago

4.0.1-next.2

4 years ago

4.0.1-next.0

4 years ago

4.0.0

4 years ago

3.8.1-next.16

4 years ago

3.8.1-next.17

4 years ago

3.9.0

4 years ago

4.0.0-beta.5

4 years ago

3.8.1-next.15

4 years ago

3.8.1-next.14

4 years ago

3.8.1-next.13

4 years ago

3.8.1-next.12

4 years ago

3.8.1-next.11

4 years ago

3.8.1-next.10

4 years ago

3.8.1-next.7

4 years ago

3.8.1-next.8

4 years ago

3.8.1-next.9

4 years ago

3.8.1-next.6

4 years ago

3.8.1-next.5

4 years ago

3.8.1-next.4

4 years ago

3.8.1-next.3

4 years ago

3.8.1-next.2

4 years ago

3.8.1-next.0

4 years ago

3.8.1-next.1

4 years ago

3.8.0

4 years ago

3.7.1-next.8

4 years ago

3.7.1-next.7

4 years ago

3.7.1-next.6

4 years ago

3.7.1-next.3

4 years ago

3.7.1-next.4

4 years ago

3.7.1-next.5

4 years ago

4.0.0-beta.4

4 years ago

3.7.1-next.2

4 years ago

3.7.1-next.0

4 years ago

4.0.0-beta.3

4 years ago

4.0.0-beta.2

4 years ago

3.6.1-next.14

4 years ago

3.7.0

4 years ago

3.6.1-next.13

4 years ago

3.6.1-next.12

4 years ago

3.6.1-next.11

4 years ago

3.6.1-next.10

4 years ago

3.6.1-next.9

4 years ago

3.6.1-next.8

4 years ago

3.6.1-next.7

4 years ago

3.6.1-next.6

4 years ago

3.6.1-next.5

4 years ago

3.6.1-next.4

4 years ago

3.6.1-next.3

4 years ago

3.6.1-next.2

4 years ago

3.6.1-next.1

4 years ago

3.6.1-next.0

4 years ago

4.0.0-beta.1

4 years ago

3.5.1-next.10

4 years ago

3.6.0

4 years ago

3.4.1

4 years ago

3.5.1-next.9

4 years ago

3.5.1-next.8

4 years ago

4.0.0-beta.0

4 years ago

3.5.1-next.7

4 years ago

3.5.1-next.6

4 years ago

3.5.1-next.5

4 years ago

3.5.1-next.1

4 years ago

3.5.1-next.2

4 years ago

3.5.1-next.3

4 years ago

3.5.1-next.4

4 years ago

3.5.1-next.0

4 years ago

3.5.0

4 years ago

3.4.1-next.17

4 years ago

3.4.1-next.16

4 years ago

3.4.1-next.15

4 years ago

3.4.1-next.14

4 years ago

3.4.1-next.13

4 years ago

3.4.1-next.12

4 years ago

3.4.1-next.11

4 years ago

3.4.1-next.10

4 years ago

3.4.1-next.8

4 years ago

3.4.1-next.9

4 years ago

3.4.1-next.6

4 years ago

3.4.1-next.7

4 years ago

3.4.1-next.5

4 years ago

3.4.1-next.4

4 years ago

3.4.1-next.3

4 years ago

3.4.1-next.2

4 years ago

3.4.1-next.0

4 years ago

3.4.1-next.1

4 years ago

3.3.3-next.31

4 years ago

3.4.0

4 years ago

3.3.3-next.30

4 years ago

3.3.3-next.29

4 years ago

3.3.3-next.28

4 years ago

3.3.3-next.27

4 years ago

3.3.3-next.26

4 years ago

3.3.3-next.25

4 years ago

3.3.3-next.21

4 years ago

3.3.3-next.19

4 years ago

3.3.3-next.18

4 years ago

3.3.3-next.17

4 years ago

3.3.3-next.15

4 years ago

3.3.3-next.14

4 years ago

3.3.3-next.16

4 years ago

3.3.2

4 years ago

3.3.0

4 years ago

3.2.0

4 years ago

3.1.0

4 years ago

3.0.1

5 years ago

3.0.0

5 years ago

3.0.0-beta.1

5 years ago

3.0.0-beta.0

5 years ago

3.0.0-alpha.9

5 years ago

3.0.0-alpha.7

5 years ago

3.0.0-alpha.6

5 years ago

3.0.0-alpha.5

5 years ago

3.0.0-alpha.4

5 years ago

3.0.0-alpha.3

5 years ago

3.0.0-alpha.2

5 years ago

3.0.0-alpha.1

5 years ago