DockBar
HkDockBar is the one dock container: every floating surface that hugs an edge or a corner of a page — a bottom-centred cruise dock, a corner step pager, a floating chat bar, a nameplate pill — mounts its content inside this container, and the page only supplies the slot. One chrome (surface, blur, border, radius) means no dock re-declares its own background, shadow or edge gap.
- A dock that lives inside a scrolling region belongs to the scroll container's dock slots — dockTop / dockBottom on HkScrollContainer — and not to this component; this one carries docks that float over a page or a canvas.
- The edge gap is one CSS custom-property family, so a host that wants a larger gap passes gap (Vue) or sets --hk-dock-gap / --hk-dock-gap-<edge> on an ancestor (both forms); nothing in JS ever reads a CSS length.
- Content inside the dock is ordinary markup — a HkButton row, a HkIconButton cluster, a HkFab when the action should float rather than dock.
Import
import { HkDockBar, type HkDockBarAnchor, type HkDockBarSurface } from "@celestia-island/hikari";
use hikari_components::*; use hikari_components::prelude::*;
The Rust form is a plain function, DockBar(DockBarProps { … }). Every prop may be omitted inside rsx!; an omitted anchor is Page and an omitted surface is Glass, exactly the Vue defaults. The Rust mirror has one documented delta: it takes no gap prop, so a host that needs a non-default gap sets the custom property on an ancestor wrapper instead (see below).
Anchor
anchor picks the plane that carries the dock. The compass is the same on both sides: page (the default, the south edge) and bottom are identical geometry, top is the north edge, left / right are the vertical edge midpoints, the four corners attach on both edges, and plane is the odd one out — it is in flow, for a host that already owns the positioning (a fixed footer band) and only wants the surface centred and lifted by the bottom gap.
The anchored forms are position: absolute against the nearest positioned ancestor, and the anchor box itself is transparent to pointer events (pointer-events: none) so a canvas underneath keeps its gestures; the inner .hk-dock-bar-surface catches them. Give the stage a positioned, sized box — otherwise an absolute dock escapes to the page and lands at the viewport edge.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { HkDockBar, HkButton } from "@celestia-island/hikari";
import type { CSSProperties } from "vue";
const stage: CSSProperties = { position: "relative", height: "240px", borderRadius: "12px", background: "#eef2f7" };
const corner: CSSProperties = { position: "relative", height: "220px", borderRadius: "12px", background: "#eef2f7" };
export default () => (
<div style={{ display: "grid", gap: "16px", maxWidth: "520px" }}>
<div style={stage}>
<HkDockBar anchor="bottom">
<HkButton size="sm">Board now</HkButton>
</HkDockBar>
</div>
<div style={corner}>
<HkDockBar anchor="top-left">
<span style={{ fontSize: "12px" }}>HUD</span>
</HkDockBar>
<HkDockBar anchor="bottom-right">
<span style={{ fontSize: "12px" }}>1 / 4</span>
</HkDockBar>
</div>
</div>
);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
rsx! {
div { style: "display:grid;gap:16px;max-width:520px",
div { style: "position:relative;height:240px;border-radius:12px;background:#eef2f7",
DockBar { anchor: DockBarAnchor::Bottom,
Button { size: ButtonSize::Sm, "Board now" }
}
}
div { style: "position:relative;height:220px;border-radius:12px;background:#eef2f7",
DockBar { anchor: DockBarAnchor::TopLeft,
span { style: "font-size:12px", "HUD" }
}
DockBar { anchor: DockBarAnchor::BottomRight,
span { style: "font-size:12px", "1 / 4" }
}
}
}
}
import { HkDockBar, HkButton } from "@celestia-island/hikari";
import type { CSSProperties } from "vue";
const stage: CSSProperties = { position: "relative", height: "240px", borderRadius: "12px", background: "#eef2f7" };
const corner: CSSProperties = { position: "relative", height: "220px", borderRadius: "12px", background: "#eef2f7" };
export default () => (
<div style={{ display: "grid", gap: "16px", maxWidth: "520px" }}>
<div style={stage}>
<HkDockBar anchor="bottom">
<HkButton size="sm">Board now</HkButton>
</HkDockBar>
</div>
<div style={corner}>
<HkDockBar anchor="top-left">
<span style={{ fontSize: "12px" }}>HUD</span>
</HkDockBar>
<HkDockBar anchor="bottom-right">
<span style={{ fontSize: "12px" }}>1 / 4</span>
</HkDockBar>
</div>
</div>
);rsx! {
div { style: "display:grid;gap:16px;max-width:520px",
div { style: "position:relative;height:240px;border-radius:12px;background:#eef2f7",
DockBar { anchor: DockBarAnchor::Bottom,
Button { size: ButtonSize::Sm, "Board now" }
}
}
div { style: "position:relative;height:220px;border-radius:12px;background:#eef2f7",
DockBar { anchor: DockBarAnchor::TopLeft,
span { style: "font-size:12px", "HUD" }
}
DockBar { anchor: DockBarAnchor::BottomRight,
span { style: "font-size:12px", "1 / 4" }
}
}
}
}Surface
surface is the finish of the panel: glass (the default) is a translucent surface with a backdrop blur, solid is opaque with no blur, and it exists for moving canvases — a WebGL scene under the dock would otherwise re-sample the backdrop every frame. The token lands on the root as data-surface, and the sheet is the single source of truth for both finishes.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { HkDockBar, HkButton } from "@celestia-island/hikari";
import type { CSSProperties } from "vue";
const stage: CSSProperties = { position: "relative", height: "240px", borderRadius: "12px", background: "#eef2f7" };
export default () => (
<div style={{ display: "grid", gap: "16px", maxWidth: "480px" }}>
<div style={stage}>
<HkDockBar anchor="bottom" surface="glass">
<HkButton size="sm" variant="secondary">Glass over a canvas</HkButton>
</HkDockBar>
</div>
<div style={stage}>
<HkDockBar anchor="bottom" surface="solid">
<HkButton size="sm" variant="secondary">Solid over a video</HkButton>
</HkDockBar>
</div>
</div>
);
rsx! {
div { style: "display:grid;gap:16px;max-width:480px",
div { style: "position:relative;height:240px;border-radius:12px;background:#eef2f7",
DockBar { anchor: DockBarAnchor::Bottom, surface: DockBarSurface::Glass,
Button { size: ButtonSize::Sm, variant: ButtonVariant::Secondary, "Glass over a canvas" }
}
}
div { style: "position:relative;height:240px;border-radius:12px;background:#eef2f7",
DockBar { anchor: DockBarAnchor::Bottom, surface: DockBarSurface::Solid,
Button { size: ButtonSize::Sm, variant: ButtonVariant::Secondary, "Solid over a video" }
}
}
}
}
import { HkDockBar, HkButton } from "@celestia-island/hikari";
import type { CSSProperties } from "vue";
const stage: CSSProperties = { position: "relative", height: "240px", borderRadius: "12px", background: "#eef2f7" };
export default () => (
<div style={{ display: "grid", gap: "16px", maxWidth: "480px" }}>
<div style={stage}>
<HkDockBar anchor="bottom" surface="glass">
<HkButton size="sm" variant="secondary">Glass over a canvas</HkButton>
</HkDockBar>
</div>
<div style={stage}>
<HkDockBar anchor="bottom" surface="solid">
<HkButton size="sm" variant="secondary">Solid over a video</HkButton>
</HkDockBar>
</div>
</div>
);rsx! {
div { style: "display:grid;gap:16px;max-width:480px",
div { style: "position:relative;height:240px;border-radius:12px;background:#eef2f7",
DockBar { anchor: DockBarAnchor::Bottom, surface: DockBarSurface::Glass,
Button { size: ButtonSize::Sm, variant: ButtonVariant::Secondary, "Glass over a canvas" }
}
}
div { style: "position:relative;height:240px;border-radius:12px;background:#eef2f7",
DockBar { anchor: DockBarAnchor::Bottom, surface: DockBarSurface::Solid,
Button { size: ButtonSize::Sm, variant: ButtonVariant::Secondary, "Solid over a video" }
}
}
}
}Size and edge gap
width, maxWidth, maxHeight and padding are CSS value strings written onto the surface as the --dock-width, --dock-max-width, --dock-max-height and --dock-padding custom properties; with none of them set the surface shrink-wraps its content. gap is the resting inset from the edge the dock hugs, written inline as --hk-dock-gap; it resolves per edge through --hk-dock-gap-<edge> → --hk-dock-inset → the foundation default of 16px, so leaving it unset simply inherits the host's rhythm.
The plane anchor is the natural place to see the size properties, because the surface is the only thing the container positions. The Rust mirror carries the same four size props and no gap, so the sample below gives the gap to the wrapping element.
import { HkDockBar, HkButton } from "@celestia-island/hikari";
import type { CSSProperties } from "vue";
const plane: CSSProperties = { display: "grid", gap: "16px", maxWidth: "440px" };
export default () => (
<div style={plane}>
<HkDockBar anchor="plane" width="320px" padding="6px 12px">
<HkButton size="sm">Sized surface</HkButton>
</HkDockBar>
<HkDockBar anchor="plane" gap="2rem" maxWidth="320px">
<HkButton size="sm" variant="secondary">Wider gap</HkButton>
</HkDockBar>
</div>
);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
rsx! {
div { style: "display:grid;gap:16px;max-width:440px",
DockBar {
anchor: DockBarAnchor::Plane,
width: Some("320px".to_string()),
padding: Some("6px 12px".to_string()),
Button { size: ButtonSize::Sm, "Sized surface" }
}
div { style: "--hk-dock-gap: 2rem",
DockBar {
anchor: DockBarAnchor::Plane,
max_width: Some("320px".to_string()),
Button { size: ButtonSize::Sm, variant: ButtonVariant::Secondary, "Wider gap" }
}
}
}
}
import { HkDockBar, HkButton } from "@celestia-island/hikari";
import type { CSSProperties } from "vue";
const plane: CSSProperties = { display: "grid", gap: "16px", maxWidth: "440px" };
export default () => (
<div style={plane}>
<HkDockBar anchor="plane" width="320px" padding="6px 12px">
<HkButton size="sm">Sized surface</HkButton>
</HkDockBar>
<HkDockBar anchor="plane" gap="2rem" maxWidth="320px">
<HkButton size="sm" variant="secondary">Wider gap</HkButton>
</HkDockBar>
</div>
);rsx! {
div { style: "display:grid;gap:16px;max-width:440px",
DockBar {
anchor: DockBarAnchor::Plane,
width: Some("320px".to_string()),
padding: Some("6px 12px".to_string()),
Button { size: ButtonSize::Sm, "Sized surface" }
}
div { style: "--hk-dock-gap: 2rem",
DockBar {
anchor: DockBarAnchor::Plane,
max_width: Some("320px".to_string()),
Button { size: ButtonSize::Sm, variant: ButtonVariant::Secondary, "Wider gap" }
}
}
}
}
API
Vue
Props
Rust
Props — DockBar
Accessibility
- The dock is a bare <section> on both sides: it has no landmark role of its own, no role and no aria-*. A <section> only becomes a region landmark when the host names it, so give the dock an aria-label (Vue: a plain attribute on the component's root; Rust: an aria-label on the element the host wraps around it) if it should be reachable from a landmark list — inventing a title would put a name into the tree that the other form does not have.
- The interactive bits are the content, not the dock: the buttons in the slot keep their own names and focus order, and a dock that only holds a status line adds no focus stop.
- The anchored box is pointer-events: none while the surface is auto, so a pointer user cannot "click through" the dock; a keyboard user reaches the content directly, in document order.
- Both forms add their safe-area inset to the resting distance, so a dock on a notched device keeps the gap instead of sliding under the system bar.
Related components
- HkScrollContainer — owns the docks that live inside a scrolling region, through its dockTop / dockBottom slots.
- Fab — the single anchored action, when the surface is a button rather than a bar.
- Button — the usual content of a dock's slot.
- IconButton — the compact row a dock's trailing cluster is built from.