mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-16 10:51:06 +00:00
feat(component): add Tooltip
Closes #11 - Fixes `tabindex` prop storybook typo
This commit is contained in:
parent
446032d8ee
commit
7e5252951a
19 changed files with 350 additions and 24 deletions
61
src/components/Tooltip/Tooltip.stories.js
Normal file
61
src/components/Tooltip/Tooltip.stories.js
Normal file
|
@ -0,0 +1,61 @@
|
|||
import { withKnobs, select, text } from '@storybook/addon-knobs';
|
||||
import Component from './Tooltip.Story.svelte';
|
||||
|
||||
export default { title: 'Tooltip', decorators: [withKnobs] };
|
||||
|
||||
const directions = {
|
||||
'Top (top)': 'top',
|
||||
'Right (right)': 'right',
|
||||
'Bottom (bottom)': 'bottom',
|
||||
'Left (left)': 'left'
|
||||
};
|
||||
|
||||
export const Default = () => ({
|
||||
Component,
|
||||
props: {
|
||||
direction: select('Tooltip direction (direction)', directions, 'bottom'),
|
||||
triggerText: text('Trigger text (triggerText)', 'Tooltip label'),
|
||||
tabindex: text('Tab index (tabindex in <Tooltip>)', '0')
|
||||
}
|
||||
});
|
||||
|
||||
export const NoIcon = () => ({
|
||||
Component,
|
||||
props: {
|
||||
story: 'no icon',
|
||||
showIcon: false,
|
||||
direction: select('Tooltip direction (direction)', directions, 'bottom'),
|
||||
triggerText: text('Trigger text (triggerText)', 'Tooltip label'),
|
||||
tabindex: text('Tab index (tabindex in <Tooltip>)', '0')
|
||||
}
|
||||
});
|
||||
|
||||
export const CustomIcon = () => ({
|
||||
Component,
|
||||
props: {
|
||||
story: 'custom icon',
|
||||
showIcon: true,
|
||||
direction: select('Tooltip direction (direction)', directions, 'bottom'),
|
||||
triggerText: text('Trigger text (triggerText)', 'Tooltip label'),
|
||||
tabindex: text('Tab index (tabindex in <Tooltip>)', '0')
|
||||
}
|
||||
});
|
||||
|
||||
export const CustomIconOnly = () => ({
|
||||
Component,
|
||||
props: {
|
||||
story: 'custom icon only',
|
||||
showIcon: true,
|
||||
direction: select('Tooltip direction (direction)', directions, 'bottom'),
|
||||
iconDescription: 'Helpful Information',
|
||||
tabindex: text('Tab index (tabindex in <Tooltip>)', '0')
|
||||
}
|
||||
});
|
||||
|
||||
export const UncontrolledTooltip = () => ({
|
||||
Component,
|
||||
props: {
|
||||
story: 'uncontrolled',
|
||||
direction: select('Tooltip direction (direction)', directions, 'bottom')
|
||||
}
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue