Text
You're browsing the documentation for an old version of MoonShine. Consider upgrading your project to MoonShine 2.x.
-
Sections
The text field includes all the basic methods
use MoonShine\Fields\Text; //... public function fields(): array{ return [ Text::make('Title', 'title') ];} //...
![](https://moonshine.cutcode.dev/screenshots/input.png)
# 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') ];} //...
![](https://moonshine.cutcode.dev/screenshots/mask.png)
# 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() ];} //...
![](https://moonshine.cutcode.dev/screenshots/expansion.png)
The copy
method uses the Clipboard API
which is only available for HTTPS or localhost