Saltar al contenido
menumenu tanreiexpand_morecontrasttranslate
tanreiexpand_more
Primeros pasosWebReactSwiftUIJetpack ComposeFlutterReact NativePreajustesTu propio sistema de diseñoUsar Tanrei con agentes de IAMarcaTokens de diseñoSistemas de diseño y personalizaciónTheme StudioColorTipografíaIconosFormaElevaciónMovimientoEstados de interacciónComportamientoDiseño de páginaAccesibilidadTextosTokens de colorTokens de la escala tipográficaTokens de formaTokens de elevaciónTokens de movimientoTokens de estadoTokens de espacio y de medidaComponentesBotónBotón de acción principalBotón segmentadoGrupo de botonesBotón con menúBarra de herramientasBotón de copiarCasilla de verificaciónBotón de opciónInterruptorChipMenúControl deslizanteCampo de control deslizanteCalendarioDateTimePickerGrupo de camposGrupo de botones de opciónGrupo de casillas de verificaciónSelectCampo de selecciónBarra de menúsSubida de archivosSelector de archivos AvanzadoZona de soltar archivosEntrada de texto AvanzadoCampo de textoCampo de chipsCampoCuadro combinado AvanzadoCampo de cuadro combinadoEntrada numérica AvanzadoCampo numéricoEntrada de color AvanzadoCampo de colorEntrada de código de un solo uso AvanzadoCampo de código de un solo usoEntrada de texto incrustada AvanzadoCuadro de redacción de chatTarjetaDivisorCapa modal AvanzadoDiálogoListaFila de listaHoja inferiorHoja lateralCarruselBloque de códigoTablaPopoverPasosAcordeónLista de descripcionesFiguraEstructura de la aplicaciónCabecera de páginaVista de árbolLínea de tiempoVista previa de imágenesTirador de tamañoMarco redimensionableÁrea de desplazamientoInsigniaIndicador de progresoMedidorContador animadoIndicador de cargaSnackbarTooltipAtajo de tecladoTagCódigo en líneaCalloutAvatarEstado vacíoGrupo de tagsEsqueletoElemento de archivoMuestraTexto en marquesinaPestañasVista de pestañasBarra de la aplicaciónBarra de navegaciónPanel de navegaciónBúsquedaEnlacePaginaciónEnlaces anterior y siguienteIndicador de pasosRuta de navegaciónTabla de contenidoTarjeta de enlaceMenú FABEstadoCómo se construye TanreiCómo contribuirLicencia y atribución
InicioComponentesEstado vacío

Estado vacío

Lo que ocupa el lugar de un contenido que no está (una búsqueda sin resultados, una lista a la que nadie ha añadido nada, una página antes de su primer elemento) y dice qué falta, por qué o qué hacer, y ofrece la acción que lo resuelve.

content_copyVer en Markdown
Categoría
Comunicación
Tokens
comp.empty-state
Nivel
Base

Descripción general

Web
tanrei-empty-state
schedule
SwiftUI
TanreiEmptyState
radio_button_unchecked
Jetpack Compose
TanreiEmptyState
radio_button_unchecked
Flutter
TanreiEmptyState
radio_button_unchecked
React Native
EmptyState
radio_button_unchecked

Generado a partir de docs/status/status.json, specs/empty-state.spec.json

Una lista a la que nadie ha añadido nada todavía, y una búsqueda que no encontró nada

folder_openUn proyecto reúne las capas, las exportaciones y las personas de un mismo sistema de diseño.Nuevo proyectoImportar una capasearch_offRevisa la ortografía o busca una palabra más corta.Borrar búsqueda

Un estado vacío está donde estaría el contenido cuando no hay ninguno: sustituye a la lista, a las filas, a los resultados. Dice qué falta en pocas palabras, por qué o qué hacer en una frase, y ofrece el control que lo resuelve. Es discreto y plano, sin relleno y sin borde, y es contenido, que se lee donde está: no recibe el foco y no tiene estados.

En la web es <tanrei-empty-state>. Las demás plataformas todavía no lo han implementado.

Uso

La descripción es el propio contenido del elemento. El título es el atributo headline, expuesto como un encabezado del nivel que da level, o el slot title donde es un encabezado u otro contenido tuyo. Un glifo del conjunto de iconos, o una imagen tuya, va en el slot media, y tus propios botones o enlaces, en el slot actions. Todas las palabras son tuyas: el componente no tiene ninguna propia.

<!-- Una región dentro de una vista: un glifo, un título, una frase, la acción. -->
<tanrei-empty-state headline="Aún no hay proyectos">
  <span slot="media">folder_open</span>
  Un proyecto reúne las capas, las exportaciones y las personas de un mismo sistema de diseño.
  <tanrei-button slot="actions">Nuevo proyecto</tanrei-button>
  <tanrei-button slot="actions" variant="text">Importar una capa</tanrei-button>
</tanrei-empty-state>

<!-- Una página que está vacía en su conjunto: large, y su título es el encabezado de la página. -->
<tanrei-empty-state size="large">
  <h1 slot="title">Esta página no existe</h1>
  Puede que la dirección esté mal escrita o que la página se haya movido.
  <a slot="actions" class="tanrei-link" href="/">Ir a la página de inicio</a>
</tanrei-empty-state>

<!-- En un panel lateral: en el borde de inicio, donde habría empezado la lista. -->
<tanrei-empty-state align="start" headline="Todavía no hay diferencias con la base">
  Cambia un valor a la izquierda y aparecerá aquí.
</tanrei-empty-state>

<!-- En respuesta a un filtro: se anuncia una vez, de forma cortés, cuando se muestra. -->
<tanrei-empty-state id="no-rows" live hidden headline="Ninguna entrada coincide con estos filtros">
  Hay tres filtros activos. Si quitas uno, se muestran más entradas.
  <tanrei-button slot="actions" variant="outlined">Borrar filtros</tanrei-button>
</tanrei-empty-state>

<script type="module">
  import '@tanrei/web/components/empty-state';
  import '@tanrei/web/empty-state.css'; // el lugar que un estado vacío renderizado en el servidor conserva antes de que el elemento esté definido
</script>
import { Button, EmptyState } from '@tanrei/react';

{rows.length === 0 && (
  <EmptyState live headline="Ninguna entrada coincide con estos filtros">
    Hay tres filtros activos. Si quitas uno, se muestran más entradas.
    <Button slot="actions" variant="outlined" onClick={clearFilters}>Borrar filtros</Button>
  </EmptyState>
)}

Especificaciones

Las partes, añadidas una a una

Un proyecto reúne las capas, las exportaciones y las personas de un mismo sistema de diseño.folder_openUn proyecto reúne las capas, las exportaciones y las personas de un mismo sistema de diseño.folder_openUn proyecto reúne las capas, las exportaciones y las personas de un mismo sistema de diseño.Nuevo proyectoImportar una capa

En el borde de inicio, y el tamaño large

Cambia un valor a la izquierda y aparecerá aquí.explore_offPuede que la dirección esté mal escrita o que la página se haya movido.Ir a la página de inicio

Anatomía

Anatomía

Dibujado sobre el fixture title, tal como lo dibuja el paquete web.
Parte Descripción
1 container The block that holds the message, as wide as the region it stands in and as tall as its content and its padding, with no fill, no edge and no elevation: it is drawn on the surface of the region whose content is missing. It carries no state.
2 media · opcional What pictures the empty place, above the title: a glyph of the system's icon set, in a quiet color, or a picture of the product's own. Decorative: the title says it.
3 title What is missing, in a few words ("No results", "No projects yet"). The one part at the surface's full text color. Plain text unless the product gives a heading; it wraps and is never cut.
4 description · opcional Why the place is empty, or what the person can do about it, in a sentence or two, in a quiet color. The product's content: text, with links where it needs them.
5 actions · opcional One or two of the product's own Buttons or links that fill the place or change what was asked for ("New project", "Clear the filter"), in a row below the text.

Medidas

Medidas

Longitud Token Valor (px)
container padding-inline tanrei.comp.empty-state.container.padding-inline 16
Dibujado sobre el fixture title, tal como lo dibuja el paquete web.

Propiedades

