MDUI文档
预设颜色
自选颜色
从壁纸提取颜色
请选择一张壁纸
开发指南
样式
与框架集成
组件
Avatar 头像Badge 徽标BottomAppBar 底部应用栏Button 按钮ButtonIcon 图标按钮Card 卡片Checkbox 复选框Chip 纸片CircularProgress 圆形进度指示器Collapse 折叠面板Dialog 对话框Divider 分割线Dropdown 下拉组件Fab 浮动操作按钮Icon 图标Layout 布局LinearProgress 线性进度指示器List 列表Menu 菜单NavigationBar 底部导航栏NavigationDrawer 侧边抽屉栏NavigationRail 侧边导航栏Radio 单选框RangeSlider 范围滑块Select 选择框SegmentedButton 分段按钮Slider 滑块Snackbar 消息条Switch 开关切换Tabs 选项卡TextField 文本框Tooltip 工具提示TopAppBar 顶部应用栏
工具函数
独立包

Badge 徽标

Badges provide dynamic information, such as counts or status indications. They can contain labels or numbers.

Usage

Import the component:

import 'mdui/components/badge.js';

Import the TypeScript type:

import type { Badge } from 'mdui/components/badge.js';

example:

12
<mdui-badge>12</mdui-badge>

Examples

Variants

The variant attribute determines the badge's shape. A large value creates a larger badge. Specify the content to display within the default slot.

API

属性

HTML 属性JavaScript 属性Reflect类型默认值
variantvariant'small' | 'large''large'

Defines the badge shape. Possible values:

  • small: A small badge without text.
  • large: A large badge with displayed text.

Slots

名称
默认

The text to be displayed.

CSS 自定义属性

名称
--shape-corner

The size of the component corner. You can use a specific pixel value, but it's recommended to reference design tokens.

本页目录