src/docs/fill.mdx
import { ApiTable } from "@/components/api-table.tsx"; import { CustomizingYourThemeColors, ResponsiveDesign, UsingACustomValue } from "@/components/content.tsx"; import { Example } from "@/components/example.tsx"; import { Figure } from "@/components/figure.tsx"; import colors from "./utils/colors";
export const title = "fill"; export const description = "Utilities for styling the fill of SVG elements.";
<ApiTable
rows={[
["fill-none", "fill: none;"],
["fill-inherit", "fill: inherit;"],
["fill-current", "fill: currentColor;"],
["fill-transparent", "fill: transparent;"],
...Object.entries(colors).map(([name, value]) => [fill-${name}, fill: var(--color-${name}); /* ${value} */]),
["fill-(<custom-property>)", "fill: var(<custom-property>);"],
["fill-[<color>]", "fill: <color>;"],
]}
/>
Use utilities like fill-indigo-500 and fill-lime-600 to change the fill color of an SVG:
<!-- [!code classes:fill-blue-500] -->
<svg class="fill-blue-500 ...">
<!-- ... -->
</svg>
This can be useful for styling icon sets like Heroicons.
Use the fill-current utility to set the fill color to the current text color:
<!-- [!code classes:fill-current] -->
<button class="bg-white text-indigo-600 hover:bg-indigo-600 hover:text-white ...">
<svg class="size-5 fill-current ...">
<!-- ... -->
</svg>
Check for updates
</button>