Field Types and Examples

Available Field Types

Devise ships with a bunch of useful fields for you to drop in to your slices.

Checkbox

The checkbox field is for boolean (true / false) values in your website:

@section('template')
  <div v-if="devise.myCheckbox.checked">
    Hey! That checkbox must be on!
  </div>
@endsection

@section('component')
  <script>
    var component = {
      fields: {
        myCheckbox: {
          type: 'checkbox',
          label: 'My Checkbox'
        }
      }
    }
  </script>
@endsection

Color

Loads a color picker and returns a hex value

Date/Time

Loads a date / time picker and returns a string. The format option is modeled after the Momentjs api. Devise actually uses the smaller dayjs but the API is the same. See options here

File

Image

Loads a field to put the address of an image or select an image from the media manager. If you use the media manager you can select a source image and Devise will resize and attempt to optimize the image. Below are a few examples of how to utilize some different scenarios

Simple Image Implementation

Responsive image implementation

Responsive images can be accessed via the media property. Example: devise.someImage.media.large which you could use. However, Devise ships with a directive that makes choosing the image automagic.

Background responsive image

Number

Select

The select field gives you an opportunity to give the content manager a chance to change values that might effect layout, or maybe, just print out the value. Below shows how you could implement a dynamic v-bind class and print out it's value.

Text

Text Area

Wysiwyg

The WYSIWYG provide a rich-text editor where you can add text with styles, headers, and inject images.

Last updated