Rail
A 48px column of icon buttons for switching top-level sections, like VS Code's activity bar.
<arc-rail>Overview
Rail renders its items as a single column of icon buttons, 48px wide. Use it for top-level sections in an app that has room for a strip but not for a labelled Sidebar. Pair it with a Sidebar that shows the detail for the active section, the way VS Code pairs its activity bar with Explorer, Search and Source Control.
Icons are text-muted at rest. The item whose value matches the Rail's value gets the primary button style, an accent glow and aria-current="page". Selecting an item fires arc-change with the new value, so your app can swap the content next to it.
Each item's label is the button's accessible name, not visible text. Setting expanded widens the strip to 200px, but the labels still don't show, and nothing sets expanded on hover.
Guidelines
Do
- Keep it to about four to seven items, so the column doesn't overflow
- Pick icons people recognize without a label, since none is shown
- Put it at the far-left edge of an AppShell
Don't
- Don't make it the only navigation on a content-heavy site. Icons alone can't carry many destinations
- Don't use it on phone-width screens. Use BottomNav
Features
- Items are plain buttons: Tab moves between them and Enter or Space selects one. There are no arrow-key shortcuts
- The inner `<nav>` carries `aria-label="Rail navigation"`
- The width change on `expanded` animates
Preview
Usage
This component needs JavaScript. Use the Web Component or a framework wrapper.
<script type="module" src="@arclux/arc-ui"></script>
<arc-rail
value="explorer"
id="rail"
items='[
{ "icon": "folder", "label": "Explorer", "value": "explorer" },
{ "icon": "magnifying-glass", "label": "Search", "value": "search" },
{ "icon": "git-branch", "label": "Source Control", "value": "scm" },
{ "icon": "puzzle-piece", "label": "Extensions", "value": "extensions" },
{ "icon": "gear", "label": "Settings", "value": "settings" }
]'
></arc-rail>
<script>
document.querySelector('#rail').addEventListener('arc-change', (e) => {
console.log('section:', e.detail.value);
});
</script>import { Rail } from '@arclux/arc-ui-react';
const items = [
{ icon: 'folder', label: 'Explorer', value: 'explorer' },
{ icon: 'search', label: 'Search', value: 'search' },
{ icon: 'git-branch', label: 'Source Control', value: 'scm' },
{ icon: 'puzzle', label: 'Extensions', value: 'extensions' },
{ icon: 'settings', label: 'Settings', value: 'settings' },
];
export function ActivityBar() {
return (
<Rail
items={items}
value="explorer"
onArcChange={(e) => console.log('section:', e.detail.value)}
/>
);
}<script setup>
import { Rail } from '@arclux/arc-ui-vue';
const items = [
{ icon: 'folder', label: 'Explorer', value: 'explorer' },
{ icon: 'search', label: 'Search', value: 'search' },
{ icon: 'git-branch', label: 'Source Control', value: 'scm' },
{ icon: 'puzzle', label: 'Extensions', value: 'extensions' },
{ icon: 'settings', label: 'Settings', value: 'settings' },
];
function onChange(e) {
console.log('section:', e.detail.value);
}
</script>
<template>
<Rail :items="items" value="explorer" @arc-change="onChange" />
</template><script>
import { Rail } from '@arclux/arc-ui-svelte';
const items = [
{ icon: 'folder', label: 'Explorer', value: 'explorer' },
{ icon: 'search', label: 'Search', value: 'search' },
{ icon: 'git-branch', label: 'Source Control', value: 'scm' },
{ icon: 'puzzle', label: 'Extensions', value: 'extensions' },
{ icon: 'settings', label: 'Settings', value: 'settings' },
];
</script>
<Rail
{items}
value="explorer"
on:arc-change={(e) => console.log('section:', e.detail.value)}
/>import { Component } from '@angular/core';
import { Rail } from '@arclux/arc-ui-angular';
@Component({
imports: [Rail],
template: `
<arc-rail
[items]="items"
value="explorer"
(arc-change)="onChange($event)"
/>
`,
})
export class ActivityBarComponent {
items = [
{ icon: 'folder', label: 'Explorer', value: 'explorer' },
{ icon: 'search', label: 'Search', value: 'search' },
{ icon: 'git-branch', label: 'Source Control', value: 'scm' },
{ icon: 'puzzle', label: 'Extensions', value: 'extensions' },
{ icon: 'settings', label: 'Settings', value: 'settings' },
];
onChange(e: CustomEvent) {
console.log('section:', e.detail.value);
}
}import { Rail } from '@arclux/arc-ui-solid';
const items = [
{ icon: 'folder', label: 'Explorer', value: 'explorer' },
{ icon: 'search', label: 'Search', value: 'search' },
{ icon: 'git-branch', label: 'Source Control', value: 'scm' },
{ icon: 'puzzle', label: 'Extensions', value: 'extensions' },
{ icon: 'settings', label: 'Settings', value: 'settings' },
];
export function ActivityBar() {
return (
<Rail
items={items}
value="explorer"
onArcChange={(e) => console.log('section:', e.detail.value)}
/>
);
}import { Rail } from '@arclux/arc-ui-preact';
const items = [
{ icon: 'folder', label: 'Explorer', value: 'explorer' },
{ icon: 'search', label: 'Search', value: 'search' },
{ icon: 'git-branch', label: 'Source Control', value: 'scm' },
{ icon: 'puzzle', label: 'Extensions', value: 'extensions' },
{ icon: 'settings', label: 'Settings', value: 'settings' },
];
export function ActivityBar() {
return (
<Rail
items={items}
value="explorer"
onArcChange={(e) => console.log('section:', e.detail.value)}
/>
);
}API
itemsArray<{icon: string, label: string, value: string}>[]- Array of navigation items, each with an icon name, text label, and value identifier.
valuestring''- The value of the currently active item. Controls which icon receives the accent glow.
expandedbooleanfalse- When true, the Rail widens to show text labels beside each icon. Can be toggled on hover or set permanently.
Events
arc-changedetail:{ value: string }- Fired when an item is selected with detail: { value }.
See also
- SidebarA vertical list of navigation links in grouped sections that can collapse, with the current page highlighted.
- Navigation MenuHorizontal navigation bar whose top-level items open dropdowns of links on hover or click. Each link can carry a one-line description.
- Bottom NavA tab bar fixed to the bottom of a phone screen, one icon and label per destination.