Propiedad Tipo Valor predeterminado Descripción
title string "" What is missing, in a few words, in the product's language ("No results for tokne"). Exposed as a heading of the level `level` gives, since it is drawn as one. The title slot takes its place where the product needs inline content or a heading element of its own.
level number 2 The level of the heading the title prop is exposed as, 1 to 6, so that the empty state takes its place in the outline of the page around it: 2, the default, for the main region of a view under the page's own title; deeper inside a section, a card or a panel that has a heading of its own. Ignored where the title slot holds the product's own content, whose role and level are the product's.
size medium | large "medium" Medium is for an empty region inside a view: a list, a table's body, a card, a panel, a search's results. Large is for a view that is empty as a whole: the main region of a page before its first item, a page that was not found. It changes the room above and below, the glyph's size and the text styles. A design system may add values.
align center | start "center" Where the parts stand on the inline axis. Center, the default, is for a region that is otherwise blank. Start puts every part at the region's start edge with its text aligned there, for a narrow column, a list in a side panel or a table whose header stays in view, where the content would have begun at that edge.
live boolean false Whether the empty state is announced. False, the default, is for a place that is empty when its view is presented: it is read where it stands. True is for one that appears in answer to what the person did (a search that found nothing, a filter that matches no row, the last item removed): it is a live region, announced once, politely, when it is shown and when its text changes. It is never announced assertively and never takes focus: an empty place is not an error. It changes nothing that is drawn.

Slots

Slot Descripción
default The description: text, with the product's own links and inline content. Empty draws the title alone.
media A glyph of the system's icon set, by name, drawn through the platform's icon helper at the media size; or a picture of the product's own (an illustration), which keeps its own size and colors.
title The product's own title content in place of the title prop: a heading of the level the page's outline needs, or text with inline content. The empty state draws it in the title's style and changes neither its role nor its level.
actions The actions: the product's own Buttons or links, one or two, the main one first. The empty state lays them out below the text and does nothing else to them.

Estados

Comportamiento

Requisitos en formato EARS. Cada implementación de plataforma se prueba contra estos identificadores. El texto de los requisitos se muestra tal como está en la especificación, en inglés.

