27 lines
661 B
TypeScript
27 lines
661 B
TypeScript
|
import React from "react";
|
||
|
|
||
|
interface LabeledButtonProps {
|
||
|
label: string; // Label for the button
|
||
|
onClick?: () => void; // Function to call when the button is clicked
|
||
|
disabled?: boolean; // Optional prop to disable the button
|
||
|
value?: string;
|
||
|
}
|
||
|
|
||
|
const LabeledButton: React.FC<LabeledButtonProps> = ({
|
||
|
label,
|
||
|
onClick,
|
||
|
disabled = false,
|
||
|
value = "Click here",
|
||
|
}) => {
|
||
|
return (
|
||
|
<div className="labeled-button-container">
|
||
|
<div className="label">{label}</div>
|
||
|
<button className="button" onClick={onClick} disabled={disabled}>
|
||
|
{value}
|
||
|
</button>
|
||
|
</div>
|
||
|
);
|
||
|
};
|
||
|
|
||
|
export default LabeledButton;
|