Float

Anchors content to an edge or corner of its positioned parent — badges, dots, close buttons.

Inbox

3 unread messages

3

Import#

import { Float } from "astralis-ui";

Usage#

Float is absolutely positioned, so its parent needs position="relative" (one Box prop away). The floated element is translated 50% past the anchor point so it centers on the edge — the badge-on-a-corner look, no manual offset math.

Placements#

Nine anchors: three per row across top, middle and bottom.

top-start

top-center

top-end

middle-start

middle-center

middle-end

bottom-start

bottom-center

bottom-end

Props#

Float extends Box and adds one prop:

PropTypeDefaultDescription
placement"top-start" | "top-center" | "top-end" | "middle-start" | "middle-center" | "middle-end" | "bottom-start" | "bottom-center" | "bottom-end""top-end"Which edge/corner of the positioned parent to anchor to.