# Feedback Form

> Feedback form with rating (1-5), message, email, and category.

- Name: `feedback-form`
- Categories: forms
- Detail page: https://open-types.dev/types/feedback-form

## Install

```bash
# Types only
npx shadcn add @open-types/feedback-form

# Types + Zod v4 validators
npx shadcn add @open-types/feedback-form-zod

# Types + real-world examples
npx shadcn add @open-types/feedback-form-examples
```

## Types

```typescript
export interface FeedbackForm {
  rating: number;
  message?: string;
  email?: string;
  category?: string;
}
```

## Zod validator

```typescript
import * as z from "zod";
import type { FeedbackForm } from "../types/feedback-form";

export const feedbackFormSchema = z.object({
  rating: z.number().int({ error: "Rating must be a whole number" }).min(1, {
    error: "Rating must be at least 1",
  }).max(5, { error: "Rating must be at most 5" }),
  message: z.string().optional(),
  email: z.string().email({ error: "Email must be a valid email address" }).optional(),
  category: z.string().optional(),
}) satisfies z.ZodType<FeedbackForm>;

export type { FeedbackForm } from "../types/feedback-form";
```

## Examples

```typescript
// Source: hand-crafted
import type { FeedbackForm } from "../types/feedback-form";

export const feedbackFormExamples = {
  fiveStarFull: {
    rating: 5,
    message: "Loved the new dashboard - much faster than before.",
    email: "jenny@example.com",
    category: "feature",
  } satisfies FeedbackForm,
  oneStarBug: {
    rating: 1,
    message: "Login keeps failing on Safari.",
    email: "bug-reporter@example.com",
    category: "bug",
  } satisfies FeedbackForm,
  ratingOnly: { rating: 4 } satisfies FeedbackForm,
  anonymousIdea: {
    rating: 3,
    message: "Would love a dark mode option.",
    category: "idea",
  } satisfies FeedbackForm,
  noCategory: {
    rating: 4,
    message: "Generally happy with the product.",
    email: "happy@example.com",
  } satisfies FeedbackForm,
} as const;
```
