BarElementAPI
React BarElement 组件的 API 参考文档。了解此导出模块的 props、CSS 和其他 API。
演示
导入
import { BarElement } from '@mui/x-charts/BarChart';
// or
import { BarElement } from '@mui/x-charts';
// or
import { BarElement } from '@mui/x-charts-pro';
阅读这篇关于最小化 bundle size 的指南,了解它们之间的区别。
名称 | 类型 | 默认值 | 描述 |
---|---|---|---|
slotProps | object | {} | 用于每个组件 slot 的 props。 |
slots | object | {} | 可覆盖的组件 slots。 有关更多详细信息,请参阅下面的 Slots API。 |
该组件不能持有 ref。
Slot 名称 | 类名 | 默认组件 | 描述 |
---|---|---|---|
bar | BarElementPath | 渲染柱状图的组件。 |
这些类名对于使用 CSS 进行样式设置非常有用。当特定状态被触发时,它们会被应用于组件的 slots。
类名 | 规则名称 | 描述 |
---|---|---|
.MuiBarElement-root | root | 应用于根元素的样式。 |
您可以使用以下自定义选项之一来覆盖组件的样式
- 使用全局类名。
- 使用规则名称作为自定义主题中组件的
styleOverrides
属性的一部分。
源代码
如果您在此页面中找不到所需信息,请考虑查看组件的实现以获取更多详细信息。