mirror of
https://github.com/usetrmnl/trmnl-form-builder.git
synced 2026-04-29 13:43:54 -07:00
47 lines
1.6 KiB
HTML
47 lines
1.6 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>TRMNL YML Form Builder - Web Component Test</title>
|
|
<script src="https://cdn.jsdelivr.net/npm/tailwindcss@4.1.17/dist/lib.min.js"></script>
|
|
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@4.1.17/index.min.css " rel="stylesheet">
|
|
<style>
|
|
body {
|
|
margin: 0;
|
|
padding: 0;
|
|
/* font-family: 'IBM Plex Sans', system-ui, -apple-system, sans-serif; */
|
|
}
|
|
|
|
trmnl-yaml-form {
|
|
display: block;
|
|
width: 100%;
|
|
height: 100vh;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<!-- The Web Component -->
|
|
<trmnl-form-builder accent-color="#F8654B" theme="light"></trmnl-form-builder>
|
|
|
|
<!-- Load the Web Component -->
|
|
<script src="trmnl-form-builder.js"></script>
|
|
|
|
<!-- Example: Access the component programmatically -->
|
|
<script>
|
|
// Wait for the component to be ready
|
|
customElements.whenDefined('trmnl-form-builder').then(() => {
|
|
const form = document.querySelector('trmnl-form-builder');
|
|
|
|
// You can access the component's public API:
|
|
// form.getYaml() - Get the generated YAML
|
|
// form.getFields() - Get the current fields array
|
|
// form.setFields(fields) - Load fields from an array
|
|
// form.clear() - Clear all fields
|
|
|
|
console.log('TRMNL YML Form Builder Web Component loaded');
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|