📍
View DocsCamera
SensorsCapture photos and select images from the gallery
photoimagecapturegallerypicture
Demo
Status
Permission: unknown
Photo Preview
No photo captured
Quality Options
Note: On web browsers, the camera API uses the device's camera through the browser's media capture capabilities. On native apps (iOS/Android via Capacitor), it uses the native camera interface for a better experience.
Usage
import { useCamera } from '@classic-homes/native/svelte';
// or for React:
import { useCamera } from '@classic-homes/native/react';API Reference
| Property | Type | Description |
|---|---|---|
| photo | CameraPhoto | null | Last captured or selected photo |
| isLoading | boolean | Whether a camera operation is in progress |
| error | Error | null | Current error if any |
| permissionState | PermissionState | null | Current permission state |
| takePhoto | (options?) => Promise<CameraPhoto> | Open camera and take a photo |
| pickFromGallery | (options?) => Promise<CameraPhoto> | Pick an image from the photo gallery |
| requestPermissions | () => Promise<PermissionState> | Request camera permissions |
| clearPhoto | () => void | Clear the current photo |