Introducing ReUI:Open-source UI components and apps built with React, Next.js and Tailwind CSS
Browse ReUI

How to Switch Between Duotone, Solid, and Outline Icon Styles Programmatically


Hi Keenthemes team,
I'm currently using your template and implementing icons in my navigation configuration like this:

```
export const MENU_ROOT: TMenuConfig = [
{
title: 'Profile',
icon: 'abstract-27',
path: 'https://www.aman.com/zh-cn/resorts/aman-kyoto',
},
{
title: 'Account',
icon: 'setting-2',
rootPath: '/account/',
path: '/',
},
{
title: 'Network',
icon: 'users',
rootPath: '/network/',
path: 'network/get-started',
},
{
title: 'Authentication',
icon: 'security-user',
rootPath: '/authentication/',
path: 'authentication/get-started',
}
];
```

I notice that the template provides icons in three different styles: Duotone, Solid, and Outline. However, I'm unable to figure out how to specify which style I want to use for a particular icon.
Could you please provide guidance on:

1. How to programmatically switch between these three styles?
2. Is there a specific property or modifier I need to add to my configuration to specify the icon style?
3. Are there any code examples showing how to implement different icon styles in the navigation configuration?

Thank you for your help!
Best regards


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (2)


I find it


<KeenIcon icon={item.icon} style="solid" />


thx



Hi,

The default icon style you can change here: "src/config/settings.config.ts"

To change the icon style programmitcally please use


// refer: src/components/keenicons/types.d.ts
const { settings, updateSettings } = useSettings();
updateSettings({ keeniconsStyle: "outline" });


Regards,
Sean


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(