Enum & Literal Schemas in Zod

From the Zod cheat sheet · Enums & Literals · verified Jul 2026

Enum & Literal Schemas

Restrict values to a known set with z.enum() and z.literal()

typescript
// Literal (exact value)
const Tuna = z.literal("tuna");

// String enum
const Fish = z.enum(["tuna", "salmon", "trout"]);

// Native TypeScript enum
enum Status { ACTIVE = "ACTIVE", INACTIVE = "INACTIVE" }
const StatusSchema = z.nativeEnum(Status);
💡 z.enum() takes a tuple of strings — much better DX than z.nativeEnum()
⚡ Use as const with z.enum() to share the values as both runtime and types
📌 z.literal() is perfect for discriminator fields in discriminated unions
🟢 Access .options on a z.enum to get the array of valid values at runtime
enumliteral

Continue with Zod

Save the full cheat sheet or work through every related task.

Back to the full Zod cheat sheet