本文整理匯總了TypeScript中@storybook/addon-knobs.select函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript select函數的具體用法?TypeScript select怎麽用?TypeScript select使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了select函數的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: select
export const getThemeKnob = (defaultTheme: GrafanaTheme = GrafanaTheme.Dark) => {
return select(
'Theme',
{
Default: defaultTheme,
Light: GrafanaTheme.Light,
Dark: GrafanaTheme.Dark,
},
defaultTheme
);
};
示例2: text
.add('All knobs', () => {
const name = text('name', 'Jane');
const stock = number('stock', 20, {
range: true,
min: 0,
max: 30,
step: 5,
});
const fruits = {
Apple: 'apples',
Banana: 'bananas',
Cherry: 'cherries',
};
const fruit = select('fruit', fruits, 'apples');
const otherFruits = {
Kiwi: 'kiwi',
Guava: 'guava',
Watermelon: 'watermelon',
};
const otherFruit = radios('Other Fruit', otherFruits, 'watermelon');
const price = number('price', 2.25);
const border = color('border', 'deeppink');
const today = date('today', new Date('Jan 20 2017'));
const items = array('items', ['Laptop', 'Book', 'Whiskey']);
const nice = boolean('nice', true);
button('Arbitrary action', action('You clicked it!'));
return {
component: AllKnobsComponent,
props: {
name,
stock,
fruit,
otherFruit,
price,
border,
today,
items,
nice,
},
};
})