ShadcnUI Vaults

Back to Blocks

Customer Review Form

Unknown Block

UnknownComponent

Customer Review Form

Review form with rating and comment input, great for e-commerce

Preview

Full width desktop view

Code

reviewform-1.tsx
1import { useState } from "react"
2import { Button } from "@/components/ui/button"
3import { Textarea } from "@/components/ui/textarea"
4import { Label } from "@/components/ui/label"
5import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
6import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
7import { toast } from "sonner"
8
9export default function ReviewForm_1() {
10  const [rating, setRating] = useState("")
11  const [comment, setComment] = useState("")
12  const [loading, setLoading] = useState(false)
13
14  const submitHandler = (e: React.FormEvent) => {
15    e.preventDefault()
16
17    if (!rating || !comment) {
18      toast.error("Please provide a rating and a comment.")
19      return
20    }
21
22    setLoading(true)
23
24    // Simulate sending, add your logical here
25    setTimeout(() => {
26      toast.success("Review submitted successfully!")
27      setRating("")
28      setComment("")
29      setLoading(false)
30    }, 1000)
31  }
32
33  return (
34    <Card className="w-full max-w-md mx-auto">
35      <CardHeader>
36        <CardTitle>Write a Customer Review</CardTitle>
37      </CardHeader>
38      <CardContent>
39        <form onSubmit={submitHandler} className="space-y-4">
40          <div>
41            <Label htmlFor="rating">Rating</Label>
42            <Select value={rating} onValueChange={setRating}>
43              <SelectTrigger id="rating">
44                <SelectValue placeholder="Select..." />
45              </SelectTrigger>
46              <SelectContent>
47                <SelectItem value="1">1 - Poor</SelectItem>
48                <SelectItem value="2">2 - Fair</SelectItem>
49                <SelectItem value="3">3 - Good</SelectItem>
50                <SelectItem value="4">4 - Very Good</SelectItem>
51                <SelectItem value="5">5 - Excellent</SelectItem>
52              </SelectContent>
53            </Select>
54          </div>
55          <div>
56            <Label htmlFor="comment">Comment</Label>
57            <Textarea
58              id="comment"
59              rows={3}
60              value={comment}
61              onChange={(e) => setComment(e.target.value)}
62              placeholder="Share your experience..."
63            />
64          </div>
65          <Button type="submit" disabled={loading} className="w-full">
66            Submit
67          </Button>
68        </form>
69      </CardContent>
70    </Card>
71  )
72}

Dependencies

External Libraries

reactsonner

Shadcn/UI Components

buttoncardlabelselecttextarea

LICENSE

MIT License

Copyright (c) 2025 Aldhaneka

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Shadcn Vaults Project (CC BY-NC 4.0 with Internal Use Exception)

All user-submitted components in the '/blocks' directory are licensed under the Creative Commons Attribution-NonCommercial 4.0 International License (CC BY-NC 4.0),
with the following clarification and exception:

You are free to:
- Share — copy and redistribute the material in any medium or format
- Adapt — remix, transform, and build upon the material

Under these conditions:
- Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made.
- NonCommercial — You may NOT use the material for commercial redistribution, resale, or monetization.

🚫 You MAY NOT:
- Sell or redistribute the components individually or as part of a product (e.g. a UI kit, template marketplace, SaaS component library)
- Offer the components or derivative works in any paid tool, theme pack, or design system

✅ You MAY:
- Use the components in internal company tools, dashboards, or applications that are not sold as products
- Remix or adapt components for private or enterprise projects
- Use them in open-source non-commercial projects

This license encourages sharing, learning, and internal innovation — but prohibits using these components as a basis for monetized products.

Full license text: https://creativecommons.org/licenses/by-nc/4.0/

By submitting a component, contributors agree to these terms.

Contributors

Ramiro Godoy@milogodoy

Review Form Block

Aldhaneka@Aldhanekaa

Project Creator

For questions about licensing, please contact the project maintainers.