UseEyeDropperDemo
guarahooks/use-eye-dropper-demoFreeExample
use-eye-dropper's hook in action.
Live preview
live · rendered by the registry
Rendered by guarahooks on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://guarahooks.com/r/use-eye-dropper-demo.jsonSource
1'use client';23import React from 'react';45import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert';6import { Button } from '@/components/ui/button';7import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';89import { useColorPicker } from '@/hooks/guarahooks/use-eye-dropper';1011export function ColorPickerExample() {12 const { color, error, isSupported, pickColor } = useColorPicker();1314 return (15 <Card className="max-w-sm mx-auto shadow-lg border-muted">16 <CardHeader>17 <CardTitle className="text-center text-2xl font-bold tracking-tight">18 Color Picker19 </CardTitle>20 </CardHeader>21 <CardContent>22 <div className="flex flex-col items-center gap-4">23 <div className="w-full text-center">24 <p className="text-sm text-muted-foreground mb-2">25 Click the button below to pick a color from anywhere on your26 screen.27 </p>28 </div>29 <div30 className="rounded-lg mb-2 h-20 w-20 flex items-center justify-center text-white font-semibold border-4 transition-all duration-300"31 style={{32 background: color || '#888',33 borderColor: color ? color : '#888',34 boxShadow: color ? `0 0 0 4px ${color}33` : undefined,35 }}36 >37 {color ? (38 <span className="text-xs font-medium drop-shadow">{color}</span>39 ) : (40 <span className="text-xs opacity-70">No color selected</span>41 )}42 </div>4344 {isSupported() ? (45 <Button46 onClick={pickColor}47 className="w-full flex items-center gap-2"48 variant="default"49 size="lg"50 >51 Pick color52 </Button>53 ) : (54 <Alert variant="destructive" className="w-full">55 <AlertTitle>Not Supported</AlertTitle>56 <AlertDescription>57 EyeDropper API not supported in this browser.58 </AlertDescription>59 </Alert>60 )}6162 {error && (63 <Alert variant="destructive" className="w-full">64 <AlertTitle>Error</AlertTitle>65 <AlertDescription>{error.message}</AlertDescription>66 </Alert>67 )}68 </div>69 </CardContent>70 </Card>71 );72}
What it pulls in
Other registry items
Files it writes
More from guarahooks
All 100 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| UseAbortControllerDemouse-abort-controller-demo | guarahooks | Examples | Free | no deps | |
| UseArrayStateDemouse-array-state-demo | guarahooks | Examples | Free | no deps | |
| UseAxiosDemouse-axios-demo | guarahooks | Examples | Free | no deps | |
| UseBatteryStatusDemouse-battery-status-demo | guarahooks | Examples | Free | no deps | |
| UseBetterAuthDemouse-better-auth-demo | guarahooks | Examples | Free | no deps | |
| UseClickOutsideDemouse-click-outside-demo | guarahooks | Examples | Free | no deps | |
| UseConfirmDemouse-confirm-demo | guarahooks | Examples | Free | no deps | |
| UseCookieDemouse-cookie-demo | guarahooks | Examples | Free | no deps |
