Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ Thumbs.db
# Claude
.claude
logs
trees/

# Worktree environment configs
**/.ports.env

app.config.timestamp*

Expand Down
5 changes: 4 additions & 1 deletion apps/docs/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ export default defineConfig(
}
},
vite: {
plugins: [tailwindcss()]
plugins: [tailwindcss()],
server: {
port: parseInt(process.env.FRONTEND_PORT || "5173", 10)
}
}
},
{
Expand Down
4 changes: 4 additions & 0 deletions apps/docs/src/config/docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ export const docsConfig: Config = {
title: "Input Group",
href: "/docs/components/input-group"
},
{
title: "Label",
href: "/docs/components/label"
},
{
title: "Radio Group",
href: "/docs/components/radio-group"
Expand Down
28 changes: 28 additions & 0 deletions apps/docs/src/registry/__index__.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,20 @@ export const Index: Record<string, any> = {
categories: undefined,
meta: undefined,
},
"label": {
name: "label",
description: "",
type: "registry:ui",
registryDependencies: undefined,
component: lazy(() => import("~/registry/ui/label.tsx")),
files: [{
path: "registry/ui/label.tsx",
type: "registry:ui",
target: ""
}],
categories: undefined,
meta: undefined,
},
"input-group": {
name: "input-group",
description: "",
Expand Down Expand Up @@ -676,6 +690,20 @@ export const Index: Record<string, any> = {
categories: undefined,
meta: undefined,
},
"label-demo": {
name: "label-demo",
description: "",
type: "registry:example",
registryDependencies: ["label","checkbox"],
component: lazy(() => import("~/registry/examples/label-demo.tsx")),
files: [{
path: "registry/examples/label-demo.tsx",
type: "registry:example",
target: ""
}],
categories: undefined,
meta: undefined,
},
"radio-group-demo": {
name: "radio-group-demo",
description: "",
Expand Down
11 changes: 11 additions & 0 deletions apps/docs/src/registry/examples/_registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,17 @@ export const examples: Registry["items"] = [
}
]
},
{
name: "label-demo",
type: "registry:example",
registryDependencies: ["label", "checkbox"],
files: [
{
path: "examples/label-demo.tsx",
type: "registry:example"
}
]
},
{
name: "radio-group-demo",
type: "registry:example",
Expand Down
11 changes: 11 additions & 0 deletions apps/docs/src/registry/examples/label-demo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Checkbox } from "~/registry/ui/checkbox"
import { Label } from "~/registry/ui/label"

export default function LabelDemo() {
return (
<div class="flex items-center space-x-2">
<Checkbox id="terms" />
<Label for="terms">Accept terms and conditions</Label>
</div>
)
}
2 changes: 1 addition & 1 deletion apps/docs/src/registry/styles/style-lyra.css
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@

/* MARK: Label */
.cn-label {
@apply gap-2 text-xs leading-none group-data-[disabled=true]:opacity-50 peer-disabled:opacity-50;
@apply gap-2 text-xs leading-none group-data-disabled:opacity-50 peer-disabled:opacity-50 peer-data-disabled:opacity-50;
}

/* MARK: Menubar */
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/src/registry/styles/style-maia.css
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@

/* MARK: Label */
.cn-label {
@apply gap-2 text-sm leading-none font-medium group-data-[disabled=true]:opacity-50 peer-disabled:opacity-50;
@apply gap-2 text-sm leading-none font-medium group-data-disabled:opacity-50 peer-disabled:opacity-50 peer-data-disabled:opacity-50;
}

/* MARK: Menubar */
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/src/registry/styles/style-mira.css
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@

/* MARK: Label */
.cn-label {
@apply gap-2 text-xs/relaxed leading-none font-medium group-data-[disabled=true]:opacity-50 peer-disabled:opacity-50;
@apply gap-2 text-xs/relaxed leading-none font-medium group-data-disabled:opacity-50 peer-disabled:opacity-50 peer-data-disabled:opacity-50;
}

/* MARK: Menubar */
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/src/registry/styles/style-nova.css
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@

/* MARK: Label */
.cn-label {
@apply gap-2 text-sm leading-none font-medium group-data-[disabled=true]:opacity-50 peer-disabled:opacity-50;
@apply gap-2 text-sm leading-none font-medium group-data-disabled:opacity-50 peer-disabled:opacity-50 peer-data-disabled:opacity-50;
}

/* MARK: Menubar */
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/src/registry/styles/style-vega.css
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@

/* MARK: Label */
.cn-label {
@apply gap-2 text-sm leading-none font-medium group-data-[disabled=true]:opacity-50 peer-disabled:opacity-50;
@apply gap-2 text-sm leading-none font-medium group-data-disabled:opacity-50 peer-disabled:opacity-50 peer-data-disabled:opacity-50;
}

/* MARK: Menubar */
Expand Down
10 changes: 10 additions & 0 deletions apps/docs/src/registry/ui/_registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,16 @@ export const ui: Registry["items"] = [
}
]
},
{
name: "label",
type: "registry:ui",
files: [
{
path: "ui/label.tsx",
type: "registry:ui"
}
]
},
{
name: "input-group",
type: "registry:ui",
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/src/registry/ui/label.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { splitProps } from "solid-js"
import { cn } from "~/lib/utils"

const Label: Component<ComponentProps<"label">> = (props) => {
const [local, others] = splitProps(props, ["class", "for"])
const [local, others] = splitProps(props, ["class"])
return (
<label
class={cn(
"flex select-none items-center gap-2 font-medium text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-50 group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50",
"cn-label flex select-none items-center peer-disabled:cursor-not-allowed group-data-disabled:pointer-events-none peer-data-disabled:cursor-not-allowed",
local.class
)}
data-slot="label"
Expand Down
45 changes: 45 additions & 0 deletions apps/docs/src/routes/docs/components/label.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
title: Label
description: Renders an accessible label associated with controls.
---

::::tab-group[preview]
:::tab[Preview]

<ComponentPreview name="label-demo" />

:::
:::tab[Code]

```file="~/registry/examples/label-demo" frame=none showLineNumbers

```

:::
::::

## Installation

### CLI

```package-exec
solidui-cli@latest add label
```

### Manual

Copy and paste the following code into your project.

```file="~/registry/ui/label.tsx" showLineNumbers

```

## Usage

```tsx
import { Label } from "~/components/ui/label";
```

```tsx
<Label for="email">Your email address</Label>
```
2 changes: 0 additions & 2 deletions apps/docs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@
"noFallthroughCasesInSwitch": true,
"noUncheckedIndexedAccess": true,
"noImplicitOverride": true,
// Some stricter flags (disabled by default)
"noUnusedLocals": true,
"noUnusedParameters": true,
"noPropertyAccessFromIndexSignature": true,
"baseUrl": ".",
"paths": {
"~/*": ["./src/*"]
Expand Down