#组件默认参数
通过 ConfigProvider 的 components 设置区域内的组件默认参数。常用示例、命名规则和继承方式见组件默认值。
#LeafComponentDefaults
所有配置项均可选。每项接受下表列出的参数,或用 null 清除继承;点击类型可查看参数含义及组件内置默认值。必填项、模式关联值、泛型数据和命令式引用仍由实例提供。
| 属性 | 类型 | 说明 |
|---|---|---|
Affix | Partial<Omit<AffixProps, 'key' | 'ref'>> | null | 设置 Affix。 |
Alert | Partial<Omit<AlertProps, 'key' | 'ref' | 'title'>> | null | 设置 Alert。 |
Anchor | Partial<Omit<AnchorProps, 'key' | 'ref' | 'items'>> | null | 设置 Anchor。 |
AppBar | Partial<Omit<AppBarProps, 'key' | 'ref'>> | null | 设置 AppBar。 |
AutoComplete | Partial<Omit<AutoCompleteProps, 'key' | 'ref' | 'options'>> | null | 设置 AutoComplete。 |
Avatar | Partial<Omit<AvatarProps, 'key' | 'ref'>> | null | 设置 Avatar。 |
AvatarGroup | Partial<Omit<AvatarGroupProps, 'key' | 'ref'>> | null | 设置 AvatarGroup。 |
BackTop | Partial<Omit<BackTopProps, 'key' | 'ref'>> | null | 设置 BackTop。 |
Badge | Partial<Omit<BadgeProps, 'key' | 'ref'>> | null | 设置 Badge。 |
BottomNavigation | Partial<Omit<BottomNavigationProps, 'key' | 'ref' | 'items'>> | null | 设置 BottomNavigation。 |
Breadcrumb | Partial<Omit<BreadcrumbProps, 'key' | 'ref' | 'items'>> | null | 设置 Breadcrumb。 |
Button | Partial<Omit<ButtonProps, 'key' | 'ref'>> | null | 按钮的默认参数。 |
ButtonGroup | Partial<Omit<ButtonGroupProps, 'key' | 'ref'>> | null | 设置 ButtonGroup。 |
Calendar | Partial<Omit<CalendarProps, 'key' | 'ref'>> | null | 设置 Calendar。 |
Card | Partial<Omit<CardProps, 'key' | 'ref'>> | null | 设置 Card。 |
CardTitle | Partial<Omit<CardTitleProps, 'key' | 'ref'>> | null | 设置 CardTitle。 |
Carousel | Partial<Omit<CarouselProps, 'key' | 'ref'>> | null | 设置 Carousel。 |
Cascader | Partial< Omit< CascaderProps, 'key' | 'ref' | 'options' | 'multiple' | 'value' | 'defaultValue' | 'onChange' > > | null | 设置 Cascader。 |
CheckableTag | Partial<Omit<CheckableTagProps, 'key' | 'ref'>> | null | 设置 CheckableTag。 |
Checkbox | Partial<Omit<CheckboxProps, 'key' | 'ref'>> | null | 设置 Checkbox。 |
CheckboxGroup | Partial<Omit<CheckboxGroupProps, 'key' | 'ref' | 'options'>> | null | 设置 CheckboxGroup。 |
Col | Partial<Omit<ColProps, 'key' | 'ref'>> | null | 设置 Col。 |
Collapse | Partial<Omit<CollapseProps, 'key' | 'ref' | 'items'>> | null | 设置 Collapse。 |
ColorPicker | Partial<Omit<ColorPickerProps, 'key' | 'ref'>> | null | 设置 ColorPicker。 |
CommandPalette | Partial<Omit<CommandPaletteProps, 'key' | 'ref' | 'items'>> | null | 设置 CommandPalette。 |
Confirm | Partial<Omit<ConfirmOptions, 'key' | 'ref'>> | null | 设置 Confirm。 |
Countdown | Partial<Omit<CountdownProps, 'key' | 'ref' | 'value'>> | null | 设置 Countdown。 |
DataTable | Partial<Omit<DataTablePresentationProps, 'tableRef'>> | null | 设置 DataTable。 |
DataTableColumnVisibility | Partial<Omit<DataTableColumnVisibilityProps, 'key' | 'ref'>> | null | 设置 DataTableColumnVisibility。 |
DataTableContent | Partial<Omit<DataTableContentProps, 'key' | 'ref'>> | null | 设置 DataTableContent。 |
DataTableFooter | Partial<Omit<HTMLAttributes<HTMLDivElement>, 'key' | 'ref'>> | null | 设置 DataTableFooter。 |
DataTablePagination | Partial<Omit<DataTablePaginationProps, 'key' | 'ref'>> | null | 设置 DataTablePagination。 |
DataTableSearch | Partial<Omit<DataTableSearchProps, 'key' | 'ref'>> | null | 设置 DataTableSearch。 |
DataTableToolbar | Partial<Omit<HTMLAttributes<HTMLDivElement>, 'key' | 'ref'>> | null | 设置 DataTableToolbar。 |
DatePicker | Partial< Omit<DatePickerProps, 'key' | 'ref' | 'multiple' | 'value' | 'defaultValue' | 'onChange'> > | null | 设置 DatePicker。 |
DateRangePicker | Partial<Omit<DateRangePickerProps, 'key' | 'ref'>> | null | 设置 DateRangePicker。 |
DateTimePicker | Partial<Omit<DateTimePickerProps, 'key' | 'ref'>> | null | 设置 DateTimePicker。 |
Descriptions | Partial<Omit<DescriptionsProps, 'key' | 'ref' | 'items'>> | null | 设置 Descriptions。 |
Divider | Partial<Omit<DividerProps, 'key' | 'ref'>> | null | 设置 Divider。 |
Drawer | Partial<Omit<DrawerProps, 'key' | 'ref' | 'open'>> | null | 设置 Drawer。 |
Dropdown | Partial<Omit<DropdownProps, 'key' | 'ref' | 'items' | 'children'>> | null | 设置 Dropdown。 |
Empty | Partial<Omit<EmptyProps, 'key' | 'ref'>> | null | 设置 Empty。 |
ErrorBoundary | Partial<Omit<ErrorBoundaryProps, 'key' | 'ref'>> | null | 设置 ErrorBoundary。 |
FileList | Partial<Omit<FileListProps, 'key' | 'ref' | 'items'>> | null | 设置 FileList。 |
Flex | Partial<Omit<FlexProps, 'key' | 'ref'>> | null | 设置 Flex。 |
FloatButton | Partial<Omit<FloatButtonProps, 'key' | 'ref'>> | null | 设置 FloatButton。 |
FloatButtonGroup | Partial<Omit<FloatButtonGroupProps, 'key' | 'ref' | 'actions'>> | null | 设置 FloatButtonGroup。 |
Form | Partial<Omit<FormProps, 'key' | 'ref'>> | null | 设置 Form。 |
FormErrorSummary | Partial<Omit<FormErrorSummaryProps, 'key' | 'ref'>> | null | 设置 FormErrorSummary。 |
FormField | Partial<Omit<FormFieldProps, 'key' | 'ref'>> | null | 设置 FormField。 |
FormGroup | Partial<Omit<FormGroupProps, 'key' | 'ref'>> | null | 设置 FormGroup。 |
FormList | Partial< Omit< FormListProps<unknown>, 'name' | 'children' | 'value' | 'defaultValue' | 'onChange' | 'itemKey' > > | null | 设置 FormList。 |
Grid | Partial<Omit<GridProps, 'key' | 'ref'>> | null | 设置 Grid。 |
Image | Partial<Omit<ImageProps, 'key' | 'ref'>> | null | 设置 Image。 |
ImagePreview | Partial< Omit<ImagePreviewProps, 'key' | 'ref' | 'items' | 'open' | 'onClose'> > | null | 设置 ImagePreview。 |
ImagePreviewGroup | Partial<Omit<ImagePreviewGroupProps, 'key' | 'ref'>> | null | 设置 ImagePreviewGroup。 |
InfiniteScroll | Partial< Omit<InfiniteScrollProps, 'key' | 'ref' | 'dataLength' | 'hasMore' | 'onLoadMore'> > | null | 设置 InfiniteScroll。 |
Input | Partial<Omit<InputProps, 'key' | 'ref'>> | null | 输入框的默认参数,InputSearch 也继承这些输入参数。 |
InputGroup | Partial<Omit<InputGroupProps, 'key' | 'ref'>> | null | 设置 InputGroup。 |
InputMask | Partial<Omit<InputMaskProps, 'key' | 'ref' | 'mask'>> | null | 设置 InputMask。 |
InputNumber | Partial< Omit< InputNumberProps, 'key' | 'ref' | 'stringMode' | 'value' | 'defaultValue' | 'onChange' | 'min' | 'max' | 'step' > > | null | 设置 InputNumber。 |
InputOTP | Partial<Omit<InputOTPProps, 'key' | 'ref'>> | null | 设置 InputOTP。 |
InputSearch | Partial<Omit<InputSearchProps, 'key' | 'ref'>> | null | 搜索框默认参数,优先于 Input 配置。 |
Layout | Partial<Omit<LayoutProps, 'key' | 'ref'>> | null | 设置 Layout。 |
LayoutContent | Partial<Omit<HTMLAttributes<HTMLElement>, 'key' | 'ref'>> | null | 设置 LayoutContent。 |
LayoutFooter | Partial<Omit<HTMLAttributes<HTMLElement>, 'key' | 'ref'>> | null | 设置 LayoutFooter。 |
LayoutHeader | Partial<Omit<HTMLAttributes<HTMLElement>, 'key' | 'ref'>> | null | 设置 LayoutHeader。 |
LayoutSider | Partial<Omit<LayoutSiderProps, 'key' | 'ref'>> | null | 设置 LayoutSider。 |
Link | Partial<Omit<LinkProps, 'key' | 'ref'>> | null | 设置 Link。 |
Loading | Partial<Omit<LoadingProps, 'key' | 'ref'>> | null | 设置 Loading。 |
LoadingBar | Partial<Omit<LoadingBarProps, 'key' | 'ref' | 'active' | 'progress'>> | null | 设置 LoadingBar。 |
Masonry | Partial<Omit<MasonryProps, 'key' | 'ref'>> | null | 设置 Masonry。 |
Mentions | Partial<Omit<MentionsProps, 'key' | 'ref' | 'options'>> | null | 设置 Mentions。 |
Menu | Partial<Omit<MenuProps, 'key' | 'ref' | 'items'>> | null | 设置 Menu。 |
MenuGroup | Partial<Omit<MenuGroupProps, 'key' | 'ref' | 'title'>> | null | 设置 MenuGroup。 |
Message | Partial<Omit<MessageOptions, 'key' | 'content'>> | null | 设置 Message。 |
Modal | Partial<Omit<ModalProps, 'key' | 'ref' | 'open'>> | null | 弹窗默认参数。 |
Notification | Partial<Omit<NotificationOptions, 'key' | 'title'>> | null | 设置 Notification。 |
Pagination | Partial<Omit<PaginationProps, 'key' | 'ref' | 'total'>> | null | 设置 Pagination。 |
Paragraph | Partial<Omit<ParagraphProps, 'key' | 'ref'>> | null | 设置 Paragraph。 |
Popconfirm | Partial<Omit<PopconfirmProps, 'key' | 'ref' | 'children' | 'title'>> | null | 设置 Popconfirm。 |
Popover | Partial<Omit<PopoverProps, 'key' | 'ref' | 'children' | 'content'>> | null | 设置 Popover。 |
Progress | Partial<Omit<ProgressProps, 'key' | 'ref'>> | null | 设置 Progress。 |
QRCode | Partial<Omit<QRCodeProps, 'key' | 'ref' | 'value'>> | null | 设置 QRCode。 |
Radio | Partial<Omit<RadioProps, 'key' | 'ref'>> | null | 设置 Radio。 |
RadioGroup | Partial<Omit<RadioGroupProps, 'key' | 'ref' | 'options'>> | null | 设置 RadioGroup。 |
Rate | Partial<Omit<RateProps, 'key' | 'ref'>> | null | 设置 Rate。 |
Result | Partial<Omit<ResultProps, 'key' | 'ref'>> | null | 设置 Result。 |
Row | Partial<Omit<RowProps, 'key' | 'ref'>> | null | 设置 Row。 |
ScrollArea | Partial<Omit<ScrollAreaProps, 'key' | 'ref'>> | null | 设置 ScrollArea。 |
Scrollbar | Partial<Omit<ScrollbarProps, 'key' | 'ref'>> | null | 设置 Scrollbar。 |
Select | Partial< Omit< SelectProps, 'key' | 'ref' | 'options' | 'multiple' | 'value' | 'defaultValue' | 'onChange' > > | null | 选择器默认参数;模式、值与变更回调仍由实例设置。 |
Skeleton | Partial<Omit<SkeletonProps, 'key' | 'ref'>> | null | 设置 Skeleton。 |
Slider | Partial< Omit<SliderProps, 'key' | 'ref' | 'range' | 'value' | 'defaultValue' | 'onChange'> > | null | 设置 Slider。 |
Space | Partial<Omit<SpaceProps, 'key' | 'ref'>> | null | 设置 Space。 |
SplitButton | Partial<Omit<SplitButtonProps, 'key' | 'ref' | 'items'>> | null | 设置 SplitButton。 |
Splitter | Partial<Omit<SplitterProps, 'key' | 'ref' | 'panels'>> | null | 设置 Splitter。 |
Statistic | Partial<Omit<StatisticProps, 'key' | 'ref' | 'value'>> | null | 设置 Statistic。 |
Steps | Partial<Omit<StepsProps, 'key' | 'ref' | 'items'>> | null | 设置 Steps。 |
Switch | Partial<Omit<SwitchProps, 'key' | 'ref'>> | null | 设置 Switch。 |
Tabs | Partial<Omit<TabsProps, 'key' | 'ref' | 'items'>> | null | 设置 Tabs。 |
Tag | Partial<Omit<TagProps, 'key' | 'ref'>> | null | 设置 Tag。 |
TagGroup | Partial<Omit<TagGroupProps, 'key' | 'ref' | 'options'>> | null | 设置 TagGroup。 |
Text | Partial<Omit<TextProps, 'key' | 'ref'>> | null | 设置 Text。 |
Textarea | Partial<Omit<TextareaProps, 'key' | 'ref'>> | null | 设置 Textarea。 |
Timeline | Partial<Omit<TimelineProps, 'key' | 'ref' | 'items'>> | null | 设置 Timeline。 |
TimePicker | Partial<Omit<TimePickerProps, 'key' | 'ref'>> | null | 设置 TimePicker。 |
TimeRangePicker | Partial<Omit<TimeRangePickerProps, 'key' | 'ref'>> | null | 设置 TimeRangePicker。 |
Title | Partial<Omit<TitleProps, 'key' | 'ref'>> | null | 设置 Title。 |
Toolbar | Partial<Omit<ToolbarProps, 'key' | 'ref'>> | null | 设置 Toolbar。 |
Tooltip | Partial<Omit<TooltipProps, 'key' | 'ref' | 'content' | 'children'>> | null | 设置 Tooltip。 |
Tour | Partial<Omit<TourProps, 'key' | 'ref' | 'open' | 'steps'>> | null | 设置 Tour。 |
Transfer | Partial<Omit<TransferProps, 'key' | 'ref' | 'items'>> | null | 设置 Transfer。 |
Tree | Partial<Omit<TreeProps, 'key' | 'ref' | 'data'>> | null | 设置 Tree。 |
TreeSelect | Partial< Omit< TreeSelectProps, | 'key' | 'ref' | 'options' | 'multiple' | 'treeCheckable' | 'value' | 'defaultValue' | 'onChange' > > | null | 设置 TreeSelect。 |
Typography | Partial<Omit<TypographyProps, 'key' | 'ref'>> | null | 设置 Typography。 |
Upload | Partial<Omit<UploadProps, 'key' | 'ref'>> | null | 设置 Upload。 |
VirtualList | (Partial< Omit<VirtualListProps<unknown>, 'items' | 'itemKey' | 'renderItem' | 'estimateSize'> > & { estimateSize?: number }) | null | 设置 VirtualList。 |
#类型导入
import type { LeafComponentDefaults } from '@ifhover/leaf-ui';
const components = {
Button: { variant: 'outline' },
Confirm: { confirmText: '继续', cancelText: '返回' },
} satisfies LeafComponentDefaults;将该对象传给 <ConfigProvider components={components}>。实例参数和服务的单次调用参数仍优先于区域默认值。