S
SolidJS16mo 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
thetarnav16mo 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 Lohr16mo ago
I usually use an em size for icons, so it scales with the font.
michael
michaelOP16mo ago
i suppose that makes sense

Did you find this page helpful?