-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add input component and examples
- Loading branch information
Showing
7 changed files
with
137 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--- | ||
title: Input | ||
description: Displays a form input field or a component that looks like an input field. | ||
--- | ||
|
||
import { Tabs, TabItem } from "@astrojs/starlight/components"; | ||
import { Steps } from "@astrojs/starlight/components"; | ||
|
||
<ComponentPreview name="input-demo" /> | ||
|
||
## Installation | ||
|
||
<Tabs> | ||
<TabItem label="CLI"> | ||
```bash frame="code" | ||
npx shadcn-ng@latest add input | ||
``` | ||
</TabItem> | ||
|
||
<TabItem label="Manual"> | ||
<Steps> | ||
1. Copy and paste the following code into your project. | ||
<ComponentSource name="input" /> | ||
|
||
2. Update the import paths to match your project setup. | ||
</Steps> | ||
|
||
</TabItem> | ||
</Tabs> | ||
|
||
## Usage | ||
|
||
```ts | ||
import { UbInputDirective } from "@/components/ui/input.directive"; | ||
``` | ||
|
||
```html | ||
<input type="text" ubInput /> | ||
``` | ||
|
||
## Examples | ||
|
||
### Default | ||
|
||
<ComponentPreview name="input-demo" /> | ||
|
||
### File | ||
|
||
<ComponentPreview name="input-file" /> | ||
|
||
### Disabled | ||
|
||
<ComponentPreview name="input-disabled" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Component } from "@angular/core"; | ||
|
||
import { UbInputDirective } from "@/registry/default/ui/input.directive"; | ||
|
||
@Component({ | ||
standalone: true, | ||
imports: [UbInputDirective], | ||
template: ` <input ubInput type="text" placeholder="Email" /> `, | ||
}) | ||
export class InputDemoComponent {} | ||
|
||
export default InputDemoComponent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Component } from "@angular/core"; | ||
|
||
import { UbInputDirective } from "@/registry/default/ui/input.directive"; | ||
|
||
@Component({ | ||
standalone: true, | ||
imports: [UbInputDirective], | ||
template: ` <input disabled ubInput type="text" placeholder="Email" /> `, | ||
}) | ||
export class InputDisabledDemoComponent {} | ||
|
||
export default InputDisabledDemoComponent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Component } from "@angular/core"; | ||
|
||
import { UbInputDirective } from "@/registry/default/ui/input.directive"; | ||
import { UbLabelDirective } from "@/registry/default/ui/label.directive"; | ||
|
||
@Component({ | ||
standalone: true, | ||
imports: [UbInputDirective, UbLabelDirective], | ||
template: ` | ||
<div class="grid w-full max-w-sm items-center gap-1.5"> | ||
<label ubLabel htmlFor="picture">Picture</label> | ||
<input ubInput id="picture" type="file" /> | ||
</div> | ||
`, | ||
}) | ||
export class InputFileDemoComponent {} | ||
|
||
export default InputFileDemoComponent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Component } from "@angular/core"; | ||
|
||
import { UbInputDirective } from "@/registry/new-york/ui/input.directive"; | ||
|
||
@Component({ | ||
standalone: true, | ||
imports: [UbInputDirective], | ||
template: ` <input ubInput type="text" placeholder="Email" /> `, | ||
}) | ||
export class InputDemoComponent {} | ||
|
||
export default InputDemoComponent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Component } from "@angular/core"; | ||
|
||
import { UbInputDirective } from "@/registry/new-york/ui/input.directive"; | ||
|
||
@Component({ | ||
standalone: true, | ||
imports: [UbInputDirective], | ||
template: ` <input disabled ubInput type="text" placeholder="Email" /> `, | ||
}) | ||
export class InputDisabledDemoComponent {} | ||
|
||
export default InputDisabledDemoComponent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Component } from "@angular/core"; | ||
|
||
import { UbInputDirective } from "@/registry/new-york/ui/input.directive"; | ||
import { UbLabelDirective } from "@/registry/new-york/ui/label.directive"; | ||
|
||
@Component({ | ||
standalone: true, | ||
imports: [UbInputDirective, UbLabelDirective], | ||
template: ` | ||
<div class="grid w-full max-w-sm items-center gap-1.5"> | ||
<label ubLabel htmlFor="picture">Picture</label> | ||
<input ubInput id="picture" type="file" /> | ||
</div> | ||
`, | ||
}) | ||
export class InputFileDemoComponent {} | ||
|
||
export default InputFileDemoComponent; |