You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `chars` property accepts a pipe `|` delimited string of characters to use as the keyboard buttons. You can include special function characters with the `{text:action}` syntax, where `text` is the text that will be rendered in the button and `action` is the action within the keyboard component to be called when that button is pressed. The inbuilt actions are:
19
+
Each layout accepts a pipe `|` delimited string of characters to use as the keyboard buttons. You can include special function characters with the `{text:action}` syntax, where `text` is the text that will be rendered in the button and `action` is the action within the keyboard component to be called when that button is pressed. The inbuilt actions are:
20
20
21
21
*`backspace` - Remove one character from the end of the current value.
22
22
*`space` - Insert one whitespace character.
23
23
*`clear` - Clear the entire input value.
24
+
*`goto:n` - Go to a new keyboard layout, replacing `n` with the index of the layout to load.
24
25
25
26
If the `action` does not match any of these inbuilt actions, an event will be dispatched by the keyboard component instead, using the action name as the event name. The keyboard component will be provided to the listener as the first argument.
26
27
27
28
> Note: You can simply use `{action}` which will create a button with no text content. This is useful for things like `space` which you may just want to render as a wide empty button.
28
29
29
30
## Props:
30
31
31
-
The possible component properties are:
32
+
<table>
33
+
<thead>
34
+
<tr>
35
+
<th>Prop</th>
36
+
<th>Type</th>
37
+
<th>Description</th>
38
+
</tr>
39
+
</thead>
40
+
<tbody>
41
+
<tr>
42
+
<td><code>layouts</code></td>
43
+
<td><code>string|string[]</code></td>
44
+
<td>One or more keyboard layouts, explained above.</td>
45
+
</tr>
46
+
<tr>
47
+
<td><code>maxlength</code></td>
48
+
<td><code>number</code></td>
49
+
<td>The maximum input length.</td>
50
+
</tr>
51
+
</tbody>
52
+
</table>
32
53
33
-
*`chars` - The character list (explained above).
34
-
*`maxlength` - The maximum length of `value`.
35
-
36
-
> Note: Because `maxlength` is a `Number` you must provide it with the Vue dynamic syntax e.g. `<keyboard :maxlength="10">` not `<keyboard maxlength="10">` (the latter will be interpreted as a `String`).
37
-
38
-
## Interacting:
39
-
40
-
In regards to styling and interacting with the component, there are several routes:
41
-
42
-
* Buttons rendered with the `{text:action}` syntax will include a class name `action-x` where `x` is the name of the action e.g. `action-clear`.
43
-
* General buttons will include a class name `char-x` where `x` is the text content e.g. `char-a`, `char-b`.
44
-
* You can use `v-model="input"` to sync the keyboard value with a value in the parent Vue instance (named `input` in this case).
This keeps the `input` value in the main application in sync with the value of the keyboard, limits that value to 16 characters and triggers the 'custom' function in the main application when the "custom" button in the keyboard is clicked.
0 commit comments