Files
heroui-vue/packages/vue/src/components/error-message/ErrorMessage.vue
T
maoyingjie af6bfda3ee feat: migrate Tag, TagGroup and ErrorMessage with collection and focus contracts
Port the fixed HeroUI baseline tag/tag-group/error-message components onto the
existing collection selection/registry protocols instead of a second state model.

- TagGroup owns selection, disabled scope, removal requests and name/description
  wiring; TagGroupList renders the role=grid node and Tag renders role=row.
- Removal has one path: a press inside the remove subtree is a removal request,
  so custom remove buttons work without a second event source; focus follows the
  next neighbour only after the item is actually gone.
- ErrorMessage keeps the baseline slot marker and reuses the field part ids
  without gaining validation or aria-invalid semantics.
- Ship the 12 tag-group and 2 error-message previews, both doc pages, navigation,
  a 35-case behavioural suite and independent tarball consumption checks.
2026-10-25 10:45:43 +08:00

25 lines
633 B
Vue

<script setup lang="ts">
import { useAttrs } from "vue";
import { errorMessageVariants } from "@heroui-vue/styles";
import { useFieldPart } from "../field/useFieldPart";
defineOptions({ name: "ErrorMessage", inheritAttrs: false });
// The `slot` attribute mirrors the fixed baseline's RAC Text slot. In Vue it is
// a plain DOM attribute (a CSS hook), not a slot assignment.
const attrs = useAttrs();
const { id } = useFieldPart("error", attrs);
</script>
<template>
<p
v-bind="attrs"
:id="id"
:class="errorMessageVariants()"
slot="errorMessage"
data-slot="error-message"
>
<slot />
</p>
</template>