Dynamic Values with Arbitrary Properties
You'll learn: How to use Tailwind's square bracket syntax to apply one-off custom values that don't exist in your design system.
The Problem with Predefined Utilities
Tailwind provides thousands of utility classes, but sometimes you need a specific value that isn't in your theme—maybe a designer specified exactly 347px width, or you need to match a brand color like #1da1f2. You could extend your Tailwind config, but for truly one-off values, that's overkill.
Arbitrary Values to the Rescue
Tailwind's arbitrary value syntax lets you inject custom values directly into utility classes using square brackets:
<div className="w-[347px] h-[120px] bg-[#1da1f2]">
Custom dimensions and color
</div>
This works for nearly any utility. Need a specific padding? p-[17px]. An unusual grid column count? grid-cols-[200px_1fr_2fr]. A custom shadow? shadow-[0_35px_60px_-15px_rgba(0,0,0,0.3)].
When to Use This
Think of arbitrary values as an "escape hatch"—use them sparingly for true edge cases. If you're using w-[347px] everywhere, you probably should add 347px to your spacing scale. But for genuinely unique scenarios (integrating third-party designs, A/B test variations, pixel-perfect mockups), arbitrary values keep you from polluting your config.
The Syntax
The pattern is simple: utility-[value]. The value inside brackets must be CSS-valid. For colors, you can use hex, rgb, hsl. For sizes, include units (px, rem, %). For complex values like gradients or transforms, wrap them carefully.
Key Takeaway: Square bracket syntax like w-[347px] or bg-[#1da1f2] lets you use arbitrary CSS values in Tailwind utilities for one-off cases without extending your configuration.