diff --git a/api-generator/components/tag.js b/api-generator/components/tag.js index e98d6a7e1..1ac243364 100644 --- a/api-generator/components/tag.js +++ b/api-generator/components/tag.js @@ -22,6 +22,12 @@ const TagProps = [ type: 'string', default: 'null', description: 'Icon of the tag to display next to the value.' + }, + { + name: 'pt', + type: 'any', + default: 'null', + description: 'Uses to pass attributes to DOM elements inside the component.' } ]; diff --git a/components/lib/tag/Tag.d.ts b/components/lib/tag/Tag.d.ts index 2a8613243..a26f2be0a 100644 --- a/components/lib/tag/Tag.d.ts +++ b/components/lib/tag/Tag.d.ts @@ -10,6 +10,41 @@ import { VNode } from 'vue'; import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; +export declare type TagPassThroughOptionType = TagPassThroughAttributes | ((options: TagPassThroughMethodOptions) => TagPassThroughAttributes) | null | undefined; + +/** + * Custom passthrough(pt) option method. + */ +export interface TagPassThroughMethodOptions { + props: TagProps; +} + +/** + * Custom passthrough(pt) options. + * @see {@link TagProps.pt} + */ +export interface TagPassThroughOptions { + /** + * Uses to pass attributes to the root's DOM element. + */ + root?: TagPassThroughOptionType; + /** + * Uses to pass attributes to the icon's DOM element. + */ + icon?: TagPassThroughOptionType; + /** + * Uses to pass attributes to the value's DOM element. + */ + value?: TagPassThroughOptionType; +} + +/** + * Custom passthrough attributes for each DOM elements + */ +export interface TagPassThroughAttributes { + [key: string]: any; +} + /** * Defines valid properties in Tag component. */ @@ -32,6 +67,11 @@ export interface TagProps { * @deprecated since v3.27.0. Use 'icon' slot. */ icon?: string | undefined; + /** + * Uses to pass attributes to DOM elements inside the component. + * @type {TagPassThroughOptions} + */ + pt?: TagPassThroughOptions; } /** diff --git a/components/lib/tag/Tag.vue b/components/lib/tag/Tag.vue index 259288a81..d40a853da 100644 --- a/components/lib/tag/Tag.vue +++ b/components/lib/tag/Tag.vue @@ -1,16 +1,19 @@