UNPKG

918 BTypeScriptView Raw
1/*
2 * Copyright (c) Jupyter Development Team.
3 * Distributed under the terms of the Modified BSD License.
4 */
5
6import React from 'react';
7import { classes } from '../utils';
8
9/**
10 * Button component property
11 */
12export interface IButtonProps
13 extends React.ButtonHTMLAttributes<HTMLButtonElement> {
14 /**
15 * Whether this button should use minimal styles.
16 */
17 minimal?: boolean;
18 /**
19 * Whether this button should use small styles.
20 */
21 small?: boolean;
22}
23
24/**
25 * Button component
26 *
27 * @param props Component properties
28 * @returns Component
29 */
30export function Button(props: IButtonProps): JSX.Element {
31 const { minimal, small, children, ...others } = props;
32 return (
33 <button
34 {...others}
35 className={classes(
36 props.className,
37 minimal ? 'jp-mod-minimal' : '',
38 small ? 'jp-mod-small' : '',
39 'jp-Button'
40 )}
41 >
42 {children}
43 </button>
44 );
45}