The data store for tenup/icons
stores icons in this shape:
{
iconSets: {
'example/theme': {
label: 'Example',
icons: [
{
source: "...",
name: "...",
label: "..."
},
{
source: "...",
name: "...",
label: "..."
}
]
},
'core/dashicons': {
label: 'Dashicons',
icons: [
{
source: "...",
name: "...",
label: "..."
},
{
source: "...",
name: "...",
label: "..."
}
]
}
}
}
You can access the Icons datastore using the tenup/icons
namespace or by importing iconStore
from @10up/block-components
;
import { iconStore } from '@10up/block-components';
select(iconStore).getIconSets();
select('tenup/icons').getIconSets();
response:
[
{ name: 'example/theme', label: 'Example' icons: [] },
{ name: 'core/dashicons', label: 'Dashicons' icons: [] },
]
select('tenup/icons').getIconSet( 'core/dashicons' );
response:
{
name: 'core/dashicons',
label: 'Dashicons'
icons: []
}
select('tenup/icons').getIcons( 'core/dashicons' );
response:
[
{
source: "...",
name: "...",
label: "..."
},
{
source: "...",
name: "...",
label: "..."
}
]
select('tenup/icons').getIcon( 'core/dashicons', 'smiley' );
response:
{
source: "...",
name: "...",
label: "..."
}