docs/guide/lucide/basics/sizing.md
By default, the size of all icons is 24px by 24px. The size is adjustable using the width and height attributes and or by CSS.
width and height attribute::: sandpack {template=vanilla showTabs=false editorHeight=295 editorWidthPercentage=60 dependencies="lucide"}
<!DOCTYPE html>
<html>
<body>
<i data-lucide="landmark" width="64" height="64"></i>
<script src="index.js">
</script>
</body>
</html>
import "./styles.css";
import { createIcons, Landmark } from 'lucide/dist/cjs/lucide';
createIcons({
icons: {
Landmark,
}
});
:::
The CSS properties width and height can be used to adjust the icon size.
::: sandpack {template=vanilla editorHeight=300 editorWidthPercentage=60 dependencies="lucide"}
.my-beer-icon {
/* Change this! */
width: 64px;
height: 64px;
}
<!DOCTYPE html>
<html>
<body>
<i data-lucide="beer" class="my-beer-icon"></i>
<script src="index.js">
</script>
</body>
</html>
import { createIcons, Beer } from 'lucide/dist/cjs/lucide';
import "./styles.css";
import "./icon.css";
createIcons({
icons: {
Beer,
}
});
:::
It is possible to resize icons based on font size. This can be achieved using the em unit. See this MDN article for more information on the em unit.
::: sandpack {template=vanilla editorHeight=320 dependencies="lucide"}
.my-icon {
/* Icon size will relative to font-size of .text-wrapper */
width: 1em;
height: 1em;
}
.text-wrapper {
/* Change this! */
font-size: 96px;
/* layout stuff */
display: flex;
gap: 0.25em;
align-items: center;
}
import { createIcons, Star } from 'lucide/dist/cjs/lucide';
import "./styles.css";
import "./icon.css";
createIcons({
icons: {
Star,
}
});
<!DOCTYPE html>
<html>
<body>
<div class="text-wrapper">
<i data-lucide="star" class="my-icon"></i>
<div>Yes</div>
</div>
<script src="index.js">
</script>
</body>
</html>
:::
size-* utilities can be used to adjust the size of the icon. See the Tailwind documentation for more information on the size-* utilities.
::: sandpack {template=vanilla editorHeight=300 editorWidthPercentage=60 dependencies="lucide" externalResources="https://cdn.tailwindcss.com"}
<!DOCTYPE html>
<html>
<body>
<i data-lucide="party-popper" class="size-24"></i>
<script src="index.js">
</script>
</body>
</html>
import { createIcons, PartyPopper } from 'lucide/dist/cjs/lucide';
import "./styles.css";
createIcons({
icons: {
PartyPopper,
}
});
:::