Usage
Chat Layout Scroll Button is the scroll affordance for the Chat family. Place it in Chat’s scroll slot; the surrounding Chat component supplies lock and unseen-message state while preserving the button as an ordinary keyboard action.
import "@nordhealth/components/lib/ChatLayoutScrollButton"
Composition
Chat Layout Scroll Button is a Nord Button-backed action in Chat’s scroll slot. Chat owns automatic visibility and unseen-message state, while the component owns its label and icon presentation and exposes activation without replacing ordinary button interaction.
Examples
Visibility and labels
Without visible, Chat shows the button when the reader leaves the newest content or new messages arrive. Add visible only for an explicit override, and remove the attribute to return control to the layout. Set label for visible copy such as “3 new messages”; the icon-only state retains a localized accessible name.
Activation emits cancelable nord-scroll-to-latest. When it is not canceled, the nearest Chat component scrolls to the bottom and clears its unseen-message state.
Accessibility
The component internally uses Nord Button and Icon, so Enter, Space, focus treatment, and disabled browser semantics remain consistent with other Nord actions. A hidden affordance is made inert and removed from the accessibility tree, but it remains visible until focus leaves if it was focused during a state change.
Templates
See this component composed into complete application views:
API reference
ChatLayoutScrollButton
Chat Layout Scroll Button composes the existing Nord Button and Nord Icon to return the reader to the newest content. It can inherit visibility and new-message state from Chat.
<nord-chat-layout-scroll-button></nord-chat-layout-scroll-button>Props
| Property | Attribute | Description | Type | Default |
|---|---|---|---|---|
visibility | visibility | Anything that is not an explicit override resolves to auto, including the
null Lit hands back when the attribute is removed. The property is then
always one of the three documented values rather than sometimes null. | ChatLayoutScrollButtonVisibility | — |
label | label | Visible button label. Omit it for a localized icon-only control. | string | undefined | — |
| Event | Detail Type | Description |
|---|---|---|
nord-scroll-to-latest | ChatScrollToLatestEvent | Cancelable scroll-to-latest intent. |
Dependencies
This component is internally dependent on the following components:
- <nord-button>
Button
Buttons are used for interface actions. Primary style should be used only once per section for main call-to-action, while other styles can appear more frequently.
- <nord-icon>
Icon
Icons are used to provide additional meaning or in places where text label doesn’t fit. Icon component allows you to display an icon from the Nordicons library.
- <nord-visually-hidden>
VisuallyHidden
Visually hidden is used when an element needs to be available to assistive technologies like screen readers, but be otherwise hidden.