2.3.0 • Published 8 months ago

@wedgekit/input v2.3.0

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

@wedgekit/input

Purpose

The Input component is a styled, slightly opinionated wrapper around an HTML input where the user can enter data.

Basic Implementation

import Input from '@wedgekit/core';

const Example = () => {
  const [value, setValue] = React.useState('');

  return <Input label="Input Component Example" value={value} onChange={setValue} />;
};

render(<Example />);

Props

In addition to the props listed below, all native and React HTML attributes will be passed through.

label

Type: string

Required: ✅

A label is required for all Wedgekit inputs. If you do not want to display the label, you can use labelHidden.

value

Type: string

Required: ✅

Used in conjunction with onChange to control the value of the input externally.

onChange

Type: onChange: (value: string, name: string, event: SyntheticEvent<HTMLInputElement>) => void

Required: ✅

Called when the value of the input has changed. Allows for externally controlling the component; as well as any desired side effects.

className

Type: string

Required: ❌

This is exposed but is only here so that styled-components will be able to style components correctly. Please do not use this unless you really know what you are doing.

disabled

Type: boolean

Required: ❌

Specifies styling and disabled the text input. Disabled elements aren't editable or selectable/focusable, and their data will not be submitted with the form.

forwardedRef

Type: React.Ref

Required: ❌

The forwarded ref giving a user access to the underlying HTML input.

fullWidth

Type: boolean

Required: ❌

Indicates whether the input should span the full width of the parent element

id

Type: `string'

Required: ❌

An ID which will be passed to the underlying HTML element.

info

Type InfoObject

Required: ❌

An object which is necessary if you want to display an info button for the input.

invalid

Type: boolean

Required: ❌

No longer supported. Instead pass 'status'="error" To be removed in v3.0.0

labelHidden

Type: boolean

Required: ❌

Indicates whether to visibly display the label. The label will always be available to users of screen readers via aria-label.

labelInline

Type: boolean

Required: ❌

Indicates whether the input's label will display inline with it to its left

placeholder

Type: string

Required: ❌

Text that appears in the input when it has no value set

readOnly

Type: boolean

Required: ❌

Specifies styling and renders the input as read only. Read only elements can be tabbed through/focused. Their data isn't editable, but it will be submitted with the form. Read only is only supported for input and input wrapping components.

renderIcon

Type: () => JSX.Element

Required: ❌

A render prop for optionally displaying an icon within the input.

<Input

  {...props}

  renderIcon={() => (

    <InteracticeWrapper onClick={() => { console.log('do something')}}> // an interactive wrapper is optional

      <Icon>my_icon</Icon>

    </InteractiveWrapper>

  )}

/>

Please note that the input handles the icon's sizing, and it is not reccomended to surround the icon with an <IconWidth/> tag. The icon will be resized to have a max height and width of 15px.

required

Type: boolean

Required: ❌

Indicates whether the input is required

status

Type: 'default' | 'error' | 'success' | 'pending'

Required: ❌

Indicates form validation status - affects input style only

tabIndex

Type: number

Required: ❌

Property used to really font keyboard users

onBlur

Type: (event: SyntheticEvent<*>) => void

Required: ❌

An optional callback when focus leaves the input

onFocus

Type: (event: SyntheticEvent<*>) => void

Required: ❌

An optional callback when the input is focused

onKeyDown

Type: (event: SyntheticEvent<*>) => void

Required: ❌

An optional callback when a key is pressed

onSubmit

Type: (value: string, event: SyntheticEvent<HTMLButtonElement>) => void

Required: ❌

An optional callback when the user hits 'Enter' while focused in the input

Other Components

2.3.0

8 months ago

2.0.6-tc.0

2 years ago

2.2.1

1 year ago

2.0.3

2 years ago

2.2.0

2 years ago

2.0.2

2 years ago

2.0.5

2 years ago

2.2.2

1 year ago

2.0.4

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

2.0.2-tc.8

2 years ago

2.0.2-tc.9

2 years ago

2.0.2-tc.7

2 years ago

2.1.1-tc.1

2 years ago

2.1.1-tc.0

2 years ago

2.1.0

2 years ago

2.0.5-tc.0

2 years ago

2.0.5-tc.4

2 years ago

2.0.5-tc.3

2 years ago

2.0.5-tc.2

2 years ago

2.0.5-tc.1

2 years ago

2.0.5-tc.6

2 years ago

2.0.5-tc.5

2 years ago

1.0.2

2 years ago

1.0.1

3 years ago

1.0.0

3 years ago

1.0.5-tc.0

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

0.7.0

3 years ago

0.6.1-tc.0

3 years ago

0.6.2-tc.0

3 years ago

0.6.3

3 years ago

0.6.2

3 years ago

0.6.1

3 years ago

0.6.0

3 years ago

0.5.3

3 years ago

0.5.2

3 years ago

0.5.1

3 years ago

0.5.0

3 years ago

0.4.14

3 years ago

0.4.13-tc.0

3 years ago

0.4.13

3 years ago

0.4.12

3 years ago

0.4.12-tc.0

3 years ago

0.4.11

3 years ago

0.4.9-tc.1

3 years ago

0.4.10

3 years ago

0.4.10-tc.0

3 years ago

0.4.10-tc.2

3 years ago

0.4.10-tc.1

3 years ago

0.4.9-tc.0

3 years ago

0.4.9

3 years ago

0.4.8

3 years ago

0.4.5

3 years ago

0.4.4

3 years ago

0.4.7

3 years ago

0.4.6

3 years ago

0.4.3

3 years ago

0.4.2

3 years ago

0.4.1

3 years ago

0.4.0

3 years ago

0.3.0

3 years ago

0.2.0

3 years ago

0.1.0

3 years ago