diff --git a/api-generator/components/badge.js b/api-generator/components/badge.js index 5c7245dfb..0562aeb0a 100644 --- a/api-generator/components/badge.js +++ b/api-generator/components/badge.js @@ -16,6 +16,12 @@ const BadgeProps = [ type: 'string', default: 'null', description: 'Size of the badge, valid options are "large" and "xlarge".' + }, + { + name: 'pt', + type: 'any', + default: 'null', + description: 'Uses to pass attributes to DOM elements inside the component.' } ]; diff --git a/components/lib/badge/Badge.d.ts b/components/lib/badge/Badge.d.ts index 044eea063..3d7934bd8 100644 --- a/components/lib/badge/Badge.d.ts +++ b/components/lib/badge/Badge.d.ts @@ -10,6 +10,33 @@ import { VNode } from 'vue'; import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; +export declare type BadgePassThroughOptionType = BadgePassThroughAttributes | ((options: BadgePassThroughMethodOptions) => BadgePassThroughAttributes) | null | undefined; + +/** + * Custom passthrough(pt) option method. + */ +export interface BadgePassThroughMethodOptions { + props: BadgeProps; +} + +/** + * Custom passthrough attributes for each DOM elements + */ +export interface BadgePassThroughAttributes { + [key: string]: any; +} + +/** + * Custom passthrough(pt) options. + * @see {@link BadgeProps.pt} + */ +export interface BadgePassThroughOptions { + /** + * Uses to pass attributes to the root's DOM element. + */ + root?: BadgePassThroughOptionType; +} + /** * Defines valid properties in Badge component. */ @@ -26,6 +53,11 @@ export interface BadgeProps { * Size of the badge, valid options are 'large' and 'xlarge'. */ size?: 'large' | 'xlarge' | null | undefined; + /** + * Uses to pass attributes to DOM elements inside the component. + * @type {BadgePassThroughOptions} + */ + pt?: BadgePassThroughOptions; } /** diff --git a/components/lib/badge/Badge.vue b/components/lib/badge/Badge.vue index 4d0ab5c76..43e243306 100644 --- a/components/lib/badge/Badge.vue +++ b/components/lib/badge/Badge.vue @@ -1,14 +1,16 @@