Updateing Docs
This commit is contained in:
28
src/components/Label.js
Normal file
28
src/components/Label.js
Normal file
@@ -0,0 +1,28 @@
|
||||
// components/Label.js
|
||||
import { $, $html } from "sigpro";
|
||||
import { ui, val } from "../core/utils.js";
|
||||
|
||||
/**
|
||||
* Label component
|
||||
*
|
||||
* daisyUI classes used:
|
||||
* - label
|
||||
* - floating-label
|
||||
*/
|
||||
export const Label = (props) => {
|
||||
const { children, value, floating = false, error, required, class: className, ...rest } = props;
|
||||
|
||||
if (floating) {
|
||||
return $html("label", { class: ui("floating-label w-full", className), ...rest }, () => [
|
||||
value ? $html("span", {}, value) : null,
|
||||
children,
|
||||
error ? $html("span", { class: "text-error text-xs" }, val(error)) : null,
|
||||
]);
|
||||
}
|
||||
|
||||
return $html("label", { class: ui("input w-full", className), ...rest }, () => [
|
||||
value ? $html("span", { class: "label" }, value) : null,
|
||||
children,
|
||||
error ? $html("span", { class: "text-error text-xs" }, val(error)) : null,
|
||||
]);
|
||||
};
|
||||
Reference in New Issue
Block a user