{label &&
}
@@ -38,7 +45,11 @@ export const Input: React.FC
= ({
)}
-
+ {customInput ? (
+ cloneElement(customInput, { ...baseInputProps, ...props })
+ ) : (
+
+ )}
{rightElement && (
diff --git a/@stellar/design-system/src/components/Table/index.tsx b/@stellar/design-system/src/components/Table/index.tsx
index 169be7ee..95e51db5 100644
--- a/@stellar/design-system/src/components/Table/index.tsx
+++ b/@stellar/design-system/src/components/Table/index.tsx
@@ -10,7 +10,7 @@ import "./styles.scss";
interface TableColumnLabel {
id: string;
- label: string;
+ label: string | React.ReactNode;
sortBy?: boolean;
}
diff --git a/@stellar/design-system/src/components/Toggle/index.tsx b/@stellar/design-system/src/components/Toggle/index.tsx
index 7a37b805..e6d892bf 100644
--- a/@stellar/design-system/src/components/Toggle/index.tsx
+++ b/@stellar/design-system/src/components/Toggle/index.tsx
@@ -1,4 +1,4 @@
-import React, { useEffect, useState } from "react";
+import React, { cloneElement, useEffect, useState } from "react";
import "./styles.scss";
enum LabelPosition {
@@ -13,7 +13,8 @@ interface ToggleComponent {
interface ToggleProps extends React.InputHTMLAttributes {
id: string;
checked: boolean;
- onChange: () => void;
+ customInput?: React.ReactElement;
+ onChange?: () => void;
disabled?: boolean;
labelOn?: string;
labelOff?: string;
@@ -23,6 +24,7 @@ interface ToggleProps extends React.InputHTMLAttributes {
export const Toggle: React.FC & ToggleComponent = ({
id,
checked,
+ customInput,
onChange,
disabled,
labelOn,
@@ -39,19 +41,25 @@ export const Toggle: React.FC & ToggleComponent = ({
" ",
);
- const renderLabel = () => {checked ? labelOn : labelOff};
+ const renderLabel = () =>
+ labelOn ? {checked ? labelOn : labelOff ?? labelOn} : null;
+
+ const baseInputProps = {
+ className: "Toggle__input",
+ type: "checkbox",
+ name: id,
+ id,
+ disabled,
+ };
return (