The purpose of this library is to make it easier to reuse components across my projects. Note: This library is currently under development, and its interfaces may change without prior notice.
To use Tale Elements, all you need to do is install the
tale-elements
package and its peer dependencies:
# with npm
$ npm i tale-elements
# with pnpm
$ pnpm add tale-elements
How you add the component to a page may vary depending on the tools you use in your work. If you use Vite or other bundler, you can add components by importing them into a script that is imported elsewhere into a page:
// Importing into a javascript file, like index.js
import { TButton } from "@tale-elements";
<!-- importing directy into an HTML page -->
<script type="module">
import { TButton } from "@tale-elements";
</script>
<t-button></t-button>
If you're using vanilla JavaScript, include an import map in your HTML to handle module imports, as browsers don't process relative paths natively. Alternatively, consider using bundlers like Vite or Webpack for more complex setups.
<!-- create an import map for the browser -->
<script type="importmap">
{
"imports": {
"tale-elements": "./node_modules/tale-elements/dist/esm/index.js"
}
}
</script>
<!-- import your custom elements -->
<script type="module">
import { TButton } from "tale-elements";
</script>
With our library, you have complete freedom to style your components. You can choose from pre-defined styles using the variant
and shape
attributes, or if you prefer full control, you can customize each element individually using the ::part
CSS API. We expose all HTML elements so you can style them as needed.
-
- secondary - red - ghost
- square
Or use
::part(t-input)
to apply custom styles to the input -
- secondary - white - red
Or use
::part(t-console)
to apply custom styles to the console
MIT License
Copyright (c) 2025 Tale Elements
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.