Axon 911 Frontend Docs
    Loading navigation…
U
User
Switch to light mode
  1. Components
  2. Send Button
  3. API and Development

Send Button

API and Development

View SourceOpens in a new tabSubmit IssueOpens in a new tab
Import SendButton from @prepared911/ui/send-button.
SendButtonProps is SendButtonOwnProps plus Button's intent, variant, size, tooltip, type, ref, className, the form attributes, data-* attributes, and the shared interaction props (disabled, active, id, the aria-* set, and the pointer, focus, keyboard, and click handlers).
PropTypeDefaultDescription
labelLocalizedMessagerequiredAccessible name at rest; never drawn
pendingLabelLocalizedMessagerequiredAccessible name and announcement while pending
pendingbooleanfalseThe send is in flight
restoreFocusToRefObject<HTMLElement | null>noneTakes focus after a keyboard activation
intentButtonIntentNeutralPaint intent, Button's default
variantButtonVariantSoftPaint variant, Button's default
sizeButtonSizeLargeControl height; the button is a square
tooltipLocalizedMessagenoneVisual tooltip, as on Button
type"button" | "submit" | "reset""button"Native type
onClickclick handlernoneRuns on a click that is not pending; send here
disabledbooleanfalseNative disabled; pending outranks it
refRef<HTMLButtonElement>noneRef to the button
Not accepted: children, icon, leading, trailing, preventFocusOnPress (always on), loading, loadingLabel, and the toggle props.
Props
NameTypeDefaultDescription
labelLocalizedMessage—Accessible name at rest. The button is icon-only, so this is never drawn.
pendingLabelLocalizedMessage—Accessible name while {@link SendButtonOwnProps.pending} is true. Announced when the send starts.
activeboolean—Non-toggle pressed or transient current marker; hosts write the pressed state key through stateAttributes (data-pressed). A toggle host (Button toggle variant) uses aria-pressed and styles with [aria-pressed="true"] without also writing data-pressed for that toggle state (ADR 0001 rule 1). Link "current" within a set uses aria-current, not active.
aria-controlsstring—Id of the element controlled by this control.
aria-currentboolean | "time" | "false" | "true" | "page" | "step" | "location" | "date"—Whether this item is current within a set.
aria-describedbystring—Id of the element that describes this control.
aria-descriptionLocalizedMessage—Accessible description when it cannot be referenced by id.
aria-expandedboolean—Whether the controlled region is expanded.
aria-haspopupboolean | "dialog" | "menu" | "false" | "true" | "listbox" | "tree" | "grid"—Type of popup triggered by this control, if any.
aria-labelLocalizedMessage—Accessible name when the visible label is insufficient.
aria-labelledbystring—Id of the element that names this control.
disabledboolean—Inert state per host: native disabled on a button; on Link, ADR 0006 link host (no href, aria-disabled="true", tabIndex={0}). Never tabIndex={-1}.
fullSpanundefined—Send is icon-only; fill is not available.
idstring—Element id for ARIA relationships.
intentButtonIntent—Visual intent. Defaults to {@link ButtonIntent.Neutral}.
marqueebooleanfalseWith truncate, fades a clipped label out at its end and slides it into view while the pointer is over the button or keyboard focus is on it, so the whole name can be read. It is the same label as a Sidebar item's, and it shows its full text in its own tooltip. There is no fade or slide when the label fits, and no slide when motion is reduced or off. A tooltip set on the button replaces the label's tooltip.
pendingbooleanfalseWhether the send is in flight. A pending button swaps its arrow for the spinner, sets aria-busy and aria-disabled instead of disabled, so focus stays where it is, and ignores clicks, Enter and Space. Pending outranks {@link InteractableProps.disabled}: a composer that clears its value on send can set both at once and the button still shows the spinner.
refRef<HTMLButtonElement>—Ref to the rendered button.
restoreFocusToRefObject<HTMLElement | null>—Element that takes focus after a keyboard activation (Enter or Space on the button), typically the composer's input. A pointer press never moves focus off the input, so a pointer click needs no restore. Without it, a keyboard send leaves focus on the button, which may become disabled as the value clears.
shapeButtonShape—Corner shape. Defaults to {@link ButtonShape.Control}.
sizeButtonSize—Control size. Defaults to {@link ButtonSize.Large}.
softFillButtonSoftFillButtonSoftFill.OutlineFill for {@link ButtonVariant.Soft}. {@link ButtonSoftFill.Outline} is the default secondary (Neutral, bordered, transparent). {@link ButtonSoftFill.Filled} keeps the tinted Neutral Soft fill for segmented selections and other cases that need a filled surface.
tooltipLocalizedMessage | DisplayValue—Short text shown in a Tooltip while the pointer hovers the button or a navigation key focuses it. Button composes Tooltip's trigger, content and root, so it behaves like Tooltip > TooltipTrigger > Button and also works while disabled (pointer only) and on toggle buttons. A labelled button points aria-describedby at the tooltip. An icon-only button does not: label already names it, so the tooltip is visual only and never read twice. Adding or removing the prop after mount remounts the button.
truncatebooleanfalseWhen true, a label wider than the button's available inline size is cut with an ellipsis instead of widening or wrapping the button. The leading and trailing content keep their size; only the label gives up room. Pair it with a parent or a width that limits the button, because a button with nothing to limit it never overflows.
type"button" | "submit" | "reset"—Native button type. Defaults to button.
variantButtonVariant—Surface variant. Defaults to {@link ButtonVariant.Soft}.
Storybook
Interactive examples and edge cases for this component are in Storybook.
DefaultOpens in a new tab
Previous
Send Button / Usage
Next
Send Button / Accessibility
On this page
Props
Storybook