AttachmentPicker

fun AttachmentPicker(attachmentsPickerViewModel: AttachmentsPickerViewModel, modifier: Modifier = Modifier, messageMode: MessageMode = MessageMode.Normal, actions: AttachmentPickerActions = remember(attachmentsPickerViewModel) { AttachmentPickerActions.pickerDefaults(attachmentsPickerViewModel) })

The main attachment picker component that allows users to select and attach files to messages.

This composable displays tabs for different attachment types (gallery, files, camera, polls, commands) and the corresponding content for the selected tab. It is typically wrapped by AttachmentPickerMenu which handles the animated expand/collapse behavior and positioning.

The picker behavior is configured through ChatTheme.config.attachmentPicker:

  • When useSystemPicker is true, shows buttons that launch system pickers (no permissions required)

  • When useSystemPicker is false, shows an in-app grid picker (requires storage permissions)

The picker integrates with AttachmentsPickerViewModel to manage state and with the message composer to add selected attachments to messages.

For customization, override the picker components in ChatTheme.componentFactory:

  • AttachmentTypePicker - The tab bar for switching between modes

  • AttachmentPickerContent - The content area for each mode

  • AttachmentSystemPicker - The system picker variant

Parameters

attachmentsPickerViewModel

The AttachmentsPickerViewModel that manages picker state, including the current mode, available attachments, and selection state.

modifier

The modifier to be applied to the picker container.

messageMode

The current message mode (MessageMode.Normal or MessageMode.MessageThread). Used to determine if poll creation is available (not available in threads).

actions

The AttachmentPickerActions that handle user interactions within the picker. Use AttachmentPickerActions.pickerDefaults for standalone usage or AttachmentPickerActions.defaultActions for full integration with the message composer.