Phase 0: Fundament für Inhaus
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m14s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 1m12s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 1m7s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 1m19s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 1m32s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 1m22s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 1m32s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 1m35s
CI / Build-Artefakte aktuell (pull_request) Failing after 1m7s
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m14s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 1m12s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 1m7s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 1m19s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 1m32s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 1m22s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 1m32s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 1m35s
CI / Build-Artefakte aktuell (pull_request) Failing after 1m7s
- Laravel 13 mit Filament 5 (Admin), Inertia 3 + Vue 3 + Vuetify 4 (Material 3) - Anmeldung über Fortify (Login, Passwort vergessen/ändern), keine Selbstregistrierung - Profil mit Profilbild (WebP in festen Größen), Personenseiten, Header mit Avatar-Menü - Material-3-Farbschema aus der Primärfarbe, hell/dunkel/System pro Person - Basis-Branding (Portalname, Logo, Primärfarbe) im Admin unter „Erscheinungsbild“ - Benutzerverwaltung im Admin, Zugang vorläufig über is_admin - vendor/ (ohne Dev-Pakete) und Frontend-Build mitversioniert, Dev-Pakete in vendor-dev/ - PHPUnit-Tests gegen MySQL/MariaDB, Forgejo-CI-Matrix, Docker-Entwicklungsumgebung - VERSION, CHANGELOG.md und CONTRIBUTING.md mit Release-Ablauf Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
7197eaebf2
commit
9c0f8de791
15771 changed files with 1564103 additions and 5 deletions
155
vendor/filament/forms/docs/15-textarea.md
vendored
Normal file
155
vendor/filament/forms/docs/15-textarea.md
vendored
Normal file
|
|
@ -0,0 +1,155 @@
|
|||
---
|
||||
title: Textarea
|
||||
---
|
||||
import AutoScreenshot from "@components/AutoScreenshot.astro"
|
||||
import UtilityInjection from "@components/UtilityInjection.astro"
|
||||
|
||||
## Introduction
|
||||
|
||||
The textarea allows you to interact with a multi-line string:
|
||||
|
||||
```php
|
||||
use Filament\Forms\Components\Textarea;
|
||||
|
||||
Textarea::make('description')
|
||||
```
|
||||
|
||||
<AutoScreenshot name="forms/fields/textarea/simple" alt="Textarea" version="5.x" />
|
||||
|
||||
## Resizing the textarea
|
||||
|
||||
You may change the size of the textarea by defining the `rows()` and `cols()` methods:
|
||||
|
||||
```php
|
||||
use Filament\Forms\Components\Textarea;
|
||||
|
||||
Textarea::make('description')
|
||||
->rows(10)
|
||||
->cols(20)
|
||||
```
|
||||
|
||||
<AutoScreenshot name="forms/fields/textarea/rows" alt="Textarea with custom row size" version="5.x" />
|
||||
|
||||
<UtilityInjection set="formFields" version="5.x">As well as allowing static values, the `rows()` and `cols()` methods also accept functions to dynamically calculate them. You can inject various utilities into the functions as parameters.</UtilityInjection>
|
||||
|
||||
### Autosizing the textarea
|
||||
|
||||
You may allow the textarea to automatically resize to fit its content by setting the `autosize()` method:
|
||||
|
||||
```php
|
||||
use Filament\Forms\Components\Textarea;
|
||||
|
||||
Textarea::make('description')
|
||||
->autosize()
|
||||
```
|
||||
|
||||
Optionally, you may pass a boolean value to control if the textarea should be autosizeable or not:
|
||||
|
||||
```php
|
||||
use Filament\Forms\Components\Textarea;
|
||||
|
||||
Textarea::make('description')
|
||||
->autosize(FeatureFlag::active())
|
||||
```
|
||||
|
||||
<UtilityInjection set="formFields" version="5.x">As well as allowing a static value, the `autosize()` method also accepts a function to dynamically calculate it. You can inject various utilities into the function as parameters.</UtilityInjection>
|
||||
|
||||
<AutoScreenshot name="forms/fields/textarea/autosize" alt="Textarea with autosize" version="5.x" />
|
||||
|
||||
## Making the field read-only
|
||||
|
||||
Not to be confused with [disabling the field](overview#disabling-a-field), you may make the field "read-only" using the `readOnly()` method:
|
||||
|
||||
```php
|
||||
use Filament\Forms\Components\Textarea;
|
||||
|
||||
Textarea::make('description')
|
||||
->readOnly()
|
||||
```
|
||||
|
||||
There are a few differences, compared to [`disabled()`](overview#disabling-a-field):
|
||||
|
||||
- When using `readOnly()`, the field will still be sent to the server when the form is submitted. It can be mutated with the browser console, or via JavaScript. You can use [`saved(false)`](overview#preventing-a-field-from-being-saved) to prevent this.
|
||||
- There are no styling changes, such as less opacity, when using `readOnly()`.
|
||||
- The field is still focusable when using `readOnly()`.
|
||||
|
||||
Optionally, you may pass a boolean value to control if the field should be read-only or not:
|
||||
|
||||
```php
|
||||
use Filament\Forms\Components\Textarea;
|
||||
|
||||
Textarea::make('description')
|
||||
->readOnly(FeatureFlag::active())
|
||||
```
|
||||
|
||||
<UtilityInjection set="formFields" version="5.x">As well as allowing a static value, the `readOnly()` method also accepts a function to dynamically calculate it. You can inject various utilities into the function as parameters.</UtilityInjection>
|
||||
|
||||
## Disabling Grammarly checks
|
||||
|
||||
If the user has Grammarly installed and you would like to prevent it from analyzing the contents of the textarea, you can use the `disableGrammarly()` method:
|
||||
|
||||
```php
|
||||
use Filament\Forms\Components\Textarea;
|
||||
|
||||
Textarea::make('description')
|
||||
->disableGrammarly()
|
||||
```
|
||||
|
||||
Optionally, you may pass a boolean value to control if the field should disable Grammarly checks or not:
|
||||
|
||||
```php
|
||||
use Filament\Forms\Components\Textarea;
|
||||
|
||||
Textarea::make('description')
|
||||
->disableGrammarly(FeatureFlag::active())
|
||||
```
|
||||
|
||||
<UtilityInjection set="formFields" version="5.x">As well as allowing a static value, the `disableGrammarly()` method also accepts a function to dynamically calculate it. You can inject various utilities into the function as parameters.</UtilityInjection>
|
||||
|
||||
## Trimming whitespace
|
||||
|
||||
You can automatically trim whitespace from the beginning and end of the textarea value using the `trim()` method:
|
||||
|
||||
```php
|
||||
use Filament\Forms\Components\Textarea;
|
||||
|
||||
Textarea::make('description')
|
||||
->trim()
|
||||
```
|
||||
|
||||
You may want to enable trimming globally for all textareas, similar to Laravel's `TrimStrings` middleware. You can do this in a service provider using the `configureUsing()` method:
|
||||
|
||||
```php
|
||||
use Filament\Forms\Components\Textarea;
|
||||
|
||||
Textarea::configureUsing(function (Textarea $component): void {
|
||||
$component->trim();
|
||||
});
|
||||
```
|
||||
|
||||
## Textarea validation
|
||||
|
||||
As well as all rules listed on the [validation](validation) page, there are additional rules that are specific to textareas.
|
||||
|
||||
### Length validation
|
||||
|
||||
You may limit the length of the textarea by setting the `minLength()` and `maxLength()` methods. These methods add both frontend and backend validation:
|
||||
|
||||
```php
|
||||
use Filament\Forms\Components\Textarea;
|
||||
|
||||
Textarea::make('description')
|
||||
->minLength(2)
|
||||
->maxLength(1024)
|
||||
```
|
||||
|
||||
You can also specify the exact length of the textarea by setting the `length()`. This method adds both frontend and backend validation:
|
||||
|
||||
```php
|
||||
use Filament\Forms\Components\Textarea;
|
||||
|
||||
Textarea::make('question')
|
||||
->length(100)
|
||||
```
|
||||
|
||||
<UtilityInjection set="formFields" version="5.x">As well as allowing static values, the `minLength()`, `maxLength()` and `length()` methods also accept a function to dynamically calculate them. You can inject various utilities into the function as parameters.</UtilityInjection>
|
||||
Loading…
Add table
Add a link
Reference in a new issue