Icons in forms

Hi, is it possible to put a icon from hero icons in a selection so i can display it on my page?
Solution:
I am just reading the docs, but u can define which BladeIconSets you wanna use: ```php IconPicker::make('icon') ->sets(['heroicons', 'fontawesome-solid']);...
Jump to solution
19 Replies
𝓒𝓱π“ͺ𝔀𝓷
please help!
LeandroFerreira
LeandroFerreiraβ€’11mo ago
where?
𝓒𝓱π“ͺ𝔀𝓷
in my backend .. I have form -> selection where I want the person to let him choose between 3 icons These need to be saved so I can display the icons on my homepage
Patrick
Patrickβ€’11mo ago
you could just use the SVG's from the hero icons themselves and a custom view right
Patrick
Patrickβ€’11mo ago
https://heroicons.com/ paste them from here into a blade view and do with it whatever you want
Heroicons
Heroicons
Beautiful hand-crafted SVG icons, by the makers of Tailwind CSS.
LeandroFerreira
LeandroFerreiraβ€’11mo ago
I have form -> selection.. What does it mean? if you are using a custom view, you can do this
@svg('heroicon-s-user', ['class' => 'w-5 h-5'])
@svg('heroicon-s-user', ['class' => 'w-5 h-5'])
𝓒𝓱π“ͺ𝔀𝓷
i use a selection ( dropdown menu ) from the documentation In my form
LeandroFerreira
LeandroFerreiraβ€’11mo ago
what is the link?
bernhard
bernhardβ€’11mo ago
Do you mean an icon select like this: https://filamentphp.com/plugins/guava-icon-picker
Filament
Icon Picker by Guava - Filament
Adds an icon picker field and column for your filament panel and form builder.
𝓒𝓱π“ͺ𝔀𝓷
in this.. i want a person to choose his icon
bernhard
bernhardβ€’11mo ago
Thats exactly what the plugin above does
𝓒𝓱π“ͺ𝔀𝓷
@bernhard when i want to use it.. it says "Svg by name "bag" from set "default" not found." .. you know why?
bernhard
bernhardβ€’11mo ago
i don't use this plugin atm, but this sounds like your bag is not in the set i think the default set is heroicons and there is no "bag" in the heroicon set Can U share your code? btw, are you editing an existing record? This sounds for me like your record has an icon "bag" which is not existing in the set
Solution
bernhard
bernhardβ€’11mo ago
I am just reading the docs, but u can define which BladeIconSets you wanna use:
IconPicker::make('icon')
->sets(['heroicons', 'fontawesome-solid']);
IconPicker::make('icon')
->sets(['heroicons', 'fontawesome-solid']);
And it looks like the IconPicker is using full icon names:
IconPicker::make('icon')
->allowIcons(['heroicon-o-user', 'heroicon-o-users']);
IconPicker::make('icon')
->allowIcons(['heroicon-o-user', 'heroicon-o-users']);
So when u have a value bag in your existing entry in the column icon it will not work.
bernhard
bernhardβ€’11mo ago
Try to change the value in your DB (phpMyadmin for example) to heroicon-o-shopping-bag and check if its working Or use it with empty fields/values
Patrick
Patrickβ€’11mo ago
i had this error today πŸ™‚ try it like this: 'heroicon-o-academic-cap' oh nvm bernhard said the same :d
𝓒𝓱π“ͺ𝔀𝓷
that worked thanks @bernhard and thanks @Patrick1989 :))
bernhard
bernhardβ€’11mo ago
Please mark as solved πŸ˜‰
Want results from more Discord servers?
Add your server