Badge API

API documentation for Badge component

Badge#

Props#

Defines valid properties in Badge component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: BadgeInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: BadgeInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<BadgePassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: BadgeInstance) => ReactNode)
null
The children to render.
shape"circle"
null
Defines the shape of the badge.
size"small" | "large" | "xlarge"
null
Size of the badge.
severity"secondary" | "info" | "success" | "warn" | "danger" | "contrast"
null
Severity type of the badge.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Interfaces#

Defines passthrough(pt) options of Badge component.

nametypedefaultdescription
rootBadgePassThroughType<HTMLAttributes<HTMLSpanElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of Badge component.

values
ComponentInstance<BadgeProps, BadgeState, BadgeExposes>

OverlayBadge#

Props#

Defines valid properties in OverlayBadge component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: OverlayBadgeInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: OverlayBadgeInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<OverlayBadgePassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: OverlayBadgeInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Interfaces#

Defines passthrough(pt) options of OverlayBadge component.

nametypedefaultdescription
rootOverlayBadgePassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of OverlayBadge component.

values
ComponentInstance<OverlayBadgeProps, OverlayBadgeState, OverlayBadgeExposes>

useBadge#

Types#

Instance of useBadge headless.

values
HeadlessInstance<useBadgeProps, useBadgeState, useBadgeExposes>