forked from microsoft/fluentui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrenderButton.tsx
More file actions
23 lines (19 loc) · 753 Bytes
/
renderButton.tsx
File metadata and controls
23 lines (19 loc) · 753 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/** @jsxRuntime automatic */
/** @jsxImportSource @fluentui/react-jsx-runtime */
import { assertSlots } from '@fluentui/react-utilities';
import type { JSXElement } from '@fluentui/react-utilities';
import type { ButtonSlots, ButtonBaseState } from './Button.types';
/**
* Renders a Button component by passing the state defined props to the appropriate slots.
*/
export const renderButton_unstable = (state: ButtonBaseState): JSXElement => {
assertSlots<ButtonSlots>(state);
const { iconOnly, iconPosition } = state;
return (
<state.root>
{iconPosition !== 'after' && state.icon && <state.icon />}
{!iconOnly && state.root.children}
{iconPosition === 'after' && state.icon && <state.icon />}
</state.root>
);
};