Slugs

import Slug from 'frui/fields/Slug';
Copy

Props

Slugs accepts all props of a standard HTML Input element. See Moz for standard input attributes.

NameTypeRequiredNotes
errorstringNoStandard error input
onUpdateFunctionNoUpdate event handler
passRefLegacyRefNoStandard ref input
styleCSS ObjectNoStandard CSS input
classNamestringNoStandard class name input

Basic

Number fields display commas and can limit decimal length. The value for numbers removes commas.

<Slug value="I am a Title" />
Copy

Events

onUpdate is like onChange except the value is passed instead of the change event.

<Slug defaultValue="I am a Title" onUpdate={value => alert(value)} />
Copy

On Change

The onChange event is triggered when the value has changed. The following arguments are passed to the event handler:

NameTypeSample
eventEvent Objectsee: Change Event

On Update

The onUpdate event is triggered when the value has been updated. The following arguments are passed to the event handler:

NameTypeSample
valuestring`foobar`

Errors

You can pass the error prop to highlight the input field red.

<Input error={string|true} defaultValue="I am not a Title" />
Copy