Inputs

Hush provides a quick way to use inputs without having to write html.
When you use a component way you can just give all necessary attributes to the component. For example:

<x-hush-input type="number" name="input" step="0.1" class="input" id="input">

When you use a helper way or a config way, then all of not described below attributes you should to put in 'attributes' array.

Common inputs

For this types you may specify:

  • 'type' - any of the supported by html input type, for some types exists some custom properties, which will be described in below sections.
  • 'name' of the field.
  • 'value' - which is not necessary, may contain string, bool, int, array or closure. If is not set, then hush will try to get field with name which is equal to 'name' field value.
  • 'default' - if not value is provided, then this value will be printed
  • 'placeholder' of the input. If not specified, label will be printed instead.
  • 'slugify' - serve to print slugified version of current field, selector of that the target field should be specified in its value.
  • 'label' - label of the field. Works only with config way.

Checkbox and radio

For component way for this types exists custom property 'checked', which should contain boolean. In config / helper way it will be automatically added when hush will compare it value.

Date

Hush provides date fields, it can be date, datetime, daterange or datetimerange.
When using it in component way, you should specify 'class' attribute and set 'type' to text.
When using it in helper way, you should specify it in 'type' attribute.

File

For this type exists two additional attributes:

  • 'multiple' - enables or disables ability to upload multiple files by that field.
  • 'preview' - if you upload images, it will enable their preview.
  • 'preview-width' - class which will be attached to each processed preview item.
  • 'delete' - if is not set or is true then delete buttons will be shown.

Select

For select fields 'placeholder' attribute serve to specify text of the first option and also for select fields exists 2 custom properties:

  • 'options' - array or closure, which should return array like [$option_value => $option_text]
  • 'multiple' - enables or disables multiple value selection. Scopes will be added to input name automatically.

NOTE: For multiple selects required to specify 'value' attribute.

Text and textarea

For common text and textarea fields you should use common way of definition, but if you need multilingual fields, there are some custom options for that:

  • 'multiligual' - defines that hush need to draw multilingual field.
  • 'multilirow' - defines how to display that field, as one input or as one input for each language.
  • 'field-width' - serve to specify field width, value will be rendered in class attribute, so you can use bootstrap grid system.

WYSIWYG and Codemirror

If you need a wysiwyg or code editor, you should specify it in 'class' attribute.