shadcn.io is not affiliated with official shadcn/ui
IP Allowlist Account Block for React
An allowlist built from the networks of the last 12 sign-ins and rehearsed against them: seen networks with Allow, the allowed set, one field to add a range, how many sign-ins would pass or be blocked, and a switch refused while your own address is outside the list.
Installation
Overview
Let people lock an account to the networks they use without locking themselves out, with this IP allowlist for React with Base UI. A hairline frame with a plus mark on each corner is split by a divider with plus marks. The start column lists the networks of the last 12 sign-ins, a /24 for an IPv4 address and a /48 for IPv6, each with its place, how many sign-ins came from it and when the last one was, and an Allow Button that moves it to the allowed list below, where each has Remove. The end column has one Field that adds a range by hand and says how many addresses it parsed to, then "If this list were on", which replays the 12 sign-ins against the allowed networks: how many would pass, how many would be blocked and the latest blocked ones. A Switch, Only allow listed networks, is refused with its reason while the address in use is outside the list. The panel keeps its height as networks move. On a phone the columns stack: seen, allowed, then the rehearsal. It's built from Field, Input, Switch, Badge, Button and Guides, with a CSS entrance only. For the security page of any app that can restrict sign-in by address.
FAQ
How do I build it from my own sign-ins?
Edit SIGNINS (a city, a documentation address and an ISO time each) and START (the networks allowed when the page opens). The seen networks are worked out from the sign-ins: each address maps to its /24 or /48, and the count, the place and the last day come from the sign-ins that share it. CURRENT is the address in use. Whether a sign-in would pass is a real containment check: a numeric range test for IPv4 and a prefix test for IPv6, so a range you add counts at once.
How does it stop you locking yourself out?
Turning the switch on is refused, with its reason in a line under it, while the address in use isn't inside the allowed networks; the switch stays off and focusable. Allow the network of your address first and it turns on. While it is on, a network can't be removed if that would uncover your address: the status line says which. The rehearsal says how many of the 12 sign-ins would have passed, so you can see what turning it on would have blocked.
What does the add-a-range field accept?
An IPv4 address, a slash and a length from /16 to /32, like 203.0.113.64/28. It shows what it parsed to as you type (16 addresses, from 203.0.113.64 to 203.0.113.79) and counts a range that starts mid-block from its first address. A bad range is refused with its problem under the field and focus stays in it; one already inside an allowed network is refused as covered. An added range appears in the allowed list and the panel grows by its row.
What stays local, and how do I make it real?
Everything: Allow, Remove, the field and the switch change this page's state and the status line says "Nothing was sent to a firewall". To make it real, save the allowed list and the switch from allow, remove, addRange and toggle, enforce them on your server at sign-in, and keep the lockout check on the server too, since the page can be bypassed. The 12 recent sign-ins come from your sign-in log.
How does it look on a phone?
The two columns stack in reading order: the networks you signed in from, the allowed networks, the add-a-range field, then the rehearsal with its switch. Every network row is the same height with its button at the end, and a group with none says so in its heading, so moving a network between the groups doesn't move the page.
Is it accessible?
The groups are labelled lists, each button is named for its network ("Allow 203.0.113.0/24"), the field has a visible label and its note is tied to it, and the refusal is read out as an alert when it appears. The result of the rehearsal is text, not only a figure, and the status line is a polite live region present from the start. Ranges and addresses read start to end in any language, and the counts keep their order in a right-to-left page.
Related
- Pro
IP Allowlist Settings
Sign-in and securityAn IP allowlist settings panel with an enforcement switch and a lockout guard that says whether your own address is covered, a rules table, and an add form that parses IPv4 and IPv6 ranges and names the rule that already covers a new one.
- Pro
A network check for a sign-in: type an IPv4 address and real CIDR maths says which of three allowed ranges holds it, then either continues or asks for access with a reason.
- Pro
Sign-in History Account
Sessions and devicesEvery sign-in attempt in the last 14 days in a sortable, searchable table with failed attempts marked by an icon and a reason, rows that open to the user agent and steps, pages of 5 or 10 and four derived figures.
- Pro
Active Sessions Account
Sessions and devicesThe open sessions of an account with how each one signed in, when it started, was last active and ends, an idle filter, a two-step sign-out per row and one button that signs out the rest.
- Pro
Session History Account
Sessions and devicesThe last seven days of sessions as a swimlane: a lane per device, each session a bar placed by its start and length, revoked ones ending in a cut mark, and a popover with the id, length, address and how it ended.
- Pro
Activity Log Account
Sessions and devicesWhat changed on an account as a vertical timeline grouped by day: icon nodes on a rail, a filter with counts for sign-in, security and data events, and a Details button that opens the device, place and address of each.