
Drive Picker Element
https://github.com/googleworkspace/drive-picker-element- Category
- Developer Tools
- Rank
- No. 903Tools index
Previous survey · No. 891 ·
- Pricing
- Open Source
- Type
- TOOL
- Builder
- googleworkspace
- GitHub
- 67 stars
- Latest release
- @googleworkspace/drive-picker-react@0.2.0
- Date
About
A web component for the Google Drive Picker. Embed Drive file selection in any framework via a custom element.
What it does
It turns Drive picking into declarative browser markup. Separate picker and document-view elements load Google API and Identity scripts, request OAuth access, and report picked, canceled, OAuth response, and OAuth error events. A React layer maps the same behavior to components and callback props.
Why it's ranked here
The design is focused and practical. It offers native custom elements plus a dedicated React wrapper, typed properties and events, multiple browser bundles, and generated reference documentation. The implementation also accounts for script-loading races and Content Security Policy attributes, which addresses integration details that often become application bugs.
What's good
Framework-neutral elements keep the core integration reusable, while React users receive components and managed event subscriptions. Type declarations accompany the ESM build. The package emits minified and unminified IIFE builds, source maps, and generated declarations. Script injection preserves nonce, integrity, and crossorigin attributes from an existing matching script.
Tradeoffs
This is browser infrastructure, not a standalone picker service. It depends on Google-hosted API and Identity scripts, browser globals, OAuth configuration, and custom-element support. Script loading may append and execute another copy of an already present script to avoid unresolved load races. The React wrapper currently models document views as its supported children.
How to use it well
Use it when a web application needs declarative Drive selection with typed results, especially when one integration must serve plain web components and React. Let the wrapper manage React listener cleanup, and handle picked, canceled, and OAuth outcomes explicitly. It does not remove the need to supply application credentials or address issues in the underlying Google Picker separately.
Technical notes+
packages/drive-picker-element/src/index.ts registers drive-picker and drive-picker-docs-view and exports element, prop, and event types. packages/drive-picker-element/tsup.config.ts produces IIFE and ESM builds, minified variants, source maps, and declarations, with a split dist/drive-picker entry. packages/drive-picker-element/src/utils.ts loads Google API and Identity scripts, initializes the OAuth token client, and copies CSP-related attributes when duplicating an existing script. packages/drive-picker-react/src/DrivePicker.tsx dynamically imports the element package in a React effect. packages/drive-picker-react/src/useDrivePickerEvents.ts attaches four custom-event listeners and removes them during effect cleanup. packages/drive-picker-element/scripts/docs.ts and packages/drive-picker-element/scripts/props.ts generate documentation and prop interfaces from the custom-elements manifest.
Observed
- License
- Apache License 2.0 headers appear throughout the supplied source files.
- Primary language
- TypeScript, including TSX for the React package.
- Package surface
- Monorepo containing @googleworkspace/drive-picker-element and @googleworkspace/drive-picker-react.
- Interfaces
- Browser custom-element library with a React component wrapper and typed custom events.
- Build outputs
- IIFE and ESM JavaScript builds, minified variants, source maps, and TypeScript declarations.
- Platform target
- Browsers supporting Custom Elements v1 and default browser targets; the ESM build targets ES6.
- Tooling
- pnpm workspace tooling with Turbo, tsup, Vitest, Storybook, Biome, Prettier, Changesets, and Husky.
Read from README.md, package.json, packages/drive-picker-element/cem.config.js, packages/drive-picker-element/tsup.config.ts, packages/drive-picker-react/vitest.config.ts, packages/drive-picker-react/src/index.ts, packages/drive-picker-element/src/index.ts, packages/drive-picker-element/src/utils.ts, packages/drive-picker-element/scripts/docs.ts, packages/drive-picker-element/scripts/props.ts, packages/drive-picker-react/src/DrivePicker.tsx, packages/drive-picker-element/.storybook/main.ts, packages/drive-picker-element/.storybook/preview.ts, packages/drive-picker-react/src/DrivePickerDocsView.tsx, packages/drive-picker-react/src/useDrivePickerEvents.ts.
What it can do
Embed Google Drive file picker in web application
Web application framework → Integrated file selection interface
Select files from Google Drive
User interaction with picker interface → Selected Google Drive file references
Browse Google Drive folders
User navigation commands → Drive folder contents display
Filter Drive files by type
File type criteria → Filtered file list
Return file metadata
Selected Drive files → File IDs, names, and metadata
Integrate with any web framework
Custom HTML element tag → Framework-agnostic Drive picker component
Tags
Tech Stack
Comments (0)
No comments yet
Editorially curated, with community endorsements as a secondary signal. Corrections welcome.