S
SolidJS15mo ago
michael

How to set size of child element?

I have this component:
export function NavigationBarItem(props: { icon: JSX.Element }) {
return <div class="m-4 h-8 w-8">{props.icon}</div>;
}
export function NavigationBarItem(props: { icon: JSX.Element }) {
return <div class="m-4 h-8 w-8">{props.icon}</div>;
}
How do I set the icons size?
3 Replies
thetarnav
thetarnav15mo ago
one pattern is to have icons always take as much space as they can, so it can be easily set by the parent
Alex Lohr
Alex Lohr15mo ago
I usually use an em size for icons, so it scales with the font.
michael
michaelOP15mo ago
i suppose that makes sense

Did you find this page helpful?