|
Download wp-calypso/client/my-sites/plugins/plugin-action/README.md from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.64 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/my-sites/plugins/plugin-action/README.md
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/my-sites/plugins/plugin-action/README.md
-
curl -L -o README.md https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/my-sites/plugins/plugin-action/README.md
1.64 kB
Plugin Action
This component is used to display a plugin action in the form of a toggle or a disconnect Jetpack button.
How to use
By default, the PluginAction component will attempt to render a FormToggle.
import PluginAction from 'calypso/my-sites/plugins/plugin-action/plugin-action';
function render() {
return (
<div className="plugin-actions">
<PluginAction
label={ this.props.translate( 'Active', { context: 'plugin status' } ) }
status={ this.isActive() }
action={ this.toggleActivation }
inProgress={ this.props.activateInProgress }
htmlFor="html-for-attribute-on-label"
/>
</div>
);
}
This behavior can be overridden by passing a child to the PluginAction component.
import { Button } from '@automattic/components';
import PluginAction from 'calypso/my-sites/plugins/plugin-action/plugin-action';
function render() {
return (
<PluginAction
label={ this.props.translate( 'Active and Connected', { context: 'plugin status' } ) }
>
<Button href="/plugins/jetpack" />
</PluginAction>
);
}
Props
label: The user friendly label that described the action.status: The state of the progress indicator.action: (callback) what should be executed once the user fires the action.inProgress: (bool) whether the action is in the middle of being performed.htmlFor: (string) htmlFor is used for creating the for attribute on the label.disabledInfo: ( string ) text that gets displayed in a infoPopover explaining why the action is disabled.disabled: ( bool ) whether the toggle is disabled (grayed out and non interactive) or not