Skip to main content
📍

Camera

Sensors
View Docs

Capture 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

PropertyTypeDescription
photoCameraPhoto | nullLast captured or selected photo
isLoadingbooleanWhether a camera operation is in progress
errorError | nullCurrent error if any
permissionStatePermissionState | nullCurrent 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() => voidClear the current photo

Related Features