components/presence
Import
Section titled “Import”import * as api from "@fungi.computer/caps/components/presence";Exports
Section titled “Exports”| Kind | Export | Description |
|---|---|---|
| type alias | PresenceProps | Props accepted by Presence. |
| type alias | CollapseProps | Props accepted by Collapse. |
| type alias | SwapProps | Props accepted by Swap. |
| constant | Presence | Content that arrives and leaves instead of popping: it makes room, fades in
while travelling the theme’s --stipe-motion-distance, and on leaving fades out
and gives its room back before it unmounts. Reduced motion keeps a short fade
only. |
| constant | Collapse | Content that opens and closes its own space: an inserted alert, a field error, a disclosure body. Height and opacity follow the theme’s tempo; under reduced motion the space changes at once and only the fade remains. |
| constant | Swap | One piece of content replaced by another without a hard cut: loading to loaded,
“Saving…” to “Saved”. The old content fades out (blurred by the theme’s
--stipe-motion-blur) as the new one arrives, and the box eases to the new
size. Reduced motion keeps the crossfade and drops the travel. |
PresencePropstype alias
Section titled “PresenceProps”type PresenceProps = object & HTMLAttributes<HTMLDivElement>;Props accepted by Presence.
Type Declaration
Section titled “Type Declaration”| Name | Type | Description |
|---|---|---|
show |
boolean |
Whether the content is present. Leaving content stays mounted until it has left. |
appear? |
boolean |
Animate the first mount too (for content that arrives after the page). |
children |
ReactNode |
- |
CollapsePropstype alias
Section titled “CollapseProps”type CollapseProps = object & HTMLAttributes<HTMLDivElement>;Props accepted by Collapse.
Type Declaration
Section titled “Type Declaration”| Name | Type | Description |
|---|---|---|
open |
boolean |
Open: the content takes its height. Closed: no space, and out of the accessibility tree. |
children |
ReactNode |
- |
SwapPropstype alias
Section titled “SwapProps”type SwapProps = object & HTMLAttributes<HTMLDivElement>;Props accepted by Swap.
Type Declaration
Section titled “Type Declaration”| Name | Type | Description |
|---|---|---|
swapKey |
string |
Names the current content. A new key crossfades from the old content to the new. |
anchor? |
"start" | "end" |
Which edge leaving content holds to while the box resizes; end for right-aligned actions. |
children |
ReactNode |
- |
Presenceconstant
Section titled “Presence”const Presence: ForwardRefExoticComponent< object & HTMLAttributes<HTMLDivElement> & RefAttributes<HTMLDivElement>>;Content that arrives and leaves instead of popping: it makes room, fades in
while travelling the theme’s --stipe-motion-distance, and on leaving fades out
and gives its room back before it unmounts. Reduced motion keeps a short fade
only.
Collapseconstant
Section titled “Collapse”const Collapse: ForwardRefExoticComponent< object & HTMLAttributes<HTMLDivElement> & RefAttributes<HTMLDivElement>>;Content that opens and closes its own space: an inserted alert, a field error, a disclosure body. Height and opacity follow the theme’s tempo; under reduced motion the space changes at once and only the fade remains.
Swapconstant
Section titled “Swap”const Swap: ForwardRefExoticComponent< object & HTMLAttributes<HTMLDivElement> & RefAttributes<HTMLDivElement>>;One piece of content replaced by another without a hard cut: loading to loaded,
“Saving…” to “Saved”. The old content fades out (blurred by the theme’s
--stipe-motion-blur) as the new one arrives, and the box eases to the new
size. Reduced motion keeps the crossfade and drops the travel.