-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from th3f0r3ign3r/main
Added showLabel property
- Loading branch information
Showing
4 changed files
with
92 additions
and
13 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
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
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
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,55 @@ | ||
import * as z from "zod"; | ||
import AutoForm from "../components/ui/auto-form"; | ||
import { | ||
Card, | ||
CardContent, | ||
CardDescription, | ||
CardHeader, | ||
CardTitle, | ||
} from "../components/ui/card"; | ||
import { Button } from "@/components/ui/button"; | ||
|
||
const formSchema = z.object({ | ||
username: z.string(), | ||
}); | ||
|
||
function InputWithoutLabel() { | ||
return ( | ||
<> | ||
<div className="mx-auto my-6 max-w-lg"> | ||
<Card> | ||
<CardHeader> | ||
<CardTitle>Input Without Label</CardTitle> | ||
<CardDescription> | ||
This example shows how to use AutoForm input without label. | ||
</CardDescription> | ||
</CardHeader> | ||
|
||
<CardContent> | ||
<AutoForm | ||
formSchema={formSchema} | ||
fieldConfig={{ | ||
username: { | ||
inputProps: { | ||
showLabel: false, | ||
placeholder: "Username", | ||
}, | ||
renderParent: ({ children }) => ( | ||
<div className="flex items-end gap-3"> | ||
<div className="flex-1">{children}</div> | ||
<div> | ||
<Button type="button">Update</Button> | ||
</div> | ||
</div> | ||
), | ||
}, | ||
}} | ||
></AutoForm> | ||
</CardContent> | ||
</Card> | ||
</div> | ||
</> | ||
); | ||
} | ||
|
||
export default InputWithoutLabel; |