-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
82fdbdf
commit b2e7242
Showing
4 changed files
with
107 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import { Meta } from '@web/storybook-prebuilt/addon-docs/blocks'; | ||
|
||
<Meta title="Getting Started" /> | ||
|
||
# Getting started | ||
|
||
Medblocks UI is packaged as an ES Module and needs a modern bundler to work with your framework of choice. [Vite](https://vitejs.dev/) is blazing fast, and we'll be using that in this guide. [Snowpack](https://www.snowpack.dev/) is another alternative. | ||
|
||
``` | ||
npm init @vitejs/app | ||
``` | ||
Give your project a name | ||
You are free to choose any framework, but for this tutorial we'll cover [Svelte](https://svelte.dev/) and [Vue](https://vuejs.org/) since they have excellent [support for web components](https://custom-elements-everywhere.com/). So it is recommended that you choose one of those. | ||
|
||
`cd` into the directory you just created once vite has finished the setup and do `npm install`. | ||
|
||
Install Medblocks UI: | ||
``` | ||
npm install medblocks-ui | ||
``` | ||
|
||
The next steps will look a little different based on the framework you choose, but it should be mostly the same. | ||
|
||
## Svelte | ||
|
||
Navigate to `src/App.svelte` | ||
|
||
Include the following in the `<script>` | ||
```jsx | ||
<script> | ||
...other content | ||
import Counter from './lib/Counter.svelte' | ||
|
||
import 'medblocks-ui/dist/medblocks' | ||
import '@shoelace-style/shoelace/dist/themes/base.css' | ||
</script> | ||
``` | ||
|
||
Now in the template let's include an `mb-input` element under `main` | ||
|
||
```jsx | ||
<main> | ||
<mb-input label="Hello world!"></mb-input> | ||
. | ||
. | ||
. | ||
...other content | ||
</main> | ||
``` | ||
and it should render an input like so: | ||
|
||
<mb-input label="Hello world!"></mb-input> | ||
|
||
The alignment may be different because of the default css, but once you fix that, you're good to go! | ||
|
||
## Vue | ||
|
||
Navigate to `src/App.vue` | ||
|
||
Include the following in the `<script>` | ||
```jsx | ||
<script> | ||
import 'medblocks-ui/dist/medblocks' | ||
import '@shoelace-style/shoelace/dist/themes/base.css' | ||
|
||
import { defineComponent } from 'vue' | ||
...other content | ||
</script> | ||
``` | ||
|
||
Now in the template let's include an `mb-input` element in the `template` | ||
|
||
```jsx | ||
<template> | ||
<mb-input label="Hello world!" :data.prop="`Property bound in Vue`"></mb-input> | ||
. | ||
. | ||
. | ||
...other content | ||
</template> | ||
``` | ||
and it should render an input like so: | ||
|
||
<mb-input label="Hello world!" data="Property bound in Vue"></mb-input> | ||
|
||
The alignment may be different because of the default css, but once you fix that, you're good to go! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
b2e7242
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: