Input Group
weekendsuperhero-io-sistine/input-groupFreeComponent
A group of inputs, with the glass material system.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/Weekendsuperhero-io/sistine/main/public/r/input-group.jsonSource
1"use client";23import { cva, type VariantProps } from "class-variance-authority";4import type * as React from "react";56import { type HoverEffect, hoverEffects } from "@/lib/hover-effects";7import { type MaterialAxisProps, materialSurface, splitAxisProps } from "@/lib/material";8import { cn } from "@/lib/utils";9import { Button } from "./button";10import { Input } from "./input";11import { Textarea } from "./textarea";1213interface InputGroupProps extends React.ComponentProps<"div">, MaterialAxisProps {14 variant?: "default" | "glass";15 /** Hover effect (folded from the glass wrapper). */16 effect?: HoverEffect;17}1819/* Role: bordered adaptive glass. */20const ROLE = {21 border: true,22};2324function InputGroup({ className, variant = "glass", effect, ...props }: InputGroupProps) {25 const [axes, rest] = splitAxisProps(props);26 /* Variant classes carry BEHAVIOR only; the surface comes from materialSurface. */27 const getVariantClass = () => (variant === "default" ? "border border-input shadow-xs dark:bg-input/30" : "");2829 const m = materialSurface(variant === "default" ? null : ROLE, axes);3031 return (32 <div33 data-slot="input-group"34 role="group"35 data-material={m?.["data-material"]}36 className={cn(37 m?.className,38 "group/input-group relative flex w-full items-center rounded-md transition-[color,box-shadow] outline-none",39 "h-9 min-w-0 has-[>textarea]:h-auto",40 // Variants based on alignment.41 "has-[>[data-align=inline-start]]:[&>input]:pl-2",42 "has-[>[data-align=inline-end]]:[&>input]:pr-2",43 "has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3",44 "has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3",45 // Focus state.46 "has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-[3px] has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50",47 // Error state.48 "has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-destructive/20 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",49 getVariantClass(),50 effect &&51 hoverEffects({52 hover: effect,53 }),54 className,55 )}56 {...rest}57 />58 );59}6061const inputGroupAddonVariants = cva(62// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from weekendsuperhero-io/sistine
All 71 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | weekendsuperhero-io/sistine | Components | Free | 5 deps · 4 files | |
| Alertalert | weekendsuperhero-io/sistine | Components | Free | 3 deps · 4 files | |
| Alert Dialogalert-dialog | weekendsuperhero-io/sistine | Components | Free | 4 deps · 4 files | |
| Auto Foregroundauto-foreground | weekendsuperhero-io/sistine | Components | Free | no deps | |
| Avataravatar | weekendsuperhero-io/sistine | Components | Free | 4 deps · 4 files | |
| Badgebadge | weekendsuperhero-io/sistine | Components | Free | 4 deps · 4 files | |
| Breadcrumbbreadcrumb | weekendsuperhero-io/sistine | Components | Free | 5 deps · 4 files | |
| Buttonbutton | weekendsuperhero-io/sistine | Components | Free | 4 deps · 4 files |
