Text

You're browsing the documentation for an old version of MoonShine. Consider upgrading your project to MoonShine 2.x.

The text field includes all the basic methods

use MoonShine\Fields\Text;
 
//...
 
public function fields(): array
{
return [
Text::make('Title', 'title')
];
}
 
//...

# Mask

Use the mask method if you want to add a mask to the field

//...
 
public function fields(): array
{
return [
Text::make('Title', 'title')
->mask('7 (999) 999-99-99')
];
}
 
//...

# Extensions

//...
 
public function fields(): array
{
return [
Text::make('Title', 'title')
// Copy input value to clipboard
->copy()
// Disable/enable input
->locked()
// Expansion
->expansion('kg')
// Switch type password/text
->eye()
];
}
 
//...

The copy method uses the Clipboard API which is only available for HTTPS or localhost