Skip to content

Commit dbfe551

Browse files
committed
Update 01-overview.md
1 parent 420f593 commit dbfe551

File tree

1 file changed

+40
-5
lines changed

1 file changed

+40
-5
lines changed

packages/schemas/docs/05-primes/01-overview.md

+40-5
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,48 @@ import UtilityInjection from "@components/UtilityInjection.astro"
99

1010
Within Filament schemas, prime components are the most basic building blocks that can be used to insert arbitrary content into a schema, such as text and images. As the name suggests, prime components are not divisible and cannot be made simpler.
1111

12-
Some examples of what prime components can be used for include:
12+
<AutoScreenshot name="primes/overview/example" alt="An example of using prime components to set up two-factor authentication." version="4.x" />
1313

14-
- Displaying instructions to the user.
15-
- Displaying an image like a QR code that the user can scan.
16-
- Displaying a button that the user can click to perform an action.
14+
In this example, prime components are being used to display instructions to the user, a QR code that the user can scan, and a button that the user can click to complete two-factor authentication setup.
1715

18-
<AutoScreenshot name="primes/overview/example" alt="An example of using prime components to set up two factor authentication." version="4.x" />
16+
```php
17+
use Filament\Actions\Action;
18+
use Filament\Schemas\Components\Image;
19+
use Filament\Schemas\Components\Section;
20+
use Filament\Schemas\Components\Text;
21+
use Filament\Schemas\Components\UnorderedList;
22+
23+
$schema
24+
->components([
25+
Text::make('Scan this QR code with your authenticator app:')
26+
->color('neutral'),
27+
Image::make(
28+
url: asset('images/qr.jpg'),
29+
alt: 'QR code to scan with an authenticator app',
30+
)
31+
->imageHeight('12rem')
32+
->alignCenter(),
33+
Section::make()
34+
->schema([
35+
Text::make('Please save the following recovery codes in a safe place. They will only be shown once, but you\'ll need them if you lose access to your authenticator app:')
36+
->weight(FontWeight::Bold)
37+
->color('neutral'),
38+
UnorderedList::make(fn (): array => array_map(
39+
fn (string $recoveryCode): Text => Text::make($recoveryCode)
40+
->copyable()
41+
->fontFamily(FontFamily::Mono)
42+
->size('xs')
43+
->color('neutral'),
44+
['tYRnCqNLUx-3QOLNKyDiV', 'cKok2eImKc-oWHHH4VhNe', 'C0ZstEcSSB-nrbyk2pv8z', '49EXLRQ8MI-FpWywpSDHE', 'TXjHnvkUrr-KuiVJENPmJ', 'BB574ookll-uI20yxP6oa', 'BbgScF2egu-VOfHrMtsCl', 'cO0dJYqmee-S9ubJHpRFR'],
45+
))
46+
->size('xs'),
47+
])
48+
->compact()
49+
->secondary(),
50+
Action::make('complete')
51+
->label('Complete authenticator setup'),
52+
])
53+
```
1954

2055
In these examples, the prime components are not associated with any other components in the schema, they are standalone.
2156

0 commit comments

Comments
 (0)