Skip to content
Redpanda UI
Esc
↑↓navigate↵open⌘Jpreview
Made by imskyleen
Edit on GitHub

Files

A component that allows you to display a list of files and folders.

Installation

bash
npx shadcn@latest add @redpanda/files
bash
pnpm dlx shadcn@latest add @redpanda/files
bash
yarn dlx shadcn@latest add @redpanda/files
bash
bunx shadcn@latest add @redpanda/files
bash
nubx shadcn@latest add @redpanda/files
bash
aube dlx shadcn@latest add @redpanda/files

When to use

Use this decision tree to determine when to use the Files component:

Usage

Files presents nested folder disclosures, not an ARIA tree widget. Tab moves between folder buttons; Enter or Space expands or collapses the focused folder. File leaves are passive display rows. Expanding one folder does not close its siblings.

Files.open controls its immediate child folders. A Folder’s open controls that folder’s immediate child folders, using their names as IDs. Use defaultOpen for uncontrolled groups. Folder names must be unique within each group.

tsx
<Files>  <Folder name="Folder 1">    <File name="file1.txt" />    <File name="file2.txt" />  </Folder>  <Folder name="Folder 2">    <File name="file3.txt" />    <File name="file4.txt" />  </Folder></Files>

Use status="modified" or status="untracked" for Git status. The owner supplies the text tone and indicator: a folder dot or a file’s M/U marker. Status is also available as text to assistive technology; folder buttons expose it as their description. A custom sideComponent replaces the visual indicator without removing the status description. Keep folder side content non-interactive because the folder row is already a button.

Folders own their disclosure element and content. Customize their displayed children and sideComponent, not a replacement render host. Disclosure layout changes immediately; folder icons and the moving row-hover highlight retain their animation. Keyboard focus has its own visible ring and does not depend on pointer hover.

Examples

Files Advanced

Props

Files

PropType
childrenReact.ReactNode

The children of the component.

TypeReact.ReactNode
className?string

The class name of the component.

Typestring
activeClassName?string

The class name of the highlight.

Typestring
defaultOpen?string[]

The child folders open by default.

Typestring[]
open?string[]

The child folders open.

Typestring[]
onOpenChange?function

The callback function when the child folders open change.

Typefunction
sideComponent?React.ReactNode

The component to display on the right side of the component.

TypeReact.ReactNode

Folder

PropType
namestring

The name of the folder.

Typestring
status?'modified' | 'untracked'

Git status with an owned text tone, visual indicator and accessible description.

Type'modified' | 'untracked'
children?React.ReactNode

The children of the component.

TypeReact.ReactNode
className?string

The class name of the component.

Typestring
defaultOpen?string[]

The child folders open by default.

Typestring[]
open?string[]

The child folders open.

Typestring[]
onOpenChange?function

The callback function when the child folders open change.

Typefunction

File

PropType
className?string

The class name of the component.

Typestring
namestring

The name of the file.

Typestring
status?'modified' | 'untracked'

Git status with an owned text tone, M/U marker and readable status text.

Type'modified' | 'untracked'

Credits

Recent changes

  • patchv1.2.0Pin shipped dependency floors to the version we develop against. Registry items now declare ranges like `^5.1.9` (the actual installed version) instead of collapsing to `^5.0.0`, so consumers start on the known-tested baseline while caret semantics still allow any compatible release within the same major.#133
  • minorv1.1.0Theme docs refresh, readability pass on semantic foregrounds, and consumer-facing Base UI regression fixes.#121
  • minorv1.0.0Post-Base-UI polish. Public API unchanged.#116
  • majorv1.0.0Migrate every Radix-based primitive to `@base-ui/react@^1.4.0` (Base UI).#114
  • minorv0.3.0Add theme-provider component to the registry with documentation and tests. Includes playground type improvements (export RegistryItem, remove as-const boilerplate) and docs site dark mode border color fix.#109
See full history →

Last updated on

Was this page helpful?