Sorry, but you either have no stories or none are selected somehow.
If the problem persists, check the browser console, or the terminal you've run Storybook from.
The component failed to render properly, likely due to a configuration issue in Storybook. Here are some common causes and how you can address them:
HTML custom elements are now widely supported across browsers, and building encapsulated web components allows us to package logic and styles for the defined field types within Disciple.Tools. By doing this, the main theme doesn't need other javascript dependencies and initialization scripts, and PHP developers can stick to writing PHP instead of also needing to figure out complex javascript interactions.
This web components library was built with a few main concepts in mind that drive the initial and future development:
ComponentService
provides coupling to standard APIs when needed.The easiest way to include the web components is to use NPM. If your project will make use of NPM, you can run:
npm i @disciple.tools/web-components
You can then include the library based on the type of project you're working on:
See git repo for details on how to manually build the components to include in a project without NPM.
import '@disciple.tools/web-components';
Your framework may need a wrapper component to make these components work, so see the specific documentation for your framework.
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@disciple.tools/web-components@0.7.0/styles/light.css" type="text/css" media="all"> <script src="https://cdn.jsdelivr.net/npm/@disciple.tools/web-components@0.7.0/dist/index.js"></script>
<link rel="stylesheet" href="/path/to/@disciple.tools/web-components/src/styles/light.css" type="text/css" media="all"> <script src="/path/to/@disciple.tools/web-components/dist/index.js"></script>
If you're using the Disciple.Tools theme, the components are all included (only in the next
branch releases for now)
and can be used without explicitly including scripts.
If you are writing a Magic Link or other plugin for WordPress that doesn't include the theme files, you'll need to include the script files.
$dtwc_version = '0.7.0'; wp_enqueue_style( 'dt-web-components-css', "https://cdn.jsdelivr.net/npm/@disciple.tools/web-components@$dtwc_version/styles/light.css", [], $dtwc_version ); wp_enqueue_script( 'dt-web-components-js', "https://cdn.jsdelivr.net/npm/@disciple.tools/web-components@$dtwc_version/dist/index.js", $dtwc_version );
$path = '../path/to/components/dist/index.js'; wp_enqueue_script( 'dt-web-components-js', plugin_dir_url( __FILE__ ) . $path, null, filemtime( plugin_dir_path( __FILE__ ) . $path ) ); $css_path = '../path/to/components/src/styles/light.css'; wp_enqueue_style( 'dt-web-components-css', plugin_dir_url( __FILE__ ) . $css_path, null, filemtime( plugin_dir_path( __FILE__ ) . $css_path ) );
Once your scripts are included, you can use the components like you would any other standard HTML elements when you render your page.
<html> <head>...</head> <body> <main> <h1>My Page</h1> <div> <dt-text id='textField' name='textField' label="My Text Field"></dt-text> </div> </main> </body> </html>
Learn about the Component Architecture in case you want to extend or contribute to the components.
View All Components to learn about how each component works.