Skip to content

Commit d4b6067

Browse files
Add import statement for SimpleAlert component
1 parent f17d707 commit d4b6067

File tree

1 file changed

+15
-32
lines changed

1 file changed

+15
-32
lines changed

README.md

Lines changed: 15 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,17 @@ Make sure you add the following to your `theme.css` file.
3333

3434
## Usage
3535

36-
The alerts can be used in your `infolists` or `forms`, make sure you pick the right component.
36+
Make sure to import the `SimpleAlert` component at the top of your file:
3737

3838
```php
3939
use CodeWithDennis\SimpleAlert\Components\SimpleAlert;
40-
```
40+
````
4141

42-
```php
43-
use CodeWithDennis\SimpleAlert\Components\SimpleAlert;
44-
```
42+
### Predefined Alerts
4543

46-
### Simple Alerts
47-
48-
There are 4 types of simple alerts: `danger`, `info`, `success`, and `warning`.
44+
There are 4 types predefined of simple alerts: `danger`, `info`, `success`, and `warning`.
4945

5046
```php
51-
use CodeWithDennis\SimpleAlert\Components\SimpleAlert;
52-
5347
SimpleAlert::make('example')
5448
->danger()
5549
->info()
@@ -60,8 +54,6 @@ SimpleAlert::make('example')
6054
If you would like to use a [different color](https://filamentphp.com/docs/3.x/support/colors), you can use the `color` method.
6155

6256
```php
63-
use CodeWithDennis\SimpleAlert\Components\SimpleAlert;
64-
6557
SimpleAlert::make('example')
6658
->color('purple')
6759
```
@@ -71,22 +63,24 @@ SimpleAlert::make('example')
7163
By default, simple alerts come with an icon. For example, the `->danger()` method includes a `heroicon-s-x-circle` icon. If you want to use a different icon, you can use the icon method.
7264

7365
```php
74-
use CodeWithDennis\SimpleAlert\Components\SimpleAlert;
75-
//use Illuminate\Support\HtmlString;
76-
7766
SimpleAlert::make('example')
7867
->color('purple')
7968
->icon('heroicon-s-users')
80-
//->icon(new HtmlString('🤓'))
81-
//->icon(new HtmlString(Blade::render('my-custom-icon-component')))
69+
```
70+
71+
Or you can use a custom icon by passing an HTML string or a Blade component to the `icon` method.
72+
73+
```php
74+
SimpleAlert::make('example')
75+
->icon(new HtmlString('🤓'))
76+
->icon(new HtmlString(Blade::render('my-custom-icon-component')))
8277
```
8378

8479
#### Icon Animation
8580

8681
You can add animation to the icon by passing the animation type as the second parameter to the `icon` method. Make sure to use the `IconAnimation` enum for the animation type.
8782

8883
```php
89-
use CodeWithDennis\SimpleAlert\Components\SimpleAlert;
9084
use CodeWithDennis\SimpleAlert\Components\Enums\IconAnimation;
9185

9286
SimpleAlert::make('example')
@@ -98,8 +92,6 @@ SimpleAlert::make('example')
9892
You can change the vertical alignment of the icon by using the `iconVerticalAlignment` method.
9993

10094
```php
101-
use CodeWithDennis\SimpleAlert\Components\SimpleAlert;
102-
10395
SimpleAlert::make('example')
10496
->iconVerticalAlignment('start'), // possible values: start, center
10597
```
@@ -109,8 +101,6 @@ SimpleAlert::make('example')
109101
You can add a title to the alert by using the `title` method.
110102

111103
```php
112-
use CodeWithDennis\SimpleAlert\Components\SimpleAlert;
113-
114104
SimpleAlert::make('example')
115105
->title('Hoorraayy! Your request has been approved! 🎉')
116106
```
@@ -120,8 +110,6 @@ SimpleAlert::make('example')
120110
You can add a description to the alert by using the `description` method.
121111

122112
```php
123-
use CodeWithDennis\SimpleAlert\Components\SimpleAlert;
124-
125113
SimpleAlert::make('example')
126114
->description('This is the description')
127115
```
@@ -131,8 +119,6 @@ SimpleAlert::make('example')
131119
You can add a border to the alert by using the `border` method.
132120

133121
```php
134-
use CodeWithDennis\SimpleAlert\Components\SimpleAlert;
135-
136122
SimpleAlert::make('example')
137123
->border()
138124
```
@@ -141,8 +127,7 @@ SimpleAlert::make('example')
141127
You can also add actions to the alert by using the `actions` method. All regular action features are supported.
142128

143129
```php
144-
use CodeWithDennis\SimpleAlert\Components\SimpleAlert;
145-
use Filament\Forms\Components\Actions;
130+
use Filament\Actions\Action;
146131

147132
SimpleAlert::make('example')
148133
->columnSpanFull()
@@ -163,8 +148,7 @@ SimpleAlert::make('example')
163148
You can change the vertical alignment of the actions by using the `actionsVerticalAlignment` method.
164149

165150
```php
166-
use CodeWithDennis\SimpleAlert\Components\SimpleAlert;
167-
use Filament\Forms\Components\Actions;
151+
use Filament\Actions\Action;
168152

169153
SimpleAlert::make('example')
170154
->actionsVerticalAlignment('start'), // possible values: start, center
@@ -174,8 +158,7 @@ SimpleAlert::make('example')
174158
### Example
175159

176160
```php
177-
use CodeWithDennis\SimpleAlert\Components\SimpleAlert;
178-
use Filament\Forms\Components\Actions;
161+
use Filament\Actions\Action;
179162

180163
SimpleAlert::make('example')
181164
->success()

0 commit comments

Comments
 (0)