Materialish

Field

A field allows a user to edit text, and provides a label and error message. Fields work with Inputs and Textareas.

🙌 Heads up! This code is editable. The preview above will update to reflect your changes.

Usage

import { Field } from 'materialish';
import 'materialish/materialish.css';

Field

Props

Prop NameDefault ValueDescription
classNameAdditional class name(s) to add to the menu item
requiredfalseWhether or not the value that this field represents is required
childrenRender the Input, Label, and ErrorMessage as children
nodeRefPass a ref to get access to the root node
...restThe rest of the props are spread on the underlying label element

CSS Variables

VariableDefault ValueDescription
--mt-baseFontSize1remThe text size and dimensions of the button are based off of this value
--mt-fontFamily'Roboto'The font family to use for the button text
--mt-field-labelColor#757575The color of the Field.Label text
--mt-field-labelErrorColor#f34335The color of the Field.ErrorMessage text

Field.Input

This is an alias of Input.

Field.TextArea

This is an alias of TextArea.

Field.Label

Props

Prop NameDefault ValueDescription
classNameAdditional class name(s) to add to the menu item
childrenThe value to display as the label
nodeRefPass a ref to get access to the root node
...restThe other props are spread onto the underlying element

Field.ErrorMessage

Props

Prop NameDefault ValueDescription
classNameAdditional class name(s) to add to the menu item
childrenThe message to display as the error
nodeRefPass a ref to get access to the root node
...restThe other props are spread onto the underlying element

Useful Links