BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/guarahooks/use-page-title-demo

UsePageTitleDemo

guarahooks/use-page-title-demo
FreeExample

use-page-title'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-page-title-demo.json

Source

registry/example/use-page-title-demo.tsxguarahooks.com/r/use-page-title-demo.json
1'use client';
2
3import React, { useState } from 'react';
4
5import { Button } from '@/components/ui/button';
6import {
7 Card,
8 CardContent,
9 CardDescription,
10 CardFooter,
11 CardHeader,
12 CardTitle,
13} from '@/components/ui/card';
14import { Input } from '@/components/ui/input';
15import { Label } from '@/components/ui/label';
16
17import { usePageTitle } from '@/hooks/guarahooks/use-page-title';
18
19export default function UsePageTitleDemo() {
20 const [title, setTitle] = useState('guarahooks');
21 const { setTitle: updatePageTitle, resetTitle } = usePageTitle({
22 suffix: 'guarahooks',
23 separator: ' - ',
24 });
25
26 const handleChangeTitle = (e: React.ChangeEvent<HTMLInputElement>) => {
27 setTitle(e.target.value);
28 };
29
30 const handleUpdateTitle = () => {
31 updatePageTitle(title);
32 };
33
34 return (
35 <Card className="w-full max-w-sm mx-auto">
36 <CardHeader>
37 <CardTitle>Page Title Demo</CardTitle>
38 <CardDescription>Change the page title dynamically</CardDescription>
39 </CardHeader>
40 <CardContent className="space-y-4">
41 <div className="space-y-2">
42 <Label htmlFor="title">New Page Title</Label>
43 <Input
44 id="title"
45 placeholder="Enter new page title"
46 value={title}
47 onChange={handleChangeTitle}
48 />
49 </div>
50 <div className="text-sm text-muted-foreground">
51 Current document title:{' '}
52 <span className="font-mono">
53 {typeof document !== 'undefined'
54 ? document.title
55 : 'Not available on server'}
56 </span>
57 </div>
58 </CardContent>
59 <CardFooter className="flex justify-between">
60 <Button variant="outline" onClick={resetTitle}>
61 Reset Title
62 </Button>
63 <Button onClick={handleUpdateTitle}>Update Title</Button>
64 </CardFooter>
65 </Card>
66 );
67}

What it pulls in

Other registry items

  • card
  • button
  • input
  • label
  • https://guarahooks.com/r/use-page-title.json

Files it writes

  • registry/example/use-page-title-demo.tsx

Facts

Registry
guarahooks
Type
registry:example
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-03
Last confirmed
today

Go to the source

Docs on guarahooks guarahooks.com h3rmel/guarahooks on GitHub Raw registry item This item as JSON

More from guarahooks

All 100 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
UseAbortControllerDemouse-abort-controller-demoguarahooksExamplesFreeno deps
UseArrayStateDemouse-array-state-demoguarahooksExamplesFreeno deps
UseAxiosDemouse-axios-demoguarahooksExamplesFreeno deps
UseBatteryStatusDemouse-battery-status-demoguarahooksExamplesFreeno deps
UseBetterAuthDemouse-better-auth-demoguarahooksExamplesFreeno deps
UseClickOutsideDemouse-click-outside-demoguarahooksExamplesFreeno deps
UseConfirmDemouse-confirm-demoguarahooksExamplesFreeno deps
UseCookieDemouse-cookie-demoguarahooksExamplesFreeno deps
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex