segmented-controls

0.1.5 • Public • Published

Published on webcomponents.org

<segmented-controls>

This webcomponent follows the open-wc recommendation.

Installation

npm i segmented-controls

Usage

<script type="module">
  import 'segmented-controls/segmented-controls.js';
  import '@material/mwc-icon';
</script>

<segmented-controls>
  <segmented-controls-item>
    <span>Label super label</span>
  </segmented-controls-item>
  <segmented-controls-item>
    <span>Label</span>
  </segmented-controls-item>
  <segmented-controls-item>
      <span>Label</span>
  </segmented-controls-item>
</segmented-controls>

<segmented-controls selected="1">
  <segmented-controls-item>
    <span>Label</span>
  </segmented-controls-item>
  <segmented-controls-item>
    <span>Label</span>
  </segmented-controls-item>
  <segmented-controls-item>
    <span>Label</span>
  </segmented-controls-item>
</segmented-controls>
<segmented-controls>
  <segmented-controls-item>
    <span>Label</span>
  </segmented-controls-item>
  <segmented-controls-item>
    <span>Label</span>
  </segmented-controls-item>
  <segmented-controls-item select>
    <span>Label</span>
  </segmented-controls-item>
</segmented-controls>

<segmented-controls>
  <segmented-controls-item>
    <span>Label</span>
  </segmented-controls-item>
  <segmented-controls-item>
    <span>Label</span>
  </segmented-controls-item>
</segmented-controls>

<segmented-controls selected="1">
  <segmented-controls-item>
    <span>Label</span>
  </segmented-controls-item>
  <segmented-controls-item>
    <span>Label</span>
  </segmented-controls-item>
</segmented-controls>

<segmented-controls>
  <segmented-controls-item select>
    <img src="https://svgur.com/i/T78.svg" alt="icon control" name="graphic">
    <span>Label</span>
  </segmented-controls-item>
  <segmented-controls-item>
    <img src="https://via.placeholder.com/150" alt="icon control 2" name="graphic">
    <span>Label</span>
  </segmented-controls-item>
</segmented-controls>

<segmented-controls>
  <segmented-controls-item select>
    <mwc-icon name="graphic">home</mwc-icon>
    <span>Label</span>
  </segmented-controls-item>
  <segmented-controls-item select>
    <mwc-icon name="graphic">favorite</mwc-icon>
    <span>Label</span>
  </segmented-controls-item>
</segmented-controls>

Has a limit of 5 elements, if you want to use mwc-icon you have to install an import '@material/mwc-icon'

Linting with ESLint, Prettier, and Types

To scan the project for linting errors, run

npm run lint

You can lint with ESLint and Prettier individually as well

npm run lint:eslint
npm run lint:prettier

To automatically fix many linting errors, run

npm run format

You can format using ESLint and Prettier individually as well

npm run format:eslint
npm run format:prettier

Tooling configs

For most of the tools, the configuration is in the package.json to reduce the amount of files in your project.

If you customize the configuration a lot, you can consider moving them to individual files.

Local Demo with web-dev-server

npm start

To run a local development server that serves the basic demo located in demo/index.html

Credits

  • Erika Valdes

License

MIT Licensed

License: MIT

Readme

Keywords

none

Package Sidebar

Install

npm i segmented-controls

Weekly Downloads

2

Version

0.1.5

License

MIT

Unpacked Size

25.4 kB

Total Files

14

Last publish

Collaborators

  • envm92