How can I change the default icon size in React? #577
Unanswered
wenchonglee
asked this question in
Q&A
Replies: 3 comments 3 replies
-
<style> .tabler-icon { width: 20px; height: 20px; } </style> |
Beta Was this translation helpful? Give feedback.
2 replies
-
I had same problem, it should fix it :
|
Beta Was this translation helpful? Give feedback.
1 reply
-
We use a simple wrapper to solve this. It has no CSS overrides, abstracts away the default icon styling for the entire app in only 1 place, but there's one extra import. //icon_wrap.tsx
import { Icon } from "@tabler/icons-react";
export default function IconWrap(props: { icon: Icon, stroke?: number, size?: number }) {
const Component = props.icon;
return <Component stroke={props.stroke ?? 1.5} size={props.size ?? 32}/>;
} To use it //some_component.tsx
import { Icon12Hours } from "@tabler/icons-react";
import IconWrap from "./icon_wrap";
export default function SomeComponent() {
return <IconWrap icon={Icon12Hours} />;
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey,
Is there a good way to change the default size of icons, say from 24px to 20px?
Initially I opted to use something like below, but it will override every instance; causing changes to the
size
prop to not work.Beta Was this translation helpful? Give feedback.
All reactions