Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
storybook-addon-toolbar-actions
Advanced tools
An Addon to add a button from within any react functional component to the storybook toolbar
An Addon to add a button from within any react functional component to the storybook toolbar.
Note that this addon will only work with react app.
within .storybook/main.js
:
module.exports = {
addons: ['storybook-addon-toolbar-actions/register'],
};
within any functional component:
To add icon:
import { useToolbarActions } from 'storybook-addon-toolbar-actions';
import AcUnitIcon from '@material-ui/icons/AcUnit';
export const WithIcon = () => {
useToolbarActions(
'icon-id',
<AcUnitIcon style={{ fill: 'currentColor' }} />,
() => {
console.log('clicked');
},
);
return <button />;
};
To add option list:
import { useToolbarActions } from 'storybook-addon-toolbar-actions';
import AcUnitIcon from '@material-ui/icons/AcUnit';
export const WithOptions = () => {
const [options, setOptions] = useState<ToolbarActionOption[]>([
{ key: 'name', value: 'val' },
{ key: 'name2', value: 'val' },
]);
useToolbarActions(
'icon-id',
<AcUnitIcon style={{ fill: 'currentColor' }} />,
{
options,
onClick:(options, option) => {
setOptions(options);
console.log(option);
},
},
);
return <button />;
};
Will activate the storybook IconButton indicator.
If set a dropdown list will be open under the button:
Will close the option dropdown list when option clicked.
When multiChoice set to
true
thecloseOptionListOnClick
option has no effect.
Use this option to sort and group button in their container, when set the Separator
will be added between button.
The value of this option will be used for knob:
setToKnob: 'locale';
// will be knob-locale=value
The Value of the knob set as follow:
Icon Button:
Required to set active
to true
/false
, if stateKnobValues
not set the true
/false
will be the value of knob.
When stateKnobValues
set, the value of stateKnobValues.active
or stateKnobValues.inactive
will be used depending on the active
state.
Single choice option:
When options
provided and multiChoice
not set, the value of selected option will be set to knob.
Multi choice option:
When options
provided and multiChoice
set to true
, an array of selected option will be set to knob.
When stateKnobValues
set, the value of stateKnobValues.active
or stateKnobValues.inactive
will be used depending on the active
state.
When set to true
user can select multiple option.
FAQs
An Addon to add a button from within any react functional component to the storybook toolbar
We found that storybook-addon-toolbar-actions demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.