TigriWeb Components
AttributesControlsMetaPrimitivesIntegrations
  • Table of Contents
  • Attributes
    • Checkbox
    • Color
    • ColorGradient
    • DateTime
    • Icon
    • Media
    • Number
    • PostType
    • PostTypeMultiple
    • Radio
    • Range
    • Select
    • Taxonomy
    • TaxonomyMultiple
    • Text
    • Textarea
    • Toggle
    • ToolbarButton
    • ToolbarGroup
  • Controls
    • AppenderButton
    • Media
    • RichHeading
    • RichText
  • Meta
    • Checkbox
    • Color
    • DateTime
    • Icon
    • Media
    • Number
    • PostType
    • PostTypeMultiple
    • Radio
    • Range
    • Select
    • Taxonomy
    • TaxonomyMultiple
    • Text
    • Textarea
    • Toggle
  • Primitives
    • HTML
    • SVG
  • Integrations
    • Enqueue SVG icons
    • Enqueue I18n strings
Powered by GitBook
On this page

Was this helpful?

  1. Meta

Number

PreviousMediaNextPostType

Last updated 6 months ago

Was this helpful?

{ label, help, min, max, step, dragDirection, dragThreshold, spinControls, isDragEnabled, labelPosition, required, name*, onChange, attributes*, setAttributes* }
/**
 * @param {string} [label] - Component label.
 * @param {string} [help] - Component description.
 * @param {number} [min] - Minimum value (default: 0).
 * @param {number} [max] - Maximum value (default: 100).
 * @param {number} [step] - Step value (default: 1).
 * @param {string} [dragDirection] - Determines the drag axis "s", "n", "e", "w".
 * @param {number} [dragThreshold] - If isDragEnabled is true, this controls the amount of px to have been dragged before the drag gesture is actually triggered.
 * @param {string} [spinControls] - The type of spin controls to display. These are buttons that allow the user to quickly increment and decrement the number: "none", "custom", "native".
 * @param {boolean} [isDragEnabled] - If true, enables mouse drag gestures.
 * @param {string} [labelPosition] - The position of the label.
 * @param {boolean} [required] - If true enforces a valid number within the control's min/max range. If false allows an empty string as a valid value.
 * @param {string} name - Attribute name.
 * @param {function} [onChange] - Callback called when the value changes.
 * @param {object} attributes - Object containing block attributes.
 * @param {function} setAttributes - Function to set new block attribute values.
 */
functions.php
register_post_meta( 'post_type_name', 'test_number', array(
	'type'         => 'number',
	'default'      => 3,
	'single'       => true,
	'show_in_rest' => true,
) );
index.js
import {
	TwebMetaNumberControl,
} from '@tigriweb/components/attributes';
index.js | edit()
<TwebMetaNumberControl
	label={ __('Number Label', 'your-theme-name') }
	help={ __('Number Description', 'your-theme-name') }
	min="3"
	max="13"
	step="2"
	name="test_number"
	{ ...{ attributes, setAttributes } }
/>
TwebMetaNumberControl