Skip to content
Meeko
Type to search the guides and the API reference. Open it from any page with / or Ctrl K; move with the arrow keys and open a result with Enter.
Get started

Contents

On this page

Not translated yet

This page has not been translated into English yet, so it is shown in Spanish.

ElementAttributes

tipo Since 1.5.0

Atributos que acepta bind="obj" en un elemento Tag: los globales (class, id, role, aria-*, data-*…) y los propios de la etiqueta según los datos HTML de Meeko. Con una unión de etiquetas vale cualquier atributo de alguna de ellas; un valor null, undefined o false no escribe el atributo. No admite claves on*: los manejadores no se crean desde datos. Desde 1.8, el tipo de cada valor ofrece al completado los valores del estándar ("submit" | "reset" | "button" en type de <button>) sin dejar de admitir cualquier otro (véase AttributeValueOf).

ts
import type { ElementAttributes } from "@meekojs/meeko";

Source code src/app/runtime/dynamic-tag.ts:71

Declaración #

ts
type ElementAttributes<Tag extends string = TagName> = { readonly [Name in AttributeNameOf<Tag>]?: AttributeValueOf<Tag, Name> }

Type parameters #

Tag extends string = TagName

Etiqueta o unión de etiquetas del elemento.

Example #

meeko
<script lang="ts">
import { computed } from "@meekojs/meeko";
import type { ElementAttributes } from "@meekojs/meeko";
const props = defineProps<{ href?: string; busy: boolean }>();
const state = computed((): ElementAttributes<"a" | "button"> => ({ "aria-busy": props.busy, "data-kind": props.href ? "link" : "action" }));
</script>
<template><component is="props.href ? 'a' : 'button'" bind="state.value" bind:href="props.href">Abrir</component></template>

See also #

Was this page helpful?

Add a comment

It is sent when you choose “Yes” or “No”. Only the page, your answer and the comment are stored: no cookies and no personal data.

0 of 2000 characters

Edit on GitHub: packages/meeko/src/app/runtime/dynamic-tag.ts