Vai al contenuto principale

Panoramica

InlineBanner combina Banner con una disposizione in linea arrotondata e un’icona informativa decorativa. Condivide i contratti indipendenti di Banner per status, variant, color, icon e action. Il suo aspetto predefinito è soft e il suo stato predefinito è info.

Utilizzo

La disposizione standard occupa la larghezza disponibile. Le stringhe figlie semplici vengono troncate; il focus da tastiera, il passaggio del puntatore o il tocco rivelano la stringa completa in un tooltip. I nodi figlio ricchi vengono renderizzati direttamente, pertanto i link e i controlli incorporati mantengono la propria semantica. Definisci una tipografia esplicita quando il contenuto ricco deve essere troncato. Usa layout="compact" per il contenuto con ritorno a capo, una spaziatura più ravvicinata e una larghezza massima del contenuto di 512px. Aggiungi fullWidth per rimuovere tale limite e riempire la larghezza disponibile dell’elemento padre, inclusi spaziatura interna e bordi. Il valore predefinito è false e non modifica il layout standard, che riempie già il proprio elemento padre. Non ha alcun margine inferiore. Il layout è indipendente dall’aspetto solid o soft. embedded rimuove il margine inferiore del layout standard.
InlineBanner.Action fornisce un piccolo pulsante con contorno che eredita il colore visualizzato del banner, incluse le sostituzioni esplicite della tavolozza e gli aspetti solidi. Supporta interazioni Button, link, refs e rendering personalizzato. Lo slot action accetta anche controlli arbitrari. La destinazione radice è un div. Le props native, className, style e ref hanno come destinazione tale radice; render di Base UI può comporre un altro elemento e riceve lo stato risolto di Banner. action accetta qualsiasi ReactNode, inclusi più controlli con le rispettive API complete di Button o link. icon={null} rimuove l’icona predefinita. Il chiamante decide se il banner viene renderizzato e se le modifiche devono essere annunciate. Quando necessario, fornisci role="status" e aria-live="polite", oppure un contenitore appropriato per una regione live. Status non assegna la semantica di regione live. Assegna un nome ai controlli di azione e contrassegna le icone personalizzate decorative con aria-hidden.

Migrazione

Sostituisci message con children, LeftIcon={Icon} con icon={<Icon />} e la configurazione button con un nodo action. Usa InlineBanner.Action per mantenere lo stile dell’azione allineato al banner. Sostituisci variant="compact" con layout="compact"; standard è ora il layout predefinito. Usa status="error" per indicare un errore o color="red" per una sostituzione della tavolozza.

Props

ReactNode
Optional trailing ReactNode. InlineBanner.Action supplies the shared banner action preset and inherits the resolved banner color; arbitrary controls are also accepted.
ReactNode
Caller-provided content. Standard plain strings truncate with a focusable tooltip; rich nodes render directly. Compact content wraps.
string
Class merged onto the root div or composed element.
"blue" | "gray" | "green" | "orange" | "red"
predefinito:"status palette"
Gray, blue, green, orange or red palette override. An omitted color follows status.
boolean
predefinito:"false"
Removes the standard bottom margin. Compact layouts have no bottom margin.
boolean
predefinito:"false"
Fills the available parent width, including padding and borders, and removes the compact layout’s 512px maximum. Defaults to false; standard layout already fills its parent.
ReactNode
predefinito:"decorative information icon"
Leading ReactNode. Defaults to a decorative information icon. Pass null to omit it.
"compact" | "standard"
predefinito:"standard"
Standard full-width layout or compact wrapping layout with a 512px maximum content width. Defaults to standard.
Ref<HTMLDivElement>
Ref to the root div, or to the DOM element supplied through render.
ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, BannerState>
Base UI root element or render callback, receiving native props/ref and resolved Banner state.
"error" | "info" | "neutral" | "success" | "warning"
predefinito:"info"
Feedback meaning: neutral, info, success, warning or error. Defaults to info. Roles and announcements remain caller-owned.
CSSProperties
Inline styles applied to the root div or composed element.
"soft" | "solid"
predefinito:"soft"
Solid or soft appearance, independently of status and layout. Defaults to soft.

InlineBanner.Action

string | ((state: ButtonState) => string | undefined)
CSS class applied to the element, or a function that returns a class based on the component’s state.
boolean
Adds a shadow and backdrop blur. Neutral outline buttons also use elevated surface colors.
ReactNode
Decorative content displayed after the label.
boolean
predefinito:"false"
Whether the button should be focusable when disabled.
boolean
Expands the button to fill its container width.
string
Destination URL. Renders a native anchor when render is omitted unless nativeButton is explicitly true. Custom renderers retain their own element contract.
boolean
Shows a loading indicator and disables activation.
"center" | "end" | "start"
Where the loading indicator appears. center hides the content while preserving its layout space; start and end keep children and the opposite icon visible and replace the corresponding icon with the spinner.
boolean
predefinito:"true"
Whether the rendered root is a native button. Defaults to true for custom renderers. The built-in href anchor defaults to false; an explicit value takes precedence.
ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, ButtonState>
Caller-supplied root element or renderer. Native attributes, handlers, event details, and refs reach the rendered root. Use nativeButton={false} and role="link" for a custom navigation anchor. Router integration belongs to the caller.
AriaRole
Role of the root element. Use link for custom navigation renderers.
ShortcutDefinition
Flat key array for simultaneous keys, or nested key arrays for an ordered sequence. Displayed on non-mobile screens.
string
Localized text between sequence steps. Defaults to then.
ReactNode
Decorative content displayed before the label.
CSSProperties | ((state: ButtonState) => CSSProperties | undefined)
Style applied to the element, or a function that returns a style object based on the component’s state.