File API
API reference docs for the React File component. Learn about the props, CSS, and other APIs of this exported module.
Demos
Import
import { File } from '@stoked-ui/sui-file-explorer/File';
// or
import { File } from '@stoked-ui/sui-file-explorer';
Learn about the difference by reading this guide on minimizing bundle size.
Props of the native component are also available.
Name | Type | Default | Description |
---|---|---|---|
children | node | - | The content of the component. |
classes | object | - | Override or extend the styles applied to the component. See CSS classes API below for more details. |
disabled | bool | false | If |
id | string | - | The id attribute of the item. If not provided, it will be generated. |
itemId | string | - | The id of the item. Must be unique. |
label | node | - | The label of the item. |
onBlur | func | - | Callback fired when the item root is blurred. |
onFocus | unsupportedProp | - | This prop isn't supported. Use the |
onKeyDown | func | - | Callback fired when a key is pressed on the keyboard and the tree is in focus. |
slotProps | object | {} | The props used for each component slot. |
slots | object | {} | Overridable component slots. See Slots API below for more details. |
ref
is forwarded to the root element.Theme default props
You can use MuiFile
to change the default props of this component with the theme.
Slot name | Class name | Default component | Description |
---|---|---|---|
root | .MuiFile-root | FileRoot | The component that renders the root. |
content | .MuiFile-content | FileContent | The component that renders the content of the item. (e.g.: everything related to this item, not to its children). |
groupTransition | .MuiFile-groupTransition | FileGroupTransition | The component that renders the children of the item. |
iconContainer | .MuiFile-iconContainer | FileIconContainer | The component that renders the icon. |
checkbox | .MuiFile-checkbox | FileCheckbox | The component that renders the item checkbox for selection. |
label | .MuiFile-label | FileLabel | The component that renders the item label. |
collapseIcon | The icon used to collapse the item. | ||
expandIcon | The icon used to expand the item. | ||
endIcon | The icon displayed next to an end item. | ||
icon | The icon to display next to the fileExplorer item's label. |
These class names are useful for styling with CSS. They are applied to the component's slots when specific states are triggered.
Class name | Rule name | Description |
---|---|---|
.Mui-disabled | State class applied to the element when disabled. | |
.Mui-expanded | State class applied to the content element when expanded. | |
.Mui-focused | State class applied to the content element when focused. | |
.Mui-selected | State class applied to the content element when selected. | |
.MuiFile-grid | grid |
You can override the style of the component using one of these customization options:
- With a global class name.
- With a rule name as part of the component's
styleOverrides
property in a custom theme.