TailwindEnv
Like TailwindCSS, but for process.env.
className your way to environment variables!
React Server ComponentsAllowlist SecurityMasked Values
<Env className="env-NODE_ENV" />renders
production
Syntax Reference
| className | Behavior |
|---|---|
env-NODE_ENV | Output value |
env-$db | Output aliased value (hides real var name) |
env-PORT-default-3000 | With fallback value |
env-API_KEY-masked | Force masked output |
env-prefix-NEXT_PUBLIC | All matching vars as object |
env-exists-SECRET | Output "true" / "false" |
if-env-FEATURE_FLAG | Render children if truthy |
if-not-env-MAINTENANCE | Render children if falsy/missing |
Live Examples
These are real values from this server's environment
Config File
Create tailwind-env.config.ts to define your allowlist:
export default { vars: { NODE_ENV: true, $db: 'DATABASE_URL', API_KEY: { masked: true }, }, patterns: [ 'NEXT_PUBLIC_*', { match: '*_KEY', masked: true }, ],}