Skip to content

Create a custom button with useModel #61

Answered by adamberecz
dan-leech asked this question in Questions
Discussion options

You must be logged in to vote

Try to take a slightly different approach. Let's get rid of defineElement altogether which wouldn't be necessary anyway as we're defining an element with composables from ground up. Let's also use non-static exports of the composables (as our element is no longer considered static because it has data) and add useNullValue.

Here's what you should get:

<template>
  <ElementLayout ref="container">
    <template #element>
      <!-- Use `button` tag -->
      <template v-if="buttonType === 'button'">
        <!-- Use it as HTML -->
        <button
          v-bind="{
            ...button,
            ...aria,
          }"
          v-html="buttonLabel"
          :tabindex="isDisabled || isLo…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@dan-leech
Comment options

@adamberecz
Comment options

@dan-leech
Comment options

@adamberecz
Comment options

Answer selected by dan-leech
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants