Skip to content

Commit 9705252

Browse files
committed
update icon fieldtype docs
closes #1816
1 parent c032469 commit 9705252

1 file changed

Lines changed: 20 additions & 8 deletions

File tree

  • content/collections/fieldtypes

content/collections/fieldtypes/icon.md

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,9 @@ screenshot_dark: fieldtypes/screenshots/v6/icon-dark.webp
99
options:
1010
-
1111
id: nKVDUK7I
12-
name: directory
12+
name: set
1313
type: string
14-
description: 'Optionally set the path to the directory containing desired icons relative to the project’s root. Default: uses system icons.'
15-
required: false
16-
-
17-
id: 752XSotc
18-
name: folder
19-
type: string
20-
description: 'Optionally set a subdirectory contain a specific set of icons.'
14+
description: "Name of a custom icon set. Uses Statamic's icon set by default."
2115
required: false
2216
-
2317
id: u8yCCuXb
@@ -53,3 +47,21 @@ Icon fields return inline string of the selected SVG icon.
5347
```html
5448
<svg viewBox="0 0 24 24"><path fill="currentColor" d="M11.983 0a12.206 12.206 0 0 0-8.51 3.653A11.8 11.8 0 0 0 0 12.207C-.008 18.712 5.26 23.992 11.765 24h.249c6.678-.069 12.04-5.531 11.986-12.209C24.015 5.293 18.76.013 12.262-.003L11.983 0zM10.5 16.542a1.475 1.475 0 0 1 1.421-1.529l.028-.001h.027c.82.002 1.492.651 1.523 1.47a1.475 1.475 0 0 1-1.419 1.529l-.03.001h-.027a1.53 1.53 0 0 1-1.523-1.47zM11 12.5v-6a1 1 0 0 1 2 0v6a1 1 0 0 1-2 0z"></path></svg>
5549
```
50+
51+
## Icon Sets
52+
53+
By default, the Icon fieldtype uses Statamic's built-in icons. However, you can register a custom icon set in your `AppServiceProvider` and specify it in the field's config.
54+
55+
```php
56+
// AppServiceProvider.php
57+
use Statamic\Facades\Icon; // [tl! ++]
58+
Icon::register('heroicons', base_path('resources/heroicons')); // [tl! ++]
59+
```
60+
61+
```yaml
62+
-
63+
handle: favourite_icon
64+
field:
65+
type: icon
66+
set: heroicons # [tl! ++]
67+
```

0 commit comments

Comments
 (0)