Raft Design System

Components · Files

FilesPanel

The list of files shared in a place, one row per file with its type, name, size and time, which opens a preview and offers Jump to message and Download.

StableAlso called Files, FileRow, Channel files
import { FilesPanel } from "@botiverse/raft-ui";

The files panel lists the files shared in a place, such as #launch-week, newest first. Each row shows the file's type, its name, its size and when it was shared; clicking the row opens a preview, and two icon buttons jump to the message it came with and download it. It fills the Files section beside a conversation, or a full Files view.

files/compositions/default

When to use

SituationUse
All the files shared in a channel or conversationFilesPanel
A file attached to one messageThe file card (MessageAttachment)
A file in the composer, before it is sentFilePreview, in the Composer
An image or video opened from a rowLightbox

In a Files section beside a conversation, list the files in the compact row the Tasks section uses (Rows in a compact list): the type icon, the name and its size, then the compact time (15:00 today, Oct 21 this year, 2025-10-21 before) and the actions at the right, all on one line at the side column's default 360px, with hairlines between rows instead of a card for each. Jump to message lands on the message with the located highlight (Located). FileRow is the card row of a full Files view and has no compact variant yet.

Where the files of a place sit on a screen (a side section or the channel details) is in Navigation and Page structure.

Anatomy

  • FilesPanel: a section on layer-canvas that fills its column. Required.
  • FilesViewport: the scroll container. Required.
  • FilesList: the column of rows, 8px apart.
  • FileRow: one file, on layer-card with a line-hairline outline and radius-container.
    • FileRowOpen: the button that covers the type, name and details and opens the preview.
      • FileThumbnail: a 36px box for the file's FilePreview, or a thumbnail through FileImage.
      • FileContent: FileName, then FileMeta with one FileMetaItem per detail (size, time), in text-mono-meta and foreground-hint.
    • FileActions: the row's FileAction icon buttons, ghost by default.
files/compositions/file-row

Variants

The file's type changes only its icon: a document, code, an archive or other file, or a thumbnail of an image or video (FilePreview).

files/compositions/file-types

States

How empty, loading and failed differ is in Feedback.

  • Empty: an EmptyState in the viewport, with a paperclip icon, No files yet, and where files come from.
  • Loading: a skeleton of rows, the same size as the rows that replace it.
  • Failed: the error at the panel's scope, with Retry, not an empty state.
  • More to load: the next page loads as people near the end of the list. A Load more button below the last row covers the case where scrolling can't trigger it.
  • Menu open: while a menu opened from one of its FileActions is up, the row lays fill-subtle over itself, the same subtle tier as its hover, so the file the menu acts on stays marked (Hover and press).
  • Not available: disable a FileAction or FileRowOpen whose action isn't available.

Content

  • Show the file name as it was uploaded, with its extension. A long name is cut off at the end of the row.
  • Give the size with its unit (184 KB) and the time as people read it elsewhere (Yesterday, 4:18 PM).

Accessibility

FilesPanel adds no Base UI primitive; its parts are a section, buttons and an image.

  • Name FilesPanel with aria-label: Files.
  • Give every FileAction an aria-label and a tooltip that say what it does: Jump to original message, Download file.
  • FileRowOpen is named by the file name inside it. The type drawing is decorative (FilePreview).
  • Give a thumbnail in FileImage an empty alt: the name beside it already says what the file is.

Rules

  • Make the whole row the target for the preview, and keep the actions outside FileRowOpen so each is its own button.
  • Keep FileAction at its default, a ghost 32px icon button, so the row stays quiet (Button).
  • Don't color a row by its file type (FilePreview).

API

FilesPanel

PropTypeDefault
renderAllows you to replace the component's HTML element with a different tag, or compose it with another component.ReactElement | ((props, state) => ReactElement)

Also takes the attributes of its element.

FilesViewport

