IBM Carbon
JS behaviour
Expandable Tile
A grid tile whose chevron spins to unfurl content inside the same flat frame — an accordion that lives in the grid, not in a column.
Real scenarios
The component as it is used in a product — not a specimen grid.
An accordion that lives in the grid
Click anywhere above the fold — the chevron spins 180° and the detail rows unfurl inside the same flat frame, growing the tile instead of pushing the page around.
- Access zones
- 3
- Latency to Berlin
- 24ms
- Price per core
- 38K
- Free capacity
- 64 vCPU
- Access zones
- 2
- Latency to Berlin
- 31ms
- Price per core
- 41K
- Free capacity
- 18 vCPU
- Access zones
- 3
- Latency to Berlin
- 118ms
- Price per core
- 35K
- Free capacity
- 96 vCPU
The body row animates from 0fr to 1fr — no measured heights, no janky max-height tricks; it is the same grid trick Carbon’s own tile uses.
The whole family
Closed, forced-open and flush — the same frame at every state.
- ping
- 12ms
- ping
- 12ms
- ping
- 12ms
Important props
| Prop | Type | Default | What it does |
|---|---|---|---|
| expanded | boolean | false | Whether the tile is open; clicking anywhere above the fold (not inner buttons) flips it. |
| chevron | rotate | '0 → 180°' | The chevron flips 180° with a soft rotation — the expandable tile’s motion signature. |
| below-the-fold | slot | null | The below-the-fold content hides in a grid row and grows the tile with a grid transition when opened. |
Snippet
<div class="cbex" data-open="false">
<button class="cbex-head" aria-expanded="false">
<b>Berlin region</b>
<span class="cbex-chevron">⌄</span>
</button>
<div class="cbex-body">
<p>3 availability zones · 24ms from Istanbul</p>
</div>
</div>
<style>
.cbex { border: 1px solid #e0e0e0; background: #fff;
display: grid; grid-template-rows: auto 0fr; transition: grid-template-rows .3s; }
.cbex[data-open='true'] { grid-template-rows: auto 1fr; border-color: #8d8d8d; }
.cbex-body { overflow: hidden; padding-inline: 1rem; }
.cbex[data-open='true'] .cbex-body { padding-block-end: 1rem; }
.cbex[data-open='true'] .cbex-chevron { rotate: 180deg; }
</style>
// app/Pages/Regions.jsx — Inertia page; renders the React snippet
// below unchanged, with Inertia's Link wired into the provider.
import { Link } from '@inertiajs/react';
import { NabuXUIProvider } from '@nabuxai/ui-react';
import RegionTiles from '@/components/RegionTiles';
export default function Regions() {
return (
<NabuXUIProvider locale="en" linkComponent={Link}>
<main className="nx-page">
<RegionTiles />
</main>
</NabuXUIProvider>
);
}
// RegionTiles.jsx — Carbon expandable tiles: an accordion that lives in the grid
import { useState } from 'react';
import '@nabuxai/ui-core/css';
const REGIONS = [
{ id: 'fra', city: 'Frankfurt', zone: 'eu-de', latency: '24ms', free: '64 vCPU' },
{ id: 'ist', city: 'Istanbul', zone: 'eu-tr', latency: '41ms', free: '38 vCPU' },
{ id: 'dub', city: 'Dublin', zone: 'eu-ie', latency: '33ms', free: '18 vCPU' },
];
export default function RegionTiles() {
const [open, setOpen] = useState({ ist: true });
const flip = (id) => setOpen((o) => ({ ...o, [id]: !o[id] }));
return (
<>
<style>{`
.cbex-grid { display: grid; gap: 1rem; grid-template-columns: repeat(3, minmax(11rem, 1fr));
max-inline-size: 36rem; }
.cbex { display: grid; grid-template-rows: auto 0fr; border: 1px solid #e0e0e0; background: #f4f4f4;
transition: grid-template-rows 240ms cubic-bezier(.2, 0, 0, 1), border-color 240ms cubic-bezier(.2, 0, 0, 1); }
.cbex[data-open='true'] { grid-template-rows: auto 1fr; border-color: #8d8d8d; }
.cbex-head { display: flex; align-items: center; gap: .5rem; padding: .875rem 1rem; border: none;
background: transparent; font: 600 .875rem/1.3 'IBM Plex Sans', sans-serif;
cursor: pointer; text-align: start; }
.cbex-head:hover { background: #e8e8e8; }
.cbex-head small { font-weight: 400; color: #525252; }
.cbex-chevron { margin-inline-start: auto; transition: rotate 240ms cubic-bezier(.2, 0, 0, 1); }
.cbex[data-open='true'] .cbex-chevron { rotate: 180deg; }
.cbex-body { overflow: hidden; padding-inline: 1rem; font-size: .75rem; }
.cbex[data-open='true'] .cbex-body { padding-block-end: 1rem; }
.cbex-body div { display: flex; justify-content: space-between; gap: 1rem; padding-block: .375rem;
border-block-start: 1px solid #e0e0e0; }
.cbex-body dt { color: #525252; }
.cbex-body dd { margin: 0; font-weight: 600; }
`}</style>
<div className="cbex-grid">
{REGIONS.map((r) => (
// data-open drives the 0fr → 1fr row transition; no height measuring.
<div className="cbex" data-open={!!open[r.id]} key={r.id}>
<button type="button" className="cbex-head" aria-expanded={!!open[r.id]} onClick={() => flip(r.id)}>
<span>{r.city} <small>{r.zone}</small></span>
<span className="cbex-chevron" aria-hidden="true">⌄</span>
</button>
<div className="cbex-body">
<dl>
<div><dt>Latency to Berlin</dt><dd>{r.latency}</dd></div>
<div><dt>Free capacity</dt><dd>{r.free}</dd></div>
</dl>
</div>
</div>
))}
</div>
</>
);
}
<!-- RegionTiles.vue — Carbon expandable tiles: an accordion that lives in the grid -->
<script setup lang="ts">
import { reactive } from 'vue';
import '@nabuxai/ui-core/css';
const regions = [
{ id: 'fra', city: 'Frankfurt', zone: 'eu-de', latency: '24ms', free: '64 vCPU' },
{ id: 'ist', city: 'Istanbul', zone: 'eu-tr', latency: '41ms', free: '38 vCPU' },
{ id: 'dub', city: 'Dublin', zone: 'eu-ie', latency: '33ms', free: '18 vCPU' },
];
const open = reactive({ ist: true });
const flip = (id: string) => { open[id] = !open[id]; };
</script>
<template>
<div class="cbex-grid">
<!-- data-open drives the 0fr → 1fr row transition; no height measuring. -->
<div v-for="r in regions" :key="r.id" class="cbex" :data-open="open[r.id]">
<button type="button" class="cbex-head" :aria-expanded="open[r.id]" @click="flip(r.id)">
<span>{{ r.city }} <small>{{ r.zone }}</small></span>
<span class="cbex-chevron" aria-hidden="true">⌄</span>
</button>
<div class="cbex-body">
<dl>
<div><dt>Latency to Berlin</dt><dd>{{ r.latency }}</dd></div>
<div><dt>Free capacity</dt><dd>{{ r.free }}</dd></div>
</dl>
</div>
</div>
</div>
</template>
<style scoped>
.cbex-grid { display: grid; gap: 1rem; grid-template-columns: repeat(3, minmax(11rem, 1fr));
max-inline-size: 36rem; }
.cbex { display: grid; grid-template-rows: auto 0fr; border: 1px solid #e0e0e0; background: #f4f4f4;
transition: grid-template-rows 240ms cubic-bezier(.2, 0, 0, 1), border-color 240ms cubic-bezier(.2, 0, 0, 1); }
.cbex[data-open='true'] { grid-template-rows: auto 1fr; border-color: #8d8d8d; }
.cbex-head { display: flex; align-items: center; gap: .5rem; padding: .875rem 1rem; border: none;
background: transparent; font: 600 .875rem/1.3 'IBM Plex Sans', sans-serif;
cursor: pointer; text-align: start; }
.cbex-head:hover { background: #e8e8e8; }
.cbex-head small { font-weight: 400; color: #525252; }
.cbex-chevron { margin-inline-start: auto; transition: rotate 240ms cubic-bezier(.2, 0, 0, 1); }
.cbex[data-open='true'] .cbex-chevron { rotate: 180deg; }
.cbex-body { overflow: hidden; padding-inline: 1rem; font-size: .75rem; }
.cbex[data-open='true'] .cbex-body { padding-block-end: 1rem; }
.cbex-body div { display: flex; justify-content: space-between; gap: 1rem; padding-block: .375rem;
border-block-start: 1px solid #e0e0e0; }
.cbex-body dt { color: #525252; }
.cbex-body dd { margin: 0; font-weight: 600; }
</style>
<!-- RegionTiles.svelte — Carbon expandable tiles: an accordion that lives in the grid -->
<script lang="ts">
import '@nabuxai/ui-core/css';
const regions = [
{ id: 'fra', city: 'Frankfurt', zone: 'eu-de', latency: '24ms', free: '64 vCPU' },
{ id: 'ist', city: 'Istanbul', zone: 'eu-tr', latency: '41ms', free: '38 vCPU' },
{ id: 'dub', city: 'Dublin', zone: 'eu-ie', latency: '33ms', free: '18 vCPU' },
];
let open = $state({ ist: true });
const flip = (id: string) => { open[id] = !open[id]; };
</script>
<div class="cbex-grid">
<!-- data-open drives the 0fr → 1fr row transition; no height measuring. -->
{#each regions as r (r.id)}
<div class="cbex" data-open={open[r.id]}>
<button type="button" class="cbex-head" aria-expanded={open[r.id]} onclick={() => flip(r.id)}>
<span>{r.city} <small>{r.zone}</small></span>
<span class="cbex-chevron" aria-hidden="true">⌄</span>
</button>
<div class="cbex-body">
<dl>
<div><dt>Latency to Berlin</dt><dd>{r.latency}</dd></div>
<div><dt>Free capacity</dt><dd>{r.free}</dd></div>
</dl>
</div>
</div>
{/each}
</div>
<style>
.cbex-grid { display: grid; gap: 1rem; grid-template-columns: repeat(3, minmax(11rem, 1fr));
max-inline-size: 36rem; }
.cbex { display: grid; grid-template-rows: auto 0fr; border: 1px solid #e0e0e0; background: #f4f4f4;
transition: grid-template-rows 240ms cubic-bezier(.2, 0, 0, 1), border-color 240ms cubic-bezier(.2, 0, 0, 1); }
.cbex[data-open='true'] { grid-template-rows: auto 1fr; border-color: #8d8d8d; }
.cbex-head { display: flex; align-items: center; gap: .5rem; padding: .875rem 1rem; border: none;
background: transparent; font: 600 .875rem/1.3 'IBM Plex Sans', sans-serif;
cursor: pointer; text-align: start; }
.cbex-head:hover { background: #e8e8e8; }
.cbex-head small { font-weight: 400; color: #525252; }
.cbex-chevron { margin-inline-start: auto; transition: rotate 240ms cubic-bezier(.2, 0, 0, 1); }
.cbex[data-open='true'] .cbex-chevron { rotate: 180deg; }
.cbex-body { overflow: hidden; padding-inline: 1rem; font-size: .75rem; }
.cbex[data-open='true'] .cbex-body { padding-block-end: 1rem; }
.cbex-body div { display: flex; justify-content: space-between; gap: 1rem; padding-block: .375rem;
border-block-start: 1px solid #e0e0e0; }
.cbex-body dt { color: #525252; }
.cbex-body dd { margin: 0; font-weight: 600; }
</style>