Command Palette

Search for a command to run...

Components · Complex component

FileTrigger

A FileTrigger allows a user to access the file system with any pressable /core Nimbus component or or custom components built with <Pressable> component.

Usage

TSX
import { FileTrigger } from '@console/nimbus-ui/core';

Examples

On Select

A FileTrigger wraps around a pressable child such as a button, and includes a visually hidden input element that allows the user to select files from their device. Use the onSelect prop to control state for the component.

Accepted File Types

By default, the file trigger will accept any file type. To support only certain file types, pass an array of the mime type of files via the acceptedFileTypes prop.

Multiple Files

A file trigger can accept multiple files by passsing the allowsMultiple property.

Directory Selection

To enable selecting directories instead of files, use the acceptDirectory property.

Pending

Polymorphic Component

In order to use the fileTrigger you must use the <Pressable> component exported from @nimbus-ui/core This ensures all the correct props are used.

API

PropTypeDefaultDescription
data-rac-idstring—Data attribute for GTM purposes. Pass this property to add a custom id to the root element for GTM tracking.
data-test-idstring—Data attribute for E2E testing purposes