Skip to content
Snippets Groups Projects
Commit baf4edfe authored by Aggarwal Himanshu's avatar Aggarwal Himanshu
Browse files

Add initial documentation for Button component

parent 353b974c
No related branches found
No related tags found
2 merge requests!17Merge develop into main,!11Setup JSDoc for documentation
import classNames from "classnames";
import React from "react";
import PropTypes from "prop-types";
import classNames from "classnames";
export default function Button({ children, className, onClick }) {
/**
* Custom button component
*
* @component
* @example
* return (
* <Button className="bg-indigo-500 text-white" onClick={() => console.log("Button pressed")}>
* Hello!
* </Button>
* )
*/
function Button({ children, className, onClick }) {
return (
<button
className={classNames("py-2 px-5 rounded-xl", className)}
......@@ -11,3 +23,20 @@ export default function Button({ children, className, onClick }) {
</button>
);
}
Button.propTypes = {
/**
* The content inside the button
*/
children: PropTypes.node.isRequired,
/**
* Additional CSS classes for the button (optional)
*/
className: PropTypes.string,
/**
* The function to run when button is pressed
*/
onClick: PropTypes.func,
};
export default Button;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment