Fields

Date

Basics

Contains all Basic Methods.

The Date field is equivalent to <input type="date">.

use MoonShine\UI\Fields\Date;
 
Date::make('Created at', 'created_at')
<x-moonshine::form.wrapper label="Created at">
<x-moonshine::form.input
type="date"
name="created_at"
/>
</x-moonshine::form.wrapper>

Creation date

Creation date

Basic Methods

Date and Time

Using the withTime() method allows you to enter both date and time in the field.

withTime()
Date::make('Created at', 'created_at')
->withTime()

date_time

date_time_dark

Format

The format() method allows you to change the display format of the field's value in preview.

format(string $format)
Date::make('Created at', 'created_at')
->format('d.m.Y')

Extensions

The field supports various extensions for help and input control.

expansion

expansion_dark

Copy

The copy() method adds a button to copy the field's value.

copy(string $value = '{{value}}')

Example usage:

Date::make('Created at', 'created_at')
->copy()

Hide Value

The eye() method adds a button to show/hide the field's value (for example, for passwords).

eye()

Example usage:

Date::make('Created at', 'created_at')
->eye()

Lock

The locked() method adds a lock icon to the field.

locked()

Example usage:

Date::make('Created at', 'created_at')
->locked()

Suffix

The suffix() method adds a suffix to the input field.

suffix(string $ext)

Preview Edit

This field supports preview editing.

Reactivity

This field supports reactivity.