ID Requisito
EMP-1 THE empty state SHALL lay itself out as a block that takes the whole inline size of the region it is placed in and is as tall as its content and its padding: it SHALL lay out in one column, in this order, its media, its title, its description and its actions, those it has, padded above the first and below the last by the block padding of its size (comp.empty-state.container.padding-block.medium for medium, comp.empty-state.container.padding-block.large for large) and at the start and the end by comp.empty-state.container.padding-inline. THE empty state SHALL draw no fill, no edge and no elevation, SHALL bring no outer space of its own, SHALL set no height of its own and SHALL NOT scroll: where the region is taller, placing the block in it is the region's.
EMP-2 WHILE align is center THE empty state SHALL centre every part on the inline axis of its container and centre the lines of its title and its description; WHILE align is start THE empty state SHALL place every part at the container's start edge, inside the inline padding, and align the lines of its text to the start. In both THE empty state SHALL keep its title and its description no wider than comp.empty-state.content.measure times the description's font size, and no wider than the container less its inline padding.
EMP-3 WHERE the media slot holds a glyph THE empty state SHALL draw it first, in a box of the media size of its size (comp.empty-state.media.size.medium for medium, comp.empty-state.media.size.large for large), in comp.empty-state.media.color, with sys.icon.family.unselected and sys.icon.fill.unselected, sys.icon.weight and an optical size clamped between sys.icon.optical-size.min and sys.icon.optical-size.max, and SHALL begin the title comp.empty-state.media.gap below it. WHERE the slot holds a picture or a view of the product's own THE empty state SHALL draw it in the same place at its own size, never wider than the container less its inline padding and with its proportions kept, and SHALL NOT color, clip or mirror it. THE empty state SHALL keep the media from assistive technology, and SHALL draw no media the product did not give.
EMP-4 THE empty state SHALL draw its title in the text style of its size (comp.empty-state.title.typescale.medium for medium, comp.empty-state.title.typescale.large for large) and in comp.empty-state.title.color; the title SHALL wrap and SHALL never be cut. THE empty state SHALL expose a title given as text as a heading — of the level the level prop gives on a platform whose headings have levels, and with the platform's heading trait on one whose headings have none — because it is drawn larger and heavier than what follows it, and a text drawn as a heading and not exposed as one tells by its look alone what its structure is. IF level is not a whole number from 1 to 6 THE empty state SHALL use 2 and report it in debug builds. WHERE the title slot holds content THE empty state SHALL draw that content in the title's place, style and color instead of the title prop, and SHALL change neither its role nor its level: a title the product gives as a heading stays a heading of the level the product gave it, and inline content the product gives stays what it is. THE empty state SHALL set the title's letter-spacing by the script of its text, as every title is set (PRS-20): no negative letter-spacing WHERE its language is Chinese, Japanese or Korean, and none WHERE its script joins its letters or stacks marks on them.
EMP-5 WHERE the default slot holds content THE empty state SHALL draw it as the description, comp.empty-state.title.gap below the title, in the text style of its size (comp.empty-state.description.typescale.medium for medium, comp.empty-state.description.typescale.large for large) and in comp.empty-state.description.color; the description SHALL wrap and SHALL never be cut or limited to a number of lines. A link in the description is the product's own and is drawn by its own spec, in its own color and underlined.
EMP-6 WHERE the actions slot holds content THE empty state SHALL lay it out in one row comp.empty-state.actions.gap below the text, in the order given from the start, comp.empty-state.actions.item-gap apart, centred or at the start as align says (EMP-2); WHERE the row does not fit the container THE empty state SHALL wrap it, comp.empty-state.actions.item-gap between its lines, and SHALL never cut or shrink an action below its own minimum. THE empty state SHALL NOT restyle, resize, reorder or rename the actions, and SHALL emit no event of its own: an action's press is that control's.
EMP-7 THE empty state SHALL NOT take pointer, touch or keyboard input, SHALL NOT take focus or be a stop in the focus order, and SHALL NOT change anything it draws under a pointer, a press or focus: it has no hovered, focused, pressed, selected or disabled state and draws no state layer and no focus indicator. What the product places in it — a link in the description, a Button in the actions — takes input and focus by its own spec, in the order the parts are drawn, and text in the title and the description SHALL remain selectable where the platform lets text be selected.
EMP-8 WHILE live is false THE empty state SHALL be exposed to assistive technology as plain content, read where it stands in reading order: its title as a heading (of the level level gives, or the product's own content in the title slot as the product gave it), then its description, then its actions as the controls they are. It SHALL have no role and no name of its own, SHALL NOT be announced when it is shown or when its text changes, SHALL NOT move focus, and SHALL NOT be exposed as an alert, a status, a dialog or a note: an empty place is content, not a message.
EMP-9 WHILE live is true THE empty state SHALL be a polite live region. WHEN it is shown after its page or view was first presented, and WHEN its title or its description changes while it is shown, THE empty state SHALL have assistive technology announce it once, after what is being read: the title, then the description, and not the names of its actions. It SHALL never announce assertively and SHALL NOT move keyboard or screen-reader focus. A live empty state that is drawn with the first presentation of its page or view SHALL NOT announce itself then. live SHALL change nothing that is drawn.
EMP-10 WHEN title, the title slot's content, the description, the media or the actions change THE empty state SHALL draw and expose the new value at once, without a motion, and SHALL announce it only as EMP-9 says. THE empty state SHALL neither show nor hide itself: whether the place is empty is the product's to know, and the product puts the empty state there and takes it away.
EMP-11 WHILE the text size is enlarged THE empty state SHALL grow its title and its description, and the measure with them, keep its paddings and gaps, wrap, and grow in height; it SHALL keep a glyph's box at the media size of its size, SHALL cut nothing and set no fixed height, SHALL lose no content when the reader raises line height, paragraph spacing, letter spacing or word spacing, and SHALL need no horizontal scrolling at a width of 320 points with text at 200 %, its actions then each on a line of their own where two do not fit side by side.
EMP-12 WHERE the platform draws with a person's own forced colors (the web's forced-colors mode, and a platform's equivalent where it has one) THE empty state SHALL draw its glyph, its title and its description in the platform's text color, and leave links, Buttons and a picture of the product's own to their own specs and colors; nothing the empty state draws relies on a fill.
EMP-13 WHERE the layout direction is right-to-left THE empty state SHALL apply its paddings by logical start and end and mirror the order of its actions, so that the first action is at the right; WHILE align is start it SHALL place every part at the right edge and align its text to the right; WHILE align is center the column stays centred.
EMP-14 THE empty state SHALL take its layout direction from where it is used — the direction of the nearest ancestor that sets one, and the platform's own where none does — and SHALL have no direction setting of its own; WHEN that direction changes while the empty state is shown THE empty state SHALL draw itself for the new direction at once, without a motion of its own, keeping what it shows.
EMP-15 WHERE the layout direction is right-to-left THE empty state SHALL draw the glyph of its media slot mirrored left to right exactly when the system's icon set marks that glyph's name as mirrored or the product forces mirroring for that use, and unmirrored when the product forbids it: the icon helper mirrors the glyph inside its own box, about the box's vertical centre line, changing neither its place, size, color and fill nor the order EMP-13 gives. THE empty state SHALL NOT mirror a glyph itself, and SHALL NOT mirror content the product gives as a picture or a view of its own rather than by a glyph's name.
EMP-16 THE empty state SHALL lay out a title given as text as text of its own direction, isolated from the text around it: it takes the base direction of its first strong character, or the layout direction where it has none, so that a title that quotes what the person typed, a file's name or a number keeps its own order in a right-to-left layout; THE empty state SHALL still place the title and align its lines by the layout direction and by align, not by the text's own. The description's direction is its content's.
EMP-17 WHEN size names a value that the active design system does not have, or align names a value this spec does not have, THE empty state SHALL render with the default value, and in debug builds report the unknown value.
EMP-18 IF the title, the title slot and the description are all empty THE empty state SHALL draw nothing, take no space and expose nothing, and in debug builds report that an empty state says nothing: a glyph or actions alone do not tell a person what is missing. IF the description is given and the title and the title slot are empty THE empty state SHALL still render and in debug builds report that an empty state has no title.

Correspondencia de nombres por plataforma

Paridad no significa API idénticas. Cada plataforma expresa el mismo contrato con su propio estilo.

Especificación Web SwiftUI Jetpack Compose Flutter React Native
Componente tanrei-empty-state TanreiEmptyState TanreiEmptyState TanreiEmptyState EmptyState
title · Propiedad headline title title title title
level · Propiedad level headingLevel headingLevel headingLevel headingLevel
size · Propiedad size size size size size
align · Propiedad align alignment alignment alignment align
live · Propiedad live isLive live live live
Notas It is the form the callout takes. <tanrei-empty-state> with the description as light-DOM children, the glyph or the picture in the media slot, the title in the title slot (<p slot="title">, or <h2 slot="title"> where it is a heading) or the headline attribute (HTML's global title attribute would show a tooltip over the whole block, as on the callout), which the shadow root draws as an element with role="heading" and aria-level from level (a number property and attribute, 2 by default), and Buttons or links in the actions slot. Everything the product writes stays in the document: the title where it is slotted, the description, the links and the Buttons are light-DOM content, read by a crawler and by a page without script. **Before the element is defined** the stylesheet of @tanrei/web gives tanrei-empty-state:not(:defined) display: block, the block and inline padding of its size, the description's text style and color, and text-align by its align, so the content is readable in its place and the block keeps most of its height; a headline attribute does not show until the element is defined, which is why a page that must read without script gives the title in the slot. The host has no role, no tabindex and no listeners; the glyph is aria-hidden. With live the announcement is made through a visually hidden role="status" region in the shadow root that exists from the element's first render and is filled, with the title and the description's text, only when the element is connected or changed after the document's first presentation (EMP-9); the host itself gets no live role, so slotted content is not read twice. The text block's width is max-inline-size: calc(var(--tanrei-comp-empty-state-content-measure) * 1em) on the element that carries the description's font size (EMP-2). The description takes its color and text style through inherited color and font, so text placed directly in the element is styled. In a table the element goes in one <td colspan> of a body row, or directly after the table, which keeps its caption and its header row (the Table spec says nothing of an empty body); in a list it takes the list's place rather than being an item. Nothing changes under forced-colors: active but the colors the mode sets (EMP-12). TanreiEmptyState(_ title: String, size:, alignment:, isLive:, media:, actions:) { description }, the glyph given by name through icon: or a view through media:; a heading title is the title: view builder with the header trait set by the product. Not the platform's own unavailable-content view, whose sizes and colors are the platform's: the same structure drawn from Tanrei's tokens. isLive posts one announcement with the title and the description when the view appears after its screen did. Not built on this platform yet: EMP-4's title given as text exposed as a heading, and level. TanreiEmptyState(title, size, alignment, live, media, actions) { description }, the glyph given by name through icon or a composable through media. With live the text column has liveRegion = LiveRegionMode.Polite, set only after the first composition of its screen. Not built on this platform yet: EMP-4's title given as text exposed as a heading, and level. TanreiEmptyState(title: …, size:, alignment:, live:, icon:, media:, actions: […], child: description); titleWidget: takes a heading of the product's own. With live the text is wrapped in Semantics(liveRegion: true) after the first frame of its route, and announced through SemanticsService.announce with polite assertiveness where the platform does not read live regions. Not built on this platform yet: EMP-4's title given as text exposed as a heading, and level. <EmptyState title="No projects yet" icon="folder_open" actions={…}>description</EmptyState>; media takes an element of the product's own. With live, accessibilityLiveRegion="polite" on Android and one AccessibilityInfo.announceForAccessibility call on iOS when it mounts after its screen. Follows the app's direction where an ancestor's is not known. Not built on this platform yet: EMP-4's title given as text exposed as a heading, and level.

Tokens

Token Alias de Valor resuelto (claro)
--tanrei-comp-empty-state-actions-gap sys.space.space200 16px
--tanrei-comp-empty-state-actions-item-gap sys.space.space100 8px
--tanrei-comp-empty-state-container-padding-block-large sys.space.space800 64px
--tanrei-comp-empty-state-container-padding-block-medium sys.space.space400 32px
--tanrei-comp-empty-state-container-padding-inline sys.space.space200 16px
--tanrei-comp-empty-state-content-measure — 30
--tanrei-comp-empty-state-description-color sys.color.on-surface-variant #4b4b4b
--tanrei-comp-empty-state-media-color sys.color.on-surface-variant #4b4b4b
--tanrei-comp-empty-state-media-gap sys.space.space200 16px
--tanrei-comp-empty-state-media-size-large — 48px
--tanrei-comp-empty-state-media-size-medium sys.icon.large 32px
--tanrei-comp-empty-state-title-color sys.color.on-surface #1b1b1b
--tanrei-comp-empty-state-title-gap sys.space.space50 4px
--tanrei-comp-empty-state-description-typescale-large sys.typescale.body-large 400 16px/1.625
--tanrei-comp-empty-state-description-typescale-medium sys.typescale.body 400 14px/1.5714
--tanrei-comp-empty-state-title-typescale-large sys.typescale.heading-3 500 20px/1.4
--tanrei-comp-empty-state-title-typescale-medium sys.typescale.heading-5 500 16px/1.5

Fixtures

Representaciones canónicas. Todas las plataformas capturan cada fixture con el mismo identificador para poder comparar los resultados.

Generado a partir de specs/empty-state.spec.json, tokens/comp/empty-state.tokens.json, design/tokens/

Pautas

Estado vacío, callout, snackbar, texto de estado

Componente Qué es Dónde está
Estado vacío El lugar de un contenido que no está. Donde estarían la lista, las filas o los resultados.
Callout Un aviso sobre un contenido que sí está. Junto a ese contenido, en el flujo.
Snackbar El resultado de algo que acaba de ocurrir. Encima del contenido, por poco tiempo.
El texto de estado de una búsqueda El recuento de lo que se encontró («No hay resultados para tokne»). En la propia fila de estado de la búsqueda.

Un lugar vacío no es un error. Un contenido que no se pudo cargar es un callout con el estado de error en ese mismo lugar, y un contenido que todavía se está cargando es un indicador de carga. Cambiar entre los tres estados de una región (cargando, vacía, con error) le corresponde a la región: el estado vacío no se muestra ni se oculta por sí mismo.

Tamaños

size Encima y debajo Glifo Título Descripción Úsalo para
medium (predeterminado) 32 32 16 14 Una región dentro de una vista: una lista, el cuerpo de una tabla, una tarjeta, un panel, los resultados de una búsqueda.
large 64 48 20 16 Una vista que está vacía en su conjunto: una página antes de su primer elemento, una página que no se encontró.

El bloque es tan ancho como su región y tan alto como su contenido y su margen interior. Donde la región es más alta, colocar el bloque en ella (centrarlo, mantener la altura mínima de una tabla) le corresponde a la región. El texto se limita a unos 60 caracteres latinos por línea (30 veces el tamaño de la descripción), de modo que una frase en medio de una tabla ancha no va de borde a borde.

Alineación

align es center (el valor predeterminado) para una región que, por lo demás, está en blanco, y start para una columna estrecha, una lista en un panel lateral o una tabla cuyo encabezado se mantiene a la vista: el mensaje empieza entonces donde habría empezado el contenido.

Título

headline se expone como un encabezado, porque se dibuja como uno: de nivel 2 por defecto, para la región principal de una vista bajo el título propio de la página. Pon en level el nivel que necesite el esquema de tu página: más profundo dentro de una sección, una tarjeta o un panel que tiene un encabezado propio. Un título en el slot title se dibuja como cualquier título, y el estado vacío no cambia ni su rol ni su nivel: pon ahí tu propio elemento de encabezado, o texto donde el título no deba ser un encabezado.

En una página que se renderiza en un servidor, da el título en el slot title: un atributo headline lo dibuja el elemento, así que no se muestra antes de que el elemento esté definido.

Gráfico

Un glifo se da por su nombre, en un elemento: <span slot="media">folder_open</span>. Se dibuja con el tamaño del gráfico, en un color discreto. Cualquier otra cosa que haya en el slot (un <img>, un <svg>, un elemento tuyo) es una imagen: conserva su tamaño y sus colores, nunca es más ancha que el bloque y nunca se refleja. El gráfico es decorativo y queda oculto para la tecnología de apoyo, así que no pongas en la imagen la única forma de seguir adelante. Tanrei no incluye ilustraciones.

Acciones

Las acciones son tus propios botones o enlaces, una o dos, la principal primero. El estado vacío las dispone en una fila que salta de línea y no les hace nada más. A una acción cuya etiqueta es más larga que su línea se le da la línea entera: un botón hace entonces saltar de línea su etiqueta, de modo que nada se corta y nada sobresale del bloque.

En una columna estrecha, cada acción ocupa una línea, y una etiqueta larga salta de línea

search_offRevisa la ortografía.Borrar búsquedaAbrir el índice de contenidos de la documentación

Aparecer en respuesta a algo

live es para un estado vacío que resulta de lo que la persona acaba de hacer: un filtro que no coincide con ninguna fila, el último elemento que se quita. Se anuncia una vez, de forma cortés (el título, después la descripción, y no las acciones), cuando se muestra y cuando su texto cambia. Mantenlo en la página con hidden, o añádelo cuando corresponda.

Un estado vacío activo, que se muestra en respuesta a una pulsación

Aplicar tres filtros

Uno que está en el marcado de la página y se muestra cuando la página se carga no se anuncia en ese momento. En la web, un estado vacío activo que tu script añade a la página después de que esta se haya cargado sí se anuncia; el elemento no puede distinguir uno añadido en respuesta a algo de uno añadido con una vista nueva de una aplicación de una sola página, así que, para un estado vacío que simplemente forma parte de una vista nueva, no pongas live.

En una búsqueda, el recuento de resultados es el propio texto de estado de la búsqueda, que ya se anuncia. Donde además muestres un estado vacío en la vista de la búsqueda, no le pongas live, o las mismas palabras se leerán dos veces.

En una tabla y en una lista

Una tabla sin filas conserva su leyenda y su fila de encabezado; el estado vacío está donde estarían las filas del cuerpo: en una celda que abarca todas las columnas, o justo después de la tabla. Una lista sin elementos no es una lista de un elemento: el estado vacío ocupa el lugar de la lista.

Antes de que el elemento esté definido

La descripción, el slot del título y las acciones son hijos del propio elemento, así que están en el documento: la búsqueda en la página los encuentra, se traducen, se seleccionan y se leen sin script. @tanrei/web/empty-state.css da a un estado vacío que todavía no está definido sus márgenes interiores, sus estilos de texto y su alineación, de modo que las palabras se pueden leer donde van a estar. Hasta entonces se muestra sin su glifo.

Recomendado

  • Di qué falta en el título, con palabras sencillas, y qué hacer en la descripción.
  • Ofrece la acción que llena el lugar o que cambia lo que se pidió.
  • Cita lo que la persona escribió en el título de una búsqueda sin resultados.

Evita

  • No le des un color de estado ni el rol de una alerta. Un lugar vacío es un hecho acerca del contenido.
  • No uses live para un lugar que está vacío cuando su vista se abre.
  • No dibujes a mano una frase gris centrada, ni una lista de un solo elemento que no es un elemento.
  • No lo uses para un «no hay nada» de una línea dentro de un control, como un menú sin opciones: ese es el texto propio del control.

Accesibilidad

Rol
none
Etiquetado
An empty state that is not live has no role and no name: it is content, read where it stands — the title (a heading of the level level gives, or the product's own content in the title slot as the product gave it), the description, then the actions, which are the product's own controls with their own names. A live empty state is a polite live region instead (the status role on the web), announced once when it is shown after its view was presented and when its text changes. The glyph or the picture is hidden.
Objetivo mínimo
El área de pulsación cumple el tamaño mínimo de objetivo aunque el tamaño visual sea menor. minimum 32px · pointer 44px · spacing 8px · touch 48px

Teclado

Teclas Acción

Notas

  • Not interactive: the empty state takes no input and no focus (EMP-7), so there is no target of its own to size and minimumTarget holds trivially. Its actions meet the minimum target by their own specs.
  • Never an alert. An empty place is a fact about the content, not something that went wrong: it is announced only when it results from what the person just did (live), and then politely (EMP-9). A failure to load is a different thing and is said by a callout with the error status in the same place.
  • It replaces content, so it must not hide that the container is still there. A table that has no rows keeps its caption and its header; the empty state stands where the body's rows would be (on the web, outside the table element or in one cell that spans the columns, as the product's table allows). A list with no items is not exposed as a list of one item: the empty state stands in the list's place.
  • In a search, the count of results is the search's own status text, which is already a live region (SRC-48). Where the product also shows an empty state in the search's view, only one of the two is live, or the same words are announced twice: leave the empty state's live false there and let the status text speak.
  • The title is a heading (EMP-4) because it looks like one (WCAG 1.3.1). Its level is the product's to fit the page's outline: 2 by default, for the main region of a view under the page's title; deeper inside a section, a card or a panel that has a heading of its own. A product whose title must not be a heading gives it as inline content in the title slot.
  • Contrast in the default system: the title is on-surface and the description and the glyph are on-surface-variant, each held to 4.5:1 on every surface tone by the token invariants, so the empty state can stand on a page, in a card or in a panel. The glyph is decorative.
  • Say what to do, not only what is missing: a description and an action are what make an empty place a way forward. Do not put the only way forward in the picture.
  • Text size, text spacing and reflow: EMP-11.

Generado a partir de specs/empty-state.spec.json, tokens/sys/measure.tokens.json

De qué se encarga el componente

  • Es contenido simple, sin rol y sin nombre: el título, la descripción y después las acciones, que se leen donde están.
  • Con live se anuncia una vez, de forma cortés, mediante una región de estado propia: cuando se muestra después de que la página se haya presentado, y cuando su título o su descripción cambian. Nunca se anuncia de forma asertiva.
  • El glifo o la imagen quedan ocultos para la tecnología de apoyo.
  • Un título dado como texto es un encabezado del nivel que da level. Lo que das en el slot title conserva su rol y su nivel.
  • No es una parada en el orden del foco y nunca mueve el foco. Tab llega a los enlaces de la descripción y después a las acciones.
  • Con el texto ampliado todo salta de línea y crece; con una anchura de 320 y el texto al 200% nada se desplaza hacia los lados, y cada acción queda en una línea propia.
  • Con colores forzados, el glifo, el título y la descripción se dibujan en el color del texto. Nada depende de un relleno.
  • En un diseño de derecha a izquierda, el inicio es el borde derecho y la primera acción está a la derecha, un glifo que el conjunto de iconos marca se refleja, y un título que cita una consulta escrita de izquierda a derecha conserva el orden de la consulta.
  • Las compilaciones de depuración notifican un tamaño o una alineación desconocidos, un estado vacío sin título y sin descripción, y uno con descripción y sin título.

Qué debes hacer tú

  • Escribe todas las palabras en el idioma de la página. El componente no aporta ninguna.
  • Ajusta level al esquema de tu página, o da tu propio encabezado o texto en el slot title.
  • Usa live solo para un estado vacío que aparece en respuesta a algo, y nunca junto a otra región activa que diga lo mismo.
  • No pongas un control en el slot media: queda oculto para la tecnología de apoyo.
  • Da a cada acción una etiqueta que quepa. Una etiqueta salta de línea donde su línea es demasiado corta, pero una sola palabra más larga que la línea no puede.