The files' scroller, a ScrollArea: `ref`, `className`, `render`, `onScroll` and the native props are the scrolling element's.
PropTypeDefault
actionsRefMethods to scroll from code that the container doesn't have natively.((instance: ScrollAreaActions | null) => void | (() => void | { [UNDEFINED_VOID_ONLY]: never; }) | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | RefObject<ScrollAreaActions | null>
childrenThe scrolling content, in ScrollArea's own container.ReactNode
contentClassNameClass of a content element around `children`, inside the container: put padding and the content's own layout (grid, flex, `gap`, `stack-y-*`) here, so the scrollbars stay at the edges and the gutters layer is never one of the laid-out children. Only with it, `contentStyle` or `fade` is there one.string
contentRefAn element whose size is the content's, watched for size changes (such as a hidden mirror of a textarea's text). Without it each element child of the container is watched, and children added or removed.RefObject<HTMLElement | null>
contentStyleStyle of the content element; renders it, as `contentClassName` does.CSSProperties
fadeFade the content out toward an edge that has more past it. The scrollbars don't fade.boolean
hideDelayHow long the scrollbars stay after scrolling stops, in ms. At least 100 with `trigger="scroll"`.number
onEdgeChangeCalled when the area reaches or leaves an edge, and after mounting when the content overflows.(edges: ScrollAreaEdges) => void
onScrollThe container's scroll events.UIEventHandler<HTMLDivElement>
orientationThe directions the area scrolls in. Content too wide for a vertical area is cut off.ScrollAreaOrientation
overscrollWhat a scroll that reaches the end does: stop there with no bounce (`none`, the default), stop there but let Mac trackpads and iOS bounce the area (`contain`), or carry on to the page behind (`auto`, which leaves the container's own `overscroll-behavior` alone). Only in the directions the area overflows right now.ScrollAreaOverscroll
railInsetRoom in px the scrollbars keep clear at each end, such as a sticky header's height, so they don't run over it. Also settable in CSS, on the root: `--r-scroll-area-rail-inset-{top,bottom,left,right}`, which don't inherit.ScrollAreaRailInset
renderAnother element in place of ScrollArea's own `<div>`, as the container (an element or a function that gets the props). It must hold children: the gutters are its first child.ReactElement | ((props, state) => ReactElement)
sizeThumb thickness: `small` is 5px, `medium` 7px; both grow while pointed at or dragged.ScrollAreaSize
tabIndexThe container's: by default `0` while there is something to scroll.number
triggerWhen the scrollbars show. They always show while scrolling or dragging.ScrollAreaTrigger

Also takes the attributes of its element.

FilesList, FileRow, FileRowOpen, FileThumbnail

PropTypeDefault
renderAllows you to replace the component's HTML element with a different tag, or compose it with another component.ReactElement | ((props, state) => ReactElement)

Also takes the attributes of its element.

FileImage

PropTypeDefault
fit"contain" | "cover""cover"
renderAllows you to replace the component's HTML element with a different tag, or compose it with another component.ReactElement | ((props, state) => ReactElement)

Also takes the attributes of its element.

FileContent, FileName, FileMeta, FileMetaItem, FileActions

PropTypeDefault
renderAllows you to replace the component's HTML element with a different tag, or compose it with another component.ReactElement | ((props, state) => ReactElement)

Also takes the attributes of its element.

FileAction

PropTypeDefault
loadingBusy: shows the spinner and blocks activation (click, Enter, Space and form submission) while keeping the button focusable. A busy button is `aria-disabled`, not natively `disabled`, so the focus a press left on it stays there and is still there when the wait ends.boolean
loadingLabelThe spinner's accessible name while `loading`: say what is happening.string
size`md` (32px) and `icon-md` for rows, cards, banners, toolbars and panel headers; `lg` and `icon-lg` (the control height) for dialog footers, forms and beside a field; `xl` for a full-width call to action; `icon-sm` (28px, a 44px hit area) for an icon-only action on a line of a row or a card, such as a comment header's More, never in a toolbar. The size follows the place: see Button › Size by place."md" | "lg" | "xl" | "icon-sm" | "icon-md" | "icon-lg" | DeprecatedButtonSize"icon-md"
variant"primary" | "accent" | "warning" | "danger" | "default" | "outline" | "information" | "muted" | "success" | "danger-secondary" | "danger-outline" | "ghost" | "on-frame"
focusableWhenDisabledWhether the button should be focusable when disabled.booleanfalse
nativeButtonWhether the component renders a native `<button>` element when replacing it via the `render` prop. Set to `false` if the rendered element is not a button (for example, `<div>`).booleantrue
renderAllows you to replace the component's HTML element with a different tag, or compose it with another component.ReactElement | ((props, state) => ReactElement)

Also takes the attributes of its element.

Changes

  • 0.73.0 · ChangedEvery region that scrolls is a ScrollArea: PanelScrollViewport, ActivityInboxViewport, SearchShellViewport, NotificationCenterScroller, FilesViewport, TasksPanelViewport, ChoiceList's scroller, MobileNavServerPopoverList, ComposerSuggestionList, AnnouncementDialogBody, MessageActionCardScopeListViewport and DialogNav show ScrollArea's overlay scrollbar instead of the platform's. Native scrolling stays only in the places scroll-area.md lists, each with its reason, and a test fails on any other.
  • 0.9.5 · FixedOn a touch screen, a tap no longer leaves a hover highlight on: TableBody rows, an InboxItem's pressed toggle action, the Activity inbox sort button and a FileRow (when its FileRowOpen is hovered) now only show their hover on devices that can hover. With a mouse they look and behave as before.