Gapv1.2.0+
@include('_partials.class-table', [ 'scroll' => true, 'rows' => collect([ ['gap', ['gap']], ['row-gap', ['row-gap']], ['col-gap', ['column-gap']], ])->flatMap(function ($side) use ($page) { return $page->config['theme']['gap']->map(function ($value, $name) use ($side) { $class = starts_with($name, '-') ? ".-{$side[0]}-".substr($name, 1) : ".{$side[0]}-{$name}"; $code = collect($side[1])->map(function ($property) use ($value) { return "{$property}: {$value};"; })->implode("\n"); return [$class, $code]; })->values(); }) ])
Gap
Use .gap-{size}
to change the gutter size in grid layouts.
@component('_partials.code-sample')
Row Gap
Use .row-gap-{size}
to change the gutter size between rows in grid layouts.
@component('_partials.code-sample')
Column Gap
Use .col-gap-{size}
to change the gutter size between columns in grid layouts.
@component('_partials.code-sample')
Responsive
To control the gap at a specific breakpoint, add a {screen}:
prefix to any existing gap utility. For example, use md:gap-6
to apply the gap-6
utility at only medium screen sizes and above.
<div className="grid gap-4 sm:gap-6 md:gap-8 lg:gap-12 xl:gap-16 ...">
{/* ... */}
</div>
For more information about Tailwind's responsive design features, check out the Responsive Design documentation.
Customizing
Gap values
By default Tailwind's gap scale matches your configured spacing scale.
You can customize the global spacing scale in the theme.spacing
or theme.extend.spacing
sections of your tailwind.config.js
file:
@component('_partials.customized-config', ['key' => 'theme.extend.spacing'])
- '72': '18rem',
- '84': '21rem',
- '96': '24rem', @endcomponent
To customize the gap scale separately, use the gap
section of your Tailwind theme config.
@component('_partials.customized-config', ['key' => 'theme.extend.gap'])
- '11': '2.75rem',
- '13': '3.25rem', @endcomponent
Learn more about customizing the default theme in the theme customization documentation.
@include('_partials.variants-and-disabling', [ 'utility' => [ 'name' => 'gap', 'property' => 'gap', ], 'variants' => $page->config['variants']['gap']->all(), ])