No description or website provided.
JavaScript CSS HTML
Latest commit b1a36a3 May 18, 2016 @nolimits4web Merge pull request #6 from ionas/patch-1
bower install instructions
Failed to load latest commit information.
demo Update dependencies Aug 21, 2015
dist 1.0.3 Release Aug 21, 2015
src 1.0.3 Release Aug 21, 2015
.gitignore Update dependencies Aug 21, 2015 1.0.3 Release Aug 21, 2015
LICENSE Initial commit Feb 1, 2015 bower install instructions May 16, 2016
bower.json 1.0.3 Release Aug 21, 2015
gulpfile.js 1.0.3 Release Aug 21, 2015
package.json 1.0.3 Release Aug 21, 2015

devDependency Status Flattr this git repo

Framework7 Keypad

Keypad plugin extends Framework7 with additional custom keyboards. By default it comes with predefined Numpad and Calculator keyboards, but it also can be used to create custom keyboards with custom buttons.

Keypad Instance

Keypad can be created and initialized only using JavaScript. We need to use related App's method:


Where parameters - object - object with Keypad parameters. Required This method returns initialized Keypad instance

For example

var myKeypad = myApp.keypad({
    input: '#demo-numpad-limited',
    valueMaxLength: 2,
    dotButton: false

Keypad Parameters

Let's look on list of all available parameters:

Parameter Type Default Description
Common Picker Modal Component Parameters
container string or HTMLElement String with CSS selector or HTMLElement where to place generated Keypad HTML. Use only for inline keypad
input string or HTMLElement String with CSS selector or HTMLElement with related input element
scrollToInput boolean true Scroll viewport (page-content) to input when keypad opened
inputReadOnly boolean true Sets "readonly" attribute on specified input
convertToPopover boolean true Converts keypad modal to Popover on large screens (on iPad)
onlyOnPopover boolean false Enable it and Keypad will be always opened in Popover
cssClass string Additional CSS class name to be set on keypad modal
toolbar boolean true Enables keypad modal toolbar
toolbarCloseText string 'Done' Text for Done/Close toolbar button
toolbarTemplate string Toolbar HTML Template. By default it is HTML string with following template:

<div class="toolbar">
  <div class="toolbar-inner">
    <div class="left"></div>
    <div class="right">
      <a href="#" class="link close-picker">

Specific Picker Parameters
value string Initial Keypad value
formatValue function (p, value) Function to format input value, should return new/formatted string value. value is the current keypad value
type string 'numbad' Keypad type, could be 'numpad', 'calculator' or 'custom'
valueMaxLength number null Limit value by selected number of characters
dotButton boolean true Only for 'numpad' type. Show or hide "dot" button
dotCharacter string '.' Dot character symbol. Only for 'numpad' and 'calculator' types
buttons array

Array with keypad buttons, by default it is predefined for numpad and calculator, but can be used for custom keypad.

Each button should be presented as object with the following properties:

  • html - string - button inner HTML
  • value - string/number - button value
  • cssClass - string - additional CSS class on button
  • dark - boolean - defines "dark" color button
  • onClick - function (p, button) - callback function that will be executed when you click on button

As a reference look at source code to see how buttons defined for Numpad and Calculator

For example:

buttons: [
        value: 1,
        onClick: function () {
            console.log('Button 1 clicked')
        value: 'a',

onChange function (p, value) Callback function that will be executed when keypad value changed.
onOpen function (p) Callback function that will be executed when picker is opened
onClose function (p) Callback function that will be executed when picker is closed

Keypad Methods & Properties

After we initialize Keypad we have its initialized instance in variable (like myKeypad variable in example above) with helpful methods and properties:

myKeypad.params Object with passed initialization parameters
myKeypad.value Current keypad value
myKeypad.opened true if Keypad is currently opened
myKeypad.inline true if Keypad is inline Keypad
myKeypad.container Dom7 instance with Keypad HTML container
myKeypad.setValue(value) Set new keypad value. Open Keypad
myKeypad.close() Close Keypad
myKeypad.destroy() Destroy Keypad instance and remove all events

Automatic initialization

Such predefined Numpad and Calculator keypads could be initialized automatically. Just use usual inputs but with special type attribute:

<input type="numpad">
<input type="calculator">

Access to Keypad's Instance

If you initialize Keypad as inline Keypad or using automatic initialization, it is still possible to access to Keypad's instance from its HTML container:

var myKeypad = $$('.keypad-inline')[0].f7Keypad;


$ bower install framework7-keypad