diff --git a/packages/client/manifest.json b/packages/client/manifest.json
index 74e28e688c..47c79df6bb 100644
--- a/packages/client/manifest.json
+++ b/packages/client/manifest.json
@@ -245,7 +245,9 @@
"name": "Button",
"description": "A basic html button that is ready for styling",
"icon": "Button",
+ "editable": true,
"illegalChildren": ["section"],
+ "showSettingsBar": true,
"settings": [
{
"type": "text",
@@ -254,6 +256,7 @@
},
{
"type": "select",
+ "showInBar": true,
"label": "Variant",
"key": "type",
"options": [
@@ -282,6 +285,7 @@
{
"type": "select",
"label": "Size",
+ "showInBar": true,
"key": "size",
"options": [
{
@@ -306,11 +310,18 @@
{
"type": "boolean",
"label": "Quiet",
- "key": "quiet"
+ "key": "quiet",
+ "showInBar": true,
+ "barIcon": "VisibilityOff",
+ "barTitle": "Quiet variant",
+ "barSeparator": false
},
{
"type": "boolean",
"label": "Disabled",
+ "showInBar": true,
+ "barIcon": "NoEdit",
+ "barTitle": "Disable button",
"key": "disabled"
},
{
diff --git a/packages/client/src/components/app/Button.svelte b/packages/client/src/components/app/Button.svelte
index 9900c740d2..3fbdcf6744 100644
--- a/packages/client/src/components/app/Button.svelte
+++ b/packages/client/src/components/app/Button.svelte
@@ -2,7 +2,7 @@
import { getContext } from "svelte"
import "@spectrum-css/button/dist/index-vars.css"
- const { styleable } = getContext("sdk")
+ const { styleable, builderStore } = getContext("sdk")
const component = getContext("component")
export let disabled = false
@@ -11,16 +11,35 @@
export let size = "M"
export let type = "primary"
export let quiet = false
+
+ let node
+
+ $: $component.editing && node?.focus()
+ $: componentText = getComponentText(text, $builderStore, $component)
+
+ const getComponentText = (text, builderState, componentState) => {
+ if (!builderState.inBuilder || componentState.editing) {
+ return text || " "
+ }
+ return text || componentState.name || "Placeholder text"
+ }
+
+ const updateText = e => {
+ builderStore.actions.updateProp("text", e.target.textContent)
+ }