CIDR Input

CIDR Input is a copy-paste React component that stops firewall opened to 0.0.0.0/0 before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/cidr-input
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsFirewall opened to 0.0.0.0/0

Was this component page useful?

How do I install CIDR Input?

pnpm dlx shadcn@latest add @bollard/cidr-input

The files land in your project. They're yours to edit.

How do I use CIDR Input in React?

cidr-input-usage.tsx
import { CidrInput } from "@/components/ui/cidr-input"

<CidrInput label="New subnet" defaultValue="10.0.4.1/8" existing={existing} />

What input mistakes does CIDR Input catch?

  • Host bits set in the address, with the network or /32 (/128) reading as fixes
  • 0.0.0.0/0 or ::/0 (open to everyone)
  • Overlap with, or nesting inside, the existing ranges you pass, named
  • A missing prefix length and ambiguous leading zeros

What props does CIDR Input accept?

CidrInput props
PropTypeDefault
label

Visible label.

string"CIDR range"
value

Controlled value.

string—
defaultValue

Initial value when uncontrolled.

string""
onValueChange

Called with the text on every change.

(value: string) => void—
existing

Ranges already in use; an overlap with any of them is flagged by name.

ExistingRange[]NONE
delay

Pause in ms before warnings appear while typing. Leaving the field shows them at once.

number500
rangeText

Templates. `{first}`, `{last}`, `{count}`, `{network}`, `{host}`, `{prefix}`, `{label}`, `{cidr}`, `{all}` are filled in.

string"{first} – {last} · {count} {addresses}"
hostBitsText

Warning when host bits are set.

string"Host bits are set. Did you mean the network, or just thi…
leadingZerosText

Warning for leading zeros in an octet.

string"Leading zeros can be read as octal (010 = 8)."
missingPrefixText

Warning when the /prefix is missing.

string"No prefix, so this is a single address."
anywhereText

Warning for 0.0.0.0/0 or ::/0.

string"This is open to the whole internet: every {all} address."
sameText

Message when the range equals an existing one.

string"Same range as {label} ({cidr})."
insideText

Message when the range sits inside an existing one.

string"Inside {label} ({cidr})."
containsText

Message when the range contains an existing one.

string"Contains {label} ({cidr})."

* required. Also accepts the native props of <input> (className, aria-*, data-*…), passed through to it.

How is CIDR Input accessible?

  • Visible <label>; aria-invalid and aria-describedby to an aria-live="polite" hint
  • Serious warnings use role="alert"
  • Fix buttons have aria-labels ("Use …") and return focus to the input
  • The bit diagram is aria-hidden; the range is stated in text

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

This is a UX guard rail. Enforce on the server: Validate rules in your cloud or firewall API and review changes to public ranges there.

  • Only compares against the ranges you pass in `existing`
  • It doesn't know whether a wide range is intended for a public service

What expensive mistakes does CIDR Input stop?

Firewall opened to 0.0.0.0/0

Also known as

cidr · subnet · ip range · security group · allowlist · firewall · vpc · ipv4

Field type

What dependencies does CIDR Input require?

CIDR Input facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameCIDR Input
Registry identifier@bollard/cidr-input
Install commandnpx shadcn@latest add @bollard/cidr-input
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about CIDR Input

What form validation mistake does CIDR Input catch?

CIDR Input prevents firewall opened to 0.0.0.0/0. Reads a CIDR block back as its exact range and size, and warns before a firewall rule opens to the whole internet or overlaps an existing range. Catches: Host bits set in the address, with the network or /32 (/128) reading as fixes, 0.0.0.0/0 or ::/0 (open to everyone), Overlap with, or nesting inside, the existing ranges you pass, named, A missing prefix length and ambiguous leading zeros. Limitation: validate cidr-input schemas on backend.

How do I install cidr-input with shadcn?

Run `npx shadcn@latest add @bollard/cidr-input`. Sources added: registry/default/cidr-input/cidr-input.tsx, registry/default/cidr-input/cidr.ts. Package requirements: lucide-react.

What props customize CIDR Input?

CIDR Input accepts `label`, `value`, `defaultValue`, `onValueChange`, `existing`. Configures cidr, subnet, ip range behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of cidr-input?

Only compares against the ranges you pass in `existing`. It doesn't know whether a wide range is intended for a public service Server requirement: Validate rules in your cloud or firewall API and review changes to public ranges there.

How does CIDR Input meet accessibility guidelines?

Visible <label>; aria-invalid and aria-describedby to an aria-live="polite" hint. Serious warnings use role="alert". Fix buttons have aria-labels ("Use …") and return focus to the input. The bit diagram is aria-hidden; the range is stated in text. Minimizes errors: cidr host bits set, subnet range calculator.

Which components pair with CIDR Input?