code
stringlengths
2.5k
150k
kind
stringclasses
1 value
padrino Class: Padrino::SafeBuffer Class: Padrino::SafeBuffer ========================== Inherits: [String](../string "String (class)") * [Object](../object "Object (class)") * [String](../string "String (class)") * Padrino::SafeBuffer Overview -------- Padrino::SafeBuffer is based on ActiveSupport::SafeBuffer Defined Under Namespace ----------------------- **Classes:** [SafeConcatError](safebuffer/safeconcaterror "Padrino::SafeBuffer::SafeConcatError (class)") Constant Summary [collapse](#) ------------------------------- UNSAFE\_STRING\_METHODS = ``` %w( capitalize chomp chop delete downcase gsub lstrip next reverse rstrip slice squeeze strip sub succ swapcase tr tr_s upcase ) ``` Instance Method Summary ------------------------ * `[#**%**(args) ⇒ Object](safebuffer#%25-instance_method "#% (instance method)")` * `[#**+**(other) ⇒ Object](safebuffer#%2B-instance_method "#+ (instance method)")` * `[#**[]**(\*args) ⇒ Object](safebuffer#%5B%5D-instance_method "#[] (instance method)")` * `[#**clone\_empty** ⇒ Object](safebuffer#clone_empty-instance_method "#clone_empty (instance method)")` * `[#**concat**(value) ⇒ Object](safebuffer#concat-instance_method "#concat (instance method)") (also: #<<)` * `[#**encode\_with**(coder) ⇒ Object](safebuffer#encode_with-instance_method "#encode_with (instance method)")` * `[#**html\_safe?** ⇒ Boolean](safebuffer#html_safe%3F-instance_method "#html_safe? (instance method)")` * `[#**initialize**(str = "") ⇒ SafeBuffer](safebuffer#initialize-instance_method "#initialize (instance method)")` constructor A new instance of SafeBuffer. * `[#**initialize\_copy**(other) ⇒ Object](safebuffer#initialize_copy-instance_method "#initialize_copy (instance method)")` * `[#**prepend**(value) ⇒ Object](safebuffer#prepend-instance_method "#prepend (instance method)")` * `[#**safe\_concat**(value) ⇒ Object](safebuffer#safe_concat-instance_method "#safe_concat (instance method)")` * `[#**to\_param** ⇒ Object](safebuffer#to_param-instance_method "#to_param (instance method)")` * `[#**to\_s** ⇒ Object](safebuffer#to_s-instance_method "#to_s (instance method)")` ### Methods inherited from String [#camelize](../string#camelize-instance_method "String#camelize (method)"), [#classify](../string#classify-instance_method "String#classify (method)"), [#colorize](../string#colorize-instance_method "String#colorize (method)"), [#constantize](../string#constantize-instance_method "String#constantize (method)"), [#html\_safe](../string#html_safe-instance_method "String#html_safe (method)"), [#pluralize](../string#pluralize-instance_method "String#pluralize (method)"), [#underscore](../string#underscore-instance_method "String#underscore (method)") Constructor Details ------------------- ### #initialize(str = "") ⇒ SafeBuffer Returns a new instance of SafeBuffer. Instance Method Details ----------------------- ### #%(args) ⇒ Object ### #+(other) ⇒ Object ### #[](\*args) ⇒ Object ### #clone\_empty ⇒ Object ### #concat(value) ⇒ Object Also known as: << ### #encode\_with(coder) ⇒ Object ### #html\_safe? ⇒ Boolean #### Returns: * (`Boolean`) ### #initialize\_copy(other) ⇒ Object ### #prepend(value) ⇒ Object ### #safe\_concat(value) ⇒ Object #### Raises: * (`[SafeConcatError](safebuffer/safeconcaterror "Padrino::SafeBuffer::SafeConcatError (class)")`) ### #to\_param ⇒ Object ### #to\_s ⇒ Object padrino Module: Padrino::Module Module: Padrino::Module ======================= Instance Attribute Summary -------------------------- * `[#**root**(\*args) ⇒ String](module#root-instance_method "#root (instance method)")` Helper method for file references within a Padrino module. Instance Method Summary ------------------------ * `[#**dependency\_paths** ⇒ Array<String>](module#dependency_paths-instance_method "#dependency_paths (instance method)")` Returns the list of path globs to load as dependencies. * `[#**gem!**(name) ⇒ Object](module#gem!-instance_method "#gem! (instance method)")` Register this module as being loaded from a gem. Instance Attribute Details -------------------------- ### #root(\*args) ⇒ String Helper method for file references within a Padrino module. #### Examples: ``` module MyModule extend Padrino::Module gem! 'my_gem' end Module.root! ``` #### Parameters: * `args` (`Array<[String](../string "String (class)")>`) — The directories to join to [#root](module#root-instance_method "Padrino::Module#root (method)"). #### Returns: * (`[String](../string "String (class)")`) — The absolute path. Instance Method Details ----------------------- ### #dependency\_paths ⇒ Array<String> Returns the list of path globs to load as dependencies. Appends custom dependency patterns to the be loaded for Padrino. #### Examples: ``` module MyModule extend Padrino::Module gem! 'my_gem' end Module.dependency_paths << "#{MyModule.root}/uploaders/*.rb" ``` #### Returns: * (`Array<[String](../string "String (class)")>`) — The dependency paths. ### #gem!(name) ⇒ Object Register this module as being loaded from a gem. This automatically sets the root and therefore the dependency paths correctly. #### Parameters: * `name` (`[String](../string "String (class)")`) — The name of the gem. Has to be the name as stated in the gemspec. padrino Module: Padrino::Rendering Module: Padrino::Rendering ========================== Overview -------- Padrino enhances the Sinatra 'render' method to have support for automatic template engine detection, enhanced layout functionality, locale enabled rendering, among other features. Defined Under Namespace ----------------------- **Modules:** [ClassMethods](rendering/classmethods "Padrino::Rendering::ClassMethods (module)"), [Erubi](rendering/erubi "Padrino::Rendering::Erubi (module)"), [InstanceMethods](rendering/instancemethods "Padrino::Rendering::InstanceMethods (module)"), [SafeBufferEnhancer](rendering/safebufferenhancer "Padrino::Rendering::SafeBufferEnhancer (module)"), [SafeTemplate](rendering/safetemplate "Padrino::Rendering::SafeTemplate (module)") **Classes:** [ERBTemplate](rendering/erbtemplate "Padrino::Rendering::ERBTemplate (class)"), [ErubiTemplate](rendering/erubitemplate "Padrino::Rendering::ErubiTemplate (class)"), [ErubisTemplate](rendering/erubistemplate "Padrino::Rendering::ErubisTemplate (class)"), [HamlTemplate](rendering/hamltemplate "Padrino::Rendering::HamlTemplate (class)"), [HamlitOutputBuffer](rendering/hamlitoutputbuffer "Padrino::Rendering::HamlitOutputBuffer (class)"), [HamlitTemplate](rendering/hamlittemplate "Padrino::Rendering::HamlitTemplate (class)"), [SafeERB](rendering/safeerb "Padrino::Rendering::SafeERB (class)"), [SafeErubi](rendering/safeerubi "Padrino::Rendering::SafeErubi (class)"), [SafeEruby](rendering/safeeruby "Padrino::Rendering::SafeEruby (class)"), [SlimOutputBuffer](rendering/slimoutputbuffer "Padrino::Rendering::SlimOutputBuffer (class)"), [SlimTemplate](rendering/slimtemplate "Padrino::Rendering::SlimTemplate (class)"), [TemplateNotFound](rendering/templatenotfound "Padrino::Rendering::TemplateNotFound (class)") Constant Summary [collapse](#) ------------------------------- IGNORE\_FILE\_PATTERN = This is an array of file patterns to ignore. If your editor add a suffix during editing to your files please add it like: #### Examples: ``` Padrino::Rendering::IGNORE_FILE_PATTERN << /~$/ ``` ``` [ /~$/ # This is for Gedit ] ``` CONTENT\_TYPE\_ALIASES = Defines common content-type alias mappings. ``` { :htm => :html } ``` DEFAULT\_RENDERING\_OPTIONS = Default options used in the resolve\_template-method. ``` { :strict_format => false, :raise_exceptions => true } ``` Class Method Summary --------------------- * `[.**engine\_configurations** ⇒ Hash<Symbol,Hash>](rendering#engine_configurations-class_method "engine_configurations (class method)")` Default engine configurations for Padrino::Rendering. * `[.**registered**(app) ⇒ Object](rendering#registered-class_method "registered (class method)")` Class Method Details -------------------- ### .engine\_configurations ⇒ Hash<Symbol,Hash> Default engine configurations for Padrino::Rendering. #### Returns: * (`Hash<Symbol,Hash>`) — The configurations, keyed by engine. ### .registered(app) ⇒ Object padrino Class: Padrino::Logger Class: Padrino::Logger ====================== Inherits: [Object](../object "Object (class)") * [Object](../object "Object (class)") * Padrino::Logger Includes: [Extensions](logger/extensions "Padrino::Logger::Extensions (module)") Overview -------- Padrinos internal logger, using all of Padrino log extensions. Defined Under Namespace ----------------------- **Modules:** [Colorize](logger/colorize "Padrino::Logger::Colorize (module)"), [Extensions](logger/extensions "Padrino::Logger::Extensions (module)") **Classes:** [Rack](logger/rack "Padrino::Logger::Rack (class)") Constant Summary [collapse](#) ------------------------------- Levels = Ruby (standard) logger levels: :fatal An not handleable error that results in a program crash :error A handleable error condition :warn A warning :info generic (useful) information about system operation :debug low-level information for developers :devel Development-related information that is unnecessary in debug mode ``` { :fatal => 4, :error => 3, :warn => 2, :info => 1, :debug => 0, :devel => -1, } ``` Config = Configuration for a given environment, possible options are: :log\_level Once of [:fatal, :error, :warn, :info, :debug] :stream Once of [:to\_file, :null, :stdout, :stderr] our your custom stream :log\_path Defines log file path or directory if :stream is :to\_file ``` If it's a file, its location is created by mkdir_p. If it's a directory, it must exist. In this case log name is '<env>.log' ``` :log\_level The log level from, e.g. :fatal or :info. Defaults to :warn in the production environment and :debug otherwise. :auto\_flush Whether the log should automatically flush after new messages are added. Defaults to true. :format\_datetime Format of datetime. Defaults to: “%d/%b/%Y %H:%M:%S” :format\_message Format of message. Defaults to: “”%s - - [%s] "%s"“” :log\_static Whether or not to show log messages for static files. Defaults to: false :colorize\_logging Whether or not to colorize log messages. Defaults to: true Defaults are: ``` :production => { :log_level => :warn, :stream => :to_file } :development => { :log_level => :debug, :stream => :stdout } :test => { :log_level => :fatal, :stream => :null } ``` In some cases, configuring the loggers before loading the framework is necessary. You can do so by setting PADRINO\_LOGGER: ``` PADRINO_LOGGER = { :staging => { :log_level => :debug, :stream => :to_file }} ``` #### Examples: ``` Padrino::Logger::Config[:development] = { :log_level => :debug, :stream => :to_file } # or you can edit our defaults Padrino::Logger::Config[:development][:log_level] = :error # or change log file path Padrino::Logger::Config[:development][:log_path] = 'logs/app-development.txt' # or change log file directory Padrino::Logger::Config[:development][:log_path] = '/var/logs/padrino' # or you can use your stream Padrino::Logger::Config[:development][:stream] = StringIO.new ``` ``` { :production => { :log_level => :warn, :stream => :to_file }, :development => { :log_level => :debug, :stream => :stdout, :format_datetime => '' }, :test => { :log_level => :debug, :stream => :null } } ``` @@mutex = ``` Mutex.new ``` ### Constants included from Extensions [Extensions::SOURCE\_LOCATION\_REGEXP](logger/extensions#SOURCE_LOCATION_REGEXP-constant "Padrino::Logger::Extensions::SOURCE_LOCATION_REGEXP (constant)") Instance Attribute Summary -------------------------- * `[#**auto\_flush** ⇒ Object](logger#auto_flush-instance_method "#auto_flush (instance method)")` Returns the value of attribute auto\_flush. * `[#**buffer** ⇒ Object](logger#buffer-instance_method "#buffer (instance method)")` readonly Returns the value of attribute buffer. * `[#**colorize\_logging** ⇒ Object](logger#colorize_logging-instance_method "#colorize_logging (instance method)")` readonly Returns the value of attribute colorize\_logging. * `[#**init\_args** ⇒ Object](logger#init_args-instance_method "#init_args (instance method)")` readonly Returns the value of attribute init\_args. * `[#**level** ⇒ Object](logger#level-instance_method "#level (instance method)")` Returns the value of attribute level. * `[#**log** ⇒ Object](logger#log-instance_method "#log (instance method)")` readonly Returns the value of attribute log. * `[#**log\_static** ⇒ Object](logger#log_static-instance_method "#log_static (instance method)")` Returns the value of attribute log\_static. Class Method Summary --------------------- * `[.**logger** ⇒ Object](logger#logger-class_method "logger (class method)")` * `[.**logger=**(logger) ⇒ Object](logger#logger=-class_method "logger= (class method)")` * `[.**setup!** ⇒ Padrino::Logger](logger#setup!-class_method "setup! (class method)")` Setup a new logger. Instance Method Summary ------------------------ * `[#**<<**(message = nil) ⇒ Object](# "#<< (instance method)") (also: #write)` Directly append message to the log. * `[#**add**(level, message = nil) ⇒ Object](logger#add-instance_method "#add (instance method)")` Adds a message to the log - for compatibility with other loggers. * `[#**close** ⇒ NilClass](logger#close-instance_method "#close (instance method)")` Close and remove the current log object. * `[#**flush** ⇒ Object](logger#flush-instance_method "#flush (instance method)")` Flush the entire buffer to the log object. * `[#**format**(message, level) ⇒ Object](logger#format-instance_method "#format (instance method)")` * `[#**initialize**(options = {}) ⇒ Logger](logger#initialize-instance_method "#initialize (instance method)")` constructor To initialize the logger you create a new object, proxies to set\_log. * `[#**source\_location?** ⇒ Boolean](logger#source_location%3F-instance_method "#source_location? (instance method)")` ### Methods included from Extensions [#bench](logger/extensions#bench-instance_method "Padrino::Logger::Extensions#bench (method)"), [#colorize](logger/extensions#colorize-instance_method "Padrino::Logger::Extensions#colorize (method)"), [#colorize!](logger/extensions#colorize!-instance_method "Padrino::Logger::Extensions#colorize! (method)"), [#enable\_source\_location?](logger/extensions#enable_source_location%3F-instance_method "Padrino::Logger::Extensions#enable_source_location? (method)"), [#exception](logger/extensions#exception-instance_method "Padrino::Logger::Extensions#exception (method)"), [#name](logger/extensions#name-instance_method "Padrino::Logger::Extensions#name (method)"), [#push](logger/extensions#push-instance_method "Padrino::Logger::Extensions#push (method)"), [#resolve\_source\_location](logger/extensions#resolve_source_location-instance_method "Padrino::Logger::Extensions#resolve_source_location (method)"), [#stylized\_level](logger/extensions#stylized_level-instance_method "Padrino::Logger::Extensions#stylized_level (method)") Constructor Details ------------------- ### #initialize(options = {}) ⇒ Logger To initialize the logger you create a new object, proxies to set\_log. #### Parameters: * `options` (`Hash`) *(defaults to: `{}`)* #### Options Hash (`options`): * `:stream` (`Symbol`) — default: `$stdout` — Either an IO object or a name of a logfile. Defaults to $stdout * `:log_level` (`Symbol`) — default: `:production in the production environment and :debug otherwise` — The log level from, e.g. :fatal or :info. * `:auto_flush` (`Symbol`) — default: `true` — Whether the log should automatically flush after new messages are added. Defaults to true. * `:format_datetime` (`Symbol`) — default: `" [%d/%b/%Y %H:%M:%S] "` — Format of datetime. * `:format_message` (`Symbol`) — default: `"%s -%s%s"` — Format of message. * `:log_static` (`Symbol`) — default: `false` — Whether or not to show log messages for static files. * `:colorize_logging` (`Symbol`) — default: `true` — Whether or not to colorize log messages. Defaults to: true. * `:sanitize_encoding` (`Symbol`) — default: `false` — Logger will replace undefined or broken characters with “uFFFD” for Unicode and “?” otherwise. Can be an encoding, false or true. If it's true, logger sanitizes to Encoding.default\_external. Instance Attribute Details -------------------------- ### #auto\_flush ⇒ Object Returns the value of attribute auto\_flush ### #buffer ⇒ Object (readonly) Returns the value of attribute buffer ### #colorize\_logging ⇒ Object (readonly) Returns the value of attribute colorize\_logging ### #init\_args ⇒ Object (readonly) Returns the value of attribute init\_args ### #level ⇒ Object Returns the value of attribute level ### #log ⇒ Object (readonly) Returns the value of attribute log ### #log\_static ⇒ Object Returns the value of attribute log\_static Class Method Details -------------------- ### .logger ⇒ Object ### .logger=(logger) ⇒ Object ### .setup! ⇒ Padrino::Logger Setup a new logger. #### Returns: * (`[Padrino::Logger](logger "Padrino::Logger (class)")`) — A [Padrino::Logger](logger "Padrino::Logger (class)") instance Instance Method Details ----------------------- ### #<<(message = nil) ⇒ Object Also known as: write Directly append message to the log. #### Parameters: * `message` (`[String](../string "String (class)")`) *(defaults to: `nil`)* — The message ### #add(level, message = nil) ⇒ Object Adds a message to the log - for compatibility with other loggers. ### #close ⇒ NilClass Close and remove the current log object. #### Returns: * (`NilClass`) ### #flush ⇒ Object Flush the entire buffer to the log object. ### #format(message, level) ⇒ Object ### #source\_location? ⇒ Boolean #### Returns: * (`Boolean`) padrino Module: Padrino::Loader Module: Padrino::Loader ======================= Included in: [Padrino](../padrino "Padrino (module)") Instance Method Summary ------------------------ * `[#**after\_load** { ... } ⇒ Array<Proc>](loader#after_load-instance_method "#after_load (instance method)")` Hooks to be called after a load/reload. * `[#**before\_load** { ... } ⇒ Array<Proc>](loader#before_load-instance_method "#before_load (instance method)")` Hooks to be called before a load/reload. * `[#**called\_from** ⇒ Object](loader#called_from-instance_method "#called_from (instance method)")` This adds the ability to instantiate load! after [Application](application "Padrino::Application (class)") definition. * `[#**clear!** ⇒ NilClass](loader#clear!-instance_method "#clear! (instance method)")` Clear the padrino env. * `[#**dependency\_paths** ⇒ Array<String>](loader#dependency_paths-instance_method "#dependency_paths (instance method)")` Returns default list of path globs to load as dependencies. * `[#**load!** ⇒ Boolean](loader#load!-instance_method "#load! (instance method)")` Requires necessary dependencies as well as application files from root lib and models. * `[#**loaded?** ⇒ Boolean](loader#loaded%3F-instance_method "#loaded? (instance method)")` Determines whether Padrino was loaded with load!. * `[#**precompile\_all\_routes!** ⇒ Object](loader#precompile_all_routes!-instance_method "#precompile_all_routes! (instance method)")` Precompiles all routes if :precompile\_routes is set to true. * `[#**reload!** ⇒ Object](loader#reload!-instance_method "#reload! (instance method)")` Method for reloading required applications and their files. * `[#**require\_dependencies**(\*paths) ⇒ Object](loader#require_dependencies-instance_method "#require_dependencies (instance method)")` Attempts to require all dependency libs that we need. Instance Method Details ----------------------- ### #after\_load { ... } ⇒ Array<Proc> Hooks to be called after a load/reload. #### Examples: ``` after_load do DataMapper.finalize end ``` #### Yields: * The given block will be called after Padrino was loaded/reloaded. #### Returns: * (`Array<Proc>`) — The load/reload hooks. ### #before\_load { ... } ⇒ Array<Proc> Hooks to be called before a load/reload. #### Examples: ``` before_load do pre_initialize_something end ``` #### Yields: * The given block will be called before Padrino was loaded/reloaded. #### Returns: * (`Array<Proc>`) — The load/reload before hooks. ### #called\_from ⇒ Object This adds the ability to instantiate Padrino.load! after [Application](application "Padrino::Application (class)") definition. ### #clear! ⇒ NilClass Clear the padrino env. #### Returns: * (`NilClass`) ### #dependency\_paths ⇒ Array<String> Returns default list of path globs to load as dependencies. Appends custom dependency patterns to the be loaded for Padrino. #### Examples: ``` Padrino.dependency_paths << "#{Padrino.root}/uploaders/*.rb" ``` #### Returns: * (`Array<[String](../string "String (class)")>`) — The dependencey paths. ### #load! ⇒ Boolean Requires necessary dependencies as well as application files from root lib and models. #### Returns: * (`Boolean`) — returns true if Padrino is not already bootstraped otherwise else. ### #loaded? ⇒ Boolean Determines whether Padrino was loaded with Padrino.load!. #### Returns: * (`Boolean`) — Specifies whether Padrino was loaded. ### #precompile\_all\_routes! ⇒ Object Precompiles all routes if :precompile\_routes is set to true ### #reload! ⇒ Object Method for reloading required applications and their files. ### #require\_dependencies(\*paths) ⇒ Object Attempts to require all dependency libs that we need. If you use this method we can perform correctly a Padrino.reload! Another good thing that this method are dependency check, for example: ``` # models # \-- a.rb => require something of b.rb # \-- b.rb ``` In the example above if we do: ``` Dir["/models/*.rb"].each { |r| require r } ``` We get an error, because we try to require first `a.rb` that need *something* of `b.rb`. With this method we don't have this problem. #### Examples: For require all our app libs we need to do: ``` require_dependencies("#{Padrino.root}/lib/**/*.rb") ``` #### Parameters: * `paths` (`Array<[String](../string "String (class)")>`) — The paths to require.
programming_docs
padrino Module: Padrino::Configuration Module: Padrino::Configuration ============================== Included in: [Padrino](../padrino "Padrino (module)") Overview -------- Padrino simple configuration module Instance Method Summary ------------------------ * `[#**config** ⇒ Object](configuration#config-instance_method "#config (instance method)")` Returns the configuration structure allowing to get and set it's values. * `[#**configure**(\*environments) {|config| ... } ⇒ Object](configuration#configure-instance_method "#configure (instance method)")` Allows to configure different environments differently. Instance Method Details ----------------------- ### #config ⇒ Object Returns the configuration structure allowing to get and set it's values. Padrino.config is a simple Ruby OpenStruct object with no additional magic. Example: ``` Padrino.config.value1 = 42 exit if Padrino.config.exiting ``` ### #configure(\*environments) {|config| ... } ⇒ Object Allows to configure different environments differently. Requires a block. Example: ``` Padrino.configure :development do |config| config.value2 = 'only development' end Padrino.configure :development, :production do |config| config.value2 = 'both development and production' end Padrino.configure do |config| config.value2 = 'any environment' end ``` #### Yields: * (`[config](configuration#config-instance_method "Padrino::Configuration#config (method)")`) padrino Module: Padrino::Cache Module: Padrino::Cache ====================== Overview -------- This component enables caching of an application's response contents on both page- and fragment-levels. Output cached in this manner is persisted, until it expires or is actively expired, in a configurable store of your choosing. Several common caching stores are supported out of the box. Defined Under Namespace ----------------------- **Modules:** [Helpers](cache/helpers "Padrino::Cache::Helpers (module)") Class Method Summary --------------------- * `[.**new**(name, options = {}) ⇒ Object](cache#new-class_method "new (class method)")` * `[.**padrino\_route\_added**(route, verb, path, args, options, block) ⇒ Object](cache#padrino_route_added-class_method "padrino_route_added (class method)")` * `[.**registered**(app) ⇒ Object](cache#registered-class_method "registered (class method)")` Register these helpers:. Class Method Details -------------------- ### .new(name, options = {}) ⇒ Object ### .padrino\_route\_added(route, verb, path, args, options, block) ⇒ Object ### .registered(app) ⇒ Object Register these helpers: ``` Padrino::Cache::Helpers::ObjectCache Padrino::Cache::Helpers::CacheStore Padrino::Cache::Helpers::Fragment Padrino::Cache::Helpers::Page ``` for Padrino::Application. By default we use FileStore as showed below: ``` set :cache, Padrino::Cache.new(:File, :dir => Padrino.root('tmp', app_name.to_s, 'cache')) ``` However, you can also change the file store easily in your app.rb: ``` set :cache, Padrino::Cache.new(:LRUHash) # Keeps cached values in memory set :cache, Padrino::Cache.new(:Memcached) # Uses default server at localhost set :cache, Padrino::Cache.new(:Memcached, '127.0.0.1:11211', :exception_retry_limit => 1) set :cache, Padrino::Cache.new(:Memcached, :backend => memcached_or_dalli_instance) set :cache, Padrino::Cache.new(:Redis) # Uses default server at localhost set :cache, Padrino::Cache.new(:Redis, :host => '127.0.0.1', :port => 6379, :db => 0) set :cache, Padrino::Cache.new(:Redis, :backend => redis_instance) set :cache, Padrino::Cache.new(:Mongo) # Uses default server at localhost set :cache, Padrino::Cache.new(:Mongo, :backend => mongo_client_instance) set :cache, Padrino::Cache.new(:File, :dir => Padrino.root('tmp', app_name.to_s, 'cache')) # default choice ``` You can manage your cache from anywhere in your app: ``` MyApp.cache['val'] = 'test' MyApp.cache['val'] # => 'test' MyApp.cache.delete('val') MyApp.cache.clear ``` padrino Module: Padrino::Utils Module: Padrino::Utils ====================== Extended by: [Utils](utils "Padrino::Utils (module)") Included in: [Utils](utils "Padrino::Utils (module)") Instance Method Summary ------------------------ * `[#**build\_uri\_query**(object, namespace = nil) ⇒ Object](utils#build_uri_query-instance_method "#build_uri_query (instance method)")` Builds an URI query from a Hash or any Object. * `[#**deep\_dup**(object) ⇒ Object](utils#deep_dup-instance_method "#deep_dup (instance method)")` Recursively duplicates the passed object. * `[#**symbolize\_keys**(hash) ⇒ Object](utils#symbolize_keys-instance_method "#symbolize_keys (instance method)")` Returns a Hash with keys turned into symbols. Instance Method Details ----------------------- ### #build\_uri\_query(object, namespace = nil) ⇒ Object Builds an URI query from a Hash or any Object. Examples (~ marks here that output is actually escaped by CGI): ``` Utils.build_uri_query(:a => 1, :b => 2) #=> "a=1&b=2" Utils.build_uri_query(:a => [1, 2]) #=> ~"a[]=1&a[]=2" Utils.build_uri_query([1, 2], 'namespace') #=> ~"namespace[]=1&namespace[]=2" Utils.build_uri_query(:a => { :d => 2 }, :b => 3) #=> ~"a[d]=2&b=3" ``` ### #deep\_dup(object) ⇒ Object Recursively duplicates the passed object. ### #symbolize\_keys(hash) ⇒ Object Returns a Hash with keys turned into symbols. padrino Module: Padrino::Performance Module: Padrino::Performance ============================ Defined Under Namespace ----------------------- **Modules:** [JSON](performance/json "Padrino::Performance::JSON (module)"), [OS](performance/os "Padrino::Performance::OS (module)") Constant Summary [collapse](#) ------------------------------- VERSION = The version constant for the current version of Padrino. ``` '0.15.0' ``` Class Method Summary --------------------- * `[.**version** ⇒ String](performance#version-class_method "version (class method)")` The current Padrino version. Class Method Details -------------------- ### .version ⇒ String The current Padrino version. #### Returns: * (`[String](../string "String (class)")`) — The version number. padrino Module: Padrino::PathRouter Module: Padrino::PathRouter =========================== Overview -------- Provides an HTTP router for use in path routing. Defined Under Namespace ----------------------- **Classes:** [Compiler](pathrouter/compiler "Padrino::PathRouter::Compiler (class)"), [Matcher](pathrouter/matcher "Padrino::PathRouter::Matcher (class)"), [Route](pathrouter/route "Padrino::PathRouter::Route (class)"), [Router](pathrouter/router "Padrino::PathRouter::Router (class)") Constant Summary [collapse](#) ------------------------------- InvalidRouteException = #### See Also: * [Router#path](pathrouter/router#path-instance_method "Padrino::PathRouter::Router#path (method)") ``` Class.new(ArgumentError) ``` Class Method Summary --------------------- * `[.**new** ⇒ Object](pathrouter#new-class_method "new (class method)")` Constructs an instance of PathRouter::Router. Class Method Details -------------------- ### .new ⇒ Object Constructs an instance of PathRouter::Router. padrino Class: Padrino::Mounter Class: Padrino::Mounter ======================= Inherits: [Object](../object "Object (class)") * [Object](../object "Object (class)") * Padrino::Mounter Overview -------- Represents a particular mounted Padrino application. Stores the name of the application (app folder name) and url mount path. #### Examples: ``` Mounter.new("blog_app", :app_class => "Blog").to("/blog") Mounter.new("blog_app", :app_file => "/path/to/blog/app.rb").to("/blog") ``` Defined Under Namespace ----------------------- **Modules:** [ApplicationExtension](mounter/applicationextension "Padrino::Mounter::ApplicationExtension (module)") **Classes:** [MounterException](mounter/mounterexception "Padrino::Mounter::MounterException (class)") Constant Summary [collapse](#) ------------------------------- DEFAULT\_CASCADE = ``` [404, 405] ``` Instance Attribute Summary -------------------------- * `[#**app\_class** ⇒ Object](mounter#app_class-instance_method "#app_class (instance method)")` Returns the value of attribute app\_class. * `[#**app\_file** ⇒ Object](mounter#app_file-instance_method "#app_file (instance method)")` Returns the value of attribute app\_file. * `[#**app\_host** ⇒ Object](mounter#app_host-instance_method "#app_host (instance method)")` Returns the value of attribute app\_host. * `[#**app\_obj** ⇒ Object](mounter#app_obj-instance_method "#app_obj (instance method)")` Returns the value of attribute app\_obj. * `[#**app\_root** ⇒ Object](mounter#app_root-instance_method "#app_root (instance method)")` Returns the value of attribute app\_root. * `[#**cascade** ⇒ Object](mounter#cascade-instance_method "#cascade (instance method)")` Returns the value of attribute cascade. * `[#**name** ⇒ Object](mounter#name-instance_method "#name (instance method)")` Returns the value of attribute name. * `[#**uri\_root** ⇒ Object](mounter#uri_root-instance_method "#uri_root (instance method)")` Returns the value of attribute uri\_root. Instance Method Summary ------------------------ * `[#**==**(other) ⇒ Object](mounter#==-instance_method "#== (instance method)")` Makes two Mounters equal if they have the same name and uri\_root. * `[#**app\_constant** ⇒ Padrino::Application](mounter#app_constant-instance_method "#app_constant (instance method)")` The class object for the app if defined, nil otherwise. * `[#**host**(mount\_host) ⇒ Object](mounter#host-instance_method "#host (instance method)")` Registers the mounted application onto Padrino for the given host. * `[#**initialize**(name, options = {}) ⇒ Mounter](mounter#initialize-instance_method "#initialize (instance method)")` constructor A new instance of Mounter. * `[#**map\_onto**(router) ⇒ Padrino::Router](mounter#map_onto-instance_method "#map_onto (instance method)")` Maps Padrino application onto a Padrino::Router. * `[#**named\_routes** ⇒ Array](mounter#named_routes-instance_method "#named_routes (instance method)")` Returns the basic route information for each named route. * `[#**padrino\_application?** ⇒ Boolean](mounter#padrino_application%3F-instance_method "#padrino_application? (instance method)")` * `[#**routes** ⇒ Object](mounter#routes-instance_method "#routes (instance method)")` Returns the route objects for the mounted application. * `[#**to**(mount\_url) ⇒ Object](mounter#to-instance_method "#to (instance method)")` Registers the mounted application onto Padrino. Constructor Details ------------------- ### #initialize(name, options = {}) ⇒ Mounter Returns a new instance of Mounter. #### Parameters: * `name` (`[String](../string "String (class)")`, `[Padrino::Application](application "Padrino::Application (class)")`) — The app name or the [Application](application "Padrino::Application (class)") class. * `options` (`Hash`) *(defaults to: `{}`)* #### Options Hash (`options`): * `:app_class` (`Symbol`) — default: `Detected from name` * `:app_file` (`Symbol`) — default: `Automatically detected` * `:app_obj` (`Symbol`) — default: `Detected` * `:app_root` (`Symbol`) — default: `Directory of :app_file` * `:gem` (`Symbol`) — The gem to load the app from (Detected from name) Instance Attribute Details -------------------------- ### #app\_class ⇒ Object Returns the value of attribute app\_class ### #app\_file ⇒ Object Returns the value of attribute app\_file ### #app\_host ⇒ Object Returns the value of attribute app\_host ### #app\_obj ⇒ Object Returns the value of attribute app\_obj ### #app\_root ⇒ Object Returns the value of attribute app\_root ### #cascade ⇒ Object Returns the value of attribute cascade ### #name ⇒ Object Returns the value of attribute name ### #uri\_root ⇒ Object Returns the value of attribute uri\_root Instance Method Details ----------------------- ### #==(other) ⇒ Object Makes two Mounters equal if they have the same name and uri\_root. #### Parameters: * `other` (`[Padrino::Mounter](mounter "Padrino::Mounter (class)")`) ### #app\_constant ⇒ Padrino::Application Returns the class object for the app if defined, nil otherwise. #### Returns: * (`[Padrino::Application](application "Padrino::Application (class)")`) — the class object for the app if defined, nil otherwise. ### #host(mount\_host) ⇒ Object Registers the mounted application onto Padrino for the given host. #### Examples: ``` Mounter.new("blog_app").to("/blog").host("blog.padrino.org") Mounter.new("blog_app").host("blog.padrino.org") Mounter.new("catch_all").host(/.*\.padrino.org/) ``` #### Parameters: * `mount_host` (`[String](../string "String (class)")`) — Host name. ### #map\_onto(router) ⇒ Padrino::Router Maps Padrino application onto a Padrino::Router. For use in constructing a Rack application. #### Examples: ``` @app.map_onto(router) ``` #### Parameters: * (`[Padrino::Router](router "Padrino::Router (class)")`) #### Returns: * (`[Padrino::Router](router "Padrino::Router (class)")`) ### #named\_routes ⇒ Array Returns the basic route information for each named route. #### Returns: * (`Array`) — Array of routes. ### #padrino\_application? ⇒ Boolean #### Returns: * (`Boolean`) ### #routes ⇒ Object Returns the route objects for the mounted application. ### #to(mount\_url) ⇒ Object Registers the mounted application onto Padrino. #### Examples: ``` Mounter.new("blog_app").to("/blog") ``` #### Parameters: * `mount_url` (`[String](../string "String (class)")`) — Path where we mount the app. padrino Module: Padrino::Flash Module: Padrino::Flash ====================== Defined Under Namespace ----------------------- **Modules:** [Helpers](flash/helpers "Padrino::Flash::Helpers (module)") **Classes:** [Storage](flash/storage "Padrino::Flash::Storage (class)") Class Method Summary --------------------- * `[.**registered**(app) ⇒ Object](flash#registered-class_method "registered (class method)")` Class Method Details -------------------- ### .registered(app) ⇒ Object padrino Module: Padrino::ApplicationSetup Module: Padrino::ApplicationSetup ================================= Overview -------- Holds setup-oriented methods for Padrino::Application. Defined Under Namespace ----------------------- **Modules:** [ClassMethods](applicationsetup/classmethods "Padrino::ApplicationSetup::ClassMethods (module)") Class Method Summary --------------------- * `[.**registered**(app) ⇒ Object](applicationsetup#registered-class_method "registered (class method)")` Class Method Details -------------------- ### .registered(app) ⇒ Object padrino Module: Padrino::Mailer Module: Padrino::Mailer ======================= Overview -------- This component uses the `mail` library to create a powerful but simple mailer within Padrino (and Sinatra). There is full support for using plain or html content-types as well as for file attachments. Using the mailer in Padrino has two forms. The 'quick' method requires only use of the `email` method directly in the controller: ``` # app/controllers/session.rb post :create do email do from "[email protected]" to "[email protected]" subject "Welcome!" body render('email/registered') end end ``` Defined Under Namespace ----------------------- **Modules:** [Helpers](mailer/helpers "Padrino::Mailer::Helpers (module)"), [Mime](mailer/mime "Padrino::Mailer::Mime (module)") **Classes:** [Base](mailer/base "Padrino::Mailer::Base (class)") Class Method Summary --------------------- * `[.**registered**(app) ⇒ Object](mailer#registered-class_method "registered (class method)") (also: included)` Registers the Padrino::Mailer helpers with the application. Class Method Details -------------------- ### .registered(app) ⇒ Object Also known as: included Registers the Padrino::Mailer helpers with the application. #### Examples: ``` require 'padrino-mailer' class Demo < Padrino::Application register Padrino::Mailer::Helpers end ``` #### Parameters: * `app` (`Sinatra::Application`) — The application that needs mailers. padrino Module: Padrino::ParamsProtection Module: Padrino::ParamsProtection ================================= Overview -------- Padrino application module providing means for mass-assignment protection. Defined Under Namespace ----------------------- **Modules:** [ClassMethods](paramsprotection/classmethods "Padrino::ParamsProtection::ClassMethods (module)"), [InstanceMethods](paramsprotection/instancemethods "Padrino::ParamsProtection::InstanceMethods (module)") Class Method Summary --------------------- * `[.**registered**(app) ⇒ Object](paramsprotection#registered-class_method "registered (class method)")` Class Method Details -------------------- ### .registered(app) ⇒ Object padrino Module: Padrino::Generators Module: Padrino::Generators =========================== Overview -------- This module it's used for register generators. Can be useful for 3rd party generators: ``` # custom_generator.rb class CustomGenerator < Thor::Group Padrino::Generators.add_generator(:custom_generator, self) end ``` Now for handle generators in padrino you need to add it to into `load_paths`. Padrino::Generators.load\_paths << “custom\_generator.rb” Defined Under Namespace ----------------------- **Modules:** [Actions](generators/actions "Padrino::Generators::Actions (module)"), [Admin](generators/admin "Padrino::Generators::Admin (module)"), [Runner](generators/runner "Padrino::Generators::Runner (module)") **Classes:** [AdminApp](generators/adminapp "Padrino::Generators::AdminApp (class)"), [AdminPage](generators/adminpage "Padrino::Generators::AdminPage (class)"), [App](generators/app "Padrino::Generators::App (class)"), [AppRootNotFound](generators/approotnotfound "Padrino::Generators::AppRootNotFound (class)"), [Cli](generators/cli "Padrino::Generators::Cli (class)"), [Component](generators/component "Padrino::Generators::Component (class)"), [Controller](generators/controller "Padrino::Generators::Controller (class)"), [Helper](generators/helper "Padrino::Generators::Helper (class)"), [Mailer](generators/mailer "Padrino::Generators::Mailer (class)"), [Migration](generators/migration "Padrino::Generators::Migration (class)"), [Model](generators/model "Padrino::Generators::Model (class)"), [Plugin](generators/plugin "Padrino::Generators::Plugin (class)"), [Project](generators/project "Padrino::Generators::Project (class)"), [Task](generators/task "Padrino::Generators::Task (class)") Constant Summary [collapse](#) ------------------------------- DEV\_PATH = Defines the absolute path to the padrino source folder. ``` File.expand_path("../../", File.dirname(__FILE__)) ``` DEFAULT\_HELPER\_NAME = Default helper name for use in tiny app skeleton generator. ``` "Helper".freeze ``` Class Method Summary --------------------- * `[.**add\_generator**(name, klass) ⇒ Hash](generators#add_generator-class_method "add_generator (class method)")` Global add a new generator class to `padrino-gen`. * `[.**load\_components!** ⇒ Object](generators#load_components!-class_method "load_components! (class method)")` Load Global Actions and Component Actions then all files in `load_path`. * `[.**load\_paths** ⇒ Object](generators#load_paths-class_method "load_paths (class method)")` Store our generators paths. * `[.**mappings** ⇒ Object](generators#mappings-class_method "mappings (class method)")` Return an ordered list of task with their class. Class Method Details -------------------- ### .add\_generator(name, klass) ⇒ Hash Global add a new generator class to `padrino-gen`. #### Examples: ``` Padrino::Generators.add_generator(:controller, Controller) ``` #### Parameters: * `name` (`Symbol`) — Key name for generator mapping. * `klass` (`Class`) — Class of generator. #### Returns: * (`Hash`) — generator mappings ### .load\_components! ⇒ Object Load Global Actions and Component Actions then all files in `load_path`. ### .load\_paths ⇒ Object Store our generators paths. ### .mappings ⇒ Object Return an ordered list of task with their class.
programming_docs
padrino Module: Padrino::Reloader Module: Padrino::Reloader ========================= Extended by: [Reloader](reloader "Padrino::Reloader (module)") Included in: [Reloader](reloader "Padrino::Reloader (module)") Overview -------- High performance source code reloader middleware Defined Under Namespace ----------------------- **Modules:** [Storage](reloader/storage "Padrino::Reloader::Storage (module)") **Classes:** [Rack](reloader/rack "Padrino::Reloader::Rack (class)") Constant Summary [collapse](#) ------------------------------- MTIMES = The modification times for every file in a project. ``` {} ``` Instance Method Summary ------------------------ * `[#**changed?** ⇒ Boolean](reloader#changed%3F-instance_method "#changed? (instance method)")` Returns true if any file changes are detected. * `[#**clear!** ⇒ Object](reloader#clear!-instance_method "#clear! (instance method)")` Remove files and classes loaded with stat. * `[#**exclude** ⇒ Object](reloader#exclude-instance_method "#exclude (instance method)")` Specified folders can be excluded from the code reload detection process. * `[#**exclude\_constants** ⇒ Object](reloader#exclude_constants-instance_method "#exclude_constants (instance method)")` Specified constants can be excluded from the code unloading process. * `[#**include\_constants** ⇒ Object](reloader#include_constants-instance_method "#include_constants (instance method)")` Specified constants can be configured to be reloaded on every request. * `[#**lock!** ⇒ Object](reloader#lock!-instance_method "#lock! (instance method)")` We lock dependencies sets to prevent reloading of protected constants. * `[#**reload!** ⇒ Object](reloader#reload!-instance_method "#reload! (instance method)")` Reload apps and files with changes detected. * `[#**remove\_constant**(const) ⇒ Object](reloader#remove_constant-instance_method "#remove_constant (instance method)")` Removes the specified class and constant. * `[#**remove\_feature**(file) ⇒ Object](reloader#remove_feature-instance_method "#remove_feature (instance method)")` Remove a feature from $LOADED\_FEATURES so it can be required again. * `[#**safe\_load**(file, options = {}) ⇒ Object](reloader#safe_load-instance_method "#safe_load (instance method)")` A safe Kernel::require which issues the necessary hooks depending on results. * `[#**special\_files** ⇒ Object](reloader#special_files-instance_method "#special_files (instance method)")` Returns the list of special tracked files for Reloader. * `[#**special\_files=**(files) ⇒ Object](reloader#special_files=-instance_method "#special_files= (instance method)")` Sets the list of special tracked files for Reloader. Instance Method Details ----------------------- ### #changed? ⇒ Boolean Returns true if any file changes are detected. #### Returns: * (`Boolean`) ### #clear! ⇒ Object Remove files and classes loaded with stat ### #exclude ⇒ Object Specified folders can be excluded from the code reload detection process. Default excluded directories at Padrino.root are: test, spec, features, tmp, config, db and public ### #exclude\_constants ⇒ Object Specified constants can be excluded from the code unloading process. ### #include\_constants ⇒ Object Specified constants can be configured to be reloaded on every request. Default included constants are: [none] ### #lock! ⇒ Object We lock dependencies sets to prevent reloading of protected constants ### #reload! ⇒ Object Reload apps and files with changes detected. ### #remove\_constant(const) ⇒ Object Removes the specified class and constant. ### #remove\_feature(file) ⇒ Object Remove a feature from $LOADED\_FEATURES so it can be required again. ### #safe\_load(file, options = {}) ⇒ Object A safe Kernel::require which issues the necessary hooks depending on results ### #special\_files ⇒ Object Returns the list of special tracked files for Reloader. ### #special\_files=(files) ⇒ Object Sets the list of special tracked files for Reloader. padrino Class: Padrino::Server Class: Padrino::Server ====================== Inherits: Rack::Server * [Object](../object "Object (class)") * Rack::Server * Padrino::Server Overview -------- This module builds a Padrino server to run the project based on available handlers. Constant Summary [collapse](#) ------------------------------- DEFAULT\_ADDRESS = ``` { :Host => '127.0.0.1', :Port => 3000 } ``` Handlers = Server Handlers ``` [:thin, :puma, :'spider-gazelle', :mongrel, :trinidad, :webrick] ``` Class Method Summary --------------------- * `[.**start**(app, options = {}) ⇒ Object](server#start-class_method "start (class method)")` Starts the application on the available server with specified options. Instance Method Summary ------------------------ * `[#**app** ⇒ Object](server#app-instance_method "#app (instance method)") (also: #wrapped_app)` The application the server will run. * `[#**initialize**(options, app) ⇒ Server](server#initialize-instance_method "#initialize (instance method)")` constructor A new instance of Server. * `[#**options** ⇒ Object](server#options-instance_method "#options (instance method)")` * `[#**start** ⇒ Object](server#start-instance_method "#start (instance method)")` Starts the application on the available server with specified options. Constructor Details ------------------- ### #initialize(options, app) ⇒ Server Returns a new instance of Server. Class Method Details -------------------- ### .start(app, options = {}) ⇒ Object Starts the application on the available server with specified options. Instance Method Details ----------------------- ### #app ⇒ Object Also known as: wrapped\_app The application the server will run. ### #options ⇒ Object ### #start ⇒ Object Starts the application on the available server with specified options. padrino Class: Padrino::AuthenticityToken Class: Padrino::AuthenticityToken ================================= Inherits: Rack::Protection::AuthenticityToken * [Object](../object "Object (class)") * Rack::Protection::AuthenticityToken * Padrino::AuthenticityToken Instance Method Summary ------------------------ * `[#**call**(env) ⇒ Object](authenticitytoken#call-instance_method "#call (instance method)")` * `[#**except?**(env) ⇒ Boolean](authenticitytoken#except%3F-instance_method "#except? (instance method)")` * `[#**initialize**(app, options = {}) ⇒ AuthenticityToken](authenticitytoken#initialize-instance_method "#initialize (instance method)")` constructor A new instance of AuthenticityToken. Constructor Details ------------------- ### #initialize(app, options = {}) ⇒ AuthenticityToken Returns a new instance of AuthenticityToken. Instance Method Details ----------------------- ### #call(env) ⇒ Object ### #except?(env) ⇒ Boolean #### Returns: * (`Boolean`) padrino Class: Padrino::Filter Class: Padrino::Filter ====================== Inherits: [Object](../object "Object (class)") * [Object](../object "Object (class)") * Padrino::Filter Instance Attribute Summary -------------------------- * `[#**block** ⇒ Object](filter#block-instance_method "#block (instance method)")` readonly Returns the value of attribute block. Instance Method Summary ------------------------ * `[#**apply?**(request) ⇒ Boolean](filter#apply%3F-instance_method "#apply? (instance method)")` * `[#**initialize**(mode, scoped\_controller, options, args, &block) ⇒ Filter](filter#initialize-instance_method "#initialize (instance method)")` constructor A new instance of Filter. * `[#**to\_proc** ⇒ Object](filter#to_proc-instance_method "#to_proc (instance method)")` Constructor Details ------------------- ### #initialize(mode, scoped\_controller, options, args, &block) ⇒ Filter Returns a new instance of Filter. Instance Attribute Details -------------------------- ### #block ⇒ Object (readonly) Returns the value of attribute block Instance Method Details ----------------------- ### #apply?(request) ⇒ Boolean #### Returns: * (`Boolean`) ### #to\_proc ⇒ Object padrino Class: Padrino::PathRouter::Matcher Class: Padrino::PathRouter::Matcher =================================== Inherits: [Object](../../object "Object (class)") * [Object](../../object "Object (class)") * Padrino::PathRouter::Matcher Constant Summary [collapse](#) ------------------------------- GROUP\_REGEXP = To count group of regexp ``` %r{\((?!\?:|\?!|\?<=|\?<!|\?=).+?\)}.freeze ``` Instance Method Summary ------------------------ * `[#**capture\_length** ⇒ Object](matcher#capture_length-instance_method "#capture_length (instance method)")` Returns captures parameter length. * `[#**expand**(params) ⇒ Object](matcher#expand-instance_method "#expand (instance method)")` Expands the path by using parameters. * `[#**handler** ⇒ Object](matcher#handler-instance_method "#handler (instance method)")` Returns the handler which is an instance of Mustermann or Regexp. * `[#**initialize**(path, options = {}) ⇒ Matcher](matcher#initialize-instance_method "#initialize (instance method)")` constructor Constructs an instance of PathRouter::Matcher. * `[#**match**(pattern) ⇒ Object](matcher#match-instance_method "#match (instance method)")` Matches a pattern with the route matcher. * `[#**mustermann?** ⇒ Boolean](matcher#mustermann%3F-instance_method "#mustermann? (instance method)")` Returns true if handler is an instance of Mustermann. * `[#**names** ⇒ Object](matcher#names-instance_method "#names (instance method)")` Returns names of the handler. * `[#**params\_for**(pattern, others) ⇒ Object](matcher#params_for-instance_method "#params_for (instance method)")` Builds a parameters, and returns them. * `[#**to\_regexp** ⇒ Object](matcher#to_regexp-instance_method "#to_regexp (instance method)")` Returns a regexp from handler. * `[#**to\_s** ⇒ Object](matcher#to_s-instance_method "#to_s (instance method)")` Converts the handler into string. Constructor Details ------------------- ### #initialize(path, options = {}) ⇒ Matcher Constructs an instance of PathRouter::Matcher. Instance Method Details ----------------------- ### #capture\_length ⇒ Object Returns captures parameter length. ### #expand(params) ⇒ Object Expands the path by using parameters. ### #handler ⇒ Object Returns the handler which is an instance of Mustermann or Regexp. ### #match(pattern) ⇒ Object Matches a pattern with the route matcher. ### #mustermann? ⇒ Boolean Returns true if handler is an instance of Mustermann. #### Returns: * (`Boolean`) ### #names ⇒ Object Returns names of the handler. #### See Also: * Regexp#names ### #params\_for(pattern, others) ⇒ Object Builds a parameters, and returns them. ### #to\_regexp ⇒ Object Returns a regexp from handler. ### #to\_s ⇒ Object Converts the handler into string. padrino Class: Padrino::PathRouter::Router Class: Padrino::PathRouter::Router ================================== Inherits: [Object](../../object "Object (class)") * [Object](../../object "Object (class)") * Padrino::PathRouter::Router Instance Attribute Summary -------------------------- * `[#**current\_order** ⇒ Object](router#current_order-instance_method "#current_order (instance method)")` readonly Returns the value of attribute current\_order. * `[#**engine** ⇒ Object](router#engine-instance_method "#engine (instance method)")` readonly Returns the value of attribute engine. * `[#**routes** ⇒ Object](router#routes-instance_method "#routes (instance method)")` readonly Returns the value of attribute routes. Instance Method Summary ------------------------ * `[#**add**(verb, path, options = {}, &block) ⇒ Object](router#add-instance_method "#add (instance method)")` Adds a new route to routes. * `[#**call**(request, &block) ⇒ Object](router#call-instance_method "#call (instance method)")` Returns all routes which are matched with the condition. * `[#**increment\_order** ⇒ Object](router#increment_order-instance_method "#increment_order (instance method)")` Increments the order. * `[#**initialize** ⇒ Router](router#initialize-instance_method "#initialize (instance method)")` constructor Constructs an instance of PathRouter::Router. * `[#**path**(name, \*args) ⇒ Object](router#path-instance_method "#path (instance method)")` Finds a path which is matched with conditions from arguments. * `[#**prepare!** ⇒ Object](router#prepare!-instance_method "#prepare! (instance method)")` Constructs an instance of PathRouter::Compiler, and sorts all routes by using the order. * `[#**recognize**(request\_or\_env) ⇒ Object](router#recognize-instance_method "#recognize (instance method)")` Returns all routes which are matched with the condition without block. * `[#**recognize\_path**(path\_info) ⇒ Object](router#recognize_path-instance_method "#recognize_path (instance method)")` Recognizes route and expanded params from a path. * `[#**reset!** ⇒ Object](router#reset!-instance_method "#reset! (instance method)")` Resets all routes, current order and preparation. Constructor Details ------------------- ### #initialize ⇒ Router Constructs an instance of PathRouter::Router. Instance Attribute Details -------------------------- ### #current\_order ⇒ Object (readonly) Returns the value of attribute current\_order ### #engine ⇒ Object (readonly) Returns the value of attribute engine ### #routes ⇒ Object (readonly) Returns the value of attribute routes Instance Method Details ----------------------- ### #add(verb, path, options = {}, &block) ⇒ Object Adds a new route to routes. ### #call(request, &block) ⇒ Object Returns all routes which are matched with the condition ### #increment\_order ⇒ Object Increments the order. ### #path(name, \*args) ⇒ Object Finds a path which is matched with conditions from arguments ### #prepare! ⇒ Object Constructs an instance of PathRouter::Compiler, and sorts all routes by using the order. ### #recognize(request\_or\_env) ⇒ Object Returns all routes which are matched with the condition without block ### #recognize\_path(path\_info) ⇒ Object Recognizes route and expanded params from a path. ### #reset! ⇒ Object Resets all routes, current order and preparation. padrino Class: Padrino::PathRouter::Route Class: Padrino::PathRouter::Route ================================= Inherits: [Object](../../object "Object (class)") * [Object](../../object "Object (class)") * Padrino::PathRouter::Route Constant Summary [collapse](#) ------------------------------- SIGNIFICANT\_VARIABLES\_REGEX = ``` /(^|[^\\])[:\*]([a-zA-Z0-9_]+)/.freeze ``` Instance Attribute Summary -------------------------- * `[#**action** ⇒ Object](route#action-instance_method "#action (instance method)")` The accessors will be used in other classes. * `[#**block** ⇒ Object](route#block-instance_method "#block (instance method)")` readonly A reader for compile option. * `[#**cache** ⇒ Object](route#cache-instance_method "#cache (instance method)")` The accessors will be used in other classes. * `[#**cache\_expires** ⇒ Object](route#cache_expires-instance_method "#cache_expires (instance method)")` The accessors will be used in other classes. * `[#**cache\_key** ⇒ Object](route#cache_key-instance_method "#cache_key (instance method)")` The accessors will be used in other classes. * `[#**capture** ⇒ Object](route#capture-instance_method "#capture (instance method)")` The accessors are useful to access from PathRouter::Router. * `[#**controller** ⇒ Object](route#controller-instance_method "#controller (instance method)")` The accessors will be used in other classes. * `[#**default\_values** ⇒ Object](route#default_values-instance_method "#default_values (instance method)")` The accessors will be used in other classes. * `[#**index** ⇒ Object](route#index-instance_method "#index (instance method)")` The accessors are useful to access from PathRouter::Router. * `[#**name** ⇒ Object](route#name-instance_method "#name (instance method)")` The accessors are useful to access from PathRouter::Router. * `[#**options** ⇒ Object](route#options-instance_method "#options (instance method)")` The accessors are useful to access from PathRouter::Router. * `[#**order** ⇒ Object](route#order-instance_method "#order (instance method)")` The accessors are useful to access from PathRouter::Router. * `[#**parent** ⇒ Object](route#parent-instance_method "#parent (instance method)")` The accessors will be used in other classes. * `[#**path\_for\_generation** ⇒ Object](route#path_for_generation-instance_method "#path_for_generation (instance method)")` The accessors will be used in other classes. * `[#**regexp** ⇒ Object](route#regexp-instance_method "#regexp (instance method)")` The accessors are useful to access from PathRouter::Router. * `[#**router** ⇒ Object](route#router=-instance_method "#router= (instance method)")` writeonly The router will be treated in this class. * `[#**use\_layout** ⇒ Object](route#use_layout-instance_method "#use_layout (instance method)")` The accessors will be used in other classes. * `[#**user\_agent** ⇒ Object](route#user_agent-instance_method "#user_agent (instance method)")` The accessors will be used in other classes. * `[#**verb** ⇒ Object](route#verb-instance_method "#verb (instance method)")` readonly A reader for compile option. Instance Method Summary ------------------------ * `[#**after\_filters**(&block) ⇒ Object](route#after_filters-instance_method "#after_filters (instance method)")` Returns after\_filters as an array. * `[#**before\_filters**(&block) ⇒ Object](route#before_filters-instance_method "#before_filters (instance method)")` Returns before\_filters as an array. * `[#**block\_parameter\_length** ⇒ Object](route#block_parameter_length-instance_method "#block_parameter_length (instance method)")` Returns block parameter length. * `[#**call**(app, \*args) ⇒ Object](route#call-instance_method "#call (instance method)")` Calls the route block with arguments. * `[#**custom\_conditions**(&block) ⇒ Object](route#custom_conditions-instance_method "#custom_conditions (instance method)")` Returns custom\_conditions as an array. * `[#**initialize**(path, verb, options = {}, &block) ⇒ Route](route#initialize-instance_method "#initialize (instance method)")` constructor Constructs an instance of PathRouter::Route. * `[#**match**(pattern) ⇒ Object](route#match-instance_method "#match (instance method)")` * `[#**matcher** ⇒ Object](route#matcher-instance_method "#matcher (instance method)")` Returns an instance of PathRouter::Matcher that is associated with the route. * `[#**original\_path** ⇒ Object](route#original_path-instance_method "#original_path (instance method)")` Returns the original path. * `[#**params\_for**(pattern, others = {}) ⇒ Object](route#params_for-instance_method "#params_for (instance method)")` Returns parameters which is created by the matcher. * `[#**path**(\*args) ⇒ Object](route#path-instance_method "#path (instance method)")` Expands the path by using parameters. * `[#**path=**(pattern) ⇒ Object](route#path=-instance_method "#path= (instance method)")` Overwrites path value by passing new path string. * `[#**request\_methods** ⇒ Object](route#request_methods-instance_method "#request_methods (instance method)")` Returns the route's verb as an array. * `[#**significant\_variable\_names** ⇒ Object](route#significant_variable_names-instance_method "#significant_variable_names (instance method)")` Returns signficant variable names. * `[#**to**(&block) ⇒ Object](route#to-instance_method "#to (instance method)")` Associates a block with the route, and increments current order of the router. Constructor Details ------------------- ### #initialize(path, verb, options = {}, &block) ⇒ Route Constructs an instance of PathRouter::Route. Instance Attribute Details -------------------------- ### #action ⇒ Object The accessors will be used in other classes ### #block ⇒ Object (readonly) A reader for compile option ### #cache ⇒ Object The accessors will be used in other classes ### #cache\_expires ⇒ Object The accessors will be used in other classes ### #cache\_key ⇒ Object The accessors will be used in other classes ### #capture ⇒ Object The accessors are useful to access from PathRouter::Router ### #controller ⇒ Object The accessors will be used in other classes ### #default\_values ⇒ Object The accessors will be used in other classes ### #index ⇒ Object The accessors are useful to access from PathRouter::Router ### #name ⇒ Object The accessors are useful to access from PathRouter::Router ### #options ⇒ Object The accessors are useful to access from PathRouter::Router ### #order ⇒ Object The accessors are useful to access from PathRouter::Router ### #parent ⇒ Object The accessors will be used in other classes ### #path\_for\_generation ⇒ Object The accessors will be used in other classes ### #regexp ⇒ Object The accessors are useful to access from PathRouter::Router ### #router=(value) ⇒ Object (writeonly) The router will be treated in this class ### #use\_layout ⇒ Object The accessors will be used in other classes ### #user\_agent ⇒ Object The accessors will be used in other classes ### #verb ⇒ Object (readonly) A reader for compile option Instance Method Details ----------------------- ### #after\_filters(&block) ⇒ Object Returns after\_filters as an array. ### #before\_filters(&block) ⇒ Object Returns before\_filters as an array. ### #block\_parameter\_length ⇒ Object Returns block parameter length. ### #call(app, \*args) ⇒ Object Calls the route block with arguments. ### #custom\_conditions(&block) ⇒ Object Returns custom\_conditions as an array. ### #match(pattern) ⇒ Object #### See Also: * [Matcher#match](matcher#match-instance_method "Padrino::PathRouter::Matcher#match (method)") ### #matcher ⇒ Object Returns an instance of PathRouter::Matcher that is associated with the route. ### #original\_path ⇒ Object Returns the original path. ### #params\_for(pattern, others = {}) ⇒ Object Returns parameters which is created by the matcher. ### #path(\*args) ⇒ Object Expands the path by using parameters. #### See Also: * [Matcher#expand](matcher#expand-instance_method "Padrino::PathRouter::Matcher#expand (method)") ### #path=(pattern) ⇒ Object Overwrites path value by passing new path string. ### #request\_methods ⇒ Object Returns the route's verb as an array. ### #significant\_variable\_names ⇒ Object Returns signficant variable names. ### #to(&block) ⇒ Object Associates a block with the route, and increments current order of the router.
programming_docs
padrino Class: Padrino::PathRouter::Compiler Class: Padrino::PathRouter::Compiler ==================================== Inherits: [Object](../../object "Object (class)") * [Object](../../object "Object (class)") * Padrino::PathRouter::Compiler Overview -------- High performance engine for finding all routes which are matched with pattern Instance Attribute Summary -------------------------- * `[#**routes** ⇒ Object](compiler#routes-instance_method "#routes (instance method)")` Returns the value of attribute routes. Instance Method Summary ------------------------ * `[#**call\_by\_request**(request) ⇒ Object](compiler#call_by_request-instance_method "#call_by_request (instance method)")` Calls routes by using request. * `[#**compile!** ⇒ Object](compiler#compile!-instance_method "#compile! (instance method)")` Compiles all routes into regexps. * `[#**compiled?** ⇒ Boolean](compiler#compiled%3F-instance_method "#compiled? (instance method)")` Returns true if all routes has been compiled. * `[#**find\_by**(request\_or\_env) ⇒ Object](compiler#find_by-instance_method "#find_by (instance method)")` Finds routes by using request or env. * `[#**find\_by\_pattern**(pattern) ⇒ Object](compiler#find_by_pattern-instance_method "#find_by_pattern (instance method)")` Finds routes by using PATH\_INFO. * `[#**initialize**(routes) ⇒ Compiler](compiler#initialize-instance_method "#initialize (instance method)")` constructor Constructs an instance of Padrino::PathRouter::Compiler. Constructor Details ------------------- ### #initialize(routes) ⇒ Compiler Constructs an instance of Padrino::PathRouter::Compiler Instance Attribute Details -------------------------- ### #routes ⇒ Object Returns the value of attribute routes Instance Method Details ----------------------- ### #call\_by\_request(request) ⇒ Object Calls routes by using request. ### #compile! ⇒ Object Compiles all routes into regexps. ### #compiled? ⇒ Boolean Returns true if all routes has been compiled. #### Returns: * (`Boolean`) ### #find\_by(request\_or\_env) ⇒ Object Finds routes by using request or env. ### #find\_by\_pattern(pattern) ⇒ Object Finds routes by using PATH\_INFO. padrino Module: Padrino::Reloader::Storage Module: Padrino::Reloader::Storage ================================== Extended by: [Storage](storage "Padrino::Reloader::Storage (module)") Included in: [Storage](storage "Padrino::Reloader::Storage (module)") Instance Method Summary ------------------------ * `[#**clear!** ⇒ Object](storage#clear!-instance_method "#clear! (instance method)")` * `[#**commit**(name) ⇒ Object](storage#commit-instance_method "#commit (instance method)")` * `[#**prepare**(name) ⇒ Object](storage#prepare-instance_method "#prepare (instance method)")` * `[#**remove**(name) ⇒ Object](storage#remove-instance_method "#remove (instance method)")` * `[#**rollback**(name) ⇒ Object](storage#rollback-instance_method "#rollback (instance method)")` Instance Method Details ----------------------- ### #clear! ⇒ Object ### #commit(name) ⇒ Object ### #prepare(name) ⇒ Object ### #remove(name) ⇒ Object ### #rollback(name) ⇒ Object padrino Class: Padrino::Reloader::Rack Class: Padrino::Reloader::Rack ============================== Inherits: [Object](../../object "Object (class)") * [Object](../../object "Object (class)") * Padrino::Reloader::Rack Overview -------- This class acts as a Rack middleware to be added to the application stack. This middleware performs a check and reload for source files at the start of each request, but also respects a specified cool down time during which no further action will be taken. Instance Method Summary ------------------------ * `[#**call**(env) ⇒ Object](rack#call-instance_method "#call (instance method)")` Invoked in order to perform the reload as part of the request stack. * `[#**initialize**(app, cooldown = 1) ⇒ Rack](rack#initialize-instance_method "#initialize (instance method)")` constructor A new instance of Rack. Constructor Details ------------------- ### #initialize(app, cooldown = 1) ⇒ Rack Returns a new instance of Rack. Instance Method Details ----------------------- ### #call(env) ⇒ Object Invoked in order to perform the reload as part of the request stack. padrino Module: Padrino::Logger::Extensions Module: Padrino::Logger::Extensions =================================== Included in: [Padrino::Logger](../logger "Padrino::Logger (class)") Constant Summary [collapse](#) ------------------------------- SOURCE\_LOCATION\_REGEXP = ``` /^(.*?):(\d+?)(?::in `.+?')?$/.freeze ``` Instance Method Summary ------------------------ * `[#**bench**(action, began\_at, message, level = :debug, color = :yellow) ⇒ Object](extensions#bench-instance_method "#bench (instance method)")` Append a to development logger a given action with time. * `[#**colorize**(string, \*colors) ⇒ Object](extensions#colorize-instance_method "#colorize (instance method)")` Colorizes a string for colored console output. * `[#**colorize!** ⇒ Object](extensions#colorize!-instance_method "#colorize! (instance method)")` Turns a logger with LoggingExtensions into a logger with colorized output. * `[#**enable\_source\_location?** ⇒ Boolean](extensions#enable_source_location%3F-instance_method "#enable_source_location? (instance method)")` Returns true if :source\_location is set to true. * `[#**exception**(boom, verbosity = :long, level = :error) ⇒ Object](extensions#exception-instance_method "#exception (instance method)")` Logs an exception. * `[#**format**(message, level) ⇒ Object](extensions#format-instance_method "#format (instance method)")` Formats the log message. * `[#**name** ⇒ Object](extensions#name-instance_method "#name (instance method)")` Generate the logging methods for [Padrino.logger](../../padrino#logger-class_method "Padrino.logger (method)") for each log level. * `[#**push**(message = nil, level = nil) ⇒ Object](extensions#push-instance_method "#push (instance method)")` Appends a message to the log. * `[#**resolve\_source\_location**(message) ⇒ Object](extensions#resolve_source_location-instance_method "#resolve_source_location (instance method)")` Resolves a filename and line-number from caller. * `[#**stylized\_level**(level) ⇒ Object](extensions#stylized_level-instance_method "#stylized_level (instance method)")` The debug level, with some style added. Instance Method Details ----------------------- ### #bench(action, began\_at, message, level = :debug, color = :yellow) ⇒ Object Append a to development logger a given action with time. #### Examples: ``` logger.bench 'GET', started_at, '/blog/categories' # => DEBUG - GET (0.0056s) - /blog/categories ``` #### Parameters: * `action` (`string`) — The action. * `time` (`float`) — Time duration for the given action. * `string` (`message`) — The message that you want to log. ### #colorize(string, \*colors) ⇒ Object Colorizes a string for colored console output. This is a noop and can be reimplemented to colorize the string as needed. #### Parameters: * `The` (`string`) — string to be colorized. * `The` (`Array<Symbol>`) — colors to use. Should be applied in the order given. #### See Also: * ColorizedLogger ### #colorize! ⇒ Object Turns a logger with LoggingExtensions into a logger with colorized output. #### Examples: ``` Padrino.logger = Logger.new($stdout) Padrino.logger.colorize! Padrino.logger.debug("Fancy Padrino debug string") ``` ### #enable\_source\_location? ⇒ Boolean Returns true if :source\_location is set to true. #### Returns: * (`Boolean`) ### #exception(boom, verbosity = :long, level = :error) ⇒ Object Logs an exception. #### Examples: ``` Padrino.logger.exception e Padrino.logger.exception(e, :short) ``` #### Parameters: * `exception` (`Exception`) — The exception to log * `verbosity` (`Symbol`) *(defaults to: `:long`)* — :short or :long, default is :long ### #format(message, level) ⇒ Object Formats the log message. This method is a noop and should be implemented by other logger components such as [Padrino::Logger](../logger "Padrino::Logger (class)"). #### Parameters: * `message` (`[String](../../string "String (class)")`) — The message to format. * `level` (`[String](../../string "String (class)")`, `Symbol`) — The log level, one of :debug, :warn … ### #name ⇒ Object Generate the logging methods for [Padrino.logger](../../padrino#logger-class_method "Padrino.logger (method)") for each log level. ### #push(message = nil, level = nil) ⇒ Object Appends a message to the log. The methods yield to an optional block and the output of this block will be appended to the message. #### Parameters: * `message` (`[String](../../string "String (class)")`) *(defaults to: `nil`)* — The message that you want write to your stream. * `level` (`[String](../../string "String (class)")`) *(defaults to: `nil`)* — The level one of :debug, :warn etc. … ### #resolve\_source\_location(message) ⇒ Object Resolves a filename and line-number from caller. ### #stylized\_level(level) ⇒ Object The debug level, with some style added. May be reimplemented. #### Examples: ``` stylized_level(:debug) => DEBUG ``` #### Parameters: * `level` (`[String](../../string "String (class)")`, `Symbol`) — The log level. padrino Module: Padrino::Logger::Colorize Module: Padrino::Logger::Colorize ================================= Constant Summary [collapse](#) ------------------------------- ColoredLevels = Colors for levels ``` { :fatal => [:bold, :red], :error => [:default, :red], :warn => [:default, :yellow], :info => [:default, :green], :debug => [:default, :cyan], :devel => [:default, :magenta] } ``` Instance Method Summary ------------------------ * `[#**colorize**(string, \*colors) ⇒ Object](colorize#colorize-instance_method "#colorize (instance method)")` Colorize our level. * `[#**stylized\_level**(level) ⇒ Object](colorize#stylized_level-instance_method "#stylized_level (instance method)")` Instance Method Details ----------------------- ### #colorize(string, \*colors) ⇒ Object Colorize our level. #### Parameters: * `level` (`[String](../../string "String (class)")`, `Symbol`) #### See Also: * Padrino::Logging::ColorizedLogger::ColoredLevels ### #stylized\_level(level) ⇒ Object padrino Class: Padrino::Logger::Rack Class: Padrino::Logger::Rack ============================ Inherits: [Object](../../object "Object (class)") * [Object](../../object "Object (class)") * Padrino::Logger::Rack Overview -------- Padrino::Logger::Rack forwards every request to an `app` given, and logs a line in the Apache common log format to the `logger`, or rack.errors by default. Instance Method Summary ------------------------ * `[#**call**(env) ⇒ Object](rack#call-instance_method "#call (instance method)")` * `[#**initialize**(app, uri\_root) ⇒ Rack](rack#initialize-instance_method "#initialize (instance method)")` constructor A new instance of Rack. Constructor Details ------------------- ### #initialize(app, uri\_root) ⇒ Rack Returns a new instance of Rack. Instance Method Details ----------------------- ### #call(env) ⇒ Object padrino Exception: Padrino::Mounter::MounterException Exception: Padrino::Mounter::MounterException ============================================= Inherits: RuntimeError * [Object](../../object "Object (class)") * RuntimeError * Padrino::Mounter::MounterException padrino Module: Padrino::Mounter::ApplicationExtension Module: Padrino::Mounter::ApplicationExtension ============================================== Instance Attribute Summary -------------------------- * `[#**cascade** ⇒ Object](applicationextension#cascade-instance_method "#cascade (instance method)")` Returns the value of attribute cascade. * `[#**mounter\_options** ⇒ Object](applicationextension#mounter_options-instance_method "#mounter_options (instance method)")` Returns the value of attribute mounter\_options. * `[#**public\_folder** ⇒ Object](applicationextension#public_folder-instance_method "#public_folder (instance method)")` * `[#**uri\_root** ⇒ Object](applicationextension#uri_root-instance_method "#uri_root (instance method)")` Returns the value of attribute uri\_root. Instance Method Summary ------------------------ * `[#**app\_file** ⇒ Object](applicationextension#app_file-instance_method "#app_file (instance method)")` * `[#**app\_name** ⇒ Object](applicationextension#app_name-instance_method "#app_name (instance method)")` * `[#**dependencies** ⇒ Object](applicationextension#dependencies-instance_method "#dependencies (instance method)")` * `[#**prerequisites** ⇒ Object](applicationextension#prerequisites-instance_method "#prerequisites (instance method)")` * `[#**root** ⇒ Object](applicationextension#root-instance_method "#root (instance method)")` * `[#**setup\_application!** ⇒ Object](applicationextension#setup_application!-instance_method "#setup_application! (instance method)")` Instance Attribute Details -------------------------- ### #cascade ⇒ Object Returns the value of attribute cascade ### #mounter\_options ⇒ Object Returns the value of attribute mounter\_options ### #public\_folder ⇒ Object ### #uri\_root ⇒ Object Returns the value of attribute uri\_root Instance Method Details ----------------------- ### #app\_file ⇒ Object ### #app\_name ⇒ Object ### #dependencies ⇒ Object ### #prerequisites ⇒ Object ### #root ⇒ Object ### #setup\_application! ⇒ Object padrino Module: Padrino::Cache::Helpers Module: Padrino::Cache::Helpers =============================== Overview -------- Helpers supporting page or fragment caching within a request route. Defined Under Namespace ----------------------- **Modules:** [CacheStore](helpers/cachestore "Padrino::Cache::Helpers::CacheStore (module)"), [Fragment](helpers/fragment "Padrino::Cache::Helpers::Fragment (module)"), [ObjectCache](helpers/objectcache "Padrino::Cache::Helpers::ObjectCache (module)"), [Page](helpers/page "Padrino::Cache::Helpers::Page (module)") padrino Module: Padrino::Cache::Helpers::Page Module: Padrino::Cache::Helpers::Page ===================================== Overview -------- Page caching is easy to integrate into your application. To turn it on, simply provide the `:cache => true` option on either a controller or one of its routes. By default, cached content is persisted with a “file store” –that is, in a subdirectory of your application root. You can manually expire cache with CachedApp.cache.delete(:my\_name) Note that the “latest” method call to `expires` determines its value: if called within a route, as opposed to a controller definition, the route's value will be assumed. #### Examples: ``` # Setting content expiry time. class CachedApp < Padrino::Application enable :caching # turns on caching mechanism controller '/blog', :cache => true do expires 15 get '/entries' do # expires 15 => can also be defined inside a single route 'Just broke up eating twinkies, lol' end get '/post/:id' do cache_key :my_name @post = Post.find(params[:id]) end end end ``` Defined Under Namespace ----------------------- **Modules:** [ClassMethods](page/classmethods "Padrino::Cache::Helpers::Page::ClassMethods (module)") Constant Summary [collapse](#) ------------------------------- CACHED\_VERBS = ``` { 'GET' => true, 'HEAD' => true }.freeze ``` Class Method Summary --------------------- * `[.**padrino\_route\_added**(route, verb) ⇒ Object](page#padrino_route_added-class_method "padrino_route_added (class method)")` Instance Method Summary ------------------------ * `[#**cache\_key**(name = nil, &block) ⇒ Object](page#cache_key-instance_method "#cache_key (instance method)")` This helper is used within a route or route to indicate the name in the cache. * `[#**expires**(time) ⇒ Object](page#expires-instance_method "#expires (instance method)")` This helper is used within a controller or route to indicate how often content should persist in the cache. Class Method Details -------------------- ### .padrino\_route\_added(route, verb) ⇒ Object Instance Method Details ----------------------- ### #cache\_key(name = nil, &block) ⇒ Object This helper is used within a route or route to indicate the name in the cache. ``` end ``` #### Examples: ``` controller '/blog', :cache => true do get '/post/:id' do cache_key :my_name @post = Post.find(params[:id]) end end ``` ``` get '/foo', :cache => true do cache_key { param[:id] } "My id is #{param[:id}" end ``` #### Parameters: * `name` (`Symbol`) *(defaults to: `nil`)* — cache key * `block` (`Proc`) — block to be evaluated to cache key ### #expires(time) ⇒ Object This helper is used within a controller or route to indicate how often content should persist in the cache. After `seconds` seconds have passed, content previously cached will be discarded and re-rendered. Code associated with that route will *not* be executed; rather, its previous output will be sent to the client with a 200 OK status code. #### Examples: ``` controller '/blog', :cache => true do expires 15 get '/entries' do 'Just broke up eating twinkies, lol' end end ``` #### Parameters: * `time` (`Integer`) — Time til expiration (seconds) padrino Module: Padrino::Cache::Helpers::Fragment Module: Padrino::Cache::Helpers::Fragment ========================================= Includes: [Helpers::OutputHelpers](../../helpers/outputhelpers "Padrino::Helpers::OutputHelpers (module)") Overview -------- Whereas page-level caching, described in the first section of this document, works by grabbing the entire output of a route, fragment caching gives the developer fine-grained control of what gets cached. This type of caching occurs at whatever level you choose. Possible uses for fragment caching might include: * a 'feed' of some items on a page * output fetched (by proxy) from an API on a third-party site * parts of your page which are largely static/do not need re-rendering every request * any output which is expensive to render Instance Method Summary ------------------------ * `[#**cache**(key, opts = {}, &block) ⇒ Object](fragment#cache-instance_method "#cache (instance method)")` This helper is used anywhere in your application you would like to associate a fragment to be cached. ### Methods included from Helpers::OutputHelpers [#block\_is\_template?](../../helpers/outputhelpers#block_is_template%3F-instance_method "Padrino::Helpers::OutputHelpers#block_is_template? (method)"), [#capture\_html](../../helpers/outputhelpers#capture_html-instance_method "Padrino::Helpers::OutputHelpers#capture_html (method)"), [#concat\_content](../../helpers/outputhelpers#concat_content-instance_method "Padrino::Helpers::OutputHelpers#concat_content (method)"), [#concat\_safe\_content](../../helpers/outputhelpers#concat_safe_content-instance_method "Padrino::Helpers::OutputHelpers#concat_safe_content (method)"), [#content\_for](../../helpers/outputhelpers#content_for-instance_method "Padrino::Helpers::OutputHelpers#content_for (method)"), [#content\_for?](../../helpers/outputhelpers#content_for%3F-instance_method "Padrino::Helpers::OutputHelpers#content_for? (method)"), [handlers](../../helpers/outputhelpers#handlers-class_method "Padrino::Helpers::OutputHelpers.handlers (method)"), [register](../../helpers/outputhelpers#register-class_method "Padrino::Helpers::OutputHelpers.register (method)"), [#yield\_content](../../helpers/outputhelpers#yield_content-instance_method "Padrino::Helpers::OutputHelpers#yield_content (method)") Instance Method Details ----------------------- ### #cache(key, opts = {}, &block) ⇒ Object This helper is used anywhere in your application you would like to associate a fragment to be cached. It can be used in within a route: #### Examples: ``` # Caching a fragment class MyTweets < Padrino::Application enable :caching # turns on caching mechanism controller '/tweets' do get :feed, :map => '/:username' do username = params[:username] @feed = cache( "feed_for_#{username}", :expires => 3 ) do @tweets = Tweet.all( :username => username ) render 'partials/feedcontent' end # Below outputs @feed somewhere in its markup. render 'feeds/show' end end end ``` #### Parameters: * `key` (`[String](../../../string "String (class)")`) — cache key * `opts` (`Hash`) *(defaults to: `{}`)* — cache options, e.g :expires * `Execution` (`Proc`) — result to store in the cache
programming_docs
padrino Module: Padrino::Cache::Helpers::CacheStore Module: Padrino::Cache::Helpers::CacheStore =========================================== Instance Method Summary ------------------------ * `[#**expire**(\*key) ⇒ Object](cachestore#expire-instance_method "#expire (instance method)")` Instance Method Details ----------------------- ### #expire(\*key) ⇒ Object padrino Module: Padrino::Cache::Helpers::ObjectCache Module: Padrino::Cache::Helpers::ObjectCache ============================================ Instance Method Summary ------------------------ * `[#**cache\_object**(key, opts = {}) ⇒ Object](objectcache#cache_object-instance_method "#cache_object (instance method)")` Instance Method Details ----------------------- ### #cache\_object(key, opts = {}) ⇒ Object padrino Module: Padrino::Cache::Helpers::Page::ClassMethods Module: Padrino::Cache::Helpers::Page::ClassMethods =================================================== Instance Method Summary ------------------------ * `[#**expires**(time) ⇒ Object](classmethods#expires-instance_method "#expires (instance method)")` A method to set `expires` time inside `controller` blocks. Instance Method Details ----------------------- ### #expires(time) ⇒ Object A method to set `expires` time inside `controller` blocks. #### Examples: ``` controller :users do expires 15 get :show do 'shown' end end ``` padrino Exception: Padrino::SafeBuffer::SafeConcatError Exception: Padrino::SafeBuffer::SafeConcatError =============================================== Inherits: StandardError * [Object](../../object "Object (class)") * StandardError * Padrino::SafeBuffer::SafeConcatError Instance Method Summary ------------------------ * `[#**initialize** ⇒ SafeConcatError](safeconcaterror#initialize-instance_method "#initialize (instance method)")` constructor A new instance of SafeConcatError. Constructor Details ------------------- ### #initialize ⇒ SafeConcatError Returns a new instance of SafeConcatError. padrino Module: Padrino::Admin::Helpers Module: Padrino::Admin::Helpers =============================== Defined Under Namespace ----------------------- **Modules:** [AuthenticationHelpers](helpers/authenticationhelpers "Padrino::Admin::Helpers::AuthenticationHelpers (module)"), [ViewHelpers](helpers/viewhelpers "Padrino::Admin::Helpers::ViewHelpers (module)") padrino Exception: Padrino::Admin::AccessControlError Exception: Padrino::Admin::AccessControlError ============================================= Inherits: StandardError * [Object](../../object "Object (class)") * StandardError * Padrino::Admin::AccessControlError padrino Module: Padrino::Admin::AccessControl Module: Padrino::Admin::AccessControl ===================================== Overview -------- This module enables access control functionality within a Padrino application. Defined Under Namespace ----------------------- **Classes:** [Authorization](accesscontrol/authorization "Padrino::Admin::AccessControl::Authorization (class)"), [Base](accesscontrol/base "Padrino::Admin::AccessControl::Base (class)"), [ProjectModule](accesscontrol/projectmodule "Padrino::Admin::AccessControl::ProjectModule (class)") Class Method Summary --------------------- * `[.**registered**(app) ⇒ Object](accesscontrol#registered-class_method "registered (class method)") (also: included)` Method used by Padrino::Application when we register the extension. Class Method Details -------------------- ### .registered(app) ⇒ Object Also known as: included Method used by Padrino::Application when we register the extension. padrino Module: Padrino::Admin::Generators Module: Padrino::Admin::Generators ================================== Overview -------- Contains all admin related generator functionality. Defined Under Namespace ----------------------- **Classes:** [Orm](generators/orm "Padrino::Admin::Generators::Orm (class)"), [OrmError](generators/ormerror "Padrino::Admin::Generators::OrmError (class)") padrino Class: Padrino::Admin::AccessControl::Base Class: Padrino::Admin::AccessControl::Base ========================================== Inherits: [Object](../../../object "Object (class)") * [Object](../../../object "Object (class)") * Padrino::Admin::AccessControl::Base Overview -------- This base access control class where roles are defined as are authorizations. Instance Method Summary ------------------------ * `[#**allowed?**(account = nil, path = nil) ⇒ Boolean](base#allowed%3F-instance_method "#allowed? (instance method)")` Return true if the given account is allowed to see the given path. * `[#**initialize** ⇒ Base](base#initialize-instance_method "#initialize (instance method)")` constructor A new instance of Base. * `[#**project\_modules**(account) ⇒ Object](base#project_modules-instance_method "#project_modules (instance method)")` Return an array of project\_modules. * `[#**roles** ⇒ Object](base#roles-instance_method "#roles (instance method)")` Return an array of roles. * `[#**roles\_for**(\*roles, &block) ⇒ Object](base#roles_for-instance_method "#roles_for (instance method)")` We map project modules for a given role or roles. Constructor Details ------------------- ### #initialize ⇒ Base Returns a new instance of Base. Instance Method Details ----------------------- ### #allowed?(account = nil, path = nil) ⇒ Boolean Return true if the given account is allowed to see the given path. #### Examples: Hiding a disallowed link from a user. ``` # File: config/apps.rb # [...] Padrino.mount('Admin').to('/admin') # File: admin/app.rb class Admin < Padrino::Application # [...] register Padrino::Admin::AccessControl # [...] # Goals: # * Admins can manage widgets and accounts. # * Workers can only manage widgets. access_control.roles_for :admin do |role| role.project_module :accounts, '/accounts' role.project_module :widgets, '/widgets' end access_control.roles_for :worker do |role| role.project_module :widgets, '/widgets' end end # File: admin/views/layouts/application.haml # NOTE The un-mounted path is used ('/accounts' instead of '/admin/accounts') - if access_control.allowed?(current_account, '/accounts') # Admins see the "Profile" link, but Workers do not = link_to 'Profile', url(:accounts, :edit, :id => current_account.id) ``` #### Returns: * (`Boolean`) ### #project\_modules(account) ⇒ Object Return an array of project\_modules. ### #roles ⇒ Object Return an array of roles. ### #roles\_for(\*roles, &block) ⇒ Object We map project modules for a given role or roles. #### Raises: * (`[Padrino::Admin::AccessControlError](../accesscontrolerror "Padrino::Admin::AccessControlError (class)")`) padrino Class: Padrino::Admin::AccessControl::ProjectModule Class: Padrino::Admin::AccessControl::ProjectModule =================================================== Inherits: [Object](../../../object "Object (class)") * [Object](../../../object "Object (class)") * Padrino::Admin::AccessControl::ProjectModule Overview -------- Project Module class. Instance Attribute Summary -------------------------- * `[#**name** ⇒ Object](projectmodule#name-instance_method "#name (instance method)")` readonly Returns the value of attribute name. * `[#**options** ⇒ Object](projectmodule#options-instance_method "#options (instance method)")` readonly Returns the value of attribute options. Instance Method Summary ------------------------ * `[#**human\_name** ⇒ Object](projectmodule#human_name-instance_method "#human_name (instance method)")` Returns the name of the project module humanize them for you. * `[#**initialize**(name, path, options = {}) ⇒ ProjectModule](projectmodule#initialize-instance_method "#initialize (instance method)")` constructor A new instance of ProjectModule. * `[#**path**(prefix = nil) ⇒ Object](projectmodule#path-instance_method "#path (instance method)")` Return the path of the project module. Constructor Details ------------------- ### #initialize(name, path, options = {}) ⇒ ProjectModule Returns a new instance of ProjectModule. Instance Attribute Details -------------------------- ### #name ⇒ Object (readonly) Returns the value of attribute name ### #options ⇒ Object (readonly) Returns the value of attribute options Instance Method Details ----------------------- ### #human\_name ⇒ Object Returns the name of the project module humanize them for you. ### #path(prefix = nil) ⇒ Object Return the path of the project module. If a prefix given will be pre pended. #### Examples: ``` # => /accounts/new project_module.path # => /admin/accounts project_module.path("/admin") ``` padrino Class: Padrino::Admin::AccessControl::Authorization Class: Padrino::Admin::AccessControl::Authorization =================================================== Inherits: [Object](../../../object "Object (class)") * [Object](../../../object "Object (class)") * Padrino::Admin::AccessControl::Authorization Overview -------- Project Authorization Class. Instance Attribute Summary -------------------------- * `[#**allowed** ⇒ Object](authorization#allowed-instance_method "#allowed (instance method)")` readonly Returns the value of attribute allowed. * `[#**denied** ⇒ Object](authorization#denied-instance_method "#denied (instance method)")` readonly Returns the value of attribute denied. * `[#**project\_modules** ⇒ Object](authorization#project_modules-instance_method "#project_modules (instance method)")` readonly Returns the value of attribute project\_modules. * `[#**roles** ⇒ Object](authorization#roles-instance_method "#roles (instance method)")` readonly Returns the value of attribute roles. Instance Method Summary ------------------------ * `[#**allow**(path) ⇒ Object](authorization#allow-instance_method "#allow (instance method)")` Allow a specified path. * `[#**initialize**(\*roles) {|\_self| ... } ⇒ Authorization](authorization#initialize-instance_method "#initialize (instance method)")` constructor A new instance of Authorization. * `[#**project\_module**(name, path, options = {}) ⇒ Object](authorization#project_module-instance_method "#project_module (instance method)")` Create a project module. * `[#**protect**(path) ⇒ Object](authorization#protect-instance_method "#protect (instance method)")` Protect access from. Constructor Details ------------------- ### #initialize(\*roles) {|\_self| ... } ⇒ Authorization Returns a new instance of Authorization. #### Yields: * (`_self`) #### Yield Parameters: * `_self` (`[Padrino::Admin::AccessControl::Authorization](authorization "Padrino::Admin::AccessControl::Authorization (class)")`) — the object that the method was called on Instance Attribute Details -------------------------- ### #allowed ⇒ Object (readonly) Returns the value of attribute allowed ### #denied ⇒ Object (readonly) Returns the value of attribute denied ### #project\_modules ⇒ Object (readonly) Returns the value of attribute project\_modules ### #roles ⇒ Object (readonly) Returns the value of attribute roles Instance Method Details ----------------------- ### #allow(path) ⇒ Object Allow a specified path. ### #project\_module(name, path, options = {}) ⇒ Object Create a project module. ### #protect(path) ⇒ Object Protect access from. padrino Class: Padrino::Admin::Generators::Orm Class: Padrino::Admin::Generators::Orm ====================================== Inherits: [Object](../../../object "Object (class)") * [Object](../../../object "Object (class)") * Padrino::Admin::Generators::Orm Overview -------- Defines the generic ORM management functions used to manipulate data for admin. Defined Under Namespace ----------------------- **Classes:** [Column](orm/column "Padrino::Admin::Generators::Orm::Column (class)") Instance Attribute Summary -------------------------- * `[#**klass** ⇒ Object](orm#klass-instance_method "#klass (instance method)")` readonly Returns the value of attribute klass. * `[#**klass\_name** ⇒ Object](orm#klass_name-instance_method "#klass_name (instance method)")` readonly Returns the value of attribute klass\_name. * `[#**name\_param** ⇒ Object](orm#name_param-instance_method "#name_param (instance method)")` readonly Returns the value of attribute name\_param. * `[#**name\_plural** ⇒ Object](orm#name_plural-instance_method "#name_plural (instance method)")` readonly Returns the value of attribute name\_plural. * `[#**name\_singular** ⇒ Object](orm#name_singular-instance_method "#name_singular (instance method)")` readonly Returns the value of attribute name\_singular. * `[#**orm** ⇒ Object](orm#orm-instance_method "#orm (instance method)")` readonly Returns the value of attribute orm. Instance Method Summary ------------------------ * `[#**activerecord?** ⇒ Boolean](orm#activerecord%3F-instance_method "#activerecord? (instance method)")` * `[#**all** ⇒ Object](orm#all-instance_method "#all (instance method)")` * `[#**build**(params = nil) ⇒ Object](orm#build-instance_method "#build (instance method)")` * `[#**column\_fields** ⇒ Object](orm#column_fields-instance_method "#column_fields (instance method)")` * `[#**columns** ⇒ Object](orm#columns-instance_method "#columns (instance method)")` * `[#**destroy** ⇒ Object](orm#destroy-instance_method "#destroy (instance method)")` * `[#**dm\_column**(p) ⇒ Object](orm#dm_column-instance_method "#dm_column (instance method)")` * `[#**field\_type**(type) ⇒ Object](orm#field_type-instance_method "#field_type (instance method)")` * `[#**find**(params = nil) ⇒ Object](orm#find-instance_method "#find (instance method)")` * `[#**find\_by\_ids**(params = nil) ⇒ Object](orm#find_by_ids-instance_method "#find_by_ids (instance method)")` * `[#**has\_error**(field) ⇒ Object](orm#has_error-instance_method "#has_error (instance method)")` * `[#**initialize**(name, orm, columns = nil, column\_fields = nil) ⇒ Orm](orm#initialize-instance_method "#initialize (instance method)")` constructor A new instance of Orm. * `[#**multiple\_destroy**(params = nil) ⇒ Object](orm#multiple_destroy-instance_method "#multiple_destroy (instance method)")` * `[#**save** ⇒ Object](orm#save-instance_method "#save (instance method)")` * `[#**update\_attributes**(params = nil) ⇒ Object](orm#update_attributes-instance_method "#update_attributes (instance method)")` Constructor Details ------------------- ### #initialize(name, orm, columns = nil, column\_fields = nil) ⇒ Orm Returns a new instance of Orm. #### Raises: * (`[OrmError](ormerror "Padrino::Admin::Generators::OrmError (class)")`) Instance Attribute Details -------------------------- ### #klass ⇒ Object (readonly) Returns the value of attribute klass ### #klass\_name ⇒ Object (readonly) Returns the value of attribute klass\_name ### #name\_param ⇒ Object (readonly) Returns the value of attribute name\_param ### #name\_plural ⇒ Object (readonly) Returns the value of attribute name\_plural ### #name\_singular ⇒ Object (readonly) Returns the value of attribute name\_singular ### #orm ⇒ Object (readonly) Returns the value of attribute orm Instance Method Details ----------------------- ### #activerecord? ⇒ Boolean #### Returns: * (`Boolean`) ### #all ⇒ Object ### #build(params = nil) ⇒ Object ### #column\_fields ⇒ Object ### #columns ⇒ Object ### #destroy ⇒ Object ### #dm\_column(p) ⇒ Object ### #field\_type(type) ⇒ Object ### #find(params = nil) ⇒ Object ### #find\_by\_ids(params = nil) ⇒ Object ### #has\_error(field) ⇒ Object ### #multiple\_destroy(params = nil) ⇒ Object ### #save ⇒ Object ### #update\_attributes(params = nil) ⇒ Object padrino Exception: Padrino::Admin::Generators::OrmError Exception: Padrino::Admin::Generators::OrmError =============================================== Inherits: StandardError * [Object](../../../object "Object (class)") * StandardError * Padrino::Admin::Generators::OrmError Overview -------- Defines a generic exception for the admin ORM handler. padrino Class: Padrino::Admin::Generators::Orm::Column Class: Padrino::Admin::Generators::Orm::Column ============================================== Inherits: Struct * [Object](../../../../object "Object (class)") * Struct * Padrino::Admin::Generators::Orm::Column Overview -------- for compatibility Instance Attribute Summary -------------------------- * `[#**name** ⇒ Object](column#name-instance_method "#name (instance method)")` Returns the value of attribute name. * `[#**type** ⇒ Object](column#type-instance_method "#type (instance method)")` Returns the value of attribute type. Instance Attribute Details -------------------------- ### #name ⇒ Object Returns the value of attribute name #### Returns: * (`[Object](../../../../object "Object (class)")`) — the current value of name ### #type ⇒ Object Returns the value of attribute type #### Returns: * (`[Object](../../../../object "Object (class)")`) — the current value of type padrino Module: Padrino::Admin::Helpers::AuthenticationHelpers Module: Padrino::Admin::Helpers::AuthenticationHelpers ====================================================== Overview -------- Common helpers used for authorization within an application. Instance Method Summary ------------------------ * `[#**allowed?** ⇒ Boolean](authenticationhelpers#allowed%3F-instance_method "#allowed? (instance method)")` Returns true if the `current_account` is allowed to see the requested path. * `[#**current\_account** ⇒ Object](authenticationhelpers#current_account-instance_method "#current_account (instance method)")` Returns the current\_account, it's an instance of Account model. * `[#**logged\_in?** ⇒ Boolean](authenticationhelpers#logged_in%3F-instance_method "#logged_in? (instance method)")` Returns true if `current_account` is logged and active. * `[#**login\_required** ⇒ Object](authenticationhelpers#login_required-instance_method "#login_required (instance method)")` Returns a helper useful in a `before_filter` for check if an account are: `logged_in?` and `allowed?`. * `[#**project\_modules** ⇒ Object](authenticationhelpers#project_modules-instance_method "#project_modules (instance method)")` Returns project modules for the current account. * `[#**redirect\_back\_or\_default**(default) ⇒ Object](authenticationhelpers#redirect_back_or_default-instance_method "#redirect_back_or_default (instance method)")` Redirect the account to the page that requested an authentication or if the account is not allowed/logged return it to a default page. * `[#**set\_current\_account**(account = nil) ⇒ Object](authenticationhelpers#set_current_account-instance_method "#set_current_account (instance method)")` Override the current\_account, you must provide an instance of Account model. * `[#**store\_location!** ⇒ Object](authenticationhelpers#store_location!-instance_method "#store_location! (instance method)")` Store in [session](#) the [env]('request_uri'). Instance Method Details ----------------------- ### #allowed? ⇒ Boolean Returns true if the `current_account` is allowed to see the requested path. For configure this role please refer to: `Padrino::Admin::AccessControl::Base` #### Returns: * (`Boolean`) ### #current\_account ⇒ Object Returns the current\_account, it's an instance of Account model. ### #logged\_in? ⇒ Boolean Returns true if `current_account` is logged and active. #### Returns: * (`Boolean`) ### #login\_required ⇒ Object Returns a helper useful in a `before_filter` for check if an account are: `logged_in?` and `allowed?` By default this method is used in Admin Apps. ### #project\_modules ⇒ Object Returns project modules for the current account. ### #redirect\_back\_or\_default(default) ⇒ Object Redirect the account to the page that requested an authentication or if the account is not allowed/logged return it to a default page. ### #set\_current\_account(account = nil) ⇒ Object Override the current\_account, you must provide an instance of Account model. #### Examples: ``` set_current_account(Account.authenticate(params[:email], params[:password]) ``` ### #store\_location! ⇒ Object Store in [session](#) the [env]('request_uri').
programming_docs
padrino Module: Padrino::Admin::Helpers::ViewHelpers Module: Padrino::Admin::Helpers::ViewHelpers ============================================ Instance Method Summary ------------------------ * `[#**model\_attribute\_translate**(model, attribute) ⇒ String](viewhelpers#model_attribute_translate-instance_method "#model_attribute_translate (instance method)") (also: #t_attr)` Translates attribute name for the given model. * `[#**model\_translate**(model) ⇒ String](viewhelpers#model_translate-instance_method "#model_translate (instance method)") (also: #mt)` Translates model name. * `[#**padrino\_admin\_translate**(word, \*args) ⇒ String](viewhelpers#padrino_admin_translate-instance_method "#padrino_admin_translate (instance method)") (also: #pat)` Translates a given word for padrino admin. * `[#**tag\_icon**(icon, tag = nil) ⇒ String](viewhelpers#tag_icon-instance_method "#tag_icon (instance method)")` Icon's Bootstrap helper. Instance Method Details ----------------------- ### #model\_attribute\_translate(model, attribute) ⇒ String Also known as: t\_attr Translates attribute name for the given model. #### Examples: ``` # => t("models.account.attributes.email", :default => "Email") mat(:account, :email) ``` #### Parameters: * `model` (`Symbol`) — The model name for the translation. * `attribute` (`Symbol`) — The attribute name in the model to translate. #### Returns: * (`[String](../../../string "String (class)")`) — The translated attribute name for the current locale. ### #model\_translate(model) ⇒ String Also known as: mt Translates model name. #### Examples: ``` # => t("models.account.name", :default => "Account") mt(:account) ``` #### Parameters: * `attribute` (`Symbol`) — The attribute name in the model to translate. #### Returns: * (`[String](../../../string "String (class)")`) — The translated model name for the current locale. ### #padrino\_admin\_translate(word, \*args) ⇒ String Also known as: pat Translates a given word for padrino admin. #### Examples: ``` # => t("padrino.admin.profile", :default => "Profile") pat(:profile) # => t("padrino.admin.profile", :default => "My Profile") pat(:profile, "My Profile") ``` #### Parameters: * `word` (`[String](../../../string "String (class)")`) — The specified word to admin translate. * `default` (`[String](../../../string "String (class)")`) — The default fallback if no word is available for the locale. #### Returns: * (`[String](../../../string "String (class)")`) — The translated word for the current locale. ### #tag\_icon(icon, tag = nil) ⇒ String Icon's Bootstrap helper. #### Examples: ``` tag_icon(:edit, :list) ``` #### Parameters: * `icon` (`Symbol`) — The specified icon type. * `tag` (`Symbol`) *(defaults to: `nil`)* — The HTML tag. #### Returns: * (`[String](../../../string "String (class)")`) — HTML tag with prepend icon padrino Module: Padrino::Mailer::Helpers Module: Padrino::Mailer::Helpers ================================ Overview -------- Helpers for defining and delivering email messages. Defined Under Namespace ----------------------- **Modules:** [ClassMethods](helpers/classmethods "Padrino::Mailer::Helpers::ClassMethods (module)") Instance Method Summary ------------------------ * `[#**deliver**(mailer\_name, message\_name, \*attributes) ⇒ Object](helpers#deliver-instance_method "#deliver (instance method)")` Delivers a mailer message email with the given attributes. * `[#**email**(mail\_attributes = {}, &block) ⇒ Object](helpers#email-instance_method "#email (instance method)")` Delivers an email with the given mail attributes. Instance Method Details ----------------------- ### #deliver(mailer\_name, message\_name, \*attributes) ⇒ Object Delivers a mailer message email with the given attributes. #### Examples: ``` deliver(:sample, :birthday, "Joey", 21) deliver(:example, :message, "John") ``` #### Parameters: * `mailer_name` (`Symbol`) — The name of the mailer. * `message_name` (`Symbol`) — The name of the message to deliver. * `attributes` — The parameters to pass to the mailer. #### See Also: * [Padrino::Mailer::Helpers::ClassMethods#deliver](helpers/classmethods#deliver-instance_method "Padrino::Mailer::Helpers::ClassMethods#deliver (method)") ### #email(mail\_attributes = {}, &block) ⇒ Object Delivers an email with the given mail attributes. #### Examples: ``` email do to @user.email from "[email protected]" subject "Welcome to Awesomeness!" locals :a => a, :b => b render 'path/to/my/template' end ``` #### Parameters: * `mail_attributes` (`Hash`) *(defaults to: `{}`)* — The attributes for this message (to, from, subject, cc, bcc, body, etc). * `block` (`Proc`) — The block mail attributes for this message. #### See Also: * [Padrino::Mailer::Helpers::ClassMethods#email](helpers/classmethods#email-instance_method "Padrino::Mailer::Helpers::ClassMethods#email (method)") padrino Class: Padrino::Mailer::Base Class: Padrino::Mailer::Base ============================ Inherits: [Object](../../object "Object (class)") * [Object](../../object "Object (class)") * Padrino::Mailer::Base Overview -------- This is the abstract class that other mailers will inherit from in order to send mail. You can set the default delivery settings from your app through: ``` set :delivery_method, :smtp => { :address => 'smtp.yourserver.com', :port => '25', :user_name => 'user', :password => 'pass', :authentication => :plain } ``` or sendmail: ``` set :delivery_method, :sendmail ``` or for tests: ``` set :delivery_method, :test ``` and all delivered mail will use these settings unless otherwise specified. Define a mailer in your application: ``` # app/mailers/sample_mailer.rb MyAppName.mailers :sample do defaults :content_type => 'html' email :registration do |name, age| to '[email protected]' from '[email protected]' subject 'Welcome to the site!' locals :name => name render 'registration' end end ``` Use the mailer to deliver messages: ``` deliver(:sample, :registration, "Bob", "21") ``` Instance Attribute Summary -------------------------- * `[#**app** ⇒ Object](base#app-instance_method "#app (instance method)")` Returns the value of attribute app. * `[#**delivery\_settings** ⇒ Object](base#delivery_settings-instance_method "#delivery_settings (instance method)")` Returns the value of attribute delivery\_settings. * `[#**mailer\_name** ⇒ Object](base#mailer_name-instance_method "#mailer_name (instance method)")` Returns the value of attribute mailer\_name. * `[#**messages** ⇒ Object](base#messages-instance_method "#messages (instance method)")` Returns the value of attribute messages. Instance Method Summary ------------------------ * `[#**defaults**(attributes = nil) ⇒ Object](base#defaults-instance_method "#defaults (instance method)")` Defines the default attributes for a message in this mailer (including app-wide defaults). * `[#**email**(name, &block) ⇒ Object](base#email-instance_method "#email (instance method)") (also: #message)` Defines a mailer object allowing the definition of various email messages that can be delivered. * `[#**initialize**(app, name, &block) ⇒ Base](base#initialize-instance_method "#initialize (instance method)")` constructor Constructs a `Mailer` base object with specified options. Constructor Details ------------------- ### #initialize(app, name, &block) ⇒ Base Constructs a `Mailer` base object with specified options. #### Parameters: * `app` (`Sinatra::Application`) — The application tied to this mailer. * `name` (`Symbol`) — The name of this mailer. * `block` (`Proc`) — The `email` definitions block. #### See Also: * [Helpers::ClassMethods#mailer](helpers/classmethods#mailer-instance_method "Padrino::Mailer::Helpers::ClassMethods#mailer (method)") Instance Attribute Details -------------------------- ### #app ⇒ Object Returns the value of attribute app ### #delivery\_settings ⇒ Object Returns the value of attribute delivery\_settings ### #mailer\_name ⇒ Object Returns the value of attribute mailer\_name ### #messages ⇒ Object Returns the value of attribute messages Instance Method Details ----------------------- ### #defaults(attributes = nil) ⇒ Object Defines the default attributes for a message in this mailer (including app-wide defaults). #### Examples: ``` mailer :alternate do defaults :from => '[email protected]', :to => '[email protected]' email(:foo) do; end end ``` #### Parameters: * `attributes` (`Hash`) *(defaults to: `nil`)* — The hash of message options to use as default. ### #email(name, &block) ⇒ Object Also known as: message Defines a mailer object allowing the definition of various email messages that can be delivered. #### Examples: ``` email :birthday do |name, age| subject "Happy Birthday!" to '[email protected]' from '[email protected]' locals 'name' => name, 'age' => age render 'birthday' end ``` #### Parameters: * `name` (`Symbol`) — The name of this email message. * `block` (`Proc`) — The message definition (i.e subject, to, from, locals). padrino Module: Padrino::Mailer::Mime Module: Padrino::Mailer::Mime ============================= Overview -------- Handles MIME type declarations for mail delivery. Constant Summary [collapse](#) ------------------------------- MIME\_TYPES = List of common mime-types, selected from various sources according to their usefulness for an email scope. You can add your own mime types like: ``` Padrino::Mailer::Mime::MIME_TYPES.merge!("text/xml" => :xml) ``` ``` { "text/html" => :html, "text/plain" => :plain, "text/xml" => :xml } ``` Class Method Summary --------------------- * `[.**mime\_type**(mime, fallback = :plain) ⇒ Object](mime#mime_type-class_method "mime_type (class method)")` Returns Symbol with mime type if found, otherwise use `fallback`. Class Method Details -------------------- ### .mime\_type(mime, fallback = :plain) ⇒ Object Returns Symbol with mime type if found, otherwise use `fallback`. `mime` should be the content type like “text/plain” `fallback` may be any symbol. Also see the documentation for [MIME\_TYPES](mime#MIME_TYPES-constant "Padrino::Mailer::Mime::MIME_TYPES (constant)"). This is a shortcut for: ``` Padrino::Mailer::Mime::MIME_TYPES.fetch('text/plain', :plain) ``` #### Examples: ``` Padrino::Mailer::Mime.mime_type('text/plain') # => :plain Padrino::Mailer::Mime.mime_type('text/html') # => :html ``` #### Parameters: * `mime` (`[String](../../string "String (class)")`) — The mime alias to fetch (i.e 'text/plain'). * `fallback` (`Symbol`) *(defaults to: `:plain`)* — The fallback mime to use if `mime` doesn't exist. padrino Module: Padrino::Mailer::Helpers::ClassMethods Module: Padrino::Mailer::Helpers::ClassMethods ============================================== Overview -------- Class methods responsible for registering mailers, configuring settings and delivering messages. Instance Method Summary ------------------------ * `[#**deliver**(mailer\_name, message\_name, \*attributes) ⇒ Object](classmethods#deliver-instance_method "#deliver (instance method)")` Delivers a mailer message email with the given attributes. * `[#**email**(mail\_attributes = {}, &block) ⇒ Object](classmethods#email-instance_method "#email (instance method)")` Delivers an email with the given mail attributes with specified and default settings. * `[#**inherited**(subclass) ⇒ Object](classmethods#inherited-instance_method "#inherited (instance method)")` * `[#**mailer**(name, &block) ⇒ Object](classmethods#mailer-instance_method "#mailer (instance method)") (also: #mailers)` Defines a mailer object allowing the definition of various email messages that can be delivered. * `[#**registered\_mailers** ⇒ Object](classmethods#registered_mailers-instance_method "#registered_mailers (instance method)")` Returns all registered mailers for this application. Instance Method Details ----------------------- ### #deliver(mailer\_name, message\_name, \*attributes) ⇒ Object Delivers a mailer message email with the given attributes. #### Examples: ``` deliver(:sample, :birthday, "Joey", 21) deliver(:example, :message, "John") ``` #### Parameters: * `mailer_name` (`Symbol`) — The name of the mailer. * `message_name` (`Symbol`) — The name of the message to deliver. * `attributes` — The parameters to pass to the mailer. ### #email(mail\_attributes = {}, &block) ⇒ Object Delivers an email with the given mail attributes with specified and default settings. #### Examples: ``` MyApp.email(:to => '[email protected]', :from => '[email protected]', :subject => 'Welcome!', :body => 'Welcome Here!') # or if you prefer blocks MyApp.email do to @user.email from "[email protected]" subject "Welcome to Awesomeness!" body 'path/to/my/template', :locals => { :a => a, :b => b } end ``` #### Parameters: * `mail_attributes` (`Hash`) *(defaults to: `{}`)* — The attributes for this message (to, from, subject, cc, bcc, body, etc.). * `block` (`Proc`) — The block mail attributes for this message. ### #inherited(subclass) ⇒ Object ### #mailer(name, &block) ⇒ Object Also known as: mailers Defines a mailer object allowing the definition of various email messages that can be delivered. #### Examples: ``` mailer :sample do email :birthday do |name, age| subject 'Happy Birthday!' to '[email protected]' from '[email protected]' locals :name => name, :age => age render 'sample/birthday' end end ``` #### Parameters: * `name` (`Symbol`) — The name of the mailer to initialize. ### #registered\_mailers ⇒ Object Returns all registered mailers for this application. padrino Module: Padrino::ApplicationSetup::ClassMethods Module: Padrino::ApplicationSetup::ClassMethods =============================================== Instance Method Summary ------------------------ * `[#**default\_configuration!** ⇒ Object](classmethods#default_configuration!-instance_method "#default_configuration! (instance method)")` Defines default settings for Padrino application. * `[#**precompile\_routes!** ⇒ Object](classmethods#precompile_routes!-instance_method "#precompile_routes! (instance method)")` * `[#**precompile\_routes?** ⇒ Boolean](classmethods#precompile_routes%3F-instance_method "#precompile_routes? (instance method)")` * `[#**setup\_application!** ⇒ TrueClass](classmethods#setup_application!-instance_method "#setup_application! (instance method)")` Setup the application by registering initializers, load paths and logger. Instance Method Details ----------------------- ### #default\_configuration! ⇒ Object Defines default settings for Padrino application. ### #precompile\_routes! ⇒ Object ### #precompile\_routes? ⇒ Boolean #### Returns: * (`Boolean`) ### #setup\_application! ⇒ TrueClass Setup the application by registering initializers, load paths and logger. Invoked automatically when an application is first instantiated. #### Returns: * (`TrueClass`) padrino Class: Padrino::Flash::Storage Class: Padrino::Flash::Storage ============================== Inherits: [Object](../../object "Object (class)") * [Object](../../object "Object (class)") * Padrino::Flash::Storage Includes: Enumerable Instance Method Summary ------------------------ * `[#**[]**(type) ⇒ Object](storage#%5B%5D-instance_method "#[] (instance method)")` * `[#**[]=**(type, message) ⇒ Object](storage#%5B%5D=-instance_method "#[]= (instance method)")` * `[#**clear** ⇒ Object](storage#clear-instance_method "#clear (instance method)")` * `[#**delete**(type) ⇒ Object](storage#delete-instance_method "#delete (instance method)")` * `[#**discard**(key = nil) ⇒ Object](storage#discard-instance_method "#discard (instance method)")` * `[#**each**(&block) ⇒ Object](storage#each-instance_method "#each (instance method)")` * `[#**empty?** ⇒ Boolean](storage#empty%3F-instance_method "#empty? (instance method)")` * `[#**error** ⇒ Object](storage#error-instance_method "#error (instance method)")` * `[#**error=**(message) ⇒ Object](storage#error=-instance_method "#error= (instance method)")` * `[#**keep**(key = nil) ⇒ Object](storage#keep-instance_method "#keep (instance method)")` * `[#**key?**(type) ⇒ Boolean](storage#key%3F-instance_method "#key? (instance method)")` * `[#**keys** ⇒ Object](storage#keys-instance_method "#keys (instance method)")` * `[#**length** ⇒ Object](storage#length-instance_method "#length (instance method)") (also: #size)` * `[#**next** ⇒ Object](storage#next-instance_method "#next (instance method)")` * `[#**notice** ⇒ Object](storage#notice-instance_method "#notice (instance method)")` * `[#**notice=**(message) ⇒ Object](storage#notice=-instance_method "#notice= (instance method)")` * `[#**now** ⇒ Object](storage#now-instance_method "#now (instance method)")` * `[#**replace**(hash) ⇒ Object](storage#replace-instance_method "#replace (instance method)")` * `[#**success** ⇒ Object](storage#success-instance_method "#success (instance method)")` * `[#**success=**(message) ⇒ Object](storage#success=-instance_method "#success= (instance method)")` * `[#**sweep** ⇒ Object](storage#sweep-instance_method "#sweep (instance method)")` * `[#**to\_hash** ⇒ Object](storage#to_hash-instance_method "#to_hash (instance method)")` * `[#**to\_s** ⇒ Object](storage#to_s-instance_method "#to_s (instance method)")` * `[#**update**(hash) ⇒ Object](storage#update-instance_method "#update (instance method)") (also: #merge!)` Instance Method Details ----------------------- ### #[](type) ⇒ Object #### Since: * 0.10.8 ### #[]=(type, message) ⇒ Object #### Since: * 0.10.8 ### #clear ⇒ Object #### Since: * 0.10.8 ### #delete(type) ⇒ Object #### Since: * 0.10.8 ### #discard(key = nil) ⇒ Object #### Since: * 0.10.8 ### #each(&block) ⇒ Object #### Since: * 0.10.8 ### #empty? ⇒ Boolean #### Returns: * (`Boolean`) #### Since: * 0.10.8 ### #error ⇒ Object #### Since: * 0.10.8 ### #error=(message) ⇒ Object #### Since: * 0.10.8 ### #keep(key = nil) ⇒ Object #### Since: * 0.10.8 ### #key?(type) ⇒ Boolean #### Returns: * (`Boolean`) #### Since: * 0.10.8 ### #keys ⇒ Object #### Since: * 0.10.8 ### #length ⇒ Object Also known as: size ### #next ⇒ Object ### #notice ⇒ Object #### Since: * 0.10.8 ### #notice=(message) ⇒ Object #### Since: * 0.10.8 ### #now ⇒ Object ### #replace(hash) ⇒ Object #### Since: * 0.10.8 ### #success ⇒ Object #### Since: * 0.10.8 ### #success=(message) ⇒ Object #### Since: * 0.10.8 ### #sweep ⇒ Object #### Since: * 0.10.8 ### #to\_hash ⇒ Object #### Since: * 0.10.8 ### #to\_s ⇒ Object #### Since: * 0.10.8 ### #update(hash) ⇒ Object Also known as: merge! #### Since: * 0.10.8 padrino Module: Padrino::Flash::Helpers Module: Padrino::Flash::Helpers =============================== Overview -------- Storage Instance Method Summary ------------------------ * `[#**flash** ⇒ Storage](helpers#flash-instance_method "#flash (instance method)")` Returns the flash storage object. * `[#**redirect**(url, \*args) ⇒ Object](helpers#redirect-instance_method "#redirect (instance method)") (also: #redirect_to)` Overloads the existing redirect helper in-order to provide support for flash messages. Instance Method Details ----------------------- ### #flash ⇒ Storage Returns the flash storage object. #### Returns: * (`[Storage](storage "Padrino::Flash::Storage (class)")`) #### Since: * 0.10.8 ### #redirect(url) ⇒ Object #redirect(url, status\_code) ⇒ Object #redirect(url, status\_code, flash\_messages) ⇒ Object #redirect(url, flash\_messages) ⇒ Object Also known as: redirect\_to Overloads the existing redirect helper in-order to provide support for flash messages. #### Examples: ``` redirect(dashboard, success: :user_created) redirect(new_location, 301, notice: 'This page has moved. Please update your bookmarks!!') ``` #### Overloads: * ### #redirect(url) ⇒ Object #### Parameters: + `url` (`[String](../../string "String (class)")`) * ### #redirect(url, status\_code) ⇒ Object #### Parameters: + `url` (`[String](../../string "String (class)")`) + `status_code` (`Integer`) * ### #redirect(url, status\_code, flash\_messages) ⇒ Object #### Parameters: + `url` (`[String](../../string "String (class)")`) + `status_code` (`Integer`) + `flash_messages` (`Hash`) * ### #redirect(url, flash\_messages) ⇒ Object #### Parameters: + `url` (`[String](../../string "String (class)")`) + `flash_messages` (`Hash`) #### Since: * 0.10.8
programming_docs
padrino Module: Padrino::ParamsProtection::InstanceMethods Module: Padrino::ParamsProtection::InstanceMethods ================================================== Instance Method Summary ------------------------ * `[#**filter\_params!**(params, allowed\_params) ⇒ Object](instancemethods#filter_params!-instance_method "#filter_params! (instance method)")` Filters a hash of parameters leaving only allowed ones and possibly typecasting and processing the others. * `[#**original\_params** ⇒ Object](instancemethods#original_params-instance_method "#original_params (instance method)")` Returns the original unfiltered query parameters hash. Instance Method Details ----------------------- ### #filter\_params!(params, allowed\_params) ⇒ Object Filters a hash of parameters leaving only allowed ones and possibly typecasting and processing the others. #### Examples: ``` filter_params!( { "a" => "1", "b" => "abc", "d" => "drop" }, { "a" => Integer, "b" => true } ) # => { "a" => 1, "b" => "abc" } filter_params!( { "id" => "", "child" => { "name" => "manny" } }, { "id" => Integer, "child" => { "name" => proc{ |v| v.camelize } } } ) # => { "id" => nil, "child" => { "name" => "Manny" } } filter_params!( { "a" => ["1", "2", "3"] }, { "a" => true } ) # => { "a" => ["1", "2", "3"] } filter_params!( { "persons" => {"p-1" => { "name" => "manny", "age" => "50" }, "p-2" => { "name" => "richard", "age" => "50" } } }, { "persons" => { "name" => true } } ) # => { "persons" => {"p-1" => { "name" => "manny" }, "p-2" => { "name" => "richard" } } } ``` #### Parameters: * `params` (`Hash`) — Parameters to filter. Warning: this hash will be changed by deleting or replacing its values. * `allowed_params` (`Hash`) — A hash of allowed keys and value classes or processing procs. Supported scalar classes are: Integer (empty string is cast to nil). ### #original\_params ⇒ Object Returns the original unfiltered query parameters hash. padrino Module: Padrino::ParamsProtection::ClassMethods Module: Padrino::ParamsProtection::ClassMethods =============================================== Instance Method Summary ------------------------ * `[#**params**(\*allowed\_params) ⇒ Object](classmethods#params-instance_method "#params (instance method)")` Implements filtering of url query params. Instance Method Details ----------------------- ### #params(\*allowed\_params) ⇒ Object Implements filtering of url query params. Can prevent mass-assignment. #### Examples: ``` post :update, :params => [:name, :email] post :update, :params => [:name, :id => Integer] post :update, :params => [:name => proc{ |v| v.reverse }] post :update, :params => [:name, :parent => [:name, :position]] post :update, :params => false post :update, :params => true ``` ``` params :name, :email, :password => prox{ |v| v.reverse } post :update ``` ``` App.controller :accounts, :params => [:name, :position] do post :create post :update, :with => [ :id ], :params => [:name, :position, :addition] get :show, :with => :id, :params => false get :search, :params => true end ``` padrino Class: Padrino::Rendering::SafeERB Class: Padrino::Rendering::SafeERB ================================== Inherits: ERB * [Object](../../object "Object (class)") * ERB * Padrino::Rendering::SafeERB Defined Under Namespace ----------------------- **Classes:** [Compiler](safeerb/compiler "Padrino::Rendering::SafeERB::Compiler (class)") Instance Method Summary ------------------------ * `[#**make\_compiler**(trim\_mode) ⇒ Object](safeerb#make_compiler-instance_method "#make_compiler (instance method)")` * `[#**set\_eoutvar**(compiler, eoutvar = '\_erbout') ⇒ Object](safeerb#set_eoutvar-instance_method "#set_eoutvar (instance method)")` Instance Method Details ----------------------- ### #make\_compiler(trim\_mode) ⇒ Object ### #set\_eoutvar(compiler, eoutvar = '\_erbout') ⇒ Object padrino Module: Padrino::Rendering::SafeBufferEnhancer Module: Padrino::Rendering::SafeBufferEnhancer ============================================== Included in: [SafeEruby](safeeruby "Padrino::Rendering::SafeEruby (class)") Overview -------- **This module is part of a private API.** You should avoid using this module if possible, as it may be removed or be changed in the future. SafeBufferEnhancer is an Erubis Enhancer that compiles templates that are fit for using SafeBuffer as a Buffer. Instance Method Summary ------------------------ * `[#**add\_expr\_escaped**(src, code) ⇒ Object](safebufferenhancer#add_expr_escaped-instance_method "#add_expr_escaped (instance method)")` private * `[#**add\_expr\_literal**(src, code) ⇒ Object](safebufferenhancer#add_expr_literal-instance_method "#add_expr_literal (instance method)")` private * `[#**add\_stmt**(src, code) ⇒ Object](safebufferenhancer#add_stmt-instance_method "#add_stmt (instance method)")` private * `[#**add\_text**(src, text) ⇒ Object](safebufferenhancer#add_text-instance_method "#add_text (instance method)")` private Instance Method Details ----------------------- ### #add\_expr\_escaped(src, code) ⇒ Object **This method is part of a private API.** You should avoid using this method if possible, as it may be removed or be changed in the future. ### #add\_expr\_literal(src, code) ⇒ Object **This method is part of a private API.** You should avoid using this method if possible, as it may be removed or be changed in the future. ### #add\_stmt(src, code) ⇒ Object **This method is part of a private API.** You should avoid using this method if possible, as it may be removed or be changed in the future. ### #add\_text(src, text) ⇒ Object **This method is part of a private API.** You should avoid using this method if possible, as it may be removed or be changed in the future. padrino Class: Padrino::Rendering::ErubisTemplate Class: Padrino::Rendering::ErubisTemplate ========================================= Inherits: Tilt::ErubisTemplate * [Object](../../object "Object (class)") * Tilt::ErubisTemplate * Padrino::Rendering::ErubisTemplate Overview -------- **This class is part of a private API.** You should avoid using this class if possible, as it may be removed or be changed in the future. Modded ErubisTemplate that doesn't insist in an String as output buffer. Instance Method Summary ------------------------ * `[#**precompiled\_preamble**(locals) ⇒ Object](erubistemplate#precompiled_preamble-instance_method "#precompiled_preamble (instance method)")` private In preamble we need a flag `\_\_in\_erb\_template` and SafeBuffer for padrino apps. * `[#**render**(\*args) ⇒ Object](erubistemplate#render-instance_method "#render (instance method)")` private Instance Method Details ----------------------- ### #precompiled\_preamble(locals) ⇒ Object **This method is part of a private API.** You should avoid using this method if possible, as it may be removed or be changed in the future. In preamble we need a flag `\_\_in\_erb\_template` and SafeBuffer for padrino apps. ### #render(\*args) ⇒ Object **This method is part of a private API.** You should avoid using this method if possible, as it may be removed or be changed in the future. padrino Exception: Padrino::Rendering::TemplateNotFound Exception: Padrino::Rendering::TemplateNotFound =============================================== Inherits: RuntimeError * [Object](../../object "Object (class)") * RuntimeError * Padrino::Rendering::TemplateNotFound Overview -------- Exception responsible for when an expected template did not exist. padrino Module: Padrino::Rendering::Erubi Module: Padrino::Rendering::Erubi ================================= Defined Under Namespace ----------------------- **Modules:** [SafeBufferEnhancer](erubi/safebufferenhancer "Padrino::Rendering::Erubi::SafeBufferEnhancer (module)") padrino Module: Padrino::Rendering::InstanceMethods Module: Padrino::Rendering::InstanceMethods =========================================== Overview -------- Instance methods that allow enhanced rendering to function properly in Padrino. Instance Attribute Summary -------------------------- * `[#**current\_engine** ⇒ Object](instancemethods#current_engine-instance_method "#current_engine (instance method)")` readonly Returns the value of attribute current\_engine. Instance Method Summary ------------------------ * `[#**content\_type**(type = nil, params = {}) ⇒ Object](instancemethods#content_type-instance_method "#content_type (instance method)")` Get/Set the content\_type. Instance Attribute Details -------------------------- ### #current\_engine ⇒ Object (readonly) Returns the value of attribute current\_engine Instance Method Details ----------------------- ### #content\_type(type = nil, params = {}) ⇒ Object Get/Set the content\_type #### Examples: ``` case content_type when :js then do_some when :css then do_another end content_type :js # => set the response with 'application/javascript' Content-Type content_type 'text/html' # => set directly the Content-Type to 'text/html' ``` #### Parameters: * `type` (`[String](../../string "String (class)")`, `nil`) *(defaults to: `nil`)* — The Content-Type to use. * `type.` (`Symbol`, `nil`) — Look and parse the given symbol to the matched Content-Type. * `params` (`Hash`) *(defaults to: `{}`)* — Additional params to append to the Content-Type. padrino Class: Padrino::Rendering::ERBTemplate Class: Padrino::Rendering::ERBTemplate ====================================== Inherits: Tilt::ERBTemplate * [Object](../../object "Object (class)") * Tilt::ERBTemplate * Padrino::Rendering::ERBTemplate Instance Method Summary ------------------------ * `[#**precompiled\_preamble**(locals) ⇒ Object](erbtemplate#precompiled_preamble-instance_method "#precompiled_preamble (instance method)")` * `[#**prepare** ⇒ Object](erbtemplate#prepare-instance_method "#prepare (instance method)")` * `[#**render**(\*args) ⇒ Object](erbtemplate#render-instance_method "#render (instance method)")` Instance Method Details ----------------------- ### #precompiled\_preamble(locals) ⇒ Object ### #prepare ⇒ Object ### #render(\*args) ⇒ Object padrino Class: Padrino::Rendering::SafeEruby Class: Padrino::Rendering::SafeEruby ==================================== Inherits: Erubis::Eruby * [Object](../../object "Object (class)") * Erubis::Eruby * Padrino::Rendering::SafeEruby Includes: [SafeBufferEnhancer](safebufferenhancer "Padrino::Rendering::SafeBufferEnhancer (module)") Overview -------- **This class is part of a private API.** You should avoid using this class if possible, as it may be removed or be changed in the future. SafeBufferTemplate is the Eruby engine, augmented with SafeBufferEnhancer. Method Summary -------------- ### Methods included from SafeBufferEnhancer [#add\_expr\_escaped](safebufferenhancer#add_expr_escaped-instance_method "Padrino::Rendering::SafeBufferEnhancer#add_expr_escaped (method)"), [#add\_expr\_literal](safebufferenhancer#add_expr_literal-instance_method "Padrino::Rendering::SafeBufferEnhancer#add_expr_literal (method)"), [#add\_stmt](safebufferenhancer#add_stmt-instance_method "Padrino::Rendering::SafeBufferEnhancer#add_stmt (method)"), [#add\_text](safebufferenhancer#add_text-instance_method "Padrino::Rendering::SafeBufferEnhancer#add_text (method)") padrino Class: Padrino::Rendering::HamlitOutputBuffer Class: Padrino::Rendering::HamlitOutputBuffer ============================================= Inherits: Temple::Generators::StringBuffer * [Object](../../object "Object (class)") * Temple::Generators::StringBuffer * Padrino::Rendering::HamlitOutputBuffer Instance Method Summary ------------------------ * `[#**call**(exp) ⇒ Object](hamlitoutputbuffer#call-instance_method "#call (instance method)")` * `[#**concat**(str) ⇒ Object](hamlitoutputbuffer#concat-instance_method "#concat (instance method)")` * `[#**create\_buffer** ⇒ Object](hamlitoutputbuffer#create_buffer-instance_method "#create_buffer (instance method)")` Instance Method Details ----------------------- ### #call(exp) ⇒ Object ### #concat(str) ⇒ Object ### #create\_buffer ⇒ Object padrino Module: Padrino::Rendering::ClassMethods Module: Padrino::Rendering::ClassMethods ======================================== Overview -------- Class methods responsible for rendering templates as part of a request. Instance Method Summary ------------------------ * `[#**cache\_layout\_path**(name) ⇒ Object](classmethods#cache_layout_path-instance_method "#cache_layout_path (instance method)")` * `[#**cache\_template\_path**(options) ⇒ Object](classmethods#cache_template_path-instance_method "#cache_template_path (instance method)")` * `[#**fetch\_layout\_path**(given\_layout, layouts\_path = views) ⇒ Object](classmethods#fetch_layout_path-instance_method "#fetch_layout_path (instance method)")` Returns the cached layout path. * `[#**layout**(name = :layout) { ... } ⇒ Object](classmethods#layout-instance_method "#layout (instance method)")` Use layout like rails does or if a block given then like sinatra. Instance Method Details ----------------------- ### #cache\_layout\_path(name) ⇒ Object ### #cache\_template\_path(options) ⇒ Object ### #fetch\_layout\_path(given\_layout, layouts\_path = views) ⇒ Object Returns the cached layout path. #### Parameters: * `given_layout` (`[String](../../string "String (class)")`, `nil`) — The requested layout. * `layouts_path` (`[String](../../string "String (class)")`, `nil`) *(defaults to: `views`)* — The directory where the layouts are located. Defaults to #views. ### #layout(name = :layout) { ... } ⇒ Object Use layout like rails does or if a block given then like sinatra. If used without a block, sets the current layout for the route. By default, searches in your: `app`/`views`/`layouts`/`application`.(`haml`|`erb`|`xxx`) `app`/`views`/`layout_name`.(`haml`|`erb`|`xxx`) If you define `layout` :`custom` then searches for your layouts in `app`/`views`/`layouts`/`custom`.(`haml`|`erb`|`xxx`) `app`/`views`/`custom`.(`haml`|`erb`|`xxx`) #### Parameters: * `name` (`Symbol`) *(defaults to: `:layout`)* — (:layout) The layout to use. #### Yields: padrino Class: Padrino::Rendering::SlimTemplate Class: Padrino::Rendering::SlimTemplate ======================================= Inherits: Slim::Template * [Object](../../object "Object (class)") * Slim::Template * Padrino::Rendering::SlimTemplate Includes: [SafeTemplate](safetemplate "Padrino::Rendering::SafeTemplate (module)") Instance Method Summary ------------------------ * `[#**precompiled\_preamble**(locals) ⇒ Object](slimtemplate#precompiled_preamble-instance_method "#precompiled_preamble (instance method)")` ### Methods included from SafeTemplate [#render](safetemplate#render-instance_method "Padrino::Rendering::SafeTemplate#render (method)") Instance Method Details ----------------------- ### #precompiled\_preamble(locals) ⇒ Object padrino Class: Padrino::Rendering::HamlitTemplate Class: Padrino::Rendering::HamlitTemplate ========================================= Inherits: Hamlit::Template * [Object](../../object "Object (class)") * Hamlit::Template * Padrino::Rendering::HamlitTemplate Includes: [SafeTemplate](safetemplate "Padrino::Rendering::SafeTemplate (module)") Instance Method Summary ------------------------ * `[#**precompiled\_preamble**(locals) ⇒ Object](hamlittemplate#precompiled_preamble-instance_method "#precompiled_preamble (instance method)")` ### Methods included from SafeTemplate [#render](safetemplate#render-instance_method "Padrino::Rendering::SafeTemplate#render (method)") Instance Method Details ----------------------- ### #precompiled\_preamble(locals) ⇒ Object padrino Class: Padrino::Rendering::ErubiTemplate Class: Padrino::Rendering::ErubiTemplate ======================================== Inherits: Tilt::ErubiTemplate * [Object](../../object "Object (class)") * Tilt::ErubiTemplate * Padrino::Rendering::ErubiTemplate Instance Method Summary ------------------------ * `[#**precompiled\_preamble** ⇒ Object](erubitemplate#precompiled_preamble-instance_method "#precompiled_preamble (instance method)")` Instance Method Details ----------------------- ### #precompiled\_preamble ⇒ Object padrino Class: Padrino::Rendering::HamlTemplate Class: Padrino::Rendering::HamlTemplate ======================================= Inherits: Tilt::HamlTemplate * [Object](../../object "Object (class)") * Tilt::HamlTemplate * Padrino::Rendering::HamlTemplate Includes: [SafeTemplate](safetemplate "Padrino::Rendering::SafeTemplate (module)") Method Summary -------------- ### Methods included from SafeTemplate [#render](safetemplate#render-instance_method "Padrino::Rendering::SafeTemplate#render (method)") padrino Class: Padrino::Rendering::SafeErubi Class: Padrino::Rendering::SafeErubi ==================================== Inherits: Erubi::Engine * [Object](../../object "Object (class)") * Erubi::Engine * Padrino::Rendering::SafeErubi Includes: [Erubi::SafeBufferEnhancer](erubi/safebufferenhancer "Padrino::Rendering::Erubi::SafeBufferEnhancer (module)") Method Summary -------------- ### Methods included from Erubi::SafeBufferEnhancer [#add\_expression\_result](erubi/safebufferenhancer#add_expression_result-instance_method "Padrino::Rendering::Erubi::SafeBufferEnhancer#add_expression_result (method)"), [#add\_expression\_result\_escaped](erubi/safebufferenhancer#add_expression_result_escaped-instance_method "Padrino::Rendering::Erubi::SafeBufferEnhancer#add_expression_result_escaped (method)"), [#add\_text](erubi/safebufferenhancer#add_text-instance_method "Padrino::Rendering::Erubi::SafeBufferEnhancer#add_text (method)") padrino Class: Padrino::Rendering::SlimOutputBuffer Class: Padrino::Rendering::SlimOutputBuffer =========================================== Inherits: Temple::Generators::StringBuffer * [Object](../../object "Object (class)") * Temple::Generators::StringBuffer * Padrino::Rendering::SlimOutputBuffer Instance Method Summary ------------------------ * `[#**call**(exp) ⇒ Object](slimoutputbuffer#call-instance_method "#call (instance method)")` * `[#**concat**(str) ⇒ Object](slimoutputbuffer#concat-instance_method "#concat (instance method)")` * `[#**create\_buffer** ⇒ Object](slimoutputbuffer#create_buffer-instance_method "#create_buffer (instance method)")` Instance Method Details ----------------------- ### #call(exp) ⇒ Object ### #concat(str) ⇒ Object ### #create\_buffer ⇒ Object padrino Module: Padrino::Rendering::SafeTemplate Module: Padrino::Rendering::SafeTemplate ======================================== Included in: [HamlTemplate](hamltemplate "Padrino::Rendering::HamlTemplate (class)"), [HamlitTemplate](hamlittemplate "Padrino::Rendering::HamlitTemplate (class)"), [SlimTemplate](slimtemplate "Padrino::Rendering::SlimTemplate (class)") Overview -------- A SafeTemplate assumes that its output is safe. Instance Method Summary ------------------------ * `[#**render** ⇒ Object](safetemplate#render-instance_method "#render (instance method)")` Instance Method Details ----------------------- ### #render ⇒ Object padrino Class: Padrino::Rendering::SafeERB::Compiler Class: Padrino::Rendering::SafeERB::Compiler ============================================ Inherits: ERB::Compiler * [Object](../../../object "Object (class)") * ERB::Compiler * Padrino::Rendering::SafeERB::Compiler Instance Method Summary ------------------------ * `[#**add\_insert\_cmd**(out, content) ⇒ Object](compiler#add_insert_cmd-instance_method "#add_insert_cmd (instance method)")` Instance Method Details ----------------------- ### #add\_insert\_cmd(out, content) ⇒ Object
programming_docs
padrino Module: Padrino::Rendering::Erubi::SafeBufferEnhancer Module: Padrino::Rendering::Erubi::SafeBufferEnhancer ===================================================== Included in: [SafeErubi](../safeerubi "Padrino::Rendering::SafeErubi (class)") Instance Method Summary ------------------------ * `[#**add\_expression\_result**(code) ⇒ Object](safebufferenhancer#add_expression_result-instance_method "#add_expression_result (instance method)")` * `[#**add\_expression\_result\_escaped**(code) ⇒ Object](safebufferenhancer#add_expression_result_escaped-instance_method "#add_expression_result_escaped (instance method)")` * `[#**add\_text**(text) ⇒ Object](safebufferenhancer#add_text-instance_method "#add_text (instance method)")` Instance Method Details ----------------------- ### #add\_expression\_result(code) ⇒ Object ### #add\_expression\_result\_escaped(code) ⇒ Object ### #add\_text(text) ⇒ Object padrino Class: Padrino::Generators::AdminPage Class: Padrino::Generators::AdminPage ===================================== Inherits: Thor::Group * [Object](../../object "Object (class)") * Thor::Group * Padrino::Generators::AdminPage Includes: [Actions](actions "Padrino::Generators::Actions (module)"), [Padrino::Generators::Admin::Actions](admin/actions "Padrino::Generators::Admin::Actions (module)"), Thor::Actions Overview -------- Defines the generator for creating a new admin page. Instance Attribute Summary -------------------------- * `[#**default\_orm** ⇒ Object](adminpage#default_orm-instance_method "#default_orm (instance method)")` Returns the value of attribute default\_orm. Class Method Summary --------------------- * `[.**banner** ⇒ Object](adminpage#banner-class_method "banner (class method)")` Defines the “banner” text for the CLI. * `[.**source\_root** ⇒ Object](adminpage#source_root-class_method "source_root (class method)")` Define the source template root. Instance Method Summary ------------------------ * `[#**create\_controller** ⇒ Object](adminpage#create_controller-instance_method "#create_controller (instance method)")` Create controller for admin. * `[#**source\_paths** ⇒ Object](adminpage#source_paths-instance_method "#source_paths (instance method)")` Look for custom template files in a generators folder under the project root. ### Methods included from Padrino::Generators::Admin::Actions [#add\_project\_module](admin/actions#add_project_module-instance_method "Padrino::Generators::Admin::Actions#add_project_module (method)"), [#ext](admin/actions#ext-instance_method "Padrino::Generators::Admin::Actions#ext (method)"), [#fetch\_app\_name](admin/actions#fetch_app_name-instance_method "Padrino::Generators::Admin::Actions#fetch_app_name (method)"), [#orm](admin/actions#orm-instance_method "Padrino::Generators::Admin::Actions#orm (method)"), [#remove\_project\_module](admin/actions#remove_project_module-instance_method "Padrino::Generators::Admin::Actions#remove_project_module (method)"), [#supported\_ext](admin/actions#supported_ext-instance_method "Padrino::Generators::Admin::Actions#supported_ext (method)"), [#supported\_orm](admin/actions#supported_orm-instance_method "Padrino::Generators::Admin::Actions#supported_orm (method)") ### Methods included from Actions [#already\_exists?](actions#already_exists%3F-instance_method "Padrino::Generators::Actions#already_exists? (method)"), [#app\_skeleton](actions#app_skeleton-instance_method "Padrino::Generators::Actions#app_skeleton (method)"), [#apply\_component\_for](actions#apply_component_for-instance_method "Padrino::Generators::Actions#apply_component_for (method)"), [#apply\_default\_fields](actions#apply_default_fields-instance_method "Padrino::Generators::Actions#apply_default_fields (method)"), [#check\_app\_existence](actions#check_app_existence-instance_method "Padrino::Generators::Actions#check_app_existence (method)"), [#destination\_root](actions#destination_root-instance_method "Padrino::Generators::Actions#destination_root (method)"), [#empty\_directory\_with\_keep\_file](actions#empty_directory_with_keep_file-instance_method "Padrino::Generators::Actions#empty_directory_with_keep_file (method)"), [#execute\_component\_setup](actions#execute_component_setup-instance_method "Padrino::Generators::Actions#execute_component_setup (method)"), [#fetch\_app\_name](actions#fetch_app_name-instance_method "Padrino::Generators::Actions#fetch_app_name (method)"), [#fetch\_component\_choice](actions#fetch_component_choice-instance_method "Padrino::Generators::Actions#fetch_component_choice (method)"), [#fetch\_project\_name](actions#fetch_project_name-instance_method "Padrino::Generators::Actions#fetch_project_name (method)"), [#in\_app\_root?](actions#in_app_root%3F-instance_method "Padrino::Generators::Actions#in_app_root? (method)"), [#include\_component\_module\_for](actions#include_component_module_for-instance_method "Padrino::Generators::Actions#include_component_module_for (method)"), [#initializer](actions#initializer-instance_method "Padrino::Generators::Actions#initializer (method)"), [#inject\_into\_file](actions#inject_into_file-instance_method "Padrino::Generators::Actions#inject_into_file (method)"), [#insert\_hook](actions#insert_hook-instance_method "Padrino::Generators::Actions#insert_hook (method)"), [#insert\_into\_gemfile](actions#insert_into_gemfile-instance_method "Padrino::Generators::Actions#insert_into_gemfile (method)"), [#insert\_middleware](actions#insert_middleware-instance_method "Padrino::Generators::Actions#insert_middleware (method)"), [#invalid\_fields](actions#invalid_fields-instance_method "Padrino::Generators::Actions#invalid_fields (method)"), [#keep\_file](actions#keep_file-instance_method "Padrino::Generators::Actions#keep_file (method)"), [#middleware](actions#middleware-instance_method "Padrino::Generators::Actions#middleware (method)"), [#recognize\_path](actions#recognize_path-instance_method "Padrino::Generators::Actions#recognize_path (method)"), [#require\_contrib](actions#require_contrib-instance_method "Padrino::Generators::Actions#require_contrib (method)"), [#require\_dependencies](actions#require_dependencies-instance_method "Padrino::Generators::Actions#require_dependencies (method)"), [#resolve\_valid\_choice](actions#resolve_valid_choice-instance_method "Padrino::Generators::Actions#resolve_valid_choice (method)"), [#retrieve\_component\_config](actions#retrieve_component_config-instance_method "Padrino::Generators::Actions#retrieve_component_config (method)"), [#run\_bundler](actions#run_bundler-instance_method "Padrino::Generators::Actions#run_bundler (method)"), [#store\_component\_choice](actions#store_component_choice-instance_method "Padrino::Generators::Actions#store_component_choice (method)"), [#store\_component\_config](actions#store_component_config-instance_method "Padrino::Generators::Actions#store_component_config (method)"), [#test?](actions#test%3F-instance_method "Padrino::Generators::Actions#test? (method)"), [#tiny?](actions#tiny%3F-instance_method "Padrino::Generators::Actions#tiny? (method)"), [#valid\_choice?](actions#valid_choice%3F-instance_method "Padrino::Generators::Actions#valid_choice? (method)"), [#valid\_constant?](actions#valid_constant%3F-instance_method "Padrino::Generators::Actions#valid_constant? (method)"), [#validate\_namespace](actions#validate_namespace-instance_method "Padrino::Generators::Actions#validate_namespace (method)") Instance Attribute Details -------------------------- ### #default\_orm ⇒ Object Returns the value of attribute default\_orm Class Method Details -------------------- ### .banner ⇒ Object Defines the “banner” text for the CLI. ### .source\_root ⇒ Object Define the source template root. Instance Method Details ----------------------- ### #create\_controller ⇒ Object Create controller for admin. ### #source\_paths ⇒ Object Look for custom template files in a generators folder under the project root. padrino Class: Padrino::Generators::AdminApp Class: Padrino::Generators::AdminApp ==================================== Inherits: Thor::Group * [Object](../../object "Object (class)") * Thor::Group * Padrino::Generators::AdminApp Includes: [Actions](actions "Padrino::Generators::Actions (module)"), [Padrino::Generators::Admin::Actions](admin/actions "Padrino::Generators::Admin::Actions (module)"), Thor::Actions Overview -------- Defines the generator for creating a new admin app. Class Method Summary --------------------- * `[.**banner** ⇒ Object](adminapp#banner-class_method "banner (class method)")` Defines the “banner” text for the CLI. * `[.**source\_root** ⇒ Object](adminapp#source_root-class_method "source_root (class method)")` Define the source template root. Instance Method Summary ------------------------ * `[#**create\_admin** ⇒ Object](adminapp#create_admin-instance_method "#create_admin (instance method)")` Copies over the Padrino base admin application. * `[#**source\_paths** ⇒ Object](adminapp#source_paths-instance_method "#source_paths (instance method)")` Look for custom template files in a generators folder under the project root. ### Methods included from Padrino::Generators::Admin::Actions [#add\_project\_module](admin/actions#add_project_module-instance_method "Padrino::Generators::Admin::Actions#add_project_module (method)"), [#ext](admin/actions#ext-instance_method "Padrino::Generators::Admin::Actions#ext (method)"), [#fetch\_app\_name](admin/actions#fetch_app_name-instance_method "Padrino::Generators::Admin::Actions#fetch_app_name (method)"), [#orm](admin/actions#orm-instance_method "Padrino::Generators::Admin::Actions#orm (method)"), [#remove\_project\_module](admin/actions#remove_project_module-instance_method "Padrino::Generators::Admin::Actions#remove_project_module (method)"), [#supported\_ext](admin/actions#supported_ext-instance_method "Padrino::Generators::Admin::Actions#supported_ext (method)"), [#supported\_orm](admin/actions#supported_orm-instance_method "Padrino::Generators::Admin::Actions#supported_orm (method)") ### Methods included from Actions [#already\_exists?](actions#already_exists%3F-instance_method "Padrino::Generators::Actions#already_exists? (method)"), [#app\_skeleton](actions#app_skeleton-instance_method "Padrino::Generators::Actions#app_skeleton (method)"), [#apply\_component\_for](actions#apply_component_for-instance_method "Padrino::Generators::Actions#apply_component_for (method)"), [#apply\_default\_fields](actions#apply_default_fields-instance_method "Padrino::Generators::Actions#apply_default_fields (method)"), [#check\_app\_existence](actions#check_app_existence-instance_method "Padrino::Generators::Actions#check_app_existence (method)"), [#destination\_root](actions#destination_root-instance_method "Padrino::Generators::Actions#destination_root (method)"), [#empty\_directory\_with\_keep\_file](actions#empty_directory_with_keep_file-instance_method "Padrino::Generators::Actions#empty_directory_with_keep_file (method)"), [#execute\_component\_setup](actions#execute_component_setup-instance_method "Padrino::Generators::Actions#execute_component_setup (method)"), [#fetch\_app\_name](actions#fetch_app_name-instance_method "Padrino::Generators::Actions#fetch_app_name (method)"), [#fetch\_component\_choice](actions#fetch_component_choice-instance_method "Padrino::Generators::Actions#fetch_component_choice (method)"), [#fetch\_project\_name](actions#fetch_project_name-instance_method "Padrino::Generators::Actions#fetch_project_name (method)"), [#in\_app\_root?](actions#in_app_root%3F-instance_method "Padrino::Generators::Actions#in_app_root? (method)"), [#include\_component\_module\_for](actions#include_component_module_for-instance_method "Padrino::Generators::Actions#include_component_module_for (method)"), [#initializer](actions#initializer-instance_method "Padrino::Generators::Actions#initializer (method)"), [#inject\_into\_file](actions#inject_into_file-instance_method "Padrino::Generators::Actions#inject_into_file (method)"), [#insert\_hook](actions#insert_hook-instance_method "Padrino::Generators::Actions#insert_hook (method)"), [#insert\_into\_gemfile](actions#insert_into_gemfile-instance_method "Padrino::Generators::Actions#insert_into_gemfile (method)"), [#insert\_middleware](actions#insert_middleware-instance_method "Padrino::Generators::Actions#insert_middleware (method)"), [#invalid\_fields](actions#invalid_fields-instance_method "Padrino::Generators::Actions#invalid_fields (method)"), [#keep\_file](actions#keep_file-instance_method "Padrino::Generators::Actions#keep_file (method)"), [#middleware](actions#middleware-instance_method "Padrino::Generators::Actions#middleware (method)"), [#recognize\_path](actions#recognize_path-instance_method "Padrino::Generators::Actions#recognize_path (method)"), [#require\_contrib](actions#require_contrib-instance_method "Padrino::Generators::Actions#require_contrib (method)"), [#require\_dependencies](actions#require_dependencies-instance_method "Padrino::Generators::Actions#require_dependencies (method)"), [#resolve\_valid\_choice](actions#resolve_valid_choice-instance_method "Padrino::Generators::Actions#resolve_valid_choice (method)"), [#retrieve\_component\_config](actions#retrieve_component_config-instance_method "Padrino::Generators::Actions#retrieve_component_config (method)"), [#run\_bundler](actions#run_bundler-instance_method "Padrino::Generators::Actions#run_bundler (method)"), [#store\_component\_choice](actions#store_component_choice-instance_method "Padrino::Generators::Actions#store_component_choice (method)"), [#store\_component\_config](actions#store_component_config-instance_method "Padrino::Generators::Actions#store_component_config (method)"), [#test?](actions#test%3F-instance_method "Padrino::Generators::Actions#test? (method)"), [#tiny?](actions#tiny%3F-instance_method "Padrino::Generators::Actions#tiny? (method)"), [#valid\_choice?](actions#valid_choice%3F-instance_method "Padrino::Generators::Actions#valid_choice? (method)"), [#valid\_constant?](actions#valid_constant%3F-instance_method "Padrino::Generators::Actions#valid_constant? (method)"), [#validate\_namespace](actions#validate_namespace-instance_method "Padrino::Generators::Actions#validate_namespace (method)") Class Method Details -------------------- ### .banner ⇒ Object Defines the “banner” text for the CLI. ### .source\_root ⇒ Object Define the source template root Instance Method Details ----------------------- ### #create\_admin ⇒ Object Copies over the Padrino base admin application. ### #source\_paths ⇒ Object Look for custom template files in a generators folder under the project root. padrino Module: Padrino::Generators::Actions Module: Padrino::Generators::Actions ==================================== Included in: [AdminApp](adminapp "Padrino::Generators::AdminApp (class)"), [AdminPage](adminpage "Padrino::Generators::AdminPage (class)"), [App](app "Padrino::Generators::App (class)"), [Component](component "Padrino::Generators::Component (class)"), [Controller](controller "Padrino::Generators::Controller (class)"), [Helper](helper "Padrino::Generators::Helper (class)"), [Mailer](mailer "Padrino::Generators::Mailer (class)"), [Migration](migration "Padrino::Generators::Migration (class)"), [Model](model "Padrino::Generators::Model (class)"), [Plugin](plugin "Padrino::Generators::Plugin (class)"), [Project](project "Padrino::Generators::Project (class)"), [Task](task "Padrino::Generators::Task (class)") Overview -------- Common actions needed to support project and component generation. Defined Under Namespace ----------------------- **Modules:** [ClassMethods](actions/classmethods "Padrino::Generators::Actions::ClassMethods (module)") Instance Method Summary ------------------------ * `[#**already\_exists?**(name, project\_name = nil) ⇒ Boolean](actions#already_exists%3F-instance_method "#already_exists? (instance method)")` Returns true if constant name already exists. * `[#**app\_skeleton**(app, tiny = false) ⇒ Object](actions#app_skeleton-instance_method "#app_skeleton (instance method)")` Generates standard and tiny applications within a project. * `[#**apply\_component\_for**(choice, component) ⇒ Object](actions#apply_component_for-instance_method "#apply_component_for (instance method)")` Returns the related module for a given component and option. * `[#**apply\_default\_fields**(fields) ⇒ Array<String>](actions#apply_default_fields-instance_method "#apply_default_fields (instance method)")` Apply default field types. * `[#**check\_app\_existence**(app) ⇒ Object](actions#check_app_existence-instance_method "#check_app_existence (instance method)")` Raise SystemExit if the app does not exist. * `[#**destination\_root**(\*paths) ⇒ String](actions#destination_root-instance_method "#destination_root (instance method)")` Returns the root for this Thor class (also aliased as destination root). * `[#**empty\_directory\_with\_keep\_file**(destination, config = {}) ⇒ Object](actions#empty_directory_with_keep_file-instance_method "#empty_directory_with_keep_file (instance method)")` Creates an empty directory with .keep file. * `[#**execute\_component\_setup**(component, choice) ⇒ Object](actions#execute_component_setup-instance_method "#execute_component_setup (instance method)")` Performs the necessary generator for a given component choice. * `[#**fetch\_app\_name**(app = 'app') ⇒ String](actions#fetch_app_name-instance_method "#fetch_app_name (instance method)")` Returns the app\_name for the application at root. * `[#**fetch\_component\_choice**(component) ⇒ String](actions#fetch_component_choice-instance_method "#fetch_component_choice (instance method)")` Returns the component choice stored within the .component file of an application. * `[#**fetch\_project\_name**(app = 'app') ⇒ String](actions#fetch_project_name-instance_method "#fetch_project_name (instance method)")` Returns the namespace for the project. * `[#**in\_app\_root?** ⇒ Boolean](actions#in_app_root%3F-instance_method "#in_app_root? (instance method)")` Returns true if inside a Padrino application. * `[#**include\_component\_module\_for**(component, choice = nil) ⇒ Object](actions#include_component_module_for-instance_method "#include_component_module_for (instance method)")` Includes the component module for the given component and choice. * `[#**initializer**(name, data = nil) ⇒ Object](actions#initializer-instance_method "#initializer (instance method)")` Registers and creates initializer. * `[#**inject\_into\_file**(destination, \*args, &block) ⇒ Object](actions#inject_into_file-instance_method "#inject_into_file (instance method)")` Avoids editing destination file if it does not exist. * `[#**insert\_hook**(include\_text, where) ⇒ Object](actions#insert_hook-instance_method "#insert_hook (instance method)")` Inserts an hook before or after load in our boot.rb. * `[#**insert\_into\_gemfile**(name, options = {}) ⇒ Object](actions#insert_into_gemfile-instance_method "#insert_into_gemfile (instance method)")` Inserts a required gem into the Gemfile to add the bundler dependency. * `[#**insert\_middleware**(include\_text, app = nil) ⇒ Object](actions#insert_middleware-instance_method "#insert_middleware (instance method)")` Inserts a middleware inside app.rb. * `[#**invalid\_fields**(fields) ⇒ Array<String>](actions#invalid_fields-instance_method "#invalid_fields (instance method)")` Returns the field with an unacceptable name(for symbol) else returns nil. * `[#**keep\_file**(destination) ⇒ Object](actions#keep_file-instance_method "#keep_file (instance method)")` Creates an empty .keep file. * `[#**middleware**(name, source) ⇒ Object](actions#middleware-instance_method "#middleware (instance method)")` Creates and inserts middleware. * `[#**recognize\_path** ⇒ Object](actions#recognize_path-instance_method "#recognize_path (instance method)")` Recognizes the path of application. * `[#**require\_contrib**(contrib) ⇒ Object](actions#require_contrib-instance_method "#require_contrib (instance method)")` Insert the regired gem and add in boot.rb custom contribs. * `[#**require\_dependencies**(\*gem\_names) ⇒ Object](actions#require_dependencies-instance_method "#require_dependencies (instance method)")` Adds all the specified gems into the Gemfile for bundler. * `[#**resolve\_valid\_choice**(component) ⇒ String](actions#resolve_valid_choice-instance_method "#resolve_valid_choice (instance method)")` Prompts the user if necessary until a valid choice is returned for the component. * `[#**retrieve\_component\_config**(target) ⇒ Hash](actions#retrieve_component_config-instance_method "#retrieve_component_config (instance method)")` Loads the component config back into a hash. * `[#**run\_bundler** ⇒ Object](actions#run_bundler-instance_method "#run_bundler (instance method)")` Run the bundler. * `[#**store\_component\_choice**(key, value) ⇒ Symbol](actions#store_component_choice-instance_method "#store_component_choice (instance method)")` Set the component choice in the .component file of the application. * `[#**store\_component\_config**(destination, opts = {}) ⇒ Object](actions#store_component_config-instance_method "#store_component_config (instance method)")` Creates a component\_config file at the destination containing all component options. * `[#**test?** ⇒ Boolean](actions#test%3F-instance_method "#test? (instance method)")` Return true if our project has test component. * `[#**tiny?** ⇒ Boolean](actions#tiny%3F-instance_method "#tiny? (instance method)")` Return true if we have a tiny skeleton. * `[#**valid\_choice?**(component, choice) ⇒ Boolean](actions#valid_choice%3F-instance_method "#valid_choice? (instance method)")` Returns true if the option passed is a valid choice for component. * `[#**valid\_constant?**(name) ⇒ Exception](actions#valid_constant%3F-instance_method "#valid_constant? (instance method)")` Ensures that project name is valid, else raise an NameError. * `[#**validate\_namespace**(name) ⇒ Object](actions#validate_namespace-instance_method "#validate_namespace (instance method)")` Validates namespace name (controller name, etc.) or fails with an error. Instance Method Details ----------------------- ### #already\_exists?(name, project\_name = nil) ⇒ Boolean Returns true if constant name already exists. #### Returns: * (`Boolean`) ### #app\_skeleton(app, tiny = false) ⇒ Object Generates standard and tiny applications within a project. #### Examples: ``` app_skeleton 'some_app' app_skeleton 'sub_app', true ``` #### Parameters: * `app` (`[String](../../string "String (class)")`) — Name of application. * `tiny` (`Boolean`) *(defaults to: `false`)* — Boolean to generate a tiny structure. ### #apply\_component\_for(choice, component) ⇒ Object Returns the related module for a given component and option. #### Examples: ``` apply_component_for('rr', :mock) ``` #### Parameters: * `choice` (`[String](../../string "String (class)")`) — The name of the component module. * `component` (`Symbol`) — The type of the component module. ### #apply\_default\_fields(fields) ⇒ Array<String> Apply default field types. #### Parameters: * `fields` (`Array<[String](../../string "String (class)")>`) — Field names for generators. #### Returns: * (`Array<[String](../../string "String (class)")>`) — fields with default types ### #check\_app\_existence(app) ⇒ Object Raise SystemExit if the app does not exist. #### Examples: ``` check_app_existence 'app' ``` #### Parameters: * `app` (`[String](../../string "String (class)")`) — Directory name of application. ### #destination\_root(\*paths) ⇒ String Returns the root for this Thor class (also aliased as destination root). #### Examples: ``` destination_root('config/boot.rb') ``` #### Parameters: * `paths` (`Array<[String](../../string "String (class)")>`) — The relative path from destination root. #### Returns: * (`[String](../../string "String (class)")`) — The full path ### #empty\_directory\_with\_keep\_file(destination, config = {}) ⇒ Object Creates an empty directory with .keep file ### #execute\_component\_setup(component, choice) ⇒ Object Performs the necessary generator for a given component choice. #### Examples: ``` execute_component_setup(:mock, 'rr') ``` #### Parameters: * `component` (`Symbol`) — The type of component module. * `choice` (`[String](../../string "String (class)")`) — The name of the component module choice. ### #fetch\_app\_name(app = 'app') ⇒ String Returns the app\_name for the application at root. #### Examples: ``` fetch_app_name('subapp') ``` #### Parameters: * `app` (`[String](../../string "String (class)")`) *(defaults to: `'app'`)* — folder name of application. #### Returns: * (`[String](../../string "String (class)")`) — class name for application. ### #fetch\_component\_choice(component) ⇒ String Returns the component choice stored within the .component file of an application. #### Examples: ``` fetch_component_choice(:mock) ``` #### Parameters: * `component` (`Symbol`) — The type of component module. #### Returns: * (`[String](../../string "String (class)")`) — Name of the component module. ### #fetch\_project\_name(app = 'app') ⇒ String Returns the namespace for the project. #### Examples: ``` fetch_project_name ``` #### Parameters: * `app` (`[String](../../string "String (class)")`) *(defaults to: `'app'`)* — folder name of application. #### Returns: * (`[String](../../string "String (class)")`) — namespace for application. ### #in\_app\_root? ⇒ Boolean Returns true if inside a Padrino application. #### Returns: * (`Boolean`) ### #include\_component\_module\_for(component, choice = nil) ⇒ Object Includes the component module for the given component and choice. It determines the choice using .components file. #### Examples: ``` include_component_module_for(:mock) include_component_module_for(:mock, 'rr') ``` #### Parameters: * `component` (`Symbol`) — The type of component module. * `choice` (`[String](../../string "String (class)")`) *(defaults to: `nil`)* — The name of the component module. ### #initializer(name, data = nil) ⇒ Object Registers and creates initializer. #### Examples: ``` initializer(:test, "some stuff here") #=> generates 'lib/test_init.rb' ``` #### Parameters: * `name` (`Symbol`) — Name of the initializer. * `data` (`[String](../../string "String (class)")`) *(defaults to: `nil`)* — Text to generate into the initializer file. ### #inject\_into\_file(destination, \*args, &block) ⇒ Object Avoids editing destination file if it does not exist. ### #insert\_hook(include\_text, where) ⇒ Object Inserts an hook before or after load in our boot.rb. #### Examples: ``` insert_hook("DataMapper.finalize", :after_load) ``` #### Parameters: * `include_text` (`[String](../../string "String (class)")`) — Text to include into hooks in boot.rb. * `where` (`Symbol`) — method hook to call from Padrino, i.e :after\_load, :before\_load. ### #insert\_into\_gemfile(name, options = {}) ⇒ Object Inserts a required gem into the Gemfile to add the bundler dependency. #### Examples: ``` insert_into_gemfile(name) insert_into_gemfile(name, :group => 'test', :require => 'foo') insert_into_gemfile(name, :group => 'test', :version => ">1.2.3") ``` #### Parameters: * `name` (`[String](../../string "String (class)")`) — Name of gem to insert into Gemfile. * `options` (`Hash`) *(defaults to: `{}`)* — Options to generate into Gemfile for gem. ### #insert\_middleware(include\_text, app = nil) ⇒ Object Inserts a middleware inside app.rb. #### Examples: ``` insert_middleware(ActiveRecord::ConnectionAdapters::ConnectionManagement) ``` #### Parameters: * `include_text` (`[String](../../string "String (class)")`) — Text to include into hooks in boot.rb. ### #invalid\_fields(fields) ⇒ Array<String> Returns the field with an unacceptable name(for symbol) else returns nil. #### Examples: ``` invalid_fields ['foo:bar', 'hello:world'] ``` #### Parameters: * `fields` (`Array<[String](../../string "String (class)")>`) — Field names for generators. #### Returns: * (`Array<[String](../../string "String (class)")>`) — array of invalid fields ### #keep\_file(destination) ⇒ Object Creates an empty .keep file ### #middleware(name, source) ⇒ Object Creates and inserts middleware. #### Examples: ``` middleware(:hello, "class Hello\nend") #=> generates 'lib/hello_middleware.rb' ``` #### Parameters: * `name` (`Symbol`, `[String](../../string "String (class)")`) — Name of the middleware. * `source` (`[String](../../string "String (class)")`) — Text to generate into the middleware file. ### #recognize\_path ⇒ Object Recognizes the path of application. ### #require\_contrib(contrib) ⇒ Object Insert the regired gem and add in boot.rb custom contribs. #### Examples: ``` require_contrib('auto_locale') ``` #### Parameters: * `contrib` (`[String](../../string "String (class)")`) — name of library from padrino-contrib ### #require\_dependencies(\*gem\_names) ⇒ Object Adds all the specified gems into the Gemfile for bundler. #### Examples: ``` require_dependencies('active_record') require_dependencies('mocha', 'bacon', :group => 'test') require_dependencies('json', :version => ">=1.2.3") ``` #### Parameters: * `gem_names` (`Array<[String](../../string "String (class)")>`) — Splat of gems to require in Gemfile. * `options` (`Hash`) — The options to pass to gem in Gemfile. ### #resolve\_valid\_choice(component) ⇒ String Prompts the user if necessary until a valid choice is returned for the component. #### Examples: ``` resolve_valid_choice(:mock) ``` #### Parameters: * `component` (`Symbol`) — The type of component module. #### Returns: * (`[String](../../string "String (class)")`) — Name of component if valid, otherwise ask for valid choice. ### #retrieve\_component\_config(target) ⇒ Hash Loads the component config back into a hash. #### Examples: ``` retrieve_component_config(...) # => { :mock => 'rr', :test => 'rspec', ... } ``` #### Parameters: * `target` (`[String](../../string "String (class)")`) — Path to component config file. #### Returns: * (`Hash`) — Loaded YAML file. ### #run\_bundler ⇒ Object Run the bundler. ### #store\_component\_choice(key, value) ⇒ Symbol Set the component choice in the .component file of the application. #### Examples: ``` store_component_choice(:renderer, :haml) ``` #### Parameters: * `key` (`Symbol`) — The type of component module. * `value` (`Symbol`) — The name of the component module. #### Returns: * (`Symbol`) — The name of the component module. ### #store\_component\_config(destination, opts = {}) ⇒ Object Creates a component\_config file at the destination containing all component options. Content is a YAMLized version of a hash containing component name mapping to chosen value. #### Examples: ``` store_component_config('/foo/bar') ``` #### Parameters: * `destination` (`[String](../../string "String (class)")`) — The file path to store the component config. ### #test? ⇒ Boolean Return true if our project has test component. #### Returns: * (`Boolean`) ### #tiny? ⇒ Boolean Return true if we have a tiny skeleton. #### Returns: * (`Boolean`) ### #valid\_choice?(component, choice) ⇒ Boolean Returns true if the option passed is a valid choice for component. #### Examples: ``` valid_choice?(:mock, 'rr') ``` #### Parameters: * `component` (`Symbol`) — The type of component module. * `choice` (`[String](../../string "String (class)")`) — The name of the component module. #### Returns: * (`Boolean`) — Boolean of whether the choice is valid. ### #valid\_constant?(name) ⇒ Exception Ensures that project name is valid, else raise an NameError. #### Examples: ``` valid_constant '1235Stuff' valid_constant '#Abc' ``` #### Parameters: * `name` (`[String](../../string "String (class)")`) — Name of project. #### Returns: * (`Exception`) — Exception with error message if not valid. ### #validate\_namespace(name) ⇒ Object Validates namespace name (controller name, etc.) or fails with an error. #### Examples: ``` validate_namespace 'Project_One1' #=> pass validate_namespace 'Erroneous/name' #=> fail ``` #### Parameters: * `name` (`[String](../../string "String (class)")`) — Name of namespace
programming_docs
padrino Exception: Padrino::Generators::AppRootNotFound Exception: Padrino::Generators::AppRootNotFound =============================================== Inherits: RuntimeError * [Object](../../object "Object (class)") * RuntimeError * Padrino::Generators::AppRootNotFound Overview -------- Raised when an application does not have a resolved root path. padrino Module: Padrino::Generators::Admin Module: Padrino::Generators::Admin ================================== Overview -------- Generator action definitions for the admin panel. Defined Under Namespace ----------------------- **Modules:** [Actions](admin/actions "Padrino::Generators::Admin::Actions (module)") padrino Class: Padrino::Generators::Helper Class: Padrino::Generators::Helper ================================== Inherits: Thor::Group * [Object](../../object "Object (class)") * Thor::Group * Padrino::Generators::Helper Includes: [Actions](actions "Padrino::Generators::Actions (module)"), Components::Actions, Thor::Actions Overview -------- Responsible for generating route helpers and associated tests within a Padrino application. Class Method Summary --------------------- * `[.**banner** ⇒ Object](helper#banner-class_method "banner (class method)")` * `[.**source\_root** ⇒ Object](helper#source_root-class_method "source_root (class method)")` Instance Method Summary ------------------------ * `[#**create\_helper** ⇒ Object](helper#create_helper-instance_method "#create_helper (instance method)")` Execute helper generation. ### Methods included from Actions [#already\_exists?](actions#already_exists%3F-instance_method "Padrino::Generators::Actions#already_exists? (method)"), [#app\_skeleton](actions#app_skeleton-instance_method "Padrino::Generators::Actions#app_skeleton (method)"), [#apply\_component\_for](actions#apply_component_for-instance_method "Padrino::Generators::Actions#apply_component_for (method)"), [#apply\_default\_fields](actions#apply_default_fields-instance_method "Padrino::Generators::Actions#apply_default_fields (method)"), [#check\_app\_existence](actions#check_app_existence-instance_method "Padrino::Generators::Actions#check_app_existence (method)"), [#destination\_root](actions#destination_root-instance_method "Padrino::Generators::Actions#destination_root (method)"), [#empty\_directory\_with\_keep\_file](actions#empty_directory_with_keep_file-instance_method "Padrino::Generators::Actions#empty_directory_with_keep_file (method)"), [#execute\_component\_setup](actions#execute_component_setup-instance_method "Padrino::Generators::Actions#execute_component_setup (method)"), [#fetch\_app\_name](actions#fetch_app_name-instance_method "Padrino::Generators::Actions#fetch_app_name (method)"), [#fetch\_component\_choice](actions#fetch_component_choice-instance_method "Padrino::Generators::Actions#fetch_component_choice (method)"), [#fetch\_project\_name](actions#fetch_project_name-instance_method "Padrino::Generators::Actions#fetch_project_name (method)"), [#in\_app\_root?](actions#in_app_root%3F-instance_method "Padrino::Generators::Actions#in_app_root? (method)"), [#include\_component\_module\_for](actions#include_component_module_for-instance_method "Padrino::Generators::Actions#include_component_module_for (method)"), [#initializer](actions#initializer-instance_method "Padrino::Generators::Actions#initializer (method)"), [#inject\_into\_file](actions#inject_into_file-instance_method "Padrino::Generators::Actions#inject_into_file (method)"), [#insert\_hook](actions#insert_hook-instance_method "Padrino::Generators::Actions#insert_hook (method)"), [#insert\_into\_gemfile](actions#insert_into_gemfile-instance_method "Padrino::Generators::Actions#insert_into_gemfile (method)"), [#insert\_middleware](actions#insert_middleware-instance_method "Padrino::Generators::Actions#insert_middleware (method)"), [#invalid\_fields](actions#invalid_fields-instance_method "Padrino::Generators::Actions#invalid_fields (method)"), [#keep\_file](actions#keep_file-instance_method "Padrino::Generators::Actions#keep_file (method)"), [#middleware](actions#middleware-instance_method "Padrino::Generators::Actions#middleware (method)"), [#recognize\_path](actions#recognize_path-instance_method "Padrino::Generators::Actions#recognize_path (method)"), [#require\_contrib](actions#require_contrib-instance_method "Padrino::Generators::Actions#require_contrib (method)"), [#require\_dependencies](actions#require_dependencies-instance_method "Padrino::Generators::Actions#require_dependencies (method)"), [#resolve\_valid\_choice](actions#resolve_valid_choice-instance_method "Padrino::Generators::Actions#resolve_valid_choice (method)"), [#retrieve\_component\_config](actions#retrieve_component_config-instance_method "Padrino::Generators::Actions#retrieve_component_config (method)"), [#run\_bundler](actions#run_bundler-instance_method "Padrino::Generators::Actions#run_bundler (method)"), [#store\_component\_choice](actions#store_component_choice-instance_method "Padrino::Generators::Actions#store_component_choice (method)"), [#store\_component\_config](actions#store_component_config-instance_method "Padrino::Generators::Actions#store_component_config (method)"), [#test?](actions#test%3F-instance_method "Padrino::Generators::Actions#test? (method)"), [#tiny?](actions#tiny%3F-instance_method "Padrino::Generators::Actions#tiny? (method)"), [#valid\_choice?](actions#valid_choice%3F-instance_method "Padrino::Generators::Actions#valid_choice? (method)"), [#valid\_constant?](actions#valid_constant%3F-instance_method "Padrino::Generators::Actions#valid_constant? (method)"), [#validate\_namespace](actions#validate_namespace-instance_method "Padrino::Generators::Actions#validate_namespace (method)") Class Method Details -------------------- ### .banner ⇒ Object ### .source\_root ⇒ Object Instance Method Details ----------------------- ### #create\_helper ⇒ Object Execute helper generation padrino Module: Padrino::Generators::Runner Module: Padrino::Generators::Runner =================================== Included in: [Plugin](plugin "Padrino::Generators::Plugin (class)"), [Project](project "Padrino::Generators::Project (class)") Overview -------- Responsible for executing plugin and template instructions including common actions for modifying a project or application. Instance Method Summary ------------------------ * `[#**app**(name) ⇒ Object](runner#app-instance_method "#app (instance method)")` Executes App generator. * `[#**generate**(type, arguments = "") ⇒ Object](runner#generate-instance_method "#generate (instance method)")` Executes generator command for specified type with given arguments. * `[#**git**(\*args) ⇒ Object](runner#git-instance_method "#git (instance method)")` Executes git commmands in project. * `[#**project**(options = {}) ⇒ Object](runner#project-instance_method "#project (instance method)")` Generates project scaffold based on a given template file. * `[#**rake**(command) ⇒ Object](runner#rake-instance_method "#rake (instance method)")` Executes rake command with given arguments. Instance Method Details ----------------------- ### #app(name) ⇒ Object Executes App generator. Accepts an optional block allowing generation inside subapp. #### Examples: ``` app :name app :name do generate :model, "posts title:string" # generate a model inside of subapp end ``` #### Parameters: * `name` (`Symbol`) — Name of (sub)application to generate. * `block` (`Proc`) — Commands to execute in context of (sub)appliation directory. ### #generate(type, arguments = "") ⇒ Object Executes generator command for specified type with given arguments. #### Examples: ``` generate :model, "post title:string body:text" generate :controller, "posts get:index get:new post:new" generate :migration, "AddEmailToUser email:string" ``` #### Parameters: * `type` (`Symbol`) — Type of component module. * `arguments` (`[String](../../string "String (class)")`) *(defaults to: `""`)* — Arguments to send to component generator. ### #git(\*args) ⇒ Object Executes git commmands in project. #### Examples: ``` git :init git :add, "." git :commit, "hello world" ``` #### Parameters: * `action` (`Symbol`) — Git command to execute. * `arguments` (`[String](../../string "String (class)")`) — Arguments to invoke on git command. ### #project(options = {}) ⇒ Object Generates project scaffold based on a given template file. #### Examples: ``` project :test => :shoulda, :orm => :activerecord, :renderer => "haml" ``` #### Parameters: * `options` (`Hash`) *(defaults to: `{}`)* — Options to use to generate the project. ### #rake(command) ⇒ Object Executes rake command with given arguments. #### Examples: ``` rake "custom task1 task2" ``` #### Parameters: * `command` (`[String](../../string "String (class)")`) — Rake tasks to execute. padrino Class: Padrino::Generators::Component Class: Padrino::Generators::Component ===================================== Inherits: Thor::Group * [Object](../../object "Object (class)") * Thor::Group * Padrino::Generators::Component Includes: [Actions](actions "Padrino::Generators::Actions (module)"), Padrino::Generators::Components::Actions, Thor::Actions Overview -------- Responsible for add components within a Padrino project. Class Method Summary --------------------- * `[.**banner** ⇒ Object](component#banner-class_method "banner (class method)")` * `[.**source\_root** ⇒ Object](component#source_root-class_method "source_root (class method)")` Instance Method Summary ------------------------ * `[#**setup\_components** ⇒ Object](component#setup_components-instance_method "#setup_components (instance method)")` For each component, retrieve a valid choice and then execute the associated generator. ### Methods included from Actions [#already\_exists?](actions#already_exists%3F-instance_method "Padrino::Generators::Actions#already_exists? (method)"), [#app\_skeleton](actions#app_skeleton-instance_method "Padrino::Generators::Actions#app_skeleton (method)"), [#apply\_component\_for](actions#apply_component_for-instance_method "Padrino::Generators::Actions#apply_component_for (method)"), [#apply\_default\_fields](actions#apply_default_fields-instance_method "Padrino::Generators::Actions#apply_default_fields (method)"), [#check\_app\_existence](actions#check_app_existence-instance_method "Padrino::Generators::Actions#check_app_existence (method)"), [#destination\_root](actions#destination_root-instance_method "Padrino::Generators::Actions#destination_root (method)"), [#empty\_directory\_with\_keep\_file](actions#empty_directory_with_keep_file-instance_method "Padrino::Generators::Actions#empty_directory_with_keep_file (method)"), [#execute\_component\_setup](actions#execute_component_setup-instance_method "Padrino::Generators::Actions#execute_component_setup (method)"), [#fetch\_app\_name](actions#fetch_app_name-instance_method "Padrino::Generators::Actions#fetch_app_name (method)"), [#fetch\_component\_choice](actions#fetch_component_choice-instance_method "Padrino::Generators::Actions#fetch_component_choice (method)"), [#fetch\_project\_name](actions#fetch_project_name-instance_method "Padrino::Generators::Actions#fetch_project_name (method)"), [#in\_app\_root?](actions#in_app_root%3F-instance_method "Padrino::Generators::Actions#in_app_root? (method)"), [#include\_component\_module\_for](actions#include_component_module_for-instance_method "Padrino::Generators::Actions#include_component_module_for (method)"), [#initializer](actions#initializer-instance_method "Padrino::Generators::Actions#initializer (method)"), [#inject\_into\_file](actions#inject_into_file-instance_method "Padrino::Generators::Actions#inject_into_file (method)"), [#insert\_hook](actions#insert_hook-instance_method "Padrino::Generators::Actions#insert_hook (method)"), [#insert\_into\_gemfile](actions#insert_into_gemfile-instance_method "Padrino::Generators::Actions#insert_into_gemfile (method)"), [#insert\_middleware](actions#insert_middleware-instance_method "Padrino::Generators::Actions#insert_middleware (method)"), [#invalid\_fields](actions#invalid_fields-instance_method "Padrino::Generators::Actions#invalid_fields (method)"), [#keep\_file](actions#keep_file-instance_method "Padrino::Generators::Actions#keep_file (method)"), [#middleware](actions#middleware-instance_method "Padrino::Generators::Actions#middleware (method)"), [#recognize\_path](actions#recognize_path-instance_method "Padrino::Generators::Actions#recognize_path (method)"), [#require\_contrib](actions#require_contrib-instance_method "Padrino::Generators::Actions#require_contrib (method)"), [#require\_dependencies](actions#require_dependencies-instance_method "Padrino::Generators::Actions#require_dependencies (method)"), [#resolve\_valid\_choice](actions#resolve_valid_choice-instance_method "Padrino::Generators::Actions#resolve_valid_choice (method)"), [#retrieve\_component\_config](actions#retrieve_component_config-instance_method "Padrino::Generators::Actions#retrieve_component_config (method)"), [#run\_bundler](actions#run_bundler-instance_method "Padrino::Generators::Actions#run_bundler (method)"), [#store\_component\_choice](actions#store_component_choice-instance_method "Padrino::Generators::Actions#store_component_choice (method)"), [#store\_component\_config](actions#store_component_config-instance_method "Padrino::Generators::Actions#store_component_config (method)"), [#test?](actions#test%3F-instance_method "Padrino::Generators::Actions#test? (method)"), [#tiny?](actions#tiny%3F-instance_method "Padrino::Generators::Actions#tiny? (method)"), [#valid\_choice?](actions#valid_choice%3F-instance_method "Padrino::Generators::Actions#valid_choice? (method)"), [#valid\_constant?](actions#valid_constant%3F-instance_method "Padrino::Generators::Actions#valid_constant? (method)"), [#validate\_namespace](actions#validate_namespace-instance_method "Padrino::Generators::Actions#validate_namespace (method)") Class Method Details -------------------- ### .banner ⇒ Object ### .source\_root ⇒ Object Instance Method Details ----------------------- ### #setup\_components ⇒ Object For each component, retrieve a valid choice and then execute the associated generator. padrino Class: Padrino::Generators::Plugin Class: Padrino::Generators::Plugin ================================== Inherits: Thor::Group * [Object](../../object "Object (class)") * Thor::Group * Padrino::Generators::Plugin Includes: [Actions](actions "Padrino::Generators::Actions (module)"), [Runner](runner "Padrino::Generators::Runner (module)"), Thor::Actions Overview -------- Responsible for executing plugins instructions within a Padrino project. Constant Summary [collapse](#) ------------------------------- PLUGIN\_URL = Defines the default URL for official padrino recipe plugins. ``` 'https://github.com/padrino/padrino-recipes/tree/master/plugins' ``` Class Method Summary --------------------- * `[.**banner** ⇒ Object](plugin#banner-class_method "banner (class method)")` * `[.**source\_root** ⇒ Object](plugin#source_root-class_method "source_root (class method)")` Instance Method Summary ------------------------ * `[#**setup\_plugin** ⇒ Object](plugin#setup_plugin-instance_method "#setup_plugin (instance method)")` Create the Padrino Plugin. ### Methods included from Runner [#app](runner#app-instance_method "Padrino::Generators::Runner#app (method)"), [#generate](runner#generate-instance_method "Padrino::Generators::Runner#generate (method)"), [#git](runner#git-instance_method "Padrino::Generators::Runner#git (method)"), [#project](runner#project-instance_method "Padrino::Generators::Runner#project (method)"), [#rake](runner#rake-instance_method "Padrino::Generators::Runner#rake (method)") ### Methods included from Actions [#already\_exists?](actions#already_exists%3F-instance_method "Padrino::Generators::Actions#already_exists? (method)"), [#app\_skeleton](actions#app_skeleton-instance_method "Padrino::Generators::Actions#app_skeleton (method)"), [#apply\_component\_for](actions#apply_component_for-instance_method "Padrino::Generators::Actions#apply_component_for (method)"), [#apply\_default\_fields](actions#apply_default_fields-instance_method "Padrino::Generators::Actions#apply_default_fields (method)"), [#check\_app\_existence](actions#check_app_existence-instance_method "Padrino::Generators::Actions#check_app_existence (method)"), [#destination\_root](actions#destination_root-instance_method "Padrino::Generators::Actions#destination_root (method)"), [#empty\_directory\_with\_keep\_file](actions#empty_directory_with_keep_file-instance_method "Padrino::Generators::Actions#empty_directory_with_keep_file (method)"), [#execute\_component\_setup](actions#execute_component_setup-instance_method "Padrino::Generators::Actions#execute_component_setup (method)"), [#fetch\_app\_name](actions#fetch_app_name-instance_method "Padrino::Generators::Actions#fetch_app_name (method)"), [#fetch\_component\_choice](actions#fetch_component_choice-instance_method "Padrino::Generators::Actions#fetch_component_choice (method)"), [#fetch\_project\_name](actions#fetch_project_name-instance_method "Padrino::Generators::Actions#fetch_project_name (method)"), [#in\_app\_root?](actions#in_app_root%3F-instance_method "Padrino::Generators::Actions#in_app_root? (method)"), [#include\_component\_module\_for](actions#include_component_module_for-instance_method "Padrino::Generators::Actions#include_component_module_for (method)"), [#initializer](actions#initializer-instance_method "Padrino::Generators::Actions#initializer (method)"), [#inject\_into\_file](actions#inject_into_file-instance_method "Padrino::Generators::Actions#inject_into_file (method)"), [#insert\_hook](actions#insert_hook-instance_method "Padrino::Generators::Actions#insert_hook (method)"), [#insert\_into\_gemfile](actions#insert_into_gemfile-instance_method "Padrino::Generators::Actions#insert_into_gemfile (method)"), [#insert\_middleware](actions#insert_middleware-instance_method "Padrino::Generators::Actions#insert_middleware (method)"), [#invalid\_fields](actions#invalid_fields-instance_method "Padrino::Generators::Actions#invalid_fields (method)"), [#keep\_file](actions#keep_file-instance_method "Padrino::Generators::Actions#keep_file (method)"), [#middleware](actions#middleware-instance_method "Padrino::Generators::Actions#middleware (method)"), [#recognize\_path](actions#recognize_path-instance_method "Padrino::Generators::Actions#recognize_path (method)"), [#require\_contrib](actions#require_contrib-instance_method "Padrino::Generators::Actions#require_contrib (method)"), [#require\_dependencies](actions#require_dependencies-instance_method "Padrino::Generators::Actions#require_dependencies (method)"), [#resolve\_valid\_choice](actions#resolve_valid_choice-instance_method "Padrino::Generators::Actions#resolve_valid_choice (method)"), [#retrieve\_component\_config](actions#retrieve_component_config-instance_method "Padrino::Generators::Actions#retrieve_component_config (method)"), [#run\_bundler](actions#run_bundler-instance_method "Padrino::Generators::Actions#run_bundler (method)"), [#store\_component\_choice](actions#store_component_choice-instance_method "Padrino::Generators::Actions#store_component_choice (method)"), [#store\_component\_config](actions#store_component_config-instance_method "Padrino::Generators::Actions#store_component_config (method)"), [#test?](actions#test%3F-instance_method "Padrino::Generators::Actions#test? (method)"), [#tiny?](actions#tiny%3F-instance_method "Padrino::Generators::Actions#tiny? (method)"), [#valid\_choice?](actions#valid_choice%3F-instance_method "Padrino::Generators::Actions#valid_choice? (method)"), [#valid\_constant?](actions#valid_constant%3F-instance_method "Padrino::Generators::Actions#valid_constant? (method)"), [#validate\_namespace](actions#validate_namespace-instance_method "Padrino::Generators::Actions#validate_namespace (method)") Class Method Details -------------------- ### .banner ⇒ Object ### .source\_root ⇒ Object Instance Method Details ----------------------- ### #setup\_plugin ⇒ Object Create the Padrino Plugin.
programming_docs
padrino Class: Padrino::Generators::Controller Class: Padrino::Generators::Controller ====================================== Inherits: Thor::Group * [Object](../../object "Object (class)") * Thor::Group * Padrino::Generators::Controller Includes: [Actions](actions "Padrino::Generators::Actions (module)"), Padrino::Generators::Components::Actions, Thor::Actions Overview -------- Responsible for generating route controllers and associated tests within a Padrino application. Class Method Summary --------------------- * `[.**banner** ⇒ Object](controller#banner-class_method "banner (class method)")` * `[.**source\_root** ⇒ Object](controller#source_root-class_method "source_root (class method)")` Instance Method Summary ------------------------ * `[#**create\_controller** ⇒ Object](controller#create_controller-instance_method "#create_controller (instance method)")` Execute controller generation. ### Methods included from Actions [#already\_exists?](actions#already_exists%3F-instance_method "Padrino::Generators::Actions#already_exists? (method)"), [#app\_skeleton](actions#app_skeleton-instance_method "Padrino::Generators::Actions#app_skeleton (method)"), [#apply\_component\_for](actions#apply_component_for-instance_method "Padrino::Generators::Actions#apply_component_for (method)"), [#apply\_default\_fields](actions#apply_default_fields-instance_method "Padrino::Generators::Actions#apply_default_fields (method)"), [#check\_app\_existence](actions#check_app_existence-instance_method "Padrino::Generators::Actions#check_app_existence (method)"), [#destination\_root](actions#destination_root-instance_method "Padrino::Generators::Actions#destination_root (method)"), [#empty\_directory\_with\_keep\_file](actions#empty_directory_with_keep_file-instance_method "Padrino::Generators::Actions#empty_directory_with_keep_file (method)"), [#execute\_component\_setup](actions#execute_component_setup-instance_method "Padrino::Generators::Actions#execute_component_setup (method)"), [#fetch\_app\_name](actions#fetch_app_name-instance_method "Padrino::Generators::Actions#fetch_app_name (method)"), [#fetch\_component\_choice](actions#fetch_component_choice-instance_method "Padrino::Generators::Actions#fetch_component_choice (method)"), [#fetch\_project\_name](actions#fetch_project_name-instance_method "Padrino::Generators::Actions#fetch_project_name (method)"), [#in\_app\_root?](actions#in_app_root%3F-instance_method "Padrino::Generators::Actions#in_app_root? (method)"), [#include\_component\_module\_for](actions#include_component_module_for-instance_method "Padrino::Generators::Actions#include_component_module_for (method)"), [#initializer](actions#initializer-instance_method "Padrino::Generators::Actions#initializer (method)"), [#inject\_into\_file](actions#inject_into_file-instance_method "Padrino::Generators::Actions#inject_into_file (method)"), [#insert\_hook](actions#insert_hook-instance_method "Padrino::Generators::Actions#insert_hook (method)"), [#insert\_into\_gemfile](actions#insert_into_gemfile-instance_method "Padrino::Generators::Actions#insert_into_gemfile (method)"), [#insert\_middleware](actions#insert_middleware-instance_method "Padrino::Generators::Actions#insert_middleware (method)"), [#invalid\_fields](actions#invalid_fields-instance_method "Padrino::Generators::Actions#invalid_fields (method)"), [#keep\_file](actions#keep_file-instance_method "Padrino::Generators::Actions#keep_file (method)"), [#middleware](actions#middleware-instance_method "Padrino::Generators::Actions#middleware (method)"), [#recognize\_path](actions#recognize_path-instance_method "Padrino::Generators::Actions#recognize_path (method)"), [#require\_contrib](actions#require_contrib-instance_method "Padrino::Generators::Actions#require_contrib (method)"), [#require\_dependencies](actions#require_dependencies-instance_method "Padrino::Generators::Actions#require_dependencies (method)"), [#resolve\_valid\_choice](actions#resolve_valid_choice-instance_method "Padrino::Generators::Actions#resolve_valid_choice (method)"), [#retrieve\_component\_config](actions#retrieve_component_config-instance_method "Padrino::Generators::Actions#retrieve_component_config (method)"), [#run\_bundler](actions#run_bundler-instance_method "Padrino::Generators::Actions#run_bundler (method)"), [#store\_component\_choice](actions#store_component_choice-instance_method "Padrino::Generators::Actions#store_component_choice (method)"), [#store\_component\_config](actions#store_component_config-instance_method "Padrino::Generators::Actions#store_component_config (method)"), [#test?](actions#test%3F-instance_method "Padrino::Generators::Actions#test? (method)"), [#tiny?](actions#tiny%3F-instance_method "Padrino::Generators::Actions#tiny? (method)"), [#valid\_choice?](actions#valid_choice%3F-instance_method "Padrino::Generators::Actions#valid_choice? (method)"), [#valid\_constant?](actions#valid_constant%3F-instance_method "Padrino::Generators::Actions#valid_constant? (method)"), [#validate\_namespace](actions#validate_namespace-instance_method "Padrino::Generators::Actions#validate_namespace (method)") Class Method Details -------------------- ### .banner ⇒ Object ### .source\_root ⇒ Object Instance Method Details ----------------------- ### #create\_controller ⇒ Object Execute controller generation padrino Class: Padrino::Generators::Cli Class: Padrino::Generators::Cli =============================== Inherits: Thor::Group * [Object](../../object "Object (class)") * Thor::Group * Padrino::Generators::Cli Includes: Thor::Actions Overview -------- This class bootstrap `config/boot` and perform `Padrino::Generators.load_components!` for handle 3rd party generators. Instance Method Summary ------------------------ * `[#**load\_boot** ⇒ Object](cli#load_boot-instance_method "#load_boot (instance method)")` We need to try to load boot because some of our app dependencies maybe have custom generators, so is necessary know who are. * `[#**setup** ⇒ Object](cli#setup-instance_method "#setup (instance method)")` Loads the components available for all generators. Instance Method Details ----------------------- ### #load\_boot ⇒ Object We need to try to load boot because some of our app dependencies maybe have custom generators, so is necessary know who are. ### #setup ⇒ Object Loads the components available for all generators. padrino Class: Padrino::Generators::Mailer Class: Padrino::Generators::Mailer ================================== Inherits: Thor::Group * [Object](../../object "Object (class)") * Thor::Group * Padrino::Generators::Mailer Includes: [Actions](actions "Padrino::Generators::Actions (module)"), Components::Actions, Thor::Actions Overview -------- Responsible for the generating mailers and message definitions. Class Method Summary --------------------- * `[.**banner** ⇒ Object](mailer#banner-class_method "banner (class method)")` * `[.**source\_root** ⇒ Object](mailer#source_root-class_method "source_root (class method)")` Instance Method Summary ------------------------ * `[#**create\_mailer** ⇒ Object](mailer#create_mailer-instance_method "#create_mailer (instance method)")` Execute mailer generation. ### Methods included from Actions [#already\_exists?](actions#already_exists%3F-instance_method "Padrino::Generators::Actions#already_exists? (method)"), [#app\_skeleton](actions#app_skeleton-instance_method "Padrino::Generators::Actions#app_skeleton (method)"), [#apply\_component\_for](actions#apply_component_for-instance_method "Padrino::Generators::Actions#apply_component_for (method)"), [#apply\_default\_fields](actions#apply_default_fields-instance_method "Padrino::Generators::Actions#apply_default_fields (method)"), [#check\_app\_existence](actions#check_app_existence-instance_method "Padrino::Generators::Actions#check_app_existence (method)"), [#destination\_root](actions#destination_root-instance_method "Padrino::Generators::Actions#destination_root (method)"), [#empty\_directory\_with\_keep\_file](actions#empty_directory_with_keep_file-instance_method "Padrino::Generators::Actions#empty_directory_with_keep_file (method)"), [#execute\_component\_setup](actions#execute_component_setup-instance_method "Padrino::Generators::Actions#execute_component_setup (method)"), [#fetch\_app\_name](actions#fetch_app_name-instance_method "Padrino::Generators::Actions#fetch_app_name (method)"), [#fetch\_component\_choice](actions#fetch_component_choice-instance_method "Padrino::Generators::Actions#fetch_component_choice (method)"), [#fetch\_project\_name](actions#fetch_project_name-instance_method "Padrino::Generators::Actions#fetch_project_name (method)"), [#in\_app\_root?](actions#in_app_root%3F-instance_method "Padrino::Generators::Actions#in_app_root? (method)"), [#include\_component\_module\_for](actions#include_component_module_for-instance_method "Padrino::Generators::Actions#include_component_module_for (method)"), [#initializer](actions#initializer-instance_method "Padrino::Generators::Actions#initializer (method)"), [#inject\_into\_file](actions#inject_into_file-instance_method "Padrino::Generators::Actions#inject_into_file (method)"), [#insert\_hook](actions#insert_hook-instance_method "Padrino::Generators::Actions#insert_hook (method)"), [#insert\_into\_gemfile](actions#insert_into_gemfile-instance_method "Padrino::Generators::Actions#insert_into_gemfile (method)"), [#insert\_middleware](actions#insert_middleware-instance_method "Padrino::Generators::Actions#insert_middleware (method)"), [#invalid\_fields](actions#invalid_fields-instance_method "Padrino::Generators::Actions#invalid_fields (method)"), [#keep\_file](actions#keep_file-instance_method "Padrino::Generators::Actions#keep_file (method)"), [#middleware](actions#middleware-instance_method "Padrino::Generators::Actions#middleware (method)"), [#recognize\_path](actions#recognize_path-instance_method "Padrino::Generators::Actions#recognize_path (method)"), [#require\_contrib](actions#require_contrib-instance_method "Padrino::Generators::Actions#require_contrib (method)"), [#require\_dependencies](actions#require_dependencies-instance_method "Padrino::Generators::Actions#require_dependencies (method)"), [#resolve\_valid\_choice](actions#resolve_valid_choice-instance_method "Padrino::Generators::Actions#resolve_valid_choice (method)"), [#retrieve\_component\_config](actions#retrieve_component_config-instance_method "Padrino::Generators::Actions#retrieve_component_config (method)"), [#run\_bundler](actions#run_bundler-instance_method "Padrino::Generators::Actions#run_bundler (method)"), [#store\_component\_choice](actions#store_component_choice-instance_method "Padrino::Generators::Actions#store_component_choice (method)"), [#store\_component\_config](actions#store_component_config-instance_method "Padrino::Generators::Actions#store_component_config (method)"), [#test?](actions#test%3F-instance_method "Padrino::Generators::Actions#test? (method)"), [#tiny?](actions#tiny%3F-instance_method "Padrino::Generators::Actions#tiny? (method)"), [#valid\_choice?](actions#valid_choice%3F-instance_method "Padrino::Generators::Actions#valid_choice? (method)"), [#valid\_constant?](actions#valid_constant%3F-instance_method "Padrino::Generators::Actions#valid_constant? (method)"), [#validate\_namespace](actions#validate_namespace-instance_method "Padrino::Generators::Actions#validate_namespace (method)") Class Method Details -------------------- ### .banner ⇒ Object ### .source\_root ⇒ Object Instance Method Details ----------------------- ### #create\_mailer ⇒ Object Execute mailer generation. padrino Class: Padrino::Generators::Migration Class: Padrino::Generators::Migration ===================================== Inherits: Thor::Group * [Object](../../object "Object (class)") * Thor::Group * Padrino::Generators::Migration Includes: [Actions](actions "Padrino::Generators::Actions (module)"), Components::Actions, Thor::Actions Overview -------- Responsible for generating migration files for the appropriate ORM component. Class Method Summary --------------------- * `[.**banner** ⇒ Object](migration#banner-class_method "banner (class method)")` * `[.**source\_root** ⇒ Object](migration#source_root-class_method "source_root (class method)")` Instance Method Summary ------------------------ * `[#**create\_migration** ⇒ Object](migration#create_migration-instance_method "#create_migration (instance method)")` Creates the migration file within a Padrino project. ### Methods included from Actions [#already\_exists?](actions#already_exists%3F-instance_method "Padrino::Generators::Actions#already_exists? (method)"), [#app\_skeleton](actions#app_skeleton-instance_method "Padrino::Generators::Actions#app_skeleton (method)"), [#apply\_component\_for](actions#apply_component_for-instance_method "Padrino::Generators::Actions#apply_component_for (method)"), [#apply\_default\_fields](actions#apply_default_fields-instance_method "Padrino::Generators::Actions#apply_default_fields (method)"), [#check\_app\_existence](actions#check_app_existence-instance_method "Padrino::Generators::Actions#check_app_existence (method)"), [#destination\_root](actions#destination_root-instance_method "Padrino::Generators::Actions#destination_root (method)"), [#empty\_directory\_with\_keep\_file](actions#empty_directory_with_keep_file-instance_method "Padrino::Generators::Actions#empty_directory_with_keep_file (method)"), [#execute\_component\_setup](actions#execute_component_setup-instance_method "Padrino::Generators::Actions#execute_component_setup (method)"), [#fetch\_app\_name](actions#fetch_app_name-instance_method "Padrino::Generators::Actions#fetch_app_name (method)"), [#fetch\_component\_choice](actions#fetch_component_choice-instance_method "Padrino::Generators::Actions#fetch_component_choice (method)"), [#fetch\_project\_name](actions#fetch_project_name-instance_method "Padrino::Generators::Actions#fetch_project_name (method)"), [#in\_app\_root?](actions#in_app_root%3F-instance_method "Padrino::Generators::Actions#in_app_root? (method)"), [#include\_component\_module\_for](actions#include_component_module_for-instance_method "Padrino::Generators::Actions#include_component_module_for (method)"), [#initializer](actions#initializer-instance_method "Padrino::Generators::Actions#initializer (method)"), [#inject\_into\_file](actions#inject_into_file-instance_method "Padrino::Generators::Actions#inject_into_file (method)"), [#insert\_hook](actions#insert_hook-instance_method "Padrino::Generators::Actions#insert_hook (method)"), [#insert\_into\_gemfile](actions#insert_into_gemfile-instance_method "Padrino::Generators::Actions#insert_into_gemfile (method)"), [#insert\_middleware](actions#insert_middleware-instance_method "Padrino::Generators::Actions#insert_middleware (method)"), [#invalid\_fields](actions#invalid_fields-instance_method "Padrino::Generators::Actions#invalid_fields (method)"), [#keep\_file](actions#keep_file-instance_method "Padrino::Generators::Actions#keep_file (method)"), [#middleware](actions#middleware-instance_method "Padrino::Generators::Actions#middleware (method)"), [#recognize\_path](actions#recognize_path-instance_method "Padrino::Generators::Actions#recognize_path (method)"), [#require\_contrib](actions#require_contrib-instance_method "Padrino::Generators::Actions#require_contrib (method)"), [#require\_dependencies](actions#require_dependencies-instance_method "Padrino::Generators::Actions#require_dependencies (method)"), [#resolve\_valid\_choice](actions#resolve_valid_choice-instance_method "Padrino::Generators::Actions#resolve_valid_choice (method)"), [#retrieve\_component\_config](actions#retrieve_component_config-instance_method "Padrino::Generators::Actions#retrieve_component_config (method)"), [#run\_bundler](actions#run_bundler-instance_method "Padrino::Generators::Actions#run_bundler (method)"), [#store\_component\_choice](actions#store_component_choice-instance_method "Padrino::Generators::Actions#store_component_choice (method)"), [#store\_component\_config](actions#store_component_config-instance_method "Padrino::Generators::Actions#store_component_config (method)"), [#test?](actions#test%3F-instance_method "Padrino::Generators::Actions#test? (method)"), [#tiny?](actions#tiny%3F-instance_method "Padrino::Generators::Actions#tiny? (method)"), [#valid\_choice?](actions#valid_choice%3F-instance_method "Padrino::Generators::Actions#valid_choice? (method)"), [#valid\_constant?](actions#valid_constant%3F-instance_method "Padrino::Generators::Actions#valid_constant? (method)"), [#validate\_namespace](actions#validate_namespace-instance_method "Padrino::Generators::Actions#validate_namespace (method)") Class Method Details -------------------- ### .banner ⇒ Object ### .source\_root ⇒ Object Instance Method Details ----------------------- ### #create\_migration ⇒ Object Creates the migration file within a Padrino project. padrino Class: Padrino::Generators::Task Class: Padrino::Generators::Task ================================ Inherits: Thor::Group * [Object](../../object "Object (class)") * Thor::Group * Padrino::Generators::Task Includes: [Actions](actions "Padrino::Generators::Actions (module)"), Components::Actions, Thor::Actions Overview -------- Responsible for generating new task file for Padrino application. Class Method Summary --------------------- * `[.**banner** ⇒ Object](task#banner-class_method "banner (class method)")` * `[.**source\_root** ⇒ Object](task#source_root-class_method "source_root (class method)")` Instance Method Summary ------------------------ * `[#**create\_task** ⇒ Object](task#create_task-instance_method "#create_task (instance method)")` ### Methods included from Actions [#already\_exists?](actions#already_exists%3F-instance_method "Padrino::Generators::Actions#already_exists? (method)"), [#app\_skeleton](actions#app_skeleton-instance_method "Padrino::Generators::Actions#app_skeleton (method)"), [#apply\_component\_for](actions#apply_component_for-instance_method "Padrino::Generators::Actions#apply_component_for (method)"), [#apply\_default\_fields](actions#apply_default_fields-instance_method "Padrino::Generators::Actions#apply_default_fields (method)"), [#check\_app\_existence](actions#check_app_existence-instance_method "Padrino::Generators::Actions#check_app_existence (method)"), [#destination\_root](actions#destination_root-instance_method "Padrino::Generators::Actions#destination_root (method)"), [#empty\_directory\_with\_keep\_file](actions#empty_directory_with_keep_file-instance_method "Padrino::Generators::Actions#empty_directory_with_keep_file (method)"), [#execute\_component\_setup](actions#execute_component_setup-instance_method "Padrino::Generators::Actions#execute_component_setup (method)"), [#fetch\_app\_name](actions#fetch_app_name-instance_method "Padrino::Generators::Actions#fetch_app_name (method)"), [#fetch\_component\_choice](actions#fetch_component_choice-instance_method "Padrino::Generators::Actions#fetch_component_choice (method)"), [#fetch\_project\_name](actions#fetch_project_name-instance_method "Padrino::Generators::Actions#fetch_project_name (method)"), [#in\_app\_root?](actions#in_app_root%3F-instance_method "Padrino::Generators::Actions#in_app_root? (method)"), [#include\_component\_module\_for](actions#include_component_module_for-instance_method "Padrino::Generators::Actions#include_component_module_for (method)"), [#initializer](actions#initializer-instance_method "Padrino::Generators::Actions#initializer (method)"), [#inject\_into\_file](actions#inject_into_file-instance_method "Padrino::Generators::Actions#inject_into_file (method)"), [#insert\_hook](actions#insert_hook-instance_method "Padrino::Generators::Actions#insert_hook (method)"), [#insert\_into\_gemfile](actions#insert_into_gemfile-instance_method "Padrino::Generators::Actions#insert_into_gemfile (method)"), [#insert\_middleware](actions#insert_middleware-instance_method "Padrino::Generators::Actions#insert_middleware (method)"), [#invalid\_fields](actions#invalid_fields-instance_method "Padrino::Generators::Actions#invalid_fields (method)"), [#keep\_file](actions#keep_file-instance_method "Padrino::Generators::Actions#keep_file (method)"), [#middleware](actions#middleware-instance_method "Padrino::Generators::Actions#middleware (method)"), [#recognize\_path](actions#recognize_path-instance_method "Padrino::Generators::Actions#recognize_path (method)"), [#require\_contrib](actions#require_contrib-instance_method "Padrino::Generators::Actions#require_contrib (method)"), [#require\_dependencies](actions#require_dependencies-instance_method "Padrino::Generators::Actions#require_dependencies (method)"), [#resolve\_valid\_choice](actions#resolve_valid_choice-instance_method "Padrino::Generators::Actions#resolve_valid_choice (method)"), [#retrieve\_component\_config](actions#retrieve_component_config-instance_method "Padrino::Generators::Actions#retrieve_component_config (method)"), [#run\_bundler](actions#run_bundler-instance_method "Padrino::Generators::Actions#run_bundler (method)"), [#store\_component\_choice](actions#store_component_choice-instance_method "Padrino::Generators::Actions#store_component_choice (method)"), [#store\_component\_config](actions#store_component_config-instance_method "Padrino::Generators::Actions#store_component_config (method)"), [#test?](actions#test%3F-instance_method "Padrino::Generators::Actions#test? (method)"), [#tiny?](actions#tiny%3F-instance_method "Padrino::Generators::Actions#tiny? (method)"), [#valid\_choice?](actions#valid_choice%3F-instance_method "Padrino::Generators::Actions#valid_choice? (method)"), [#valid\_constant?](actions#valid_constant%3F-instance_method "Padrino::Generators::Actions#valid_constant? (method)"), [#validate\_namespace](actions#validate_namespace-instance_method "Padrino::Generators::Actions#validate_namespace (method)") Class Method Details -------------------- ### .banner ⇒ Object ### .source\_root ⇒ Object Instance Method Details ----------------------- ### #create\_task ⇒ Object
programming_docs
padrino Class: Padrino::Generators::Project Class: Padrino::Generators::Project =================================== Inherits: Thor::Group * [Object](../../object "Object (class)") * Thor::Group * Padrino::Generators::Project Includes: [Actions](actions "Padrino::Generators::Actions (module)"), Components::Actions, [Runner](runner "Padrino::Generators::Runner (module)"), Thor::Actions Overview -------- Responsible for generating new Padrino projects based on the specified project components. Class Method Summary --------------------- * `[.**banner** ⇒ Object](project#banner-class_method "banner (class method)")` * `[.**source\_root** ⇒ Object](project#source_root-class_method "source_root (class method)")` Instance Method Summary ------------------------ * `[#**bundle\_dependencies** ⇒ Object](project#bundle_dependencies-instance_method "#bundle_dependencies (instance method)")` Bundle all required components using bundler and Gemfile. * `[#**finish\_message** ⇒ Object](project#finish_message-instance_method "#finish_message (instance method)")` Finish message. * `[#**git\_author\_email** ⇒ Object](project#git_author_email-instance_method "#git_author_email (instance method)")` Returns the git author email config or a fill-in value. * `[#**git\_author\_name** ⇒ Object](project#git_author_name-instance_method "#git_author_name (instance method)")` Returns the git author name config or a fill-in value. * `[#**setup\_components** ⇒ Object](project#setup_components-instance_method "#setup_components (instance method)")` For each component, retrieve a valid choice and then execute the associated generator. * `[#**setup\_project** ⇒ Object](project#setup_project-instance_method "#setup_project (instance method)")` Copies over the Padrino base application app. * `[#**setup\_test\_files** ⇒ Object](project#setup_test_files-instance_method "#setup_test_files (instance method)")` Generates test files for tiny app skeleton. ### Methods included from Runner [#app](runner#app-instance_method "Padrino::Generators::Runner#app (method)"), [#generate](runner#generate-instance_method "Padrino::Generators::Runner#generate (method)"), [#git](runner#git-instance_method "Padrino::Generators::Runner#git (method)"), [#project](runner#project-instance_method "Padrino::Generators::Runner#project (method)"), [#rake](runner#rake-instance_method "Padrino::Generators::Runner#rake (method)") ### Methods included from Actions [#already\_exists?](actions#already_exists%3F-instance_method "Padrino::Generators::Actions#already_exists? (method)"), [#app\_skeleton](actions#app_skeleton-instance_method "Padrino::Generators::Actions#app_skeleton (method)"), [#apply\_component\_for](actions#apply_component_for-instance_method "Padrino::Generators::Actions#apply_component_for (method)"), [#apply\_default\_fields](actions#apply_default_fields-instance_method "Padrino::Generators::Actions#apply_default_fields (method)"), [#check\_app\_existence](actions#check_app_existence-instance_method "Padrino::Generators::Actions#check_app_existence (method)"), [#destination\_root](actions#destination_root-instance_method "Padrino::Generators::Actions#destination_root (method)"), [#empty\_directory\_with\_keep\_file](actions#empty_directory_with_keep_file-instance_method "Padrino::Generators::Actions#empty_directory_with_keep_file (method)"), [#execute\_component\_setup](actions#execute_component_setup-instance_method "Padrino::Generators::Actions#execute_component_setup (method)"), [#fetch\_app\_name](actions#fetch_app_name-instance_method "Padrino::Generators::Actions#fetch_app_name (method)"), [#fetch\_component\_choice](actions#fetch_component_choice-instance_method "Padrino::Generators::Actions#fetch_component_choice (method)"), [#fetch\_project\_name](actions#fetch_project_name-instance_method "Padrino::Generators::Actions#fetch_project_name (method)"), [#in\_app\_root?](actions#in_app_root%3F-instance_method "Padrino::Generators::Actions#in_app_root? (method)"), [#include\_component\_module\_for](actions#include_component_module_for-instance_method "Padrino::Generators::Actions#include_component_module_for (method)"), [#initializer](actions#initializer-instance_method "Padrino::Generators::Actions#initializer (method)"), [#inject\_into\_file](actions#inject_into_file-instance_method "Padrino::Generators::Actions#inject_into_file (method)"), [#insert\_hook](actions#insert_hook-instance_method "Padrino::Generators::Actions#insert_hook (method)"), [#insert\_into\_gemfile](actions#insert_into_gemfile-instance_method "Padrino::Generators::Actions#insert_into_gemfile (method)"), [#insert\_middleware](actions#insert_middleware-instance_method "Padrino::Generators::Actions#insert_middleware (method)"), [#invalid\_fields](actions#invalid_fields-instance_method "Padrino::Generators::Actions#invalid_fields (method)"), [#keep\_file](actions#keep_file-instance_method "Padrino::Generators::Actions#keep_file (method)"), [#middleware](actions#middleware-instance_method "Padrino::Generators::Actions#middleware (method)"), [#recognize\_path](actions#recognize_path-instance_method "Padrino::Generators::Actions#recognize_path (method)"), [#require\_contrib](actions#require_contrib-instance_method "Padrino::Generators::Actions#require_contrib (method)"), [#require\_dependencies](actions#require_dependencies-instance_method "Padrino::Generators::Actions#require_dependencies (method)"), [#resolve\_valid\_choice](actions#resolve_valid_choice-instance_method "Padrino::Generators::Actions#resolve_valid_choice (method)"), [#retrieve\_component\_config](actions#retrieve_component_config-instance_method "Padrino::Generators::Actions#retrieve_component_config (method)"), [#run\_bundler](actions#run_bundler-instance_method "Padrino::Generators::Actions#run_bundler (method)"), [#store\_component\_choice](actions#store_component_choice-instance_method "Padrino::Generators::Actions#store_component_choice (method)"), [#store\_component\_config](actions#store_component_config-instance_method "Padrino::Generators::Actions#store_component_config (method)"), [#test?](actions#test%3F-instance_method "Padrino::Generators::Actions#test? (method)"), [#tiny?](actions#tiny%3F-instance_method "Padrino::Generators::Actions#tiny? (method)"), [#valid\_choice?](actions#valid_choice%3F-instance_method "Padrino::Generators::Actions#valid_choice? (method)"), [#valid\_constant?](actions#valid_constant%3F-instance_method "Padrino::Generators::Actions#valid_constant? (method)"), [#validate\_namespace](actions#validate_namespace-instance_method "Padrino::Generators::Actions#validate_namespace (method)") Class Method Details -------------------- ### .banner ⇒ Object ### .source\_root ⇒ Object Instance Method Details ----------------------- ### #bundle\_dependencies ⇒ Object Bundle all required components using bundler and Gemfile. ### #finish\_message ⇒ Object Finish message. ### #git\_author\_email ⇒ Object Returns the git author email config or a fill-in value. ### #git\_author\_name ⇒ Object Returns the git author name config or a fill-in value. ### #setup\_components ⇒ Object For each component, retrieve a valid choice and then execute the associated generator. ### #setup\_project ⇒ Object Copies over the Padrino base application app. ### #setup\_test\_files ⇒ Object Generates test files for tiny app skeleton. padrino Class: Padrino::Generators::App Class: Padrino::Generators::App =============================== Inherits: Thor::Group * [Object](../../object "Object (class)") * Thor::Group * Padrino::Generators::App Includes: [Actions](actions "Padrino::Generators::Actions (module)"), Thor::Actions Overview -------- Responsible for applications within a Padrino project. Creates and mounts the application and gives the user related information. Class Method Summary --------------------- * `[.**banner** ⇒ Object](app#banner-class_method "banner (class method)")` * `[.**source\_root** ⇒ Object](app#source_root-class_method "source_root (class method)")` Instance Method Summary ------------------------ * `[#**create\_app** ⇒ Object](app#create_app-instance_method "#create_app (instance method)")` Copies over the Padrino base admin application. ### Methods included from Actions [#already\_exists?](actions#already_exists%3F-instance_method "Padrino::Generators::Actions#already_exists? (method)"), [#app\_skeleton](actions#app_skeleton-instance_method "Padrino::Generators::Actions#app_skeleton (method)"), [#apply\_component\_for](actions#apply_component_for-instance_method "Padrino::Generators::Actions#apply_component_for (method)"), [#apply\_default\_fields](actions#apply_default_fields-instance_method "Padrino::Generators::Actions#apply_default_fields (method)"), [#check\_app\_existence](actions#check_app_existence-instance_method "Padrino::Generators::Actions#check_app_existence (method)"), [#destination\_root](actions#destination_root-instance_method "Padrino::Generators::Actions#destination_root (method)"), [#empty\_directory\_with\_keep\_file](actions#empty_directory_with_keep_file-instance_method "Padrino::Generators::Actions#empty_directory_with_keep_file (method)"), [#execute\_component\_setup](actions#execute_component_setup-instance_method "Padrino::Generators::Actions#execute_component_setup (method)"), [#fetch\_app\_name](actions#fetch_app_name-instance_method "Padrino::Generators::Actions#fetch_app_name (method)"), [#fetch\_component\_choice](actions#fetch_component_choice-instance_method "Padrino::Generators::Actions#fetch_component_choice (method)"), [#fetch\_project\_name](actions#fetch_project_name-instance_method "Padrino::Generators::Actions#fetch_project_name (method)"), [#in\_app\_root?](actions#in_app_root%3F-instance_method "Padrino::Generators::Actions#in_app_root? (method)"), [#include\_component\_module\_for](actions#include_component_module_for-instance_method "Padrino::Generators::Actions#include_component_module_for (method)"), [#initializer](actions#initializer-instance_method "Padrino::Generators::Actions#initializer (method)"), [#inject\_into\_file](actions#inject_into_file-instance_method "Padrino::Generators::Actions#inject_into_file (method)"), [#insert\_hook](actions#insert_hook-instance_method "Padrino::Generators::Actions#insert_hook (method)"), [#insert\_into\_gemfile](actions#insert_into_gemfile-instance_method "Padrino::Generators::Actions#insert_into_gemfile (method)"), [#insert\_middleware](actions#insert_middleware-instance_method "Padrino::Generators::Actions#insert_middleware (method)"), [#invalid\_fields](actions#invalid_fields-instance_method "Padrino::Generators::Actions#invalid_fields (method)"), [#keep\_file](actions#keep_file-instance_method "Padrino::Generators::Actions#keep_file (method)"), [#middleware](actions#middleware-instance_method "Padrino::Generators::Actions#middleware (method)"), [#recognize\_path](actions#recognize_path-instance_method "Padrino::Generators::Actions#recognize_path (method)"), [#require\_contrib](actions#require_contrib-instance_method "Padrino::Generators::Actions#require_contrib (method)"), [#require\_dependencies](actions#require_dependencies-instance_method "Padrino::Generators::Actions#require_dependencies (method)"), [#resolve\_valid\_choice](actions#resolve_valid_choice-instance_method "Padrino::Generators::Actions#resolve_valid_choice (method)"), [#retrieve\_component\_config](actions#retrieve_component_config-instance_method "Padrino::Generators::Actions#retrieve_component_config (method)"), [#run\_bundler](actions#run_bundler-instance_method "Padrino::Generators::Actions#run_bundler (method)"), [#store\_component\_choice](actions#store_component_choice-instance_method "Padrino::Generators::Actions#store_component_choice (method)"), [#store\_component\_config](actions#store_component_config-instance_method "Padrino::Generators::Actions#store_component_config (method)"), [#test?](actions#test%3F-instance_method "Padrino::Generators::Actions#test? (method)"), [#tiny?](actions#tiny%3F-instance_method "Padrino::Generators::Actions#tiny? (method)"), [#valid\_choice?](actions#valid_choice%3F-instance_method "Padrino::Generators::Actions#valid_choice? (method)"), [#valid\_constant?](actions#valid_constant%3F-instance_method "Padrino::Generators::Actions#valid_constant? (method)"), [#validate\_namespace](actions#validate_namespace-instance_method "Padrino::Generators::Actions#validate_namespace (method)") Class Method Details -------------------- ### .banner ⇒ Object ### .source\_root ⇒ Object Instance Method Details ----------------------- ### #create\_app ⇒ Object Copies over the Padrino base admin application. padrino Class: Padrino::Generators::Model Class: Padrino::Generators::Model ================================= Inherits: Thor::Group * [Object](../../object "Object (class)") * Thor::Group * Padrino::Generators::Model Includes: [Actions](actions "Padrino::Generators::Actions (module)"), Components::Actions, Thor::Actions Overview -------- Responsible for generating new models for the specified ORM component. Class Method Summary --------------------- * `[.**banner** ⇒ Object](model#banner-class_method "banner (class method)")` * `[.**source\_root** ⇒ Object](model#source_root-class_method "source_root (class method)")` Instance Method Summary ------------------------ * `[#**create\_model** ⇒ Object](model#create_model-instance_method "#create_model (instance method)")` Execute the model generation. ### Methods included from Actions [#already\_exists?](actions#already_exists%3F-instance_method "Padrino::Generators::Actions#already_exists? (method)"), [#app\_skeleton](actions#app_skeleton-instance_method "Padrino::Generators::Actions#app_skeleton (method)"), [#apply\_component\_for](actions#apply_component_for-instance_method "Padrino::Generators::Actions#apply_component_for (method)"), [#apply\_default\_fields](actions#apply_default_fields-instance_method "Padrino::Generators::Actions#apply_default_fields (method)"), [#check\_app\_existence](actions#check_app_existence-instance_method "Padrino::Generators::Actions#check_app_existence (method)"), [#destination\_root](actions#destination_root-instance_method "Padrino::Generators::Actions#destination_root (method)"), [#empty\_directory\_with\_keep\_file](actions#empty_directory_with_keep_file-instance_method "Padrino::Generators::Actions#empty_directory_with_keep_file (method)"), [#execute\_component\_setup](actions#execute_component_setup-instance_method "Padrino::Generators::Actions#execute_component_setup (method)"), [#fetch\_app\_name](actions#fetch_app_name-instance_method "Padrino::Generators::Actions#fetch_app_name (method)"), [#fetch\_component\_choice](actions#fetch_component_choice-instance_method "Padrino::Generators::Actions#fetch_component_choice (method)"), [#fetch\_project\_name](actions#fetch_project_name-instance_method "Padrino::Generators::Actions#fetch_project_name (method)"), [#in\_app\_root?](actions#in_app_root%3F-instance_method "Padrino::Generators::Actions#in_app_root? (method)"), [#include\_component\_module\_for](actions#include_component_module_for-instance_method "Padrino::Generators::Actions#include_component_module_for (method)"), [#initializer](actions#initializer-instance_method "Padrino::Generators::Actions#initializer (method)"), [#inject\_into\_file](actions#inject_into_file-instance_method "Padrino::Generators::Actions#inject_into_file (method)"), [#insert\_hook](actions#insert_hook-instance_method "Padrino::Generators::Actions#insert_hook (method)"), [#insert\_into\_gemfile](actions#insert_into_gemfile-instance_method "Padrino::Generators::Actions#insert_into_gemfile (method)"), [#insert\_middleware](actions#insert_middleware-instance_method "Padrino::Generators::Actions#insert_middleware (method)"), [#invalid\_fields](actions#invalid_fields-instance_method "Padrino::Generators::Actions#invalid_fields (method)"), [#keep\_file](actions#keep_file-instance_method "Padrino::Generators::Actions#keep_file (method)"), [#middleware](actions#middleware-instance_method "Padrino::Generators::Actions#middleware (method)"), [#recognize\_path](actions#recognize_path-instance_method "Padrino::Generators::Actions#recognize_path (method)"), [#require\_contrib](actions#require_contrib-instance_method "Padrino::Generators::Actions#require_contrib (method)"), [#require\_dependencies](actions#require_dependencies-instance_method "Padrino::Generators::Actions#require_dependencies (method)"), [#resolve\_valid\_choice](actions#resolve_valid_choice-instance_method "Padrino::Generators::Actions#resolve_valid_choice (method)"), [#retrieve\_component\_config](actions#retrieve_component_config-instance_method "Padrino::Generators::Actions#retrieve_component_config (method)"), [#run\_bundler](actions#run_bundler-instance_method "Padrino::Generators::Actions#run_bundler (method)"), [#store\_component\_choice](actions#store_component_choice-instance_method "Padrino::Generators::Actions#store_component_choice (method)"), [#store\_component\_config](actions#store_component_config-instance_method "Padrino::Generators::Actions#store_component_config (method)"), [#test?](actions#test%3F-instance_method "Padrino::Generators::Actions#test? (method)"), [#tiny?](actions#tiny%3F-instance_method "Padrino::Generators::Actions#tiny? (method)"), [#valid\_choice?](actions#valid_choice%3F-instance_method "Padrino::Generators::Actions#valid_choice? (method)"), [#valid\_constant?](actions#valid_constant%3F-instance_method "Padrino::Generators::Actions#valid_constant? (method)"), [#validate\_namespace](actions#validate_namespace-instance_method "Padrino::Generators::Actions#validate_namespace (method)") Class Method Details -------------------- ### .banner ⇒ Object ### .source\_root ⇒ Object Instance Method Details ----------------------- ### #create\_model ⇒ Object Execute the model generation. padrino Module: Padrino::Generators::Admin::Actions Module: Padrino::Generators::Admin::Actions =========================================== Included in: [Padrino::Generators::AdminApp](../adminapp "Padrino::Generators::AdminApp (class)"), [Padrino::Generators::AdminPage](../adminpage "Padrino::Generators::AdminPage (class)") Overview -------- Important tasks for setting up or configuring the admin application. Instance Method Summary ------------------------ * `[#**add\_project\_module**(controller) ⇒ Object](actions#add_project_module-instance_method "#add_project_module (instance method)")` Add access\_control permission in our app.rb. * `[#**ext** ⇒ Object](actions#ext-instance_method "#ext (instance method)")` Tell us which rendering engine you are using. * `[#**fetch\_app\_name**(app = 'app') ⇒ String](actions#fetch_app_name-instance_method "#fetch_app_name (instance method)")` Returns the app\_name for the application at root. * `[#**orm** ⇒ Object](actions#orm-instance_method "#orm (instance method)") (also: #adapter)` Tell us which orm we are using. * `[#**remove\_project\_module**(controller) ⇒ Object](actions#remove_project_module-instance_method "#remove_project_module (instance method)")` Remove from access\_control permissions. * `[#**supported\_ext** ⇒ Object](actions#supported_ext-instance_method "#supported_ext (instance method)")` Tell us for now which rendering engine we support. * `[#**supported\_orm** ⇒ Object](actions#supported_orm-instance_method "#supported_orm (instance method)")` Tell us for now which orm we support. Instance Method Details ----------------------- ### #add\_project\_module(controller) ⇒ Object Add access\_control permission in our app.rb. ### #ext ⇒ Object Tell us which rendering engine you are using. ### #fetch\_app\_name(app = 'app') ⇒ String Returns the app\_name for the application at root. #### Examples: ``` fetch_app_name('subapp') ``` #### Parameters: * `app` (`[String](../../../string "String (class)")`) *(defaults to: `'app'`)* — folder name of application. #### Returns: * (`[String](../../../string "String (class)")`) — module name for application. ### #orm ⇒ Object Also known as: adapter Tell us which orm we are using. ### #remove\_project\_module(controller) ⇒ Object Remove from access\_control permissions. ### #supported\_ext ⇒ Object Tell us for now which rendering engine we support. ### #supported\_orm ⇒ Object Tell us for now which orm we support
programming_docs
padrino Module: Padrino::Generators::Actions::ClassMethods Module: Padrino::Generators::Actions::ClassMethods ================================================== Overview -------- Class methods for Thor generators to support the generators and component choices. Instance Method Summary ------------------------ * `[#**available\_choices\_for**(component) ⇒ Array<Symbol>](classmethods#available_choices_for-instance_method "#available_choices_for (instance method)")` Returns the list of available choices for the given component (including none). * `[#**component\_option**(name, caption, options = {}) ⇒ Object](classmethods#component_option-instance_method "#component_option (instance method)")` Defines a class option to allow a component to be chosen and add to component type list. * `[#**component\_types** ⇒ Object](classmethods#component_types-instance_method "#component_types (instance method)")` Returns the compiled list of component types which can be specified. * `[#**defines\_component\_options**(options = {}) ⇒ Object](classmethods#defines_component_options-instance_method "#defines_component_options (instance method)")` Definitions for the available customizable components. * `[#**require\_arguments!** ⇒ Object](classmethods#require_arguments!-instance_method "#require_arguments! (instance method)")` Tells Padrino that for this Thor::Group it is a necessary task to run. * `[#**require\_arguments?** ⇒ Boolean](classmethods#require_arguments%3F-instance_method "#require_arguments? (instance method)")` Returns true if we need an arguments for our Thor::Group. Instance Method Details ----------------------- ### #available\_choices\_for(component) ⇒ Array<Symbol> Returns the list of available choices for the given component (including none). #### Examples: ``` available_choices_for :test => [:shoulda, :bacon, :minitest] ``` #### Parameters: * `component` (`Symbol`) — The type of the component module. #### Returns: * (`Array<Symbol>`) — Array of component choices. ### #component\_option(name, caption, options = {}) ⇒ Object Defines a class option to allow a component to be chosen and add to component type list. Also builds the available\_choices hash of which component choices are supported. #### Examples: ``` component_option :test, "Testing framework", :aliases => '-t', :choices => [:bacon, :shoulda] ``` #### Parameters: * `name` (`Symbol`) — Name of component. * `caption` (`[String](../../../string "String (class)")`) — Description of the component. * `options` (`Hash`) *(defaults to: `{}`)* — Additional parameters for component choice. ### #component\_types ⇒ Object Returns the compiled list of component types which can be specified. ### #defines\_component\_options(options = {}) ⇒ Object Definitions for the available customizable components. ### #require\_arguments! ⇒ Object Tells Padrino that for this Thor::Group it is a necessary task to run. ### #require\_arguments? ⇒ Boolean Returns true if we need an arguments for our Thor::Group. #### Returns: * (`Boolean`) padrino Module: Padrino::Routing::InstanceMethods Module: Padrino::Routing::InstanceMethods ========================================= Overview -------- Instance methods related to recognizing and processing routes and serving static files. Instance Method Summary ------------------------ * `[#**absolute\_url**(\*args) ⇒ Object](instancemethods#absolute_url-instance_method "#absolute_url (instance method)")` Returns absolute url. * `[#**content\_type**(type = nil, params = {}) ⇒ Object](instancemethods#content_type-instance_method "#content_type (instance method)")` Return the request format, this is useful when we need to respond to a given Content-Type. * `[#**current\_path**(\*path\_params) ⇒ Object](instancemethods#current_path-instance_method "#current_path (instance method)")` Returns the current path within a route from specified `path_params`. * `[#**recognize\_path**(path) ⇒ Object](instancemethods#recognize_path-instance_method "#recognize_path (instance method)")` * `[#**route** ⇒ Object](instancemethods#route-instance_method "#route (instance method)")` Returns the current route. * `[#**static!**(options = {}) ⇒ Object](instancemethods#static!-instance_method "#static! (instance method)")` Method for deliver static files. * `[#**static\_file?**(path\_info) ⇒ Boolean](instancemethods#static_file%3F-instance_method "#static_file? (instance method)")` This is mostly just a helper so request.path\_info isn't changed when serving files from the public directory. * `[#**url**(\*args) ⇒ Object](instancemethods#url-instance_method "#url (instance method)") (also: #url_for)` Instance method for URL generation. Instance Method Details ----------------------- ### #absolute\_url(\*args) ⇒ Object Returns absolute url. Calls Sinatra::Helpers#uri to generate protocol version, hostname and port. #### Examples: ``` absolute_url(:show, :id => 1) # => http://example.com/show?id=1 absolute_url(:show, 24) # => https://example.com/admin/show/24 absolute_url('/foo/bar') # => https://example.com/admin/foo/bar absolute_url('baz') # => https://example.com/admin/foo/baz ``` ### #content\_type(type = nil, params = {}) ⇒ Object Return the request format, this is useful when we need to respond to a given Content-Type. #### Examples: ``` get :index, :provides => :any do case content_type when :js then ... when :json then ... when :html then ... end end ``` #### Parameters: * `type` (`Symbol`, `nil`) *(defaults to: `nil`)* * `params` (`Hash`) *(defaults to: `{}`)* ### #current\_path(\*path\_params) ⇒ Object Returns the current path within a route from specified `path_params`. ### #recognize\_path(path) ⇒ Object ### #route ⇒ Object Returns the current route #### Examples: ``` -if route.controller == :press %li=show_article ``` ### #static!(options = {}) ⇒ Object Method for deliver static files. ### #static\_file?(path\_info) ⇒ Boolean This is mostly just a helper so request.path\_info isn't changed when serving files from the public directory. #### Returns: * (`Boolean`) ### #url(\*args) ⇒ Object Also known as: url\_for Instance method for URL generation. #### Examples: ``` url(:show, :id => 1) url(:show, :name => :test) url(:show, 1) url("/foo", false, false) ``` #### See Also: * [ClassMethods#url](classmethods#url-instance_method "Padrino::Routing::ClassMethods#url (method)") padrino Module: Padrino::Routing::ClassMethods Module: Padrino::Routing::ClassMethods ====================================== Overview -------- Class methods responsible for enhanced routing for controllers. Instance Method Summary ------------------------ * `[#**absolute\_url**(\*args) ⇒ Object](classmethods#absolute_url-instance_method "#absolute_url (instance method)")` Returns absolute url. * `[#**add\_filter**(type, &block) ⇒ Object](classmethods#add_filter-instance_method "#add_filter (instance method)")` Adds a filter hook to a request. * `[#**after**(\*args, &block) ⇒ Object](classmethods#after-instance_method "#after (instance method)")` Add an after filter hook. * `[#**before**(\*args, &block) ⇒ Object](classmethods#before-instance_method "#before (instance method)")` Add a before filter hook. * `[#**compiled\_router** ⇒ Object](classmethods#compiled_router-instance_method "#compiled_router (instance method)")` * `[#**construct\_filter**(\*args, &block) ⇒ Object](classmethods#construct_filter-instance_method "#construct_filter (instance method)")` Creates a filter to process before/after the matching route. * `[#**controller**(\*args) { ... } ⇒ Object](classmethods#controller-instance_method "#controller (instance method)") (also: #controllers)` Method to organize our routes in a better way. * `[#**deferred\_routes** ⇒ Object](classmethods#deferred_routes-instance_method "#deferred_routes (instance method)")` * `[#**delete**(path, \*args, &block) ⇒ Object](classmethods#delete-instance_method "#delete (instance method)")` * `[#**get**(path, \*args, &block) ⇒ Object](classmethods#get-instance_method "#get (instance method)")` * `[#**head**(path, \*args, &block) ⇒ Object](classmethods#head-instance_method "#head (instance method)")` * `[#**link**(path, \*args, &block) ⇒ Object](classmethods#link-instance_method "#link (instance method)")` * `[#**options**(path, \*args, &block) ⇒ Object](classmethods#options-instance_method "#options (instance method)")` * `[#**parent**(name = nil, options = {}) ⇒ Object](classmethods#parent-instance_method "#parent (instance method)")` Provides many parents with shallowing. * `[#**patch**(path, \*args, &block) ⇒ Object](classmethods#patch-instance_method "#patch (instance method)")` * `[#**post**(path, \*args, &block) ⇒ Object](classmethods#post-instance_method "#post (instance method)")` * `[#**process\_path\_for\_parent\_params**(path, parent\_params) ⇒ Object](classmethods#process_path_for_parent_params-instance_method "#process_path_for_parent_params (instance method)")` Processes the existing path and prepends the 'parent' parameters onto the route Used for calculating path in route method. * `[#**put**(path, \*args, &block) ⇒ Object](classmethods#put-instance_method "#put (instance method)")` * `[#**rebase\_url**(url) ⇒ Object](classmethods#rebase_url-instance_method "#rebase_url (instance method)")` * `[#**recognize\_path**(path) ⇒ Symbol, Hash](classmethods#recognize_path-instance_method "#recognize_path (instance method)")` Recognize a given path. * `[#**reset\_router!** ⇒ Object](classmethods#reset_router!-instance_method "#reset_router! (instance method)")` * `[#**router** ⇒ Object](classmethods#router-instance_method "#router (instance method)") (also: #urls)` Using PathRouter, for features and configurations. * `[#**unlink**(path, \*args, &block) ⇒ Object](classmethods#unlink-instance_method "#unlink (instance method)")` * `[#**url**(\*args) ⇒ Object](classmethods#url-instance_method "#url (instance method)") (also: #url_for)` Instance method for url generation. Instance Method Details ----------------------- ### #absolute\_url(\*args) ⇒ Object Returns absolute url. By default adds '[localhost](http://localhost)' before generated url. To change that `set :base\_url, '[example.com](http://example.com)'` in your app. ### #add\_filter(type, &block) ⇒ Object Adds a filter hook to a request. ### #after(\*args, &block) ⇒ Object Add an after filter hook. #### See Also: * [#construct\_filter](classmethods#construct_filter-instance_method "Padrino::Routing::ClassMethods#construct_filter (method)") ### #before(\*args, &block) ⇒ Object Add a before filter hook. #### See Also: * [#construct\_filter](classmethods#construct_filter-instance_method "Padrino::Routing::ClassMethods#construct_filter (method)") ### #compiled\_router ⇒ Object ### #construct\_filter(\*args, &block) ⇒ Object Creates a filter to process before/after the matching route. #### Examples: We are be able to filter with String path ``` before('/') { 'only to :index' } get(:index} { 'foo' } # => filter match only before this. get(:main) { 'bar' } ``` is the same of ``` before(:index) { 'only to :index' } get(:index} { 'foo' } # => filter match only before this. get(:main) { 'bar' } ``` it works only for the given controller ``` controller :foo do before(:index) { 'only to for :foo_index' } get(:index} { 'foo' } # => filter match only before this. get(:main) { 'bar' } end controller :bar do before(:index) { 'only to for :bar_index' } get(:index} { 'foo' } # => filter match only before this. get(:main) { 'bar' } end ``` if filters based on a symbol or regexp ``` before :index, /main/ do; ... end # => match only path that are +/+ or contains +main+ ``` filtering everything except an occurrence ``` before :except => :index do; ...; end ``` you can also filter using a request param ``` before :agent => /IE/ do; ...; end # => match +HTTP_USER_AGENT+ containing +IE+ ``` #### Parameters: * `args` (`Array`) #### See Also: * [http://padrinorb.com/guides/controllers/route-filters/](http://padrinorb.com/guides/controllers/route-filters/ "http://padrinorb.com/guides/controllers/route-filters/") ### #controller(\*args) { ... } ⇒ Object Also known as: controllers Method to organize our routes in a better way. In a controller, before and after filters are scoped and don't ``` affect other controllers or the main app. ``` In a controller, layouts are scoped and don't affect other ``` controllers or the main app. ``` #### Examples: ``` controller :admin do get :index do; ...; end get :show, :with => :id do; ...; end end url(:admin_index) # => "/admin" url(:admin_show, :id => 1) # "/admin/show/1" ``` Using named routes follow the sinatra way: ``` controller "/admin" do get "/index" do; ...; end get "/show/:id" do; ...; end end ``` Supply `:provides` to all controller routes: ``` controller :provides => [:html, :xml, :json] do get :index do; "respond to html, xml and json"; end post :index do; "respond to html, xml and json"; end get :foo do; "respond to html, xml and json"; end end ``` Specify parent resources in padrino with the `:parent` option on the controller: ``` controllers :product, :parent => :user do get :index do # url is generated as "/user/#{params[:user_id]}/product" # url_for(:product, :index, :user_id => 5) => "/user/5/product" end get :show, :with => :id do # url is generated as "/user/#{params[:user_id]}/product/show/#{params[:id]}" # url_for(:product, :show, :user_id => 5, :id => 10) => "/user/5/product/show/10" end end ``` Specify conditions to run for all routes: ``` controller :conditions => {:protect => true} do def self.protect(protected) condition do halt 403, "No secrets for you!" unless params[:key] == "s3cr3t" end if protected end # This route will only return "secret stuff" if the user goes to # `/private?key=s3cr3t`. get("/private") { "secret stuff" } # And this one, too! get("/also-private") { "secret stuff" } # But you can override the conditions for each route as needed. # This route will be publicly accessible without providing the # secret key. get :index, :protect => false do "Welcome!" end end ``` Supply default values: ``` controller :lang => :de do get :index, :map => "/:lang" do; "params[:lang] == :de"; end end ``` ``` controller :posts do layout :post before { foo } after { bar } end ``` #### Parameters: * `args` (`Array`) — Controller arguments. #### Yields: * The given block will be used to define the routes within the Controller. ### #deferred\_routes ⇒ Object ### #delete(path, \*args, &block) ⇒ Object ### #get(path, \*args, &block) ⇒ Object ### #head(path, \*args, &block) ⇒ Object ### #link(path, \*args, &block) ⇒ Object ### #options(path, \*args, &block) ⇒ Object ### #parent(name = nil, options = {}) ⇒ Object Provides many parents with shallowing. #### Examples: ``` controllers :product do parent :shop, :optional => true, :map => "/my/stand" parent :category, :optional => true get :show, :with => :id do # generated urls: # "/product/show/#{params[:id]}" # "/my/stand/#{params[:shop_id]}/product/show/#{params[:id]}" # "/my/stand/#{params[:shop_id]}/category/#{params[:category_id]}/product/show/#{params[:id]}" # url_for(:product, :show, :id => 10) => "/product/show/10" # url_for(:product, :show, :shop_id => 5, :id => 10) => "/my/stand/5/product/show/10" # url_for(:product, :show, :shop_id => 5, :category_id => 1, :id => 10) => "/my/stand/5/category/1/product/show/10" end end ``` #### Parameters: * `name` (`Symbol`) *(defaults to: `nil`)* — The parent name. * `options` (`Hash`) *(defaults to: `{}`)* — Additional options. ### #patch(path, \*args, &block) ⇒ Object ### #post(path, \*args, &block) ⇒ Object ### #process\_path\_for\_parent\_params(path, parent\_params) ⇒ Object Processes the existing path and prepends the 'parent' parameters onto the route Used for calculating path in route method. ### #put(path, \*args, &block) ⇒ Object ### #rebase\_url(url) ⇒ Object ### #recognize\_path(path) ⇒ Symbol, Hash Recognize a given path. #### Examples: Giving a controller like: ``` controller :foo do get :bar, :map => 'foo-bar-:id'; ...; end end ``` You should be able to reverse: ``` MyApp.url(:foo_bar, :id => :mine) # => /foo-bar-mine ``` Into this: ``` MyApp.recognize_path('foo-bar-mine') # => [:foo_bar, :id => :mine] ``` #### Parameters: * `path` (`[String](../../string "String (class)")`) — Path+Query to parse #### Returns: * (`Symbol`, `Hash`) — Returns controller and query params. ### #reset\_router! ⇒ Object ### #router ⇒ Object Also known as: urls Using PathRouter, for features and configurations. #### Examples: ``` router.add('/greedy/:greed') router.recognize('/simple') ``` ### #unlink(path, \*args, &block) ⇒ Object ### #url(\*args) ⇒ Object Also known as: url\_for Instance method for url generation. #### Examples: ``` url(:show, :id => 1) url(:show, :name => 'test', :id => 24) url(:show, 1) url(:controller_name, :show, :id => 21) url(:controller_show, :id => 29) url(:index, :fragment => 'comments') ``` #### Parameters: * `options` (`Hash`) — a customizable set of options padrino Class: Padrino::Routing::Parent Class: Padrino::Routing::Parent =============================== Inherits: [String](../../string "String (class)") * [Object](../../object "Object (class)") * [String](../../string "String (class)") * Padrino::Routing::Parent Instance Attribute Summary -------------------------- * `[#**map** ⇒ Object](parent#map-instance_method "#map (instance method)")` readonly Returns the value of attribute map. * `[#**optional** ⇒ Object](parent#optional-instance_method "#optional (instance method)") (also: #optional?)` readonly Returns the value of attribute optional. * `[#**options** ⇒ Object](parent#options-instance_method "#options (instance method)")` readonly Returns the value of attribute options. Instance Method Summary ------------------------ * `[#**initialize**(value, options = {}) ⇒ Parent](parent#initialize-instance_method "#initialize (instance method)")` constructor A new instance of Parent. ### Methods inherited from String [#camelize](../../string#camelize-instance_method "String#camelize (method)"), [#classify](../../string#classify-instance_method "String#classify (method)"), [#colorize](../../string#colorize-instance_method "String#colorize (method)"), [#constantize](../../string#constantize-instance_method "String#constantize (method)"), [#html\_safe](../../string#html_safe-instance_method "String#html_safe (method)"), [#pluralize](../../string#pluralize-instance_method "String#pluralize (method)"), [#underscore](../../string#underscore-instance_method "String#underscore (method)") Constructor Details ------------------- ### #initialize(value, options = {}) ⇒ Parent Returns a new instance of Parent. Instance Attribute Details -------------------------- ### #map ⇒ Object (readonly) Returns the value of attribute map ### #optional ⇒ Object (readonly) Also known as: optional? Returns the value of attribute optional ### #options ⇒ Object (readonly) Returns the value of attribute options padrino Exception: Padrino::Routing::UnrecognizedException Exception: Padrino::Routing::UnrecognizedException ================================================== Inherits: RuntimeError * [Object](../../object "Object (class)") * RuntimeError * Padrino::Routing::UnrecognizedException Overview -------- Raised when a route was invalid or cannot be processed.
programming_docs
padrino Exception: Padrino::Routing::BlockArityError Exception: Padrino::Routing::BlockArityError ============================================ Inherits: ArgumentError * [Object](../../object "Object (class)") * ArgumentError * Padrino::Routing::BlockArityError Overview -------- Raised when block arity was nonzero and was not same with captured parameter length. Instance Method Summary ------------------------ * `[#**initialize**(path, block\_arity, required\_arity) ⇒ BlockArityError](blockarityerror#initialize-instance_method "#initialize (instance method)")` constructor A new instance of BlockArityError. Constructor Details ------------------- ### #initialize(path, block\_arity, required\_arity) ⇒ BlockArityError Returns a new instance of BlockArityError. padrino Module: Padrino::Performance::JSON Module: Padrino::Performance::JSON ================================== Defined Under Namespace ----------------------- **Modules:** [InfectedRequire](json/infectedrequire "Padrino::Performance::JSON::InfectedRequire (module)") Class Method Summary --------------------- * `[.**infect\_require!** ⇒ Object](json#infect_require!-class_method "infect_require! (class method)")` * `[.**loaded\_lib!**(lib) ⇒ Object](json#loaded_lib!-class_method "loaded_lib! (class method)")` * `[.**loaded\_libs** ⇒ Object](json#loaded_libs-class_method "loaded_libs (class method)")` * `[.**registered\_libs** ⇒ Object](json#registered_libs-class_method "registered_libs (class method)")` InfectedRequire. * `[.**setup\_captures!**(\*libs) ⇒ Object](json#setup_captures!-class_method "setup_captures! (class method)")` Class Method Details -------------------- ### .infect\_require! ⇒ Object ### .loaded\_lib!(lib) ⇒ Object ### .loaded\_libs ⇒ Object ### .registered\_libs ⇒ Object InfectedRequire ### .setup\_captures!(\*libs) ⇒ Object padrino Module: Padrino::Performance::OS Module: Padrino::Performance::OS ================================ Overview -------- OS detection useful for targeting CLI commands. Source: [stackoverflow.com/questions/170956/how-can-i-find-which-operating-system-my-ruby-program-is-running-on](https://stackoverflow.com/questions/170956/how-can-i-find-which-operating-system-my-ruby-program-is-running-on) Class Method Summary --------------------- * `[.**linux?** ⇒ Boolean](os#linux%3F-class_method "linux? (class method)")` * `[.**mac?** ⇒ Boolean](os#mac%3F-class_method "mac? (class method)")` * `[.**unix?** ⇒ Boolean](os#unix%3F-class_method "unix? (class method)")` * `[.**windows?** ⇒ Boolean](os#windows%3F-class_method "windows? (class method)")` Class Method Details -------------------- ### .linux? ⇒ Boolean #### Returns: * (`Boolean`) ### .mac? ⇒ Boolean #### Returns: * (`Boolean`) ### .unix? ⇒ Boolean #### Returns: * (`Boolean`) ### .windows? ⇒ Boolean #### Returns: * (`Boolean`) padrino Module: Padrino::Performance::JSON::InfectedRequire Module: Padrino::Performance::JSON::InfectedRequire =================================================== Instance Method Summary ------------------------ * `[#**require**(\*args) ⇒ Object](infectedrequire#require-instance_method "#require (instance method)")` Instance Method Details ----------------------- ### #require(\*args) ⇒ Object padrino Module: Padrino::Helpers::RenderHelpers Module: Padrino::Helpers::RenderHelpers ======================================= Overview -------- Helpers related to rendering within templates (i.e partials). Instance Method Summary ------------------------ * `[#**partial**(template, options = {}, &block) ⇒ String](renderhelpers#partial-instance_method "#partial (instance method)") (also: #render_partial)` Render a partials with collections support. Instance Method Details ----------------------- ### #partial(template, options = {}, &block) ⇒ String Also known as: render\_partial **Note:** If using this from Sinatra, pass explicit `:engine` option Render a partials with collections support. #### Examples: ``` partial 'photo/item', :object => @photo partial 'photo/item', :collection => @photos partial 'photo/item', :locals => { :foo => :bar } partial 'photo/item', :engine => :erb ``` #### Parameters: * `template` (`[String](../../string "String (class)")`) — Relative path to partial template. * `options` (`Hash`) *(defaults to: `{}`)* — Options hash for rendering options. #### Options Hash (`options`): * `:object` (`[Object](../../object "Object (class)")`) — Object rendered in partial. * `:collection` (`Array<[Object](../../object "Object (class)")>`) — Partial is rendered for each object in this collection. * `:locals` (`Hash`) — default: `{}` — Local variables accessible in the partial. * `:engine` (`Symbol`) — Explicit rendering engine to use for this partial. #### Returns: * (`[String](../../string "String (class)")`) — The html generated from this partial. padrino Module: Padrino::Helpers::TranslationHelpers Module: Padrino::Helpers::TranslationHelpers ============================================ Overview -------- Helpers related to locale i18n translation within templates. Instance Method Summary ------------------------ * `[#**localize**(\*args) ⇒ String](translationhelpers#localize-instance_method "#localize (instance method)") (also: #l)` Delegates to I18n.localize with no additional functionality. * `[#**translate**(\*args) ⇒ String](translationhelpers#translate-instance_method "#translate (instance method)") (also: #t)` Delegates to I18n.translate with no additional functionality. Instance Method Details ----------------------- ### #localize(\*args) ⇒ String Also known as: l Delegates to I18n.localize with no additional functionality. #### Parameters: * `*args` (`Symbol`) — The keys to retrieve. #### Returns: * (`[String](../../string "String (class)")`) — The translation for the specified keys. ### #translate(\*args) ⇒ String Also known as: t Delegates to I18n.translate with no additional functionality. #### Parameters: * `*args` (`Symbol`) — The keys to retrieve. #### Returns: * (`[String](../../string "String (class)")`) — The translation for the specified keys. padrino Module: Padrino::Helpers::FormatHelpers Module: Padrino::Helpers::FormatHelpers ======================================= Overview -------- Helpers related to formatting or manipulating text within templates. Instance Method Summary ------------------------ * `[#**distance\_of\_time\_in\_words**(from\_time, to\_time = 0, include\_seconds = false, options = {}) ⇒ String](formathelpers#distance_of_time_in_words-instance_method "#distance_of_time_in_words (instance method)")` Reports the approximate distance in time between two Time or Date objects or integers as seconds. * `[#**escape\_html**(text) ⇒ String](formathelpers#escape_html-instance_method "#escape_html (instance method)") (also: #h, #sanitize_html)` Returns escaped text to protect against malicious content. * `[#**h!**(text, blank\_text = '&nbsp;') ⇒ String](formathelpers#h!-instance_method "#h! (instance method)")` Returns escaped text to protect against malicious content. * `[#**highlight**(text, words, options = {}) ⇒ String](formathelpers#highlight-instance_method "#highlight (instance method)")` Highlights one or more words everywhere in text by inserting it into a :highlighter string. * `[#**js\_escape\_html**(html\_content) ⇒ String](formathelpers#js_escape_html-instance_method "#js_escape_html (instance method)") (also: #escape_javascript)` Used in xxxx.js.erb files to escape html so that it can be passed to javascript from Padrino. * `[#**pluralize**(count, singular, plural = nil) ⇒ String](formathelpers#pluralize-instance_method "#pluralize (instance method)")` Attempts to pluralize the singular word unless count is 1. * `[#**simple\_format**(text, options = {}) ⇒ String](formathelpers#simple_format-instance_method "#simple_format (instance method)")` Returns text transformed into HTML using simple formatting rules. * `[#**strip\_tags**(html) ⇒ String](formathelpers#strip_tags-instance_method "#strip_tags (instance method)")` Strips all HTML tags from the html. * `[#**time\_ago\_in\_words**(from\_time, include\_seconds = false) ⇒ String](formathelpers#time_ago_in_words-instance_method "#time_ago_in_words (instance method)")` Like distance\_of\_time\_in\_words, but where `to_time` is fixed to `Time.now`. * `[#**truncate**(text, options = {}) ⇒ String](formathelpers#truncate-instance_method "#truncate (instance method)")` Truncates a given text after a given :length if text is longer than :length (defaults to 30). * `[#**truncate\_words**(text, options = {}) ⇒ String](formathelpers#truncate_words-instance_method "#truncate_words (instance method)")` Truncates words of a given text after a given :length if number of words in text is more than :length (defaults to 30). * `[#**word\_wrap**(text, options = {}) ⇒ String](formathelpers#word_wrap-instance_method "#word_wrap (instance method)")` Wraps the text into lines no longer than line\_width width. Instance Method Details ----------------------- ### #distance\_of\_time\_in\_words(from\_time, to\_time = 0, include\_seconds = false, options = {}) ⇒ String Reports the approximate distance in time between two Time or Date objects or integers as seconds. Set `include_seconds` to true if you want more detailed approximations when distance < 1 min, 29 secs Distances are reported based on the following table: ``` 0 <-> 29 secs # => less than a minute 30 secs <-> 1 min, 29 secs # => 1 minute 1 min, 30 secs <-> 44 mins, 29 secs # => [2..44] minutes 44 mins, 30 secs <-> 89 mins, 29 secs # => about 1 hour 89 mins, 29 secs <-> 23 hrs, 59 mins, 29 secs # => about [2..24] hours 23 hrs, 59 mins, 29 secs <-> 47 hrs, 59 mins, 29 secs # => 1 day 47 hrs, 59 mins, 29 secs <-> 29 days, 23 hrs, 59 mins, 29 secs # => [2..29] days 29 days, 23 hrs, 59 mins, 30 secs <-> 59 days, 23 hrs, 59 mins, 29 secs # => about 1 month 59 days, 23 hrs, 59 mins, 30 secs <-> 1 yr minus 1 sec # => [2..12] months 1 yr <-> 1 yr, 3 months # => about 1 year 1 yr, 3 months <-> 1 yr, 9 months # => over 1 year 1 yr, 9 months <-> 2 yr minus 1 sec # => almost 2 years 2 yrs <-> max time or date # => (same rules as 1 yr) ``` With `include_seconds` = true and the difference < 1 minute 29 seconds: ``` 0-4 secs # => less than 5 seconds 5-9 secs # => less than 10 seconds 10-19 secs # => less than 20 seconds 20-39 secs # => half a minute 40-59 secs # => less than a minute 60-89 secs # => 1 minute ``` #### Examples: ``` from_time = Time.now distance_of_time_in_words(from_time, from_time + 50.minutes) # => about 1 hour distance_of_time_in_words(from_time, 50.minutes.from_now) # => about 1 hour distance_of_time_in_words(from_time, from_time + 15.seconds) # => less than a minute distance_of_time_in_words(from_time, from_time + 15.seconds, true) # => less than 20 seconds distance_of_time_in_words(from_time, 3.years.from_now) # => about 3 years distance_of_time_in_words(from_time, from_time + 60.hours) # => about 3 days distance_of_time_in_words(from_time, from_time + 45.seconds, true) # => less than a minute distance_of_time_in_words(from_time, from_time - 45.seconds, true) # => less than a minute distance_of_time_in_words(from_time, 76.seconds.from_now) # => 1 minute distance_of_time_in_words(from_time, from_time + 1.year + 3.days) # => about 1 year distance_of_time_in_words(from_time, from_time + 3.years + 6.months) # => over 3 years distance_of_time_in_words(from_time, from_time + 4.years + 9.days + 30.minutes + 5.seconds) # => about 4 years to_time = Time.now + 6.years + 19.days distance_of_time_in_words(from_time, to_time, true) # => about 6 years distance_of_time_in_words(to_time, from_time, true) # => about 6 years distance_of_time_in_words(Time.now, Time.now) # => less than a minute ``` #### Parameters: * `from_time` (`Time`) — The time to be compared against `to_time` in order to approximate the distance. * `to_time` (`Time`) *(defaults to: `0`)* — The time to be compared against `from_time` in order to approximate the distance. * `include_seconds` (`Boolean`) *(defaults to: `false`)* — Set true for more detailed approximations. * `options` (`Hash`) *(defaults to: `{}`)* — Flags for the approximation. #### Options Hash (`options`): * `:locale` (`[String](../../string "String (class)")`) — The translation locale to be used for approximating the time. #### Returns: * (`[String](../../string "String (class)")`) — The time formatted as a relative string. ### #escape\_html(text) ⇒ String Also known as: h, sanitize\_html Returns escaped text to protect against malicious content. #### Examples: ``` escape_html("<b>Hey<b>") => "&lt;b&gt;Hey&lt;b;gt;" h("Me & Bob") => "Me &amp; Bob" ``` #### Parameters: * `text` (`[String](../../string "String (class)")`) — Unsanitized HTML string that needs to be escaped. #### Returns: * (`[String](../../string "String (class)")`) — HTML with escaped characters. ### #h!(text, blank\_text = '&nbsp;') ⇒ String Returns escaped text to protect against malicious content. #### Examples: ``` h!("Me & Bob") => "Me &amp; Bob" h!("", "Whoops") => "Whoops" ``` #### Parameters: * `text` (`[String](../../string "String (class)")`) — Unsanitized HTML string that needs to be escaped. * `blank_text` (`[String](../../string "String (class)")`) *(defaults to: `'&nbsp;'`)* — Text to return if escaped text is blank. #### Returns: * (`[String](../../string "String (class)")`) — HTML with escaped characters or the value specified if blank. ### #highlight(text, words, options = {}) ⇒ String Highlights one or more words everywhere in text by inserting it into a :highlighter string. The highlighter can be customized by passing :`highlighter` as a single-quoted string with 1 where the phrase is to be inserted. #### Examples: ``` highlight('Lorem ipsum dolor sit amet', 'dolor') # => Lorem ipsum <strong class="highlight">dolor</strong> sit amet highlight('Lorem ipsum dolor sit amet', 'dolor', :highlighter => '<span class="custom">\1</span>') # => Lorem ipsum <strong class="custom">dolor</strong> sit amet ``` #### Parameters: * `text` (`[String](../../string "String (class)")`) — The text that will be searched. * `words` (`[String](../../string "String (class)")`) — The words to be highlighted in the `text`. * `options` (`Hash`) *(defaults to: `{}`)* — Formatting options for the highlight. #### Options Hash (`options`): * `:highlighter` (`[String](../../string "String (class)")`) — default: `'<strong class="highlight">\1</strong>'` — The html pattern for wrapping the highlighted words. #### Returns: * (`[String](../../string "String (class)")`) — The text with the words specified wrapped with highlighted spans. ### #js\_escape\_html(html\_content) ⇒ String Also known as: escape\_javascript Used in xxxx.js.erb files to escape html so that it can be passed to javascript from Padrino. #### Examples: ``` js_escape_html("<h1>Hey</h1>") ``` #### Parameters: * `html` (`[String](../../string "String (class)")`) — The HTML content to be escaped into javascript compatible format. #### Returns: * (`[String](../../string "String (class)")`) — The html escaped for javascript passing. ### #pluralize(count, singular, plural = nil) ⇒ String Attempts to pluralize the singular word unless count is 1. If plural is supplied, it will use that when count is > 1, otherwise it will use inflector to determine the plural form. #### Examples: ``` pluralize(2, 'person') => '2 people' ``` #### Parameters: * `count` (`Integer`) — The count which determines pluralization. * `singular` (`[String](../../string "String (class)")`) — The word to be pluralized if appropriate based on `count`. * `plural` (`[String](../../string "String (class)")`) *(defaults to: `nil`)* — Explicit pluralized word to be used; if not specified uses inflector. #### Returns: * (`[String](../../string "String (class)")`) — The properly pluralized word. ### #simple\_format(text, options = {}) ⇒ String Returns text transformed into HTML using simple formatting rules. Two or more consecutive newlines(nn) are considered as a paragraph and wrapped in <p> or your own tags. One newline (n) is considered as a linebreak and a <br /> tag is appended. This method does not remove the newlines from the text. #### Examples: ``` simple_format("hello\nworld") # => "<p>hello<br/>world</p>" simple_format("hello\nworld", :tag => :div, :class => :foo) # => "<div class="foo">hello<br/>world</div>" ``` #### Parameters: * `text` (`[String](../../string "String (class)")`) — The simple text to be formatted. * `options` (`Hash`) *(defaults to: `{}`)* — Formatting options for the text. Can accept html options for the wrapper tag. #### Options Hash (`options`): * `:tag` (`Symbol`) — default: `p` — The html tag to use for formatting newlines. #### Returns: * (`[String](../../string "String (class)")`) — The text formatted as simple HTML. ### #strip\_tags(html) ⇒ String Strips all HTML tags from the html. #### Examples: ``` strip_tags("<b>Hey</b>") => "Hey" ``` #### Parameters: * `html` (`[String](../../string "String (class)")`) — The HTML for which to strip tags. #### Returns: * (`[String](../../string "String (class)")`) — HTML with tags stripped. ### #time\_ago\_in\_words(from\_time, include\_seconds = false) ⇒ String Like distance\_of\_time\_in\_words, but where `to_time` is fixed to `Time.now`. #### Examples: ``` time_ago_in_words(3.minutes.from_now) # => 3 minutes time_ago_in_words(Time.now - 15.hours) # => 15 hours time_ago_in_words(Time.now) # => less than a minute ``` #### Parameters: * `from_time` (`Time`) — The time to be compared against now in order to approximate the distance. * `include_seconds` (`Boolean`) *(defaults to: `false`)* — Set true for more detailed approximations. #### Returns: * (`[String](../../string "String (class)")`) — The time formatted as a relative string. ### #truncate(text, options = {}) ⇒ String Truncates a given text after a given :length if text is longer than :length (defaults to 30). The last characters will be replaced with the :omission (defaults to “…”) for a total length not exceeding :length. #### Examples: ``` truncate("Once upon a time in a world far far away", :length => 8) => "Once upon..." ``` #### Parameters: * `text` (`[String](../../string "String (class)")`) — The text to be truncated. * `options` (`Hash`) *(defaults to: `{}`)* — Formatting options for the truncation. #### Options Hash (`options`): * `:length` (`Integer`) — default: `30` — The number of characters before truncation occurs. * `:omission` (`[String](../../string "String (class)")`) — default: `"..."` — The characters that are placed after the truncated text. #### Returns: * (`[String](../../string "String (class)")`) — The text truncated after the given number of characters. ### #truncate\_words(text, options = {}) ⇒ String Truncates words of a given text after a given :length if number of words in text is more than :length (defaults to 30). The last words will be replaced with the :omission (defaults to “…”) for a total number of words not exceeding :length. #### Examples: ``` truncate_words("Once upon a time in a world far far away", :length => 8) => "Once upon a time in a world far..." ``` #### Parameters: * `text` (`[String](../../string "String (class)")`) — The text to be truncated. * `options` (`Hash`) *(defaults to: `{}`)* — Formatting options for the truncation. #### Options Hash (`options`): * `:length` (`Integer`) — default: `30` — The number of words before truncation occurs. * `:omission` (`[String](../../string "String (class)")`) — default: `"..."` — The characters that are placed after the truncated text. #### Returns: * (`[String](../../string "String (class)")`) — The text truncated after the given number of words. ### #word\_wrap(text, options = {}) ⇒ String Wraps the text into lines no longer than line\_width width. This method breaks on the first whitespace character that does not exceed line\_width (which is 80 by default). #### Examples: ``` word_wrap('Once upon a time', :line_width => 8) => "Once upon\na time" ``` #### Parameters: * `text` (`[String](../../string "String (class)")`) — The text to be wrapped. * `options` (`Hash`) *(defaults to: `{}`)* — Formatting options for the wrapping. #### Options Hash (`options`): * `:line_width` (`Integer`) — default: `80` — The line width before a wrap should occur. #### Returns: * (`[String](../../string "String (class)")`) — The text with line wraps for lines longer then `line_width`.
programming_docs
padrino Module: Padrino::Helpers::FormBuilder Module: Padrino::Helpers::FormBuilder ===================================== Defined Under Namespace ----------------------- **Classes:** [AbstractFormBuilder](formbuilder/abstractformbuilder "Padrino::Helpers::FormBuilder::AbstractFormBuilder (class)"), [StandardFormBuilder](formbuilder/standardformbuilder "Padrino::Helpers::FormBuilder::StandardFormBuilder (class)") padrino Module: Padrino::Helpers::FormHelpers Module: Padrino::Helpers::FormHelpers ===================================== Overview -------- Helpers related to producing form related tags and inputs into templates. Defined Under Namespace ----------------------- **Modules:** [Errors](formhelpers/errors "Padrino::Helpers::FormHelpers::Errors (module)"), [Options](formhelpers/options "Padrino::Helpers::FormHelpers::Options (module)"), [Security](formhelpers/security "Padrino::Helpers::FormHelpers::Security (module)") Constant Summary [collapse](#) ------------------------------- DATETIME\_ATTRIBUTES = ``` [:value, :max, :min].freeze ``` COLOR\_CODE\_REGEXP = ``` /\A#([0-9a-fA-F]{3}){1,2}\z/.freeze ``` Instance Method Summary ------------------------ * `[#**button\_tag**(caption, options = {}) ⇒ String](formhelpers#button_tag-instance_method "#button_tag (instance method)")` Constructs a button input from the given options. * `[#**button\_to**(\*args, &block) ⇒ String](formhelpers#button_to-instance_method "#button_to (instance method)")` Creates a form containing a single button that submits to the URL. * `[#**check\_box\_tag**(name, options = {}) ⇒ Object](formhelpers#check_box_tag-instance_method "#check_box_tag (instance method)")` Constructs a check\_box from the given options. * `[#**color\_field\_tag**(name, options = {}) ⇒ Object](formhelpers#color_field_tag-instance_method "#color_field_tag (instance method)")` Constructs a color tag from the given options. * `[#**date\_field\_tag**(name, options = {}) ⇒ String](formhelpers#date_field_tag-instance_method "#date_field_tag (instance method)")` Constructs a date tag from the given options. * `[#**datetime\_field\_tag**(name, options = {}) ⇒ String](formhelpers#datetime_field_tag-instance_method "#datetime_field_tag (instance method)")` Constructs a datetime tag from the given options. * `[#**datetime\_local\_field\_tag**(name, options = {}) ⇒ String](formhelpers#datetime_local_field_tag-instance_method "#datetime_local_field_tag (instance method)")` Constructs a datetime-local tag from the given options. * `[#**email\_field\_tag**(name, options = {}) ⇒ String](formhelpers#email_field_tag-instance_method "#email_field_tag (instance method)")` Creates an email field input with the given name and options. * `[#**field\_set\_tag**(\*args, &block) ⇒ String](formhelpers#field_set_tag-instance_method "#field_set_tag (instance method)")` Constructs a field\_set to group fields with given options. * `[#**fields\_for**(object, options = {}, &block) ⇒ String](formhelpers#fields_for-instance_method "#fields_for (instance method)")` Constructs form fields for an object using given or default form\_builder. * `[#**file\_field\_tag**(name, options = {}) ⇒ Object](formhelpers#file_field_tag-instance_method "#file_field_tag (instance method)")` Constructs a file field input from the given options. * `[#**form\_for**(object, url, options = {}, &block) {|AbstractFormBuilder| ... } ⇒ String](formhelpers#form_for-instance_method "#form_for (instance method)")` Constructs a form for object using given or default form\_builder. * `[#**form\_tag**(url, options = {}, &block) ⇒ String](formhelpers#form_tag-instance_method "#form_tag (instance method)")` Constructs a form without object based on options. * `[#**hidden\_field\_tag**(name, options = {}) ⇒ Object](formhelpers#hidden_field_tag-instance_method "#hidden_field_tag (instance method)")` Constructs a hidden field input from the given options. * `[#**hidden\_form\_method\_field**(desired\_method) ⇒ String](formhelpers#hidden_form_method_field-instance_method "#hidden_form_method_field (instance method)")` Returns the hidden method field for 'put' and 'delete' forms. * `[#**image\_submit\_tag**(source, options = {}) ⇒ String](formhelpers#image_submit_tag-instance_method "#image_submit_tag (instance method)")` Constructs a submit button from the given options. * `[#**label\_tag**(name, options = {}, &block) ⇒ String](formhelpers#label_tag-instance_method "#label_tag (instance method)")` Constructs a label tag from the given options. * `[#**month\_field\_tag**(name, options = {}) ⇒ String](formhelpers#month_field_tag-instance_method "#month_field_tag (instance method)")` Constructs a month tag from the given options. * `[#**number\_field\_tag**(name, options = {}) ⇒ String](formhelpers#number_field_tag-instance_method "#number_field_tag (instance method)")` Creates a number field input with the given name and options. * `[#**password\_field\_tag**(name, options = {}) ⇒ Object](formhelpers#password_field_tag-instance_method "#password_field_tag (instance method)")` Constructs a password field input from the given options. * `[#**radio\_button\_tag**(name, options = {}) ⇒ Object](formhelpers#radio_button_tag-instance_method "#radio_button_tag (instance method)")` Constructs a radio\_button from the given options. * `[#**range\_field\_tag**(name, options = {}) ⇒ String](formhelpers#range_field_tag-instance_method "#range_field_tag (instance method)")` Constructs a range tag from the given options. * `[#**search\_field\_tag**(name, options = {}) ⇒ String](formhelpers#search_field_tag-instance_method "#search_field_tag (instance method)")` Creates a search field input with the given name and options. * `[#**select\_tag**(name, options = {}) ⇒ String](formhelpers#select_tag-instance_method "#select_tag (instance method)")` Constructs a select from the given options. * `[#**submit\_tag**(\*args) ⇒ String](formhelpers#submit_tag-instance_method "#submit_tag (instance method)")` Constructs a submit button from the given options. * `[#**telephone\_field\_tag**(name, options = {}) ⇒ String](formhelpers#telephone_field_tag-instance_method "#telephone_field_tag (instance method)") (also: #phone_field_tag)` Creates a telephone field input with the given name and options. * `[#**text\_area\_tag**(name, options = {}) ⇒ Object](formhelpers#text_area_tag-instance_method "#text_area_tag (instance method)")` Constructs a text area input from the given options. * `[#**text\_field\_tag**(name, options = {}) ⇒ String](formhelpers#text_field_tag-instance_method "#text_field_tag (instance method)")` Creates a text field input with the given name and options. * `[#**time\_field\_tag**(name, options = {}) ⇒ String](formhelpers#time_field_tag-instance_method "#time_field_tag (instance method)")` Constructs a time tag from the given options. * `[#**url\_field\_tag**(name, options = {}) ⇒ String](formhelpers#url_field_tag-instance_method "#url_field_tag (instance method)")` Creates a URL field input with the given name and options. * `[#**week\_field\_tag**(name, options = {}) ⇒ String](formhelpers#week_field_tag-instance_method "#week_field_tag (instance method)")` Constructs a week tag from the given options. Instance Method Details ----------------------- ### #button\_tag(caption, options = {}) ⇒ String Constructs a button input from the given options. #### Examples: ``` button_tag "Cancel", :class => 'clear' ``` #### Parameters: * `caption` (`[String](../../string "String (class)")`) — The caption for the button. * `options` (`Hash`) *(defaults to: `{}`)* — The html options for the input field. #### Returns: * (`[String](../../string "String (class)")`) — The html button based on the `options` specified. ### #button\_to(caption, url, options = {}) ⇒ String #button\_to(url, options = {}, &block) ⇒ String Creates a form containing a single button that submits to the URL. #### Examples: ``` button_to 'Delete', url(:accounts_destroy, :id => account), :method => :delete, :class => :form # Generates: # <form class="form" action="/admin/accounts/destroy/2" method="post"> # <input type="hidden" value="delete" name="_method" /> # <input type="submit" value="Delete" /> # </form> ``` #### Overloads: * ### #button\_to(caption, url, options = {}) ⇒ String #### Parameters: + `caption` (`[String](../../string "String (class)")`) — The text caption. + `url` (`[String](../../string "String (class)")`) — The url href. + `options` (`Hash`) *(defaults to: `{}`)* — The html options. * ### #button\_to(url, options = {}, &block) ⇒ String #### Parameters: + `url` (`[String](../../string "String (class)")`) — The url href. + `options` (`Hash`) *(defaults to: `{}`)* — The html options. + `block` (`Proc`) — The button content. #### Parameters: * `options` (`Hash`) — a customizable set of options #### Returns: * (`[String](../../string "String (class)")`) — Form and button html with specified `options`. ### #check\_box\_tag(name, options = {}) ⇒ Object Constructs a check\_box from the given options. #### Examples: ``` check_box_tag :remember_me, :value => 'Yes' ``` ### #color\_field\_tag(name, options = {}) ⇒ Object Constructs a color tag from the given options. #### Examples: ``` color_field_tag('color', :value => "#ff0000") color_field_tag('color', :value => "#f00") ``` #### Parameters: * `name` (`[String](../../string "String (class)")`) — The name of the color field. * `options` (`Hash`) *(defaults to: `{}`)* — The html options for the color field. #### Options Hash (`options`): * `:value` (`[String](../../string "String (class)")`) — The value of the color field. See examples for details. ### #date\_field\_tag(name, options = {}) ⇒ String Constructs a date tag from the given options. #### Examples: ``` date_field_tag('date_with_min_max', :min => DateTime.new(1993, 2, 24), :max => DateTime.new(2000, 4, 1)) date_field_tag('date_with_value', :value => DateTime.new(2000, 4, 1)) ``` #### Parameters: * `name` (`[String](../../string "String (class)")`) — The name of the date field. * `options` (`Hash`) *(defaults to: `{}`)* — The html options for the date field. #### Options Hash (`options`): * `:min` (`DateTime`, `[String](../../string "String (class)")`) — The min date time of the date field. * `:max` (`DateTime`, `[String](../../string "String (class)")`) — The max date time of the date field. * `:value` (`DateTime`, `[String](../../string "String (class)")`) — The value of the date field. See examples for details. #### Returns: * (`[String](../../string "String (class)")`) — The html date field ### #datetime\_field\_tag(name, options = {}) ⇒ String Constructs a datetime tag from the given options. #### Examples: ``` datetime_field_tag('datetime_with_min_max', :min => DateTime.new(1993, 2, 24, 12, 30, 45), :max => DateTime.new(2000, 4, 1, 12, 0, 0)) datetime_field_tag('datetime_with_value', :value => DateTime.new(2000, 4, 1, 12, 0, 0)) ``` #### Parameters: * `name` (`[String](../../string "String (class)")`) — The name of the datetime field. * `options` (`Hash`) *(defaults to: `{}`)* — The html options for the datetime field. #### Options Hash (`options`): * `:min` (`DateTime`, `[String](../../string "String (class)")`) — The min date time of the datetime field. * `:max` (`DateTime`, `[String](../../string "String (class)")`) — The max date time of the datetime field. * `:value` (`DateTime`, `[String](../../string "String (class)")`) — The value of the datetime field. See examples for details. #### Returns: * (`[String](../../string "String (class)")`) — The html datetime field ### #datetime\_local\_field\_tag(name, options = {}) ⇒ String Constructs a datetime-local tag from the given options. #### Examples: ``` datetime_local_field_tag('datetime_local_with_min_max', :min => DateTime.new(1993, 2, 24, 12, 30, 45), :max => DateTime.new(2000, 4, 1, 12, 0, 0)) datetime_local_field_tag('datetime_local_with_value', :value => DateTime.new(2000, 4, 1, 12, 0, 0)) ``` #### Parameters: * `name` (`[String](../../string "String (class)")`) — The name of the datetime local field. * `options` (`Hash`) *(defaults to: `{}`)* — The html options for the datetime-local field. #### Options Hash (`options`): * `:min` (`DateTime`, `[String](../../string "String (class)")`) — The min date time of the datetime-local field. * `:max` (`DateTime`, `[String](../../string "String (class)")`) — The max date time of the datetime-local field. * `:value` (`DateTime`, `[String](../../string "String (class)")`) — The value of the datetime field. See examples for details. #### Returns: * (`[String](../../string "String (class)")`) — The html datetime-local field ### #email\_field\_tag(name, options = {}) ⇒ String Creates an email field input with the given name and options. #### Examples: ``` email_field_tag :email, :placeholder => '[email protected]' # => <input name="email" placeholder="[email protected]" type="email" /> email_field_tag :email, :value => '[email protected]', :readonly => true # => <input name="email" value="[email protected]" readonly type="email" /> ``` #### Parameters: * `name` (`Symbol`) — The name of the input to create. * `options` (`Hash`) *(defaults to: `{}`)* — The HTML options to include in this field. #### Options Hash (`options`): * `:id` (`[String](../../string "String (class)")`) — Specifies a unique identifier for the field. * `:class` (`[String](../../string "String (class)")`) — Specifies the stylesheet class of the field. * `:name` (`[String](../../string "String (class)")`) — Specifies the name of the field. * `:accesskey` (`[String](../../string "String (class)")`) — Specifies a shortcut key to access the field. * `:tabindex` (`Integer`) — Specifies the tab order of the field. * `:maxlength` (`Integer`) — Specifies the maximum length, in characters, of the field. * `:size` (`Integer`) — Specifies the width, in characters, of the field. * `:placeholder` (`[String](../../string "String (class)")`) — Specifies a short hint that describes the expected value of the field. * `:hidden` (`Boolean`) — Specifies whether or not the field is hidden from view. * `:spellcheck` (`Boolean`) — Specifies whether or not the field should have it's spelling and grammar checked for errors. * `:draggable` (`Boolean`) — Specifies whether or not the field is draggable. (true, false, :auto). * `:pattern` (`[String](../../string "String (class)")`) — Specifies the regular expression pattern that the field's value is checked against. * `:autocomplete` (`Symbol`) — Specifies whether or not the field should have autocomplete enabled. (:on, :off). * `:autofocus` (`Boolean`) — Specifies whether or not the field should automatically get focus when the page loads. * `:required` (`Boolean`) — Specifies whether or not the field is required to be completed before the form is submitted. * `:readonly` (`Boolean`) — Specifies whether or not the field is read only. * `:disabled` (`Boolean`) — Specifies whether or not the field is disabled. #### Returns: * (`[String](../../string "String (class)")`) — Generated HTML with specified `options`. ### #field\_set\_tag(legend = nil, options = {}, &block) ⇒ String #field\_set\_tag(options = {}, &block) ⇒ String Constructs a field\_set to group fields with given options. #### Examples: ``` field_set_tag(:class => "office-set") { } field_set_tag("Office", :class => 'office-set') { } ``` #### Overloads: * ### #field\_set\_tag(legend = nil, options = {}, &block) ⇒ String #### Parameters: + `legend` (`[String](../../string "String (class)")`) *(defaults to: `nil`)* — The legend caption for the fieldset + `options` (`Hash`) *(defaults to: `{}`)* — The html options for the fieldset. + `block` (`Proc`) — The content inside the fieldset. * ### #field\_set\_tag(options = {}, &block) ⇒ String #### Parameters: + `options` (`Hash`) *(defaults to: `{}`)* — The html options for the fieldset. + `block` (`Proc`) — The content inside the fieldset. #### Returns: * (`[String](../../string "String (class)")`) — The html for the fieldset tag based on given `options`. ### #fields\_for(object, options = {}, &block) ⇒ String Constructs form fields for an object using given or default form\_builder. Used within an existing form to allow alternate objects within one form. #### Examples: ``` fields_for @user.assignment do |assignment| ... end fields_for :assignment do |assigment| ... end ``` #### Parameters: * `object` (`[Object](../../object "Object (class)")`) — The object for which the fields are being built. * `options` (`Hash`) *(defaults to: `{}`)* — The settings associated with these fields. Accepts HTML options. * `block` (`Proc`) — The content inside this set of fields. #### Returns: * (`[String](../../string "String (class)")`) — The html fields with the specified options. ### #file\_field\_tag(name, options = {}) ⇒ Object Constructs a file field input from the given options. #### Examples: ``` file_field_tag :photo, :class => 'long' ``` ### #form\_for(object, url, options = {}, &block) {|AbstractFormBuilder| ... } ⇒ String Constructs a form for object using given or default form\_builder. #### Examples: ``` form_for :user, '/register' do |f| ... end form_for @user, '/register', :id => 'register' do |f| ... end form_for @user, '/register', :as => :customer do |f| ... end ``` #### Parameters: * `object` (`[Object](../../object "Object (class)")`) — The object for which the form is being built. * `URL` (`[String](../../string "String (class)")`) — The url this form will submit to. * `options` (`Hash`) *(defaults to: `{}`)* — The settings associated with this form. Accepts a :namespace option that will be prepended to the id attributes of the form's elements. Also accepts HTML options. * `block` (`Proc`) — The fields and content inside this form. * `settings` (`Hash`) — a customizable set of options #### Yields: * (`AbstractFormBuilder`) — The form builder used to compose fields. #### Returns: * (`[String](../../string "String (class)")`) — The html object-backed form with the specified options and input fields. ### #form\_tag(url, options = {}, &block) ⇒ String Constructs a form without object based on options. #### Examples: ``` form_tag '/register', :class => "registration_form" do ... end ``` #### Parameters: * `url` (`[String](../../string "String (class)")`) — The URL this form will submit to. * `options` (`Hash`) *(defaults to: `{}`)* — The html options associated with this form. * `block` (`Proc`) — The fields and content inside this form. #### Returns: * (`[String](../../string "String (class)")`) — The HTML form with the specified options and input fields. ### #hidden\_field\_tag(name, options = {}) ⇒ Object Constructs a hidden field input from the given options. #### Examples: ``` hidden_field_tag :session_key, :value => "__secret__" ``` ### #hidden\_form\_method\_field(desired\_method) ⇒ String Returns the hidden method field for 'put' and 'delete' forms. Only 'get' and 'post' are allowed within browsers; 'put' and 'delete' are just specified using hidden fields with form action still 'put'. #### Examples: ``` # Generate: <input name="_method" value="delete" /> hidden_form_method_field('delete') ``` #### Parameters: * `desired_method` (`[String](../../string "String (class)")`) — The method this hidden field represents (i.e put or delete). #### Returns: * (`[String](../../string "String (class)")`) — The hidden field representing the `desired_method` for the form. ### #image\_submit\_tag(source, options = {}) ⇒ String Constructs a submit button from the given options. #### Examples: ``` image_submit_tag 'form/submit.png' ``` #### Parameters: * `source` (`[String](../../string "String (class)")`) — The source image path for the button. * `options` (`Hash`) *(defaults to: `{}`)* — The html options for the input field. #### Returns: * (`[String](../../string "String (class)")`) — The html image button based on the `options` specified. ### #label\_tag(name, options = {}, &block) ⇒ String Constructs a label tag from the given options. #### Examples: ``` label_tag :username, :class => 'long-label' label_tag :username, :class => 'long-label' do ... end ``` #### Parameters: * `name` (`[String](../../string "String (class)")`) — The name of the field to label. * `options` (`Hash`) *(defaults to: `{}`)* — The html options for this label. * `block` (`Proc`) — The content to be inserted into the label. #### Options Hash (`options`): * `:caption` (`[Object](../../object "Object (class)")`) — The caption for this label. #### Returns: * (`[String](../../string "String (class)")`) — The html for this label with the given `options`. ### #month\_field\_tag(name, options = {}) ⇒ String Constructs a month tag from the given options. #### Examples: ``` month_field_tag('month_with_min_max', :min => DateTime.new(1993, 2, 24), :max => DateTime.new(2000, 4, 1)) month_field_tag('month_with_value', :value => DateTime.new(2000, 4, 1)) ``` #### Parameters: * `name` (`[String](../../string "String (class)")`) — The name of the month field. * `options` (`Hash`) *(defaults to: `{}`)* — The html options for the month field. #### Options Hash (`options`): * `:min` (`DateTime`, `[String](../../string "String (class)")`) — The min month time of the month field. * `:max` (`DateTime`, `[String](../../string "String (class)")`) — The max month time of the month field. * `:value` (`DateTime`, `[String](../../string "String (class)")`) — The value of the month field. See examples for details. #### Returns: * (`[String](../../string "String (class)")`) — The html month field ### #number\_field\_tag(name, options = {}) ⇒ String Creates a number field input with the given name and options. #### Examples: ``` number_field_tag :quantity, :class => 'numeric' # => <input name="quantity" class="numeric" type="number" /> number_field_tag :zip_code, :pattern => /[0-9]{5}/ # => <input name="zip_code" pattern="[0-9]{5}" type="number" /> number_field_tag :credit_card, :autocomplete => :off # => <input name="credit_card" autocomplete="off" type="number" /> number_field_tag :age, :min => 18, :max => 120, :step => 1 # => <input name="age" min="18" max="120" step="1" type="number" /> ``` #### Parameters: * `name` (`Symbol`) — The name of the input to create. * `options` (`Hash`) *(defaults to: `{}`)* — The HTML options to include in this field. #### Options Hash (`options`): * `:id` (`[String](../../string "String (class)")`) — Specifies a unique identifier for the field. * `:class` (`[String](../../string "String (class)")`) — Specifies the stylesheet class of the field. * `:name` (`[String](../../string "String (class)")`) — Specifies the name of the field. * `:accesskey` (`[String](../../string "String (class)")`) — Specifies a shortcut key to access the field. * `:tabindex` (`Integer`) — Specifies the tab order of the field. * `:min` (`Integer`) — Specifies the minimum value of the field. * `:max` (`Integer`) — Specifies the maximum value of the field. * `:step` (`Integer`) — Specifies the legal number intervals of the field. * `:hidden` (`Boolean`) — Specifies whether or not the field is hidden from view. * `:spellcheck` (`Boolean`) — Specifies whether or not the field should have it's spelling and grammar checked for errors. * `:draggable` (`Boolean`) — Specifies whether or not the field is draggable. (true, false, :auto). * `:pattern` (`[String](../../string "String (class)")`) — Specifies the regular expression pattern that the field's value is checked against. * `:autocomplete` (`Symbol`) — Specifies whether or not the field should have autocomplete enabled. (:on, :off). * `:autofocus` (`Boolean`) — Specifies whether or not the field should automatically get focus when the page loads. * `:required` (`Boolean`) — Specifies whether or not the field is required to be completeled before the form is submitted. * `:readonly` (`Boolean`) — Specifies whether or not the field is read only. * `:disabled` (`Boolean`) — Specifies whether or not the field is disabled. #### Returns: * (`[String](../../string "String (class)")`) — Generated HTML with specified `options`. ### #password\_field\_tag(name, options = {}) ⇒ Object Constructs a password field input from the given options. #### Examples: ``` password_field_tag :password, :class => 'long' ``` ### #radio\_button\_tag(name, options = {}) ⇒ Object Constructs a radio\_button from the given options. #### Examples: ``` radio_button_tag :remember_me, :value => 'true' ``` ### #range\_field\_tag(name, options = {}) ⇒ String Constructs a range tag from the given options. #### Examples: ``` range_field_tag('ranger_with_min_max', :min => 1, :max => 50) range_field_tag('ranger_with_range', :range => 1..5) ``` #### Parameters: * `name` (`[String](../../string "String (class)")`) — The name of the range field. * `options` (`Hash`) *(defaults to: `{}`)* — The html options for the range field. #### Options Hash (`options`): * `:min` (`Integer`) — The min range of the range field. * `:max` (`Integer`) — The max range of the range field. * `:range` (`range`) — The range, in lieu of :min and :max. See examples for details. #### Returns: * (`[String](../../string "String (class)")`) — The html range field ### #search\_field\_tag(name, options = {}) ⇒ String Creates a search field input with the given name and options. #### Examples: ``` search_field_tag :search, :placeholder => 'Search this website...' # => <input name="search" placeholder="Search this website..." type="search" /> search_field_tag :search, :maxlength => 15, :class => ['search', 'string'] # => <input name="search" maxlength="15" class="search string" /> search_field_tag :search, :id => 'search' # => <input name="search" id="search" type="search" /> search_field_tag :search, :autofocus => true # => <input name="search" autofocus type="search" /> ``` #### Parameters: * `name` (`Symbol`) — The name of the input to create. * `options` (`Hash`) *(defaults to: `{}`)* — The HTML options to include in this field. #### Options Hash (`options`): * `:id` (`[String](../../string "String (class)")`) — Specifies a unique identifier for the field. * `:class` (`[String](../../string "String (class)")`) — Specifies the stylesheet class of the field. * `:name` (`[String](../../string "String (class)")`) — Specifies the name of the field. * `:accesskey` (`[String](../../string "String (class)")`) — Specifies a shortcut key to access the field. * `:tabindex` (`Integer`) — Specifies the tab order of the field. * `:maxlength` (`Integer`) — Specifies the maximum length, in characters, of the field. * `:size` (`Integer`) — Specifies the width, in characters, of the field. * `:placeholder` (`[String](../../string "String (class)")`) — Specifies a short hint that describes the expected value of the field. * `:hidden` (`Boolean`) — Specifies whether or not the field is hidden from view. * `:spellcheck` (`Boolean`) — Specifies whether or not the field should have it's spelling and grammar checked for errors. * `:draggable` (`Boolean`) — Specifies whether or not the field is draggable. (true, false, :auto). * `:pattern` (`[String](../../string "String (class)")`) — Specifies the regular expression pattern that the field's value is checked against. * `:autocomplete` (`Symbol`) — Specifies whether or not the field should have autocomplete enabled. (:on, :off). * `:autofocus` (`Boolean`) — Specifies whether or not the field should automatically get focus when the page loads. * `:required` (`Boolean`) — Specifies whether or not the field is required to be completed before the form is submitted. * `:readonly` (`Boolean`) — Specifies whether or not the field is read only. * `:disabled` (`Boolean`) — Specifies whether or not the field is disabled. #### Returns: * (`[String](../../string "String (class)")`) — Generated HTML with specified `options`. ### #select\_tag(name, options = {}) ⇒ String Constructs a select from the given options. #### Examples: ``` options = [['caption', 'value'], ['Green', 'green1'], ['Blue', 'blue1'], ['Black', "black1"]] options = ['option', 'red', 'yellow' ] select_tag(:favorite_color, :options => ['red', 'yellow'], :selected => 'green1') select_tag(:country, :collection => @countries, :fields => [:name, :code], :include_blank => 'None') # Optgroups can be generated using :grouped_options => (Hash or nested Array) grouped_options = [['Friends',['Yoda',['Obiwan',1]]],['Enemies',['Palpatine',['Darth Vader',3]]]] grouped_options = {'Friends' => ['Yoda',['Obiwan',1]],'Enemies' => ['Palpatine',['Darth Vader',3]]} select_tag(:color, :grouped_options => [['warm',['red','yellow']],['cool',['blue', 'purple']]]) # Optgroups can be generated using the rails-style attribute hash. grouped_options = { "Friends" => ["Yoda", ["Obiwan", 2, {:magister => 'no'}], {:lame => 'yes'}], "Enemies" => [["Palpatine", "Palpatine", {:scary => 'yes', :old => 'yes'}], ["Darth Vader", 3, {:disabled => true}]] } select_tag(:name, :grouped_options => grouped_options) ``` #### Parameters: * `name` (`[String](../../string "String (class)")`) — The name of the input field. * `options` (`Hash`) *(defaults to: `{}`)* — The html options for the input field. #### Options Hash (`options`): * `:options` (`Array<[String](../../string "String (class)"), Array>`) — Explicit options to display in the select. Can be strings or string tuples. * `:grouped_options` (`Array<Array>`) — List of options for each group in the select. See examples for details. * `:collection` (`Array<[Object](../../object "Object (class)")>`) — Collection of objects used as options in the select. * `:fields` (`Array<Symbol>`) — The attributes used as “label” and “value” for each `collection` object. * `:selected` (`[String](../../string "String (class)")`) — default: `nil` — The option value initially selected. * `:include_blank` (`Boolean`) — default: `false` — Include a blank option in the select. * `:multiple` (`Boolean`) — default: `false` — Allow multiple options to be selected at once. #### Returns: * (`[String](../../string "String (class)")`) — The HTML input field based on the `options` specified. ### #submit\_tag(options = {}) ⇒ String #submit\_tag(caption, options = {}) ⇒ String Constructs a submit button from the given options. #### Examples: ``` submit_tag "Create", :class => 'success' submit_tag :class => 'btn' ``` #### Overloads: * ### #submit\_tag(options = {}) ⇒ String #### Parameters: + `options` (`Hash`) *(defaults to: `{}`)* — The html options for the input field. * ### #submit\_tag(caption, options = {}) ⇒ String #### Parameters: + `caption` (`[String](../../string "String (class)")`) — The caption for the submit button. + `options` (`Hash`) *(defaults to: `{}`)* — The html options for the input field. #### Returns: * (`[String](../../string "String (class)")`) — The html submit button based on the `options` specified. ### #telephone\_field\_tag(name, options = {}) ⇒ String Also known as: phone\_field\_tag Creates a telephone field input with the given name and options. ``` telephone_field_tag :cell_phone, :tabindex => 1 telephone_field_tag :work_phone, :tabindex => 2 telephone_field_tag :home_phone, :tabindex => 3 # => <input name="cell_phone" tabindex="1" type="tel" /> # => <input name="work_phone" tabindex="2" type="tel" /> # => <input name="home_phone" tabindex="3" type="tel" /> ``` #### Examples: ``` telephone_field_tag :phone_number, :class => 'string' # => <input name="phone_number" class="string" type="tel" /> ``` #### Parameters: * `name` (`Symbol`) — The name of the input to create. * `options` (`Hash`) *(defaults to: `{}`)* — The HTML options to include in this field. #### Options Hash (`options`): * `:id` (`[String](../../string "String (class)")`) — Specifies a unique identifier for the field. * `:class` (`[String](../../string "String (class)")`) — Specifies the stylesheet class of the field. * `:name` (`[String](../../string "String (class)")`) — Specifies the name of the field. * `:accesskey` (`[String](../../string "String (class)")`) — Specifies a shortcut key to access the field. * `:tabindex` (`Integer`) — Specifies the tab order of the field. * `:maxlength` (`Integer`) — Specifies the maximum length, in characters, of the field. * `:size` (`Integer`) — Specifies the width, in characters, of the field. * `:placeholder` (`[String](../../string "String (class)")`) — Specifies a short hint that describes the expected value of the field. * `:hidden` (`Boolean`) — Specifies whether or not the field is hidden from view. * `:spellcheck` (`Boolean`) — Specifies whether or not the field should have it's spelling and grammar checked for errors. * `:draggable` (`Boolean`) — Specifies whether or not the field is draggable. (true, false, :auto). * `:pattern` (`[String](../../string "String (class)")`) — Specifies the regular expression pattern that the field's value is checked against. * `:autocomplete` (`Symbol`) — Specifies whether or not the field should have autocomplete enabled. (:on, :off). * `:autofocus` (`Boolean`) — Specifies whether or not the field should automatically get focus when the page loads. * `:required` (`Boolean`) — Specifies whether or not the field is required to be completed before the form is submitted. * `:readonly` (`Boolean`) — Specifies whether or not the field is read only. * `:disabled` (`Boolean`) — Specifies whether or not the field is disabled. #### Returns: * (`[String](../../string "String (class)")`) — Generated HTML with specified `options`. ### #text\_area\_tag(name, options = {}) ⇒ Object Constructs a text area input from the given options. #### Examples: ``` text_area_tag :username, :class => 'long', :value => "Demo?" ``` ### #text\_field\_tag(name, options = {}) ⇒ String Creates a text field input with the given name and options. #### Examples: ``` text_field_tag :first_name, :maxlength => 40, :required => true # => <input name="first_name" maxlength="40" required type="text" /> text_field_tag :last_name, :class => 'string', :size => 40 # => <input name="last_name" class="string" size="40" type="text" /> text_field_tag :username, :placeholder => 'Your Username' # => <input name="username" placeholder="Your Username" type="text" /> ``` #### Parameters: * `name` (`Symbol`) — The name of the input to create. * `options` (`Hash`) *(defaults to: `{}`)* — The HTML options to include in this field. #### Options Hash (`options`): * `:id` (`[String](../../string "String (class)")`) — Specifies a unique identifier for the field. * `:class` (`[String](../../string "String (class)")`) — Specifies the stylesheet class of the field. * `:name` (`[String](../../string "String (class)")`) — Specifies the name of the field. * `:accesskey` (`[String](../../string "String (class)")`) — Specifies a shortcut key to access the field. * `:tabindex` (`Integer`) — Specifies the tab order of the field. * `:maxlength` (`Integer`) — Specifies the maximum length, in characters, of the field. * `:size` (`Integer`) — Specifies the width, in characters, of the field. * `:placeholder` (`[String](../../string "String (class)")`) — Specifies a short hint that describes the expected value of the field. * `:hidden` (`Boolean`) — Specifies whether or not the field is hidden from view. * `:spellcheck` (`Boolean`) — Specifies whether or not the field should have it's spelling and grammar checked for errors. * `:draggable` (`Boolean`) — Specifies whether or not the field is draggable. (true, false, :auto). * `:pattern` (`[String](../../string "String (class)")`) — Specifies the regular expression pattern that the field's value is checked against. * `:autocomplete` (`Symbol`) — Specifies whether or not the field should have autocomplete enabled. (:on, :off). * `:autofocus` (`Boolean`) — Specifies whether or not the field should automatically get focus when the page loads. * `:required` (`Boolean`) — Specifies whether or not the field is required to be completed before the form is submitted. * `:readonly` (`Boolean`) — Specifies whether or not the field is read only. * `:disabled` (`Boolean`) — Specifies whether or not the field is disabled. #### Returns: * (`[String](../../string "String (class)")`) — Generated HTML with specified `options`. ### #time\_field\_tag(name, options = {}) ⇒ String Constructs a time tag from the given options. #### Examples: ``` time_field_tag('time_with_min_max', :max => Time.new(1993, 2, 24, 1, 19, 12), :min => Time.new(2008, 6, 21, 13, 30, 0)) time_field_tag('time_with_value', :value => Time.new(2008, 6, 21, 13, 30, 0)) ``` #### Parameters: * `name` (`[String](../../string "String (class)")`) — The name of the time field. * `options` (`Hash`) *(defaults to: `{}`)* — The html options for the time field. #### Options Hash (`options`): * `:min` (`Time`, `DateTime`, `[String](../../string "String (class)")`) — The min time of the time field. * `:max` (`Time`, `DateTime`, `[String](../../string "String (class)")`) — The max time of the time field. * `:value` (`Time`, `DateTime`, `[String](../../string "String (class)")`) — The value of the time field. See examples for details. #### Returns: * (`[String](../../string "String (class)")`) — The html time field ### #url\_field\_tag(name, options = {}) ⇒ String Creates a URL field input with the given name and options. #### Examples: ``` url_field_tag :favorite_website, :placeholder => 'http://padrinorb.com' <input name="favorite_website" placeholder="http://padrinorb.com." type="url" /> url_field_tag :home_page, :class => 'string url' <input name="home_page" class="string url", type="url" /> ``` #### Parameters: * `name` (`Symbol`) — The name of the input to create. * `options` (`Hash`) *(defaults to: `{}`)* — The HTML options to include in this field. #### Options Hash (`options`): * `:id` (`[String](../../string "String (class)")`) — Specifies a unique identifier for the field. * `:class` (`[String](../../string "String (class)")`) — Specifies the stylesheet class of the field. * `:name` (`[String](../../string "String (class)")`) — Specifies the name of the field. * `:accesskey` (`[String](../../string "String (class)")`) — Specifies a shortcut key to access the field. * `:tabindex` (`Integer`) — Specifies the tab order of the field. * `:maxlength` (`Integer`) — Specifies the maximum length, in characters, of the field. * `:size` (`Integer`) — Specifies the width, in characters, of the field. * `:placeholder` (`[String](../../string "String (class)")`) — Specifies a short hint that describes the expected value of the field. * `:hidden` (`Boolean`) — Specifies whether or not the field is hidden from view. * `:spellcheck` (`Boolean`) — Specifies whether or not the field should have it's spelling and grammar checked for errors. * `:draggable` (`Boolean`) — Specifies whether or not the field is draggable. (true, false, :auto). * `:pattern` (`[String](../../string "String (class)")`) — Specifies the regular expression pattern that the field's value is checked against. * `:autocomplete` (`Symbol`) — Specifies whether or not the field should have autocomplete enabled. (:on, :off). * `:autofocus` (`Boolean`) — Specifies whether or not the field should automatically get focus when the page loads. * `:required` (`Boolean`) — Specifies whether or not the field is required to be completed before the form is submitted. * `:readonly` (`Boolean`) — Specifies whether or not the field is read only. * `:disabled` (`Boolean`) — Specifies whether or not the field is disabled. #### Returns: * (`[String](../../string "String (class)")`) — Generated HTML with specified `options`. ### #week\_field\_tag(name, options = {}) ⇒ String Constructs a week tag from the given options. #### Examples: ``` week_field_tag('week_with_min_max', :min => DateTime.new(1993, 2, 24), :max => DateTime.new(2000, 4, 1)) week_field_tag('week_with_value', :value => DateTime.new(2000, 4, 1)) ``` #### Parameters: * `name` (`[String](../../string "String (class)")`) — The name of the week field. * `options` (`Hash`) *(defaults to: `{}`)* — The html options for the week field. #### Options Hash (`options`): * `:min` (`DateTime`, `[String](../../string "String (class)")`) — The min week time of the week field. * `:max` (`DateTime`, `[String](../../string "String (class)")`) — The max week time of the week field. * `:value` (`DateTime`, `[String](../../string "String (class)")`) — The value of the week field. See examples for details. #### Returns: * (`[String](../../string "String (class)")`) — The html week field
programming_docs
padrino Module: Padrino::Helpers::TagHelpers Module: Padrino::Helpers::TagHelpers ==================================== Overview -------- Helpers related to producing html tags within templates. Constant Summary [collapse](#) ------------------------------- ESCAPE\_VALUES = Tag values escaped to html entities. ``` { "&" => "&amp;", "<" => "&lt;", ">" => "&gt;", '"' => "&quot;" }.freeze ``` ESCAPE\_REGEXP = Cached Regexp for escaping values to avoid rebuilding one on every escape operation. ``` Regexp.union(*ESCAPE_VALUES.keys).freeze ``` BOOLEAN\_ATTRIBUTES = ``` [ :autoplay, :autofocus, :formnovalidate, :checked, :disabled, :hidden, :loop, :multiple, :muted, :readonly, :required, :selected, :declare, :defer, :ismap, :itemscope, :noresize, :novalidate ].freeze ``` DATA\_ATTRIBUTES = Custom data attributes, feel free to update with yours: ``` Padrino::Helpers::TagHelpers::DATA_ATTRIBUTES.push(:dialog) text_field :foo, :dialog => true # Generates: <input type="text" data-dialog="true" name="foo" /> ``` ``` [ :method, :remote, :confirm ] ``` NEWLINE = A html\_safe newline string to avoid allocating a new on each concatenation. ``` "\n".html_safe.freeze ``` Instance Method Summary ------------------------ * `[#**content\_tag**(name, content = nil, options = nil, &block) ⇒ String](taghelpers#content_tag-instance_method "#content_tag (instance method)")` Creates an HTML tag with given name, content, and options. * `[#**escape\_link**(link) ⇒ Object](taghelpers#escape_link-instance_method "#escape_link (instance method)")` Returns an escaped document link. * `[#**input\_tag**(type, options = {}) ⇒ String](taghelpers#input_tag-instance_method "#input_tag (instance method)")` Creates an HTML input field with the given type and options. * `[#**safe\_content\_tag**(name, content = nil, options = nil, &block) ⇒ Object](taghelpers#safe_content_tag-instance_method "#safe_content_tag (instance method)")` Like #content\_tag, but assumes its input to be safe and doesn't escape. * `[#**tag**(name, options = nil, open = false) ⇒ String](taghelpers#tag-instance_method "#tag (instance method)")` Creates an HTML tag with the given name and options. Instance Method Details ----------------------- ### #content\_tag(name, content, options = nil) ⇒ String #content\_tag(name, options = nil, &block) ⇒ String Creates an HTML tag with given name, content, and options. #### Examples: ``` content_tag(:p, 'Hello World', :class => 'light') # => <p class="light"> # => Hello World # => </p> content_tag(:p, :class => 'dark') do link_to 'Padrino', 'http://www.padrinorb.com' end # => <p class="dark"> # => <a href="http://www.padrinorb.com">Padrino</a> # => </p> ``` #### Overloads: * ### #content\_tag(name, content, options = nil) ⇒ String #### Parameters: + `name` (`Symbol`) — The name of the HTML tag to create. + `content` (`[String](../../string "String (class)")`) — The content inside of the tag. + `options` (`Hash`) *(defaults to: `nil`)* — The HTML options to include in this tag. * ### #content\_tag(name, options = nil, &block) ⇒ String #### Parameters: + `name` (`Symbol`) — The name of the HTML tag to create. + `options` (`Hash`) *(defaults to: `nil`)* — The HTML options to include in this tag. + `block` (`Proc`) — The block returning HTML content. #### Parameters: * `options` (`Hash`) *(defaults to: `nil`)* — a customizable set of options #### Options Hash (`options`): * `:id` (`[String](../../string "String (class)")`) — Specifies a unique identifier for the element. * `:class` (`[String](../../string "String (class)")`) — Specifies the stylesheet class of the element. * `:title` (`[String](../../string "String (class)")`) — Specifies the title for the element. * `:accesskey` (`[String](../../string "String (class)")`) — Specifies a shortcut key to access the element. * `:dropzone` (`Symbol`) — Specifies what happens when dragged items are dropped on the element. (:copy, :link, :move) * `:hidden` (`Boolean`) — Specifies whether or not the element is hidden from view. * `:draggable` (`Boolean`) — Specifies whether or not the element is draggable. (true, false, :auto) * `:contenteditable` (`Boolean`) — Specifies whether or not the element is editable. #### Returns: * (`[String](../../string "String (class)")`) — Generated HTML with specified `options`. ### #escape\_link(link) ⇒ Object Returns an escaped document link. #### Examples: ``` escape_link('http://example.com/spaced link') # => 'http://example.com/spaced%20link' escape_link('already%20partially escaped') # => 'already%20partially%20escaped' ``` ### #input\_tag(type, options = {}) ⇒ String Creates an HTML input field with the given type and options. #### Examples: ``` input_tag :text, :name => 'handle' # => <input type="test" name="handle" /> input_tag :password, :name => 'password', :size => 20 # => <input type="password" name="password" size="20" /> input_tag :text, :name => 'username', :required => true, :autofocus => true # => <input type="text" name="username" required autofocus /> input_tag :number, :name => 'credit_card', :autocomplete => :off # => <input type="number" name="credit_card" autocomplete="off" /> ``` #### Parameters: * `type` (`Symbol`) — The type of input to create. * `options` (`Hash`) *(defaults to: `{}`)* — The HTML options to include in this input. #### Options Hash (`options`): * `:id` (`[String](../../string "String (class)")`) — Specifies a unique identifier for the input. * `:class` (`[String](../../string "String (class)")`) — Specifies the stylesheet class of the input. * `:name` (`[String](../../string "String (class)")`) — Specifies the name of the input. * `:accesskey` (`[String](../../string "String (class)")`) — Specifies a shortcut key to access the input. * `:tabindex` (`Integer`) — Specifies the tab order of the input. * `:hidden` (`Boolean`) — Specifies whether or not the input is hidden from view. * `:spellcheck` (`Boolean`) — Specifies whether or not the input should have it's spelling and grammar checked for errors. * `:draggable` (`Boolean`) — Specifies whether or not the input is draggable. (true, false, :auto) * `:pattern` (`[String](../../string "String (class)")`) — Specifies the regular expression pattern that the input's value is checked against. * `:autocomplete` (`Symbol`) — Specifies whether or not the input should have autocomplete enabled. (:on, :off) * `:autofocus` (`Boolean`) — Specifies whether or not the input should automatically get focus when the page loads. * `:required` (`Boolean`) — Specifies whether or not the input is required to be completed before the form is submitted. * `:readonly` (`Boolean`) — Specifies whether or not the input is read only. * `:disabled` (`Boolean`) — Specifies whether or not the input is disabled. #### Returns: * (`[String](../../string "String (class)")`) — Generated HTML with specified `options`. ### #safe\_content\_tag(name, content = nil, options = nil, &block) ⇒ Object Like #content\_tag, but assumes its input to be safe and doesn't escape. It also returns safe HTML. #### See Also: * [#content\_tag](taghelpers#content_tag-instance_method "Padrino::Helpers::TagHelpers#content_tag (method)") ### #tag(name, options = nil, open = false) ⇒ String Creates an HTML tag with the given name and options. #### Examples: ``` tag :hr, :class => 'dotted' # => <hr class="dotted" /> tag :input, :name => 'username', :type => :text # => <input name="username" type="text" /> tag :img, :src => 'images/pony.jpg', :alt => 'My Little Pony' # => <img src="images/pony.jpg" alt="My Little Pony" /> tag :img, :src => 'sinatra.jpg', :data => { :nsfw => false, :geo => [34.087, -118.407] } # => <img src="sinatra.jpg" data-nsfw="false" data-geo="34.087 -118.407" /> ``` #### Parameters: * `name` (`Symbol`) — The name of the HTML tag to create. * `options` (`Hash`) *(defaults to: `nil`)* — The HTML options to include in this tag. #### Options Hash (`options`): * `:id` (`[String](../../string "String (class)")`) — Specifies a unique identifier for the element. * `:class` (`[String](../../string "String (class)")`) — Specifies the stylesheet class of the element. * `:title` (`[String](../../string "String (class)")`) — Specifies the title for the element. * `:accesskey` (`[String](../../string "String (class)")`) — Specifies a shortcut key to access the element. * `:dropzone` (`Symbol`) — Specifies what happens when dragged items are dropped on the element. (:copy, :link, :move) * `:hidden` (`Boolean`) — Specifies whether or not the element is hidden from view. * `:draggable` (`Boolean`) — Specifies whether or not the element is draggable. (true, false, :auto) * `:contenteditable` (`Boolean`) — Specifies whether or not the element is editable. #### Returns: * (`[String](../../string "String (class)")`) — Generated HTML with specified `options`. padrino Module: Padrino::Helpers::OutputHelpers Module: Padrino::Helpers::OutputHelpers ======================================= Included in: [Cache::Helpers::Fragment](../cache/helpers/fragment "Padrino::Cache::Helpers::Fragment (module)") Overview -------- Helpers related to buffer output for various template engines. Defined Under Namespace ----------------------- **Modules:** [SinatraCurrentEngine](outputhelpers/sinatracurrentengine "Padrino::Helpers::OutputHelpers::SinatraCurrentEngine (module)") **Classes:** [AbstractHandler](outputhelpers/abstracthandler "Padrino::Helpers::OutputHelpers::AbstractHandler (class)"), [ErbHandler](outputhelpers/erbhandler "Padrino::Helpers::OutputHelpers::ErbHandler (class)"), [HamlHandler](outputhelpers/hamlhandler "Padrino::Helpers::OutputHelpers::HamlHandler (class)"), [HamlitHandler](outputhelpers/hamlithandler "Padrino::Helpers::OutputHelpers::HamlitHandler (class)"), [SlimHandler](outputhelpers/slimhandler "Padrino::Helpers::OutputHelpers::SlimHandler (class)") Class Method Summary --------------------- * `[.**handlers** ⇒ Object](outputhelpers#handlers-class_method "handlers (class method)")` Returns the list of all available template handlers. * `[.**register**(engine, handler) ⇒ Object](outputhelpers#register-class_method "register (class method)")` Registers a new handler as available to the output helpers. Instance Method Summary ------------------------ * `[#**block\_is\_template?**(block) ⇒ Boolean](outputhelpers#block_is_template%3F-instance_method "#block_is_template? (instance method)")` Returns true if the block is from a supported template type; false otherwise. * `[#**capture\_html**(\*args, &block) ⇒ String](outputhelpers#capture_html-instance_method "#capture_html (instance method)") (also: #capture)` Captures the html from a block of template code for any available handler. * `[#**concat\_content**(text = "") ⇒ Object](outputhelpers#concat_content-instance_method "#concat_content (instance method)") (also: #concat)` Outputs the given text to the templates buffer directly. * `[#**concat\_safe\_content**(text = "") ⇒ Object](outputhelpers#concat_safe_content-instance_method "#concat_safe_content (instance method)")` Outputs the given text to the templates buffer directly, assuming that it is safe. * `[#**content\_for**(key, content = nil, options = {}, &block) ⇒ Object](outputhelpers#content_for-instance_method "#content_for (instance method)")` Capture a block or text of content to be rendered at a later time. * `[#**content\_for?**(key) ⇒ TrueClass, FalseClass](outputhelpers#content_for%3F-instance_method "#content_for? (instance method)")` Is there a content block for a given key?. * `[#**yield\_content**(key, \*args) ⇒ String](outputhelpers#yield_content-instance_method "#yield_content (instance method)")` Render the captured content blocks for a given key. Class Method Details -------------------- ### .handlers ⇒ Object Returns the list of all available template handlers. ### .register(engine, handler) ⇒ Object Registers a new handler as available to the output helpers. Instance Method Details ----------------------- ### #block\_is\_template?(block) ⇒ Boolean Returns true if the block is from a supported template type; false otherwise. Used to determine if html should be returned or concatenated to the view. #### Examples: ``` block_is_template?(block) => true ``` #### Parameters: * `block` (`Block`) — Determine if this block is a view template. #### Returns: * (`Boolean`) — True if the block is a template; false otherwise. ### #capture\_html(\*args, &block) ⇒ String Also known as: capture Captures the html from a block of template code for any available handler. Be aware that trusting the html is up to the caller. #### Examples: ``` capture_html(&block) => "...html..." capture_html(object_for_block, &block) => "...html..." ``` ``` SafeBuffer.new + capture_html { "<foo>" } # => "&lt;foo&gt;" SafeBuffer.new.safe_concat(capture_html { "<foo>" }) # => "<foo>" ``` #### Parameters: * `*args` (`[Object](../../object "Object (class)")`) — Objects yield to the captured block. * `&block` (`Proc`) — Template code to capture as HTML. #### Returns: * (`[String](../../string "String (class)")`) — Captured HTML resulting from the block. ### #concat\_content(text = "") ⇒ Object Also known as: concat Outputs the given text to the templates buffer directly. The output might be subject to escaping, if it is not marked as safe. #### Examples: ``` concat_content("This will be output to the template buffer") ``` #### Parameters: * `text` (`[String](../../string "String (class)")`, `[SafeBuffer](../safebuffer "Padrino::SafeBuffer (class)")`) *(defaults to: `""`)* — Text to concatenate to the buffer. ### #concat\_safe\_content(text = "") ⇒ Object Outputs the given text to the templates buffer directly, assuming that it is safe. #### Examples: ``` concat_safe_content("This will be output to the template buffer") ``` #### Parameters: * `text` (`[String](../../string "String (class)")`) *(defaults to: `""`)* — Text to concatenate to the buffer. ### #content\_for(key, content) ⇒ Object #content\_for(key, &block) ⇒ Object Capture a block or text of content to be rendered at a later time. Your blocks can also receive values, which are passed to them by `yield_content`. #### Examples: ``` content_for(:name) { ...content... } content_for(:name) { |name| ...content... } content_for(:name, "I'm Jeff") content_for(:name, :flush => true) { ...new content... } ``` #### Overloads: * ### #content\_for(key, content) ⇒ Object #### Parameters: + `key` (`Symbol`) — Name of your key for the content yield. + `content` (`[String](../../string "String (class)")`) — Text to be stored for this key. + `options` (`Hash`) — Options associated with this method. * ### #content\_for(key, &block) ⇒ Object #### Parameters: + `key` (`Symbol`) — Name of your key for the content yield. + `block` (`Proc`) — Block to be stored as content for this key. + `options` (`Hash`) — Options associated with this method. #### Parameters: * `options` (`Hash`) *(defaults to: `{}`)* — a customizable set of options #### Options Hash (`options`): * `:flush` (`Boolean`) — Specifies whether to replace the content. ### #content\_for?(key) ⇒ TrueClass, FalseClass Is there a content block for a given key? #### Examples: ``` content_for? :header => true ``` #### Parameters: * `key` (`Symbol`) — Name of content to yield. #### Returns: * (`TrueClass`, `FalseClass`) — Result html for the given `key` ### #yield\_content(key, \*args) ⇒ String Render the captured content blocks for a given key. You can also pass values to the content blocks by passing them as arguments after the key. #### Examples: ``` yield_content :include yield_content :head, "param1", "param2" yield_content(:title) || "My page title" ``` #### Parameters: * `key` (`Symbol`) — Name of content to yield. * `*args` — Values to pass to the content block. #### Returns: * (`[String](../../string "String (class)")`) — Result HTML for the given `key`. padrino Module: Padrino::Helpers::NumberHelpers Module: Padrino::Helpers::NumberHelpers ======================================= Overview -------- Provides methods for converting numbers into formatted strings. Methods are provided for phone numbers, currency, percentage, precision, positional notation, and file size. Adapted from Rails Number Helpers. Constant Summary [collapse](#) ------------------------------- STORAGE\_UNITS = The units available for storage formatting. ``` [:byte, :kb, :mb, :gb, :tb].freeze ``` Instance Method Summary ------------------------ * `[#**number\_to\_currency**(number, options = {}) ⇒ String](numberhelpers#number_to_currency-instance_method "#number_to_currency (instance method)")` Formats a `number` into a currency string (e.g., $13.65). * `[#**number\_to\_human\_size**(number, options = {}) ⇒ String](numberhelpers#number_to_human_size-instance_method "#number_to_human_size (instance method)")` Formats the bytes in `size` into a more understandable representation (e.g., giving it 1500 yields 1.5 KB). * `[#**number\_to\_percentage**(number, options = {}) ⇒ String](numberhelpers#number_to_percentage-instance_method "#number_to_percentage (instance method)")` Formats a `number` as a percentage string (e.g., 65%). * `[#**number\_with\_delimiter**(number, options = {}) ⇒ String](numberhelpers#number_with_delimiter-instance_method "#number_with_delimiter (instance method)")` Formats a `number` with grouped thousands using `delimiter` (e.g., 12,324). * `[#**number\_with\_precision**(number, options = {}) ⇒ String](numberhelpers#number_with_precision-instance_method "#number_with_precision (instance method)")` Formats a `number` with the specified level of `:precision` (e.g., 112.32 has a precision of 2). Instance Method Details ----------------------- ### #number\_to\_currency(number, options = {}) ⇒ String Formats a `number` into a currency string (e.g., $13.65). You can customize the format in the `options` hash. #### Examples: ``` number_to_currency(1234567890.50) # => $1,234,567,890.50 number_to_currency(1234567890.506) # => $1,234,567,890.51 number_to_currency(1234567890.506, :precision => 3) # => $1,234,567,890.506 number_to_currency(1234567890.50, :unit => "&pound;", :separator => ",", :delimiter => "") # => &pound;1234567890,50 number_to_currency(1234567890.50, :unit => "&pound;", :separator => ",", :delimiter => "", :format => "%n %u") # => 1234567890,50 &pound; ``` #### Parameters: * `number` (`Float`) — Currency value to format. * `options` (`Hash`) *(defaults to: `{}`)* — Options for currency conversion. #### Options Hash (`options`): * `:precision` (`Integer`) — default: `2` — Sets the level of precision. * `:unit` (`[String](../../string "String (class)")`) — default: `"$"` — Sets the denomination of the currency. * `:separator` (`[String](../../string "String (class)")`) — default: `"."` — Sets the separator between the units. * `:delimiter` (`[String](../../string "String (class)")`) — default: `","` — Sets the thousands delimiter. * `:format` (`[String](../../string "String (class)")`) — default: `"%u%n"` — Sets the format of the output string. The field types are: ``` %u The currency unit %n The number ``` #### Returns: * (`[String](../../string "String (class)")`) — The formatted representation of the currency. ### #number\_to\_human\_size(number, options = {}) ⇒ String Formats the bytes in `size` into a more understandable representation (e.g., giving it 1500 yields 1.5 KB). This method is useful for reporting file sizes to users. This method returns nil if `size` cannot be converted into a number. You can customize the format in the `options` hash. #### Examples: ``` number_to_human_size(123) # => 123 Bytes number_to_human_size(1234) # => 1.2 KB number_to_human_size(12345) # => 12.1 KB number_to_human_size(1234567) # => 1.2 MB number_to_human_size(1234567890) # => 1.1 GB number_to_human_size(1234567890123) # => 1.1 TB number_to_human_size(1234567, :precision => 2) # => 1.18 MB number_to_human_size(483989, :precision => 0) # => 473 KB number_to_human_size(1234567, :precision => 2, :separator => ',') # => 1,18 MB ``` #### Parameters: * `number` (`Integer`) — Number value to format. * `options` (`Hash`) *(defaults to: `{}`)* — Options for formatter. #### Options Hash (`options`): * `:precision` (`Integer`) — default: `1` — Sets the level of precision. * `:separator` (`[String](../../string "String (class)")`) — default: `"."` — Sets the separator between the units. * `:delimiter` (`[String](../../string "String (class)")`) — default: `""` — Sets the thousands delimiter. #### Returns: * (`[String](../../string "String (class)")`) — The formatted representation of bytes ### #number\_to\_percentage(number, options = {}) ⇒ String Formats a `number` as a percentage string (e.g., 65%). You can customize the format in the `options` hash. #### Examples: ``` number_to_percentage(100) # => 100.000% number_to_percentage(100, :precision => 0) # => 100% number_to_percentage(1000, :delimiter => '.', :separator => ',') # => 1.000,000% number_to_percentage(302.24398923423, :precision => 5) # => 302.24399% ``` #### Parameters: * `number` (`Integer`, `Float`) — Percentage value to format. * `options` (`Hash`) *(defaults to: `{}`)* — Options for percentage conversion. #### Options Hash (`options`): * `:precision` (`Integer`) — default: `3` — Sets the level of precision. * `:separator` (`[String](../../string "String (class)")`) — default: `"."` — Sets the separator between the units. * `:delimiter` (`[String](../../string "String (class)")`) — default: `""` — Sets the thousands delimiter. #### Returns: * (`[String](../../string "String (class)")`) — The formatted representation of the percentage ### #number\_with\_delimiter(number, options = {}) ⇒ String Formats a `number` with grouped thousands using `delimiter` (e.g., 12,324). You can customize the format in the `options` hash. #### Examples: ``` number_with_delimiter(12345678) # => 12,345,678 number_with_delimiter(12345678.05) # => 12,345,678.05 number_with_delimiter(12345678, :delimiter => ".") # => 12.345.678 number_with_delimiter(12345678, :separator => ",") # => 12,345,678 number_with_delimiter(98765432.98, :delimiter => " ", :separator => ",") # => 98 765 432,98 ``` #### Parameters: * `number` (`Integer`, `Float`) — Number value to format. * `options` (`Hash`) *(defaults to: `{}`)* — Options for formatter. #### Options Hash (`options`): * `:delimiter` (`[String](../../string "String (class)")`) — default: `", "` — Sets the thousands delimiter. * `:separator` (`[String](../../string "String (class)")`) — default: `"."` — Sets the separator between the units. #### Returns: * (`[String](../../string "String (class)")`) — The formatted representation of the number. ### #number\_with\_precision(number, options = {}) ⇒ String Formats a `number` with the specified level of `:precision` (e.g., 112.32 has a precision of 2). You can customize the format in the `options` hash. #### Examples: ``` number_with_precision(111.2345) # => 111.235 number_with_precision(111.2345, :precision => 2) # => 111.23 number_with_precision(13, :precision => 5) # => 13.00000 number_with_precision(389.32314, :precision => 0) # => 389 number_with_precision(1111.2345, :precision => 2, :separator => ',', :delimiter => '.') # => 1.111,23 ``` #### Parameters: * `number` (`Integer`, `Float`) — Number value to format. * `options` (`Hash`) *(defaults to: `{}`)* — Options for formatter. #### Options Hash (`options`): * `:precision` (`Integer`) — default: `3` — Sets the level of precision. * `:separator` (`[String](../../string "String (class)")`) — default: `"."` — Sets the separator between the units. * `:delimiter` (`[String](../../string "String (class)")`) — default: `""` — Sets the thousands delimiter. #### Returns: * (`[String](../../string "String (class)")`) — The formatted representation of the number.
programming_docs
padrino Module: Padrino::Helpers::AssetTagHelpers Module: Padrino::Helpers::AssetTagHelpers ========================================= Overview -------- Helpers related to producing assets (images, stylesheets, js, etc) within templates. Constant Summary [collapse](#) ------------------------------- APPEND\_ASSET\_EXTENSIONS = ``` ["js", "css"] ``` ABSOLUTE\_URL\_PATTERN = ``` %r{^(https?://)} ``` ASSET\_FOLDERS = ``` { :js => 'javascripts', :css => 'stylesheets', } ``` Instance Method Summary ------------------------ * `[#**asset\_path**(kind, source = nil) ⇒ String](assettaghelpers#asset_path-instance_method "#asset_path (instance method)")` Returns the path to the specified asset (css or javascript). * `[#**favicon\_tag**(source, options = {}) ⇒ String](assettaghelpers#favicon_tag-instance_method "#favicon_tag (instance method)")` Generates a favicon link. * `[#**feed\_tag**(mime, url, options = {}) ⇒ String](assettaghelpers#feed_tag-instance_method "#feed_tag (instance method)")` Creates a link tag that browsers and news readers can use to auto-detect an RSS or ATOM feed. * `[#**flash\_tag**(\*args) ⇒ String](assettaghelpers#flash_tag-instance_method "#flash_tag (instance method)")` Creates a div to display the flash of given type if it exists. * `[#**image\_alt**(src) ⇒ String](assettaghelpers#image_alt-instance_method "#image_alt (instance method)")` Returns a string suitable for an alt attribute of img element. * `[#**image\_path**(src) ⇒ String](assettaghelpers#image_path-instance_method "#image_path (instance method)")` Returns the path to the image, either relative or absolute. * `[#**image\_tag**(url, options = {}) ⇒ String](assettaghelpers#image_tag-instance_method "#image_tag (instance method)")` Creates an image element with given url and options. * `[#**javascript\_include\_tag**(\*sources, options = {}) ⇒ String](assettaghelpers#javascript_include_tag-instance_method "#javascript_include_tag (instance method)")` Returns a html script tag for each of the sources provided. * `[#**link\_to**(\*args, &block) ⇒ String](assettaghelpers#link_to-instance_method "#link_to (instance method)")` Creates a link element with given name, url and options. * `[#**mail\_to**(email, caption = nil, mail\_options = {}) ⇒ String](assettaghelpers#mail_to-instance_method "#mail_to (instance method)")` Creates a mail link element with given name and caption. * `[#**meta\_tag**(content, options = {}) ⇒ String](assettaghelpers#meta_tag-instance_method "#meta_tag (instance method)")` Creates a meta element with the content and given options. * `[#**stylesheet\_link\_tag**(\*sources, options = {}) ⇒ String](assettaghelpers#stylesheet_link_tag-instance_method "#stylesheet_link_tag (instance method)")` Returns a html link tag for each of the sources provided. Instance Method Details ----------------------- ### #asset\_path(kind, source = nil) ⇒ String Returns the path to the specified asset (css or javascript). #### Examples: ``` # Generates: /javascripts/application.js?1269008689 asset_path :js, :application # Generates: /stylesheets/application.css?1269008689 asset_path :css, :application # Generates: /images/example.jpg?1269008689 asset_path :images, 'example.jpg' # Generates: /uploads/file.ext?1269008689 asset_path 'uploads/file.ext' ``` #### Parameters: * `kind` (`[String](../../string "String (class)")`) — The kind of asset (i.e :images, :js, :css). * `source` (`[String](../../string "String (class)")`) *(defaults to: `nil`)* — The path to the asset (relative or absolute). #### Returns: * (`[String](../../string "String (class)")`) — Path for the asset given the `kind` and `source`. ### #favicon\_tag(source, options = {}) ⇒ String Generates a favicon link. Looks inside images folder #### Examples: ``` favicon_tag 'favicon.png' favicon_tag 'icons/favicon.png' # or override some options favicon_tag 'favicon.png', :type => 'image/ico' ``` #### Parameters: * `source` (`[String](../../string "String (class)")`) — The source image path for the favicon link tag. * `options` (`Hash`) *(defaults to: `{}`)* — The html options for the favicon link tag. #### Returns: * (`[String](../../string "String (class)")`) — The favicon link html tag with specified `options`. ### #feed\_tag(mime, url, options = {}) ⇒ String Creates a link tag that browsers and news readers can use to auto-detect an RSS or ATOM feed. @[param](hash) options ``` The options for the feed tag. ``` #### Examples: ``` feed_tag :atom, url(:blog, :posts, :format => :atom), :title => "ATOM" # Generates: <link type="application/atom+xml" rel="alternate" href="/blog/posts.atom" title="ATOM" /> feed_tag :rss, url(:blog, :posts, :format => :rss) # Generates: <link type="application/rss+xml" rel="alternate" href="/blog/posts.rss" title="rss" /> ``` #### Parameters: * `mime` (`Symbol`) — The mime type of the feed (i.e :atom or :rss). * `url` (`[String](../../string "String (class)")`) — The url for the feed tag to reference. * `options` (`Hash`) *(defaults to: `{}`)* — a customizable set of options #### Options Hash (`options`): * `:rel` (`[String](../../string "String (class)")`) — default: `"alternate"` — Specify the relation of this link. * `:type` (`[String](../../string "String (class)")`) — Override the auto-generated mime type. * `:title` (`[String](../../string "String (class)")`) — Specify the title of the link, defaults to the type. #### Returns: * (`[String](../../string "String (class)")`) — Feed link html tag with specified `options`. ### #flash\_tag(\*args) ⇒ String Creates a div to display the flash of given type if it exists. #### Examples: ``` flash_tag(:notice, :id => 'flash-notice') # Generates: <div class="notice" id="flash-notice">flash-notice</div> flash_tag(:error, :success) # Generates: <div class="error">flash-error</div> # <div class="success">flash-success</div> ``` #### Parameters: * `kind` (`Symbol`) — The type of flash to display in the tag. * `options` (`Hash`) — The html options for this section. use :bootstrap => true to support Twitter's bootstrap dismiss alert button. #### Returns: * (`[String](../../string "String (class)")`) — Flash tag html with specified `options`. ### #image\_alt(src) ⇒ String Returns a string suitable for an alt attribute of img element. #### Parameters: * `src` (`[String](../../string "String (class)")`) — The source path for the image tag. #### Returns: * (`[String](../../string "String (class)")`) — The alt attribute value. ### #image\_path(src) ⇒ String Returns the path to the image, either relative or absolute. We search it in your `appname.public_folder` like app/public/images for inclusion. You can provide also a full path. #### Examples: ``` # Generates: /images/foo.jpg?1269008689 image_path("foo.jpg") ``` #### Parameters: * `src` (`[String](../../string "String (class)")`) — The path to the image file (relative or absolute). #### Returns: * (`[String](../../string "String (class)")`) — Path to an image given the `kind` and `source`. ### #image\_tag(url, options = {}) ⇒ String Creates an image element with given url and options. #### Examples: ``` image_tag('icons/avatar.png') ``` #### Parameters: * `url` (`[String](../../string "String (class)")`) — The source path for the image tag. * `options` (`Hash`) *(defaults to: `{}`)* — The html options for the image tag. #### Returns: * (`[String](../../string "String (class)")`) — Image html tag with `url` and specified `options`. ### #javascript\_include\_tag(\*sources, options = {}) ⇒ String Returns a html script tag for each of the sources provided. You can pass in the filename without extension or a symbol and we search it in your `appname.public_folder` like app/public/javascript for inclusion. You can provide also a full path. #### Examples: ``` javascript_include_tag 'application', :extjs ``` #### Parameters: * `sources` (`Array<[String](../../string "String (class)")>`) — Splat of js source paths * `options` (`Hash`) *(defaults to: `{}`)* — The html options for the script tag #### Returns: * (`[String](../../string "String (class)")`) — Script tag for `sources` with specified `options`. ### #link\_to(caption, url, options = {}) ⇒ String #link\_to(url, options = {}, &block) ⇒ String Creates a link element with given name, url and options. Note that you can pass :`if` or :`unless` conditions, but if you provide :current as condition padrino return true/false if the request.path\_info match the given url. #### Examples: ``` link_to('click me', '/dashboard', :class => 'linky') # Generates <a class="linky" href="/dashboard">click me</a> link_to('click me', '/dashboard', :remote => true) # Generates <a href="/dashboard" data-remote="true">click me</a> link_to('click me', '/dashboard', :method => :delete) # Generates <a href="/dashboard" data-method="delete" rel="nofollow">click me</a> link_to('/dashboard', :class => 'blocky') { 'click me' } # Generates <a class="blocky" href="/dashboard">click me</a> ``` #### Overloads: * ### #link\_to(caption, url, options = {}) ⇒ String #### Parameters: + `caption` (`[String](../../string "String (class)")`) — The text caption. + `url` (`[String](../../string "String (class)")`) — The url href. + `options` (`Hash`) *(defaults to: `{}`)* — The html options. * ### #link\_to(url, options = {}, &block) ⇒ String #### Parameters: + `url` (`[String](../../string "String (class)")`) — The url href. + `options` (`Hash`) *(defaults to: `{}`)* — The html options. + `block` (`Proc`) — The link content. #### Parameters: * `options` (`Hash`) — a customizable set of options #### Returns: * (`[String](../../string "String (class)")`) — Link tag html with specified `options`. ### #mail\_to(email, caption = nil, mail\_options = {}) ⇒ String Creates a mail link element with given name and caption. #### Examples: ``` mail_to "[email protected]" # Generates: <a href="mailto:[email protected]">[email protected]</a> mail_to "[email protected]", "My Email" # Generates: <a href="mailto:[email protected]">My Email</a> ``` #### Parameters: * `email` (`[String](../../string "String (class)")`) — The email address for the link. * `caption` (`[String](../../string "String (class)")`) *(defaults to: `nil`)* — The caption for the link. * `mail_options` (`Hash`) *(defaults to: `{}`)* — The options for the mail link. Accepts html options. #### Options Hash (`mail_options`): * `cc` (`[String](../../string "String (class)")`) — The cc recipients. * `bcc` (`[String](../../string "String (class)")`) — The bcc recipients. * `subject` (`[String](../../string "String (class)")`) — The subject line. * `body` (`[String](../../string "String (class)")`) — The email body. #### Returns: * (`[String](../../string "String (class)")`) — Mail link html tag with specified `options`. ### #meta\_tag(content, options = {}) ⇒ String Creates a meta element with the content and given options. #### Examples: ``` meta_tag "weblog,news", :name => "keywords" # Generates: <meta name="keywords" content="weblog,news" /> meta_tag "text/html; charset=UTF-8", 'http-equiv' => "Content-Type" # Generates: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> ``` #### Parameters: * `content` (`[String](../../string "String (class)")`) — The content for the meta tag. * `options` (`Hash`) *(defaults to: `{}`)* — The html options for the meta tag. #### Returns: * (`[String](../../string "String (class)")`) — Meta html tag with specified `options`. ### #stylesheet\_link\_tag(\*sources, options = {}) ⇒ String Returns a html link tag for each of the sources provided. You can pass in the filename without extension or a symbol and we search it in your `appname.public_folder` like app/public/stylesheets for inclusion. You can provide also a full path. #### Examples: ``` stylesheet_link_tag 'style', 'application', 'layout' ``` #### Parameters: * `sources` (`Array<[String](../../string "String (class)")>`) — Splat of css source paths * `options` (`Hash`) *(defaults to: `{}`)* — The html options for the link tag #### Returns: * (`[String](../../string "String (class)")`) — Stylesheet link html tag for `sources` with specified `options`. padrino Class: Padrino::Helpers::OutputHelpers::AbstractHandler Class: Padrino::Helpers::OutputHelpers::AbstractHandler ======================================================= Inherits: [Object](../../../object "Object (class)") * [Object](../../../object "Object (class)") * Padrino::Helpers::OutputHelpers::AbstractHandler Direct Known Subclasses ----------------------- [ErbHandler](erbhandler "Padrino::Helpers::OutputHelpers::ErbHandler (class)"), [HamlHandler](hamlhandler "Padrino::Helpers::OutputHelpers::HamlHandler (class)"), [HamlitHandler](hamlithandler "Padrino::Helpers::OutputHelpers::HamlitHandler (class)"), [SlimHandler](slimhandler "Padrino::Helpers::OutputHelpers::SlimHandler (class)") Instance Attribute Summary -------------------------- * `[#**output\_buffer** ⇒ Object](abstracthandler#output_buffer-instance_method "#output_buffer (instance method)")` readonly Returns the value of attribute output\_buffer. * `[#**template** ⇒ Object](abstracthandler#template-instance_method "#template (instance method)")` readonly Returns the value of attribute template. Instance Method Summary ------------------------ * `[#**capture\_from\_template**(\*args, &block) ⇒ Object](abstracthandler#capture_from_template-instance_method "#capture_from_template (instance method)")` Captures the html from a block of template code for this handler. * `[#**concat\_to\_template**(text = "", context = nil) ⇒ Object](abstracthandler#concat_to_template-instance_method "#concat_to_template (instance method)")` Outputs the given text to the template. * `[#**engine\_matches?**(block) ⇒ Boolean](abstracthandler#engine_matches%3F-instance_method "#engine_matches? (instance method)")` Returns true if the block given is of the handler's template type; false otherwise. * `[#**initialize**(template) ⇒ AbstractHandler](abstracthandler#initialize-instance_method "#initialize (instance method)")` constructor A new instance of AbstractHandler. Constructor Details ------------------- ### #initialize(template) ⇒ AbstractHandler Returns a new instance of AbstractHandler. Instance Attribute Details -------------------------- ### #output\_buffer ⇒ Object Returns the value of attribute output\_buffer ### #template ⇒ Object (readonly) Returns the value of attribute template Instance Method Details ----------------------- ### #capture\_from\_template(\*args, &block) ⇒ Object Captures the html from a block of template code for this handler. This method is called to capture content of a block-loving helpers in templates. Haml has a special method to do this, for Erb and Slim we save original buffer, call the block and then restore the buffer. #### Examples: ``` @handler.capture_from_template(&block) => "...html..." ``` ### #concat\_to\_template(text = "", context = nil) ⇒ Object Outputs the given text to the template. This method is called when template uses block-aware helpers. For Slim and Haml such helpers just return output to use with `=`. For Erb this method is implemented in ErbHandler by concatenating given text to output buffer. #### Examples: ``` @handler.concat_to_template("This will be output to the template buffer") ``` ### #engine\_matches?(block) ⇒ Boolean Returns true if the block given is of the handler's template type; false otherwise. #### Examples: ``` @handler.engine_matches?(block) => true ``` #### Returns: * (`Boolean`) padrino Module: Padrino::Helpers::OutputHelpers::SinatraCurrentEngine Module: Padrino::Helpers::OutputHelpers::SinatraCurrentEngine ============================================================= Overview -------- Module used to detect the current engine in vanilla Sinatra apps. Instance Attribute Summary -------------------------- * `[#**current\_engine** ⇒ Object](sinatracurrentengine#current_engine-instance_method "#current_engine (instance method)")` readonly Returns the value of attribute current\_engine. Instance Method Summary ------------------------ * `[#**render**(engine) ⇒ Object](sinatracurrentengine#render-instance_method "#render (instance method)")` Instance Attribute Details -------------------------- ### #current\_engine ⇒ Object (readonly) Returns the value of attribute current\_engine Instance Method Details ----------------------- ### #render(engine) ⇒ Object padrino Class: Padrino::Helpers::OutputHelpers::HamlitHandler Class: Padrino::Helpers::OutputHelpers::HamlitHandler ===================================================== Inherits: [AbstractHandler](abstracthandler "Padrino::Helpers::OutputHelpers::AbstractHandler (class)") * [Object](../../../object "Object (class)") * [AbstractHandler](abstracthandler "Padrino::Helpers::OutputHelpers::AbstractHandler (class)") * Padrino::Helpers::OutputHelpers::HamlitHandler Overview -------- Handler for Haml templates. Instance Attribute Summary -------------------------- ### Attributes inherited from AbstractHandler [#output\_buffer](abstracthandler#output_buffer-instance_method "Padrino::Helpers::OutputHelpers::AbstractHandler#output_buffer (method)"), [#template](abstracthandler#template-instance_method "Padrino::Helpers::OutputHelpers::AbstractHandler#template (method)") Instance Method Summary ------------------------ * `[#**engine\_matches?**(block) ⇒ Boolean](hamlithandler#engine_matches%3F-instance_method "#engine_matches? (instance method)")` Returns true if the block is for Hamlit. ### Methods inherited from AbstractHandler [#capture\_from\_template](abstracthandler#capture_from_template-instance_method "Padrino::Helpers::OutputHelpers::AbstractHandler#capture_from_template (method)"), [#concat\_to\_template](abstracthandler#concat_to_template-instance_method "Padrino::Helpers::OutputHelpers::AbstractHandler#concat_to_template (method)"), [#initialize](abstracthandler#initialize-instance_method "Padrino::Helpers::OutputHelpers::AbstractHandler#initialize (method)") Constructor Details ------------------- This class inherits a constructor from [Padrino::Helpers::OutputHelpers::AbstractHandler](abstracthandler#initialize-instance_method "Padrino::Helpers::OutputHelpers::AbstractHandler#initialize (method)") Instance Method Details ----------------------- ### #engine\_matches?(block) ⇒ Boolean Returns true if the block is for Hamlit. #### Returns: * (`Boolean`) padrino Class: Padrino::Helpers::OutputHelpers::HamlHandler Class: Padrino::Helpers::OutputHelpers::HamlHandler =================================================== Inherits: [AbstractHandler](abstracthandler "Padrino::Helpers::OutputHelpers::AbstractHandler (class)") * [Object](../../../object "Object (class)") * [AbstractHandler](abstracthandler "Padrino::Helpers::OutputHelpers::AbstractHandler (class)") * Padrino::Helpers::OutputHelpers::HamlHandler Overview -------- Handler for Haml templates. Instance Attribute Summary -------------------------- ### Attributes inherited from AbstractHandler [#output\_buffer](abstracthandler#output_buffer-instance_method "Padrino::Helpers::OutputHelpers::AbstractHandler#output_buffer (method)"), [#template](abstracthandler#template-instance_method "Padrino::Helpers::OutputHelpers::AbstractHandler#template (method)") Instance Method Summary ------------------------ * `[#**capture\_from\_template**(\*args, &block) ⇒ Object](hamlhandler#capture_from_template-instance_method "#capture_from_template (instance method)")` Captures the html from a block of template code for this handler. * `[#**engine\_matches?**(block) ⇒ Boolean](hamlhandler#engine_matches%3F-instance_method "#engine_matches? (instance method)")` Returns true if the block is for Haml. ### Methods inherited from AbstractHandler [#concat\_to\_template](abstracthandler#concat_to_template-instance_method "Padrino::Helpers::OutputHelpers::AbstractHandler#concat_to_template (method)"), [#initialize](abstracthandler#initialize-instance_method "Padrino::Helpers::OutputHelpers::AbstractHandler#initialize (method)") Constructor Details ------------------- This class inherits a constructor from [Padrino::Helpers::OutputHelpers::AbstractHandler](abstracthandler#initialize-instance_method "Padrino::Helpers::OutputHelpers::AbstractHandler#initialize (method)") Instance Method Details ----------------------- ### #capture\_from\_template(\*args, &block) ⇒ Object Captures the html from a block of template code for this handler. ### #engine\_matches?(block) ⇒ Boolean Returns true if the block is for Haml #### Returns: * (`Boolean`)
programming_docs
padrino Class: Padrino::Helpers::OutputHelpers::SlimHandler Class: Padrino::Helpers::OutputHelpers::SlimHandler =================================================== Inherits: [AbstractHandler](abstracthandler "Padrino::Helpers::OutputHelpers::AbstractHandler (class)") * [Object](../../../object "Object (class)") * [AbstractHandler](abstracthandler "Padrino::Helpers::OutputHelpers::AbstractHandler (class)") * Padrino::Helpers::OutputHelpers::SlimHandler Overview -------- Handler for Slim templates. Instance Attribute Summary -------------------------- ### Attributes inherited from AbstractHandler [#output\_buffer](abstracthandler#output_buffer-instance_method "Padrino::Helpers::OutputHelpers::AbstractHandler#output_buffer (method)"), [#template](abstracthandler#template-instance_method "Padrino::Helpers::OutputHelpers::AbstractHandler#template (method)") Instance Method Summary ------------------------ * `[#**engine\_matches?**(block) ⇒ Boolean](slimhandler#engine_matches%3F-instance_method "#engine_matches? (instance method)")` Returns true if the block is for Slim. ### Methods inherited from AbstractHandler [#capture\_from\_template](abstracthandler#capture_from_template-instance_method "Padrino::Helpers::OutputHelpers::AbstractHandler#capture_from_template (method)"), [#concat\_to\_template](abstracthandler#concat_to_template-instance_method "Padrino::Helpers::OutputHelpers::AbstractHandler#concat_to_template (method)"), [#initialize](abstracthandler#initialize-instance_method "Padrino::Helpers::OutputHelpers::AbstractHandler#initialize (method)") Constructor Details ------------------- This class inherits a constructor from [Padrino::Helpers::OutputHelpers::AbstractHandler](abstracthandler#initialize-instance_method "Padrino::Helpers::OutputHelpers::AbstractHandler#initialize (method)") Instance Method Details ----------------------- ### #engine\_matches?(block) ⇒ Boolean Returns true if the block is for Slim. #### Returns: * (`Boolean`) padrino Class: Padrino::Helpers::OutputHelpers::ErbHandler Class: Padrino::Helpers::OutputHelpers::ErbHandler ================================================== Inherits: [AbstractHandler](abstracthandler "Padrino::Helpers::OutputHelpers::AbstractHandler (class)") * [Object](../../../object "Object (class)") * [AbstractHandler](abstracthandler "Padrino::Helpers::OutputHelpers::AbstractHandler (class)") * Padrino::Helpers::OutputHelpers::ErbHandler Overview -------- Handler for Erb template. Instance Attribute Summary -------------------------- ### Attributes inherited from AbstractHandler [#output\_buffer](abstracthandler#output_buffer-instance_method "Padrino::Helpers::OutputHelpers::AbstractHandler#output_buffer (method)"), [#template](abstracthandler#template-instance_method "Padrino::Helpers::OutputHelpers::AbstractHandler#template (method)") Instance Method Summary ------------------------ * `[#**concat\_to\_template**(text = "", context = nil) ⇒ Object](erbhandler#concat_to_template-instance_method "#concat_to_template (instance method)")` Outputs the given text to the templates buffer directly. * `[#**engine\_matches?**(block) ⇒ Boolean](erbhandler#engine_matches%3F-instance_method "#engine_matches? (instance method)")` Returns true if the block is Erb. ### Methods inherited from AbstractHandler [#capture\_from\_template](abstracthandler#capture_from_template-instance_method "Padrino::Helpers::OutputHelpers::AbstractHandler#capture_from_template (method)"), [#initialize](abstracthandler#initialize-instance_method "Padrino::Helpers::OutputHelpers::AbstractHandler#initialize (method)") Constructor Details ------------------- This class inherits a constructor from [Padrino::Helpers::OutputHelpers::AbstractHandler](abstracthandler#initialize-instance_method "Padrino::Helpers::OutputHelpers::AbstractHandler#initialize (method)") Instance Method Details ----------------------- ### #concat\_to\_template(text = "", context = nil) ⇒ Object Outputs the given text to the templates buffer directly. ### #engine\_matches?(block) ⇒ Boolean Returns true if the block is Erb. #### Returns: * (`Boolean`) padrino Class: Padrino::Helpers::FormBuilder::AbstractFormBuilder Class: Padrino::Helpers::FormBuilder::AbstractFormBuilder ========================================================= Inherits: [Object](../../../object "Object (class)") * [Object](../../../object "Object (class)") * Padrino::Helpers::FormBuilder::AbstractFormBuilder Overview -------- Base class for Padrino Form Builder Direct Known Subclasses ----------------------- [StandardFormBuilder](standardformbuilder "Padrino::Helpers::FormBuilder::StandardFormBuilder (class)") Instance Attribute Summary -------------------------- * `[#**attributes\_name** ⇒ Object](abstractformbuilder#attributes_name-instance_method "#attributes_name (instance method)")` readonly Returns the value of attribute attributes\_name. * `[#**is\_nested** ⇒ Object](abstractformbuilder#is_nested-instance_method "#is_nested (instance method)")` readonly Returns the value of attribute is\_nested. * `[#**model\_name** ⇒ Object](abstractformbuilder#model_name-instance_method "#model_name (instance method)")` readonly Returns the value of attribute model\_name. * `[#**multipart** ⇒ Object](abstractformbuilder#multipart-instance_method "#multipart (instance method)")` Returns the value of attribute multipart. * `[#**namespace** ⇒ Object](abstractformbuilder#namespace-instance_method "#namespace (instance method)")` readonly Returns the value of attribute namespace. * `[#**nested\_index** ⇒ Object](abstractformbuilder#nested_index-instance_method "#nested_index (instance method)")` readonly Returns the value of attribute nested\_index. * `[#**object** ⇒ Object](abstractformbuilder#object-instance_method "#object (instance method)")` Returns the value of attribute object. * `[#**parent\_form** ⇒ Object](abstractformbuilder#parent_form-instance_method "#parent_form (instance method)")` readonly Returns the value of attribute parent\_form. * `[#**template** ⇒ Object](abstractformbuilder#template-instance_method "#template (instance method)")` Returns the value of attribute template. Instance Method Summary ------------------------ * `[#**check\_box**(field, options = {}) ⇒ Object](abstractformbuilder#check_box-instance_method "#check_box (instance method)")` * `[#**check\_box\_group**(field, options = {}) ⇒ Object](abstractformbuilder#check_box_group-instance_method "#check_box_group (instance method)")` * `[#**color\_field**(field, options = {}) ⇒ Object](abstractformbuilder#color_field-instance_method "#color_field (instance method)")` * `[#**csrf\_token\_field** ⇒ Object](abstractformbuilder#csrf_token_field-instance_method "#csrf_token_field (instance method)")` * `[#**date\_field**(field, options = {}) ⇒ Object](abstractformbuilder#date_field-instance_method "#date_field (instance method)")` * `[#**datetime\_field**(field, options = {}) ⇒ Object](abstractformbuilder#datetime_field-instance_method "#datetime_field (instance method)")` * `[#**datetime\_local\_field**(field, options = {}) ⇒ Object](abstractformbuilder#datetime_local_field-instance_method "#datetime_local_field (instance method)")` * `[#**email\_field**(field, options = {}) ⇒ Object](abstractformbuilder#email_field-instance_method "#email_field (instance method)")` * `[#**error\_message\_on**(field, options = {}) ⇒ Object](abstractformbuilder#error_message_on-instance_method "#error_message_on (instance method)")` * `[#**error\_messages**(\*params) ⇒ Object](abstractformbuilder#error_messages-instance_method "#error_messages (instance method)")` * `[#**fields\_for**(child\_association, collection = nil, options = {}, &block) ⇒ Object](abstractformbuilder#fields_for-instance_method "#fields_for (instance method)")` Supports nested fields for a child model within a form. * `[#**file\_field**(field, options = {}) ⇒ Object](abstractformbuilder#file_field-instance_method "#file_field (instance method)")` * `[#**hidden\_field**(field, options = {}) ⇒ Object](abstractformbuilder#hidden_field-instance_method "#hidden_field (instance method)")` * `[#**image\_submit**(source, options = {}) ⇒ Object](abstractformbuilder#image_submit-instance_method "#image_submit (instance method)")` * `[#**initialize**(template, object, options = {}) ⇒ AbstractFormBuilder](abstractformbuilder#initialize-instance_method "#initialize (instance method)")` constructor A new instance of AbstractFormBuilder. * `[#**label**(field, options = {}, &block) ⇒ Object](abstractformbuilder#label-instance_method "#label (instance method)")` * `[#**month\_field**(field, options = {}) ⇒ Object](abstractformbuilder#month_field-instance_method "#month_field (instance method)")` * `[#**number\_field**(field, options = {}) ⇒ Object](abstractformbuilder#number_field-instance_method "#number_field (instance method)")` * `[#**password\_field**(field, options = {}) ⇒ Object](abstractformbuilder#password_field-instance_method "#password_field (instance method)")` * `[#**radio\_button**(field, options = {}) ⇒ Object](abstractformbuilder#radio_button-instance_method "#radio_button (instance method)")` * `[#**radio\_button\_group**(field, options = {}) ⇒ Object](abstractformbuilder#radio_button_group-instance_method "#radio_button_group (instance method)")` * `[#**search\_field**(field, options = {}) ⇒ Object](abstractformbuilder#search_field-instance_method "#search_field (instance method)")` * `[#**select**(field, options = {}) ⇒ Object](abstractformbuilder#select-instance_method "#select (instance method)")` * `[#**submit**(\*args) ⇒ Object](abstractformbuilder#submit-instance_method "#submit (instance method)")` * `[#**telephone\_field**(field, options = {}) ⇒ Object](abstractformbuilder#telephone_field-instance_method "#telephone_field (instance method)") (also: #phone_field)` * `[#**text\_area**(field, options = {}) ⇒ Object](abstractformbuilder#text_area-instance_method "#text_area (instance method)")` * `[#**text\_field**(field, options = {}) ⇒ Object](abstractformbuilder#text_field-instance_method "#text_field (instance method)")` * `[#**time\_field**(field, options = {}) ⇒ Object](abstractformbuilder#time_field-instance_method "#time_field (instance method)")` * `[#**url\_field**(field, options = {}) ⇒ Object](abstractformbuilder#url_field-instance_method "#url_field (instance method)")` * `[#**week\_field**(field, options = {}) ⇒ Object](abstractformbuilder#week_field-instance_method "#week_field (instance method)")` Constructor Details ------------------- ### #initialize(template, object, options = {}) ⇒ AbstractFormBuilder Returns a new instance of AbstractFormBuilder. Instance Attribute Details -------------------------- ### #attributes\_name ⇒ Object (readonly) Returns the value of attribute attributes\_name ### #is\_nested ⇒ Object (readonly) Returns the value of attribute is\_nested ### #model\_name ⇒ Object (readonly) Returns the value of attribute model\_name ### #multipart ⇒ Object Returns the value of attribute multipart ### #namespace ⇒ Object (readonly) Returns the value of attribute namespace ### #nested\_index ⇒ Object (readonly) Returns the value of attribute nested\_index ### #object ⇒ Object Returns the value of attribute object ### #parent\_form ⇒ Object (readonly) Returns the value of attribute parent\_form ### #template ⇒ Object Returns the value of attribute template Instance Method Details ----------------------- ### #check\_box(field, options = {}) ⇒ Object ### #check\_box\_group(field, options = {}) ⇒ Object ### #color\_field(field, options = {}) ⇒ Object ### #csrf\_token\_field ⇒ Object ### #date\_field(field, options = {}) ⇒ Object ### #datetime\_field(field, options = {}) ⇒ Object ### #datetime\_local\_field(field, options = {}) ⇒ Object ### #email\_field(field, options = {}) ⇒ Object ### #error\_message\_on(field, options = {}) ⇒ Object ### #error\_messages(\*params) ⇒ Object ### #fields\_for(child\_association, collection = nil, options = {}, &block) ⇒ Object Supports nested fields for a child model within a form. f.fields\_for :addresses f.fields\_for :addresses, address f.fields\_for :addresses, @addresses f.fields\_for :addresses, address, index: i ### #file\_field(field, options = {}) ⇒ Object ### #hidden\_field(field, options = {}) ⇒ Object ### #image\_submit(source, options = {}) ⇒ Object ### #label(field, options = {}, &block) ⇒ Object ### #month\_field(field, options = {}) ⇒ Object ### #number\_field(field, options = {}) ⇒ Object ### #password\_field(field, options = {}) ⇒ Object ### #radio\_button(field, options = {}) ⇒ Object ### #radio\_button\_group(field, options = {}) ⇒ Object ### #search\_field(field, options = {}) ⇒ Object ### #select(field, options = {}) ⇒ Object ### #submit(\*args) ⇒ Object ### #telephone\_field(field, options = {}) ⇒ Object Also known as: phone\_field ### #text\_area(field, options = {}) ⇒ Object ### #text\_field(field, options = {}) ⇒ Object ### #time\_field(field, options = {}) ⇒ Object ### #url\_field(field, options = {}) ⇒ Object ### #week\_field(field, options = {}) ⇒ Object padrino Class: Padrino::Helpers::FormBuilder::StandardFormBuilder Class: Padrino::Helpers::FormBuilder::StandardFormBuilder ========================================================= Inherits: [AbstractFormBuilder](abstractformbuilder "Padrino::Helpers::FormBuilder::AbstractFormBuilder (class)") * [Object](../../../object "Object (class)") * [AbstractFormBuilder](abstractformbuilder "Padrino::Helpers::FormBuilder::AbstractFormBuilder (class)") * Padrino::Helpers::FormBuilder::StandardFormBuilder Instance Attribute Summary -------------------------- ### Attributes inherited from AbstractFormBuilder [#attributes\_name](abstractformbuilder#attributes_name-instance_method "Padrino::Helpers::FormBuilder::AbstractFormBuilder#attributes_name (method)"), [#is\_nested](abstractformbuilder#is_nested-instance_method "Padrino::Helpers::FormBuilder::AbstractFormBuilder#is_nested (method)"), [#model\_name](abstractformbuilder#model_name-instance_method "Padrino::Helpers::FormBuilder::AbstractFormBuilder#model_name (method)"), [#multipart](abstractformbuilder#multipart-instance_method "Padrino::Helpers::FormBuilder::AbstractFormBuilder#multipart (method)"), [#namespace](abstractformbuilder#namespace-instance_method "Padrino::Helpers::FormBuilder::AbstractFormBuilder#namespace (method)"), [#nested\_index](abstractformbuilder#nested_index-instance_method "Padrino::Helpers::FormBuilder::AbstractFormBuilder#nested_index (method)"), [#object](abstractformbuilder#object-instance_method "Padrino::Helpers::FormBuilder::AbstractFormBuilder#object (method)"), [#parent\_form](abstractformbuilder#parent_form-instance_method "Padrino::Helpers::FormBuilder::AbstractFormBuilder#parent_form (method)"), [#template](abstractformbuilder#template-instance_method "Padrino::Helpers::FormBuilder::AbstractFormBuilder#template (method)") Instance Method Summary ------------------------ * `[#**field\_type** ⇒ Object](standardformbuilder#field_type-instance_method "#field_type (instance method)")` StandardFormBuilder. * `[#**image\_submit\_block**(source, options = {}) ⇒ Object](standardformbuilder#image_submit_block-instance_method "#image_submit_block (instance method)")` * `[#**submit\_block**(caption, options = {}) ⇒ Object](standardformbuilder#submit_block-instance_method "#submit_block (instance method)")` ### Methods inherited from AbstractFormBuilder [#check\_box](abstractformbuilder#check_box-instance_method "Padrino::Helpers::FormBuilder::AbstractFormBuilder#check_box (method)"), [#check\_box\_group](abstractformbuilder#check_box_group-instance_method "Padrino::Helpers::FormBuilder::AbstractFormBuilder#check_box_group (method)"), [#color\_field](abstractformbuilder#color_field-instance_method "Padrino::Helpers::FormBuilder::AbstractFormBuilder#color_field (method)"), [#csrf\_token\_field](abstractformbuilder#csrf_token_field-instance_method "Padrino::Helpers::FormBuilder::AbstractFormBuilder#csrf_token_field (method)"), [#date\_field](abstractformbuilder#date_field-instance_method "Padrino::Helpers::FormBuilder::AbstractFormBuilder#date_field (method)"), [#datetime\_field](abstractformbuilder#datetime_field-instance_method "Padrino::Helpers::FormBuilder::AbstractFormBuilder#datetime_field (method)"), [#datetime\_local\_field](abstractformbuilder#datetime_local_field-instance_method "Padrino::Helpers::FormBuilder::AbstractFormBuilder#datetime_local_field (method)"), [#email\_field](abstractformbuilder#email_field-instance_method "Padrino::Helpers::FormBuilder::AbstractFormBuilder#email_field (method)"), [#error\_message\_on](abstractformbuilder#error_message_on-instance_method "Padrino::Helpers::FormBuilder::AbstractFormBuilder#error_message_on (method)"), [#error\_messages](abstractformbuilder#error_messages-instance_method "Padrino::Helpers::FormBuilder::AbstractFormBuilder#error_messages (method)"), [#fields\_for](abstractformbuilder#fields_for-instance_method "Padrino::Helpers::FormBuilder::AbstractFormBuilder#fields_for (method)"), [#file\_field](abstractformbuilder#file_field-instance_method "Padrino::Helpers::FormBuilder::AbstractFormBuilder#file_field (method)"), [#hidden\_field](abstractformbuilder#hidden_field-instance_method "Padrino::Helpers::FormBuilder::AbstractFormBuilder#hidden_field (method)"), [#image\_submit](abstractformbuilder#image_submit-instance_method "Padrino::Helpers::FormBuilder::AbstractFormBuilder#image_submit (method)"), [#initialize](abstractformbuilder#initialize-instance_method "Padrino::Helpers::FormBuilder::AbstractFormBuilder#initialize (method)"), [#label](abstractformbuilder#label-instance_method "Padrino::Helpers::FormBuilder::AbstractFormBuilder#label (method)"), [#month\_field](abstractformbuilder#month_field-instance_method "Padrino::Helpers::FormBuilder::AbstractFormBuilder#month_field (method)"), [#number\_field](abstractformbuilder#number_field-instance_method "Padrino::Helpers::FormBuilder::AbstractFormBuilder#number_field (method)"), [#password\_field](abstractformbuilder#password_field-instance_method "Padrino::Helpers::FormBuilder::AbstractFormBuilder#password_field (method)"), [#radio\_button](abstractformbuilder#radio_button-instance_method "Padrino::Helpers::FormBuilder::AbstractFormBuilder#radio_button (method)"), [#radio\_button\_group](abstractformbuilder#radio_button_group-instance_method "Padrino::Helpers::FormBuilder::AbstractFormBuilder#radio_button_group (method)"), [#search\_field](abstractformbuilder#search_field-instance_method "Padrino::Helpers::FormBuilder::AbstractFormBuilder#search_field (method)"), [#select](abstractformbuilder#select-instance_method "Padrino::Helpers::FormBuilder::AbstractFormBuilder#select (method)"), [#submit](abstractformbuilder#submit-instance_method "Padrino::Helpers::FormBuilder::AbstractFormBuilder#submit (method)"), [#telephone\_field](abstractformbuilder#telephone_field-instance_method "Padrino::Helpers::FormBuilder::AbstractFormBuilder#telephone_field (method)"), [#text\_area](abstractformbuilder#text_area-instance_method "Padrino::Helpers::FormBuilder::AbstractFormBuilder#text_area (method)"), [#text\_field](abstractformbuilder#text_field-instance_method "Padrino::Helpers::FormBuilder::AbstractFormBuilder#text_field (method)"), [#time\_field](abstractformbuilder#time_field-instance_method "Padrino::Helpers::FormBuilder::AbstractFormBuilder#time_field (method)"), [#url\_field](abstractformbuilder#url_field-instance_method "Padrino::Helpers::FormBuilder::AbstractFormBuilder#url_field (method)"), [#week\_field](abstractformbuilder#week_field-instance_method "Padrino::Helpers::FormBuilder::AbstractFormBuilder#week_field (method)") Constructor Details ------------------- This class inherits a constructor from [Padrino::Helpers::FormBuilder::AbstractFormBuilder](abstractformbuilder#initialize-instance_method "Padrino::Helpers::FormBuilder::AbstractFormBuilder#initialize (method)") Instance Method Details ----------------------- ### #field\_type ⇒ Object StandardFormBuilder ``` text_field_block(:username, { :class => 'long' }, { :class => 'wide-label' }) text_area_block(:summary, { :class => 'long' }, { :class => 'wide-label' }) password_field_block(:password, { :class => 'long' }, { :class => 'wide-label' }) file_field_block(:photo, { :class => 'long' }, { :class => 'wide-label' }) check_box_block(:remember_me, { :class => 'long' }, { :class => 'wide-label' }) select_block(:color, :options => ['green', 'black']) ``` ### #image\_submit\_block(source, options = {}) ⇒ Object ### #submit\_block(caption, options = {}) ⇒ Object
programming_docs
padrino Module: Padrino::Helpers::FormHelpers::Security Module: Padrino::Helpers::FormHelpers::Security =============================================== Overview -------- Helpers to generate form security tags for csrf protection. Instance Method Summary ------------------------ * `[#**csrf\_meta\_tags** ⇒ String](security#csrf_meta_tags-instance_method "#csrf_meta_tags (instance method)")` Constructs meta tags `csrf-param` and `csrf-token` with the name of the cross-site request forgery protection parameter and token, respectively. * `[#**csrf\_token\_field** ⇒ String](security#csrf_token_field-instance_method "#csrf_token_field (instance method)")` Constructs a hidden field containing a CSRF token. Instance Method Details ----------------------- ### #csrf\_meta\_tags ⇒ String Constructs meta tags `csrf-param` and `csrf-token` with the name of the cross-site request forgery protection parameter and token, respectively. #### Examples: ``` csrf_meta_tags ``` #### Returns: * (`[String](../../../string "String (class)")`) — The meta tags with the CSRF token and the param your app expects it in. ### #csrf\_token\_field ⇒ String Constructs a hidden field containing a CSRF token. #### Examples: ``` csrf_token_field ``` #### Parameters: * `token` (`[String](../../../string "String (class)")`) — The token to use. Will be read from the session by default. #### Returns: * (`[String](../../../string "String (class)")`) — The hidden field with CSRF token as value. padrino Module: Padrino::Helpers::FormHelpers::Errors Module: Padrino::Helpers::FormHelpers::Errors ============================================= Overview -------- Helpers to generate form errors. Instance Method Summary ------------------------ * `[#**error\_message\_on**(object, field, options = {}) ⇒ String](errors#error_message_on-instance_method "#error_message_on (instance method)")` Returns a string containing the error message attached to the `method` on the `object` if one exists. * `[#**error\_messages\_for**(\*objects, options = {}) ⇒ String](errors#error_messages_for-instance_method "#error_messages_for (instance method)")` Constructs list HTML for the errors for a given symbol. Instance Method Details ----------------------- ### #error\_message\_on(object, field, options = {}) ⇒ String Returns a string containing the error message attached to the `method` on the `object` if one exists. #### Examples: ``` # => <span class="error">can't be blank</div> error_message_on :post, :title error_message_on @post, :title # => <div class="custom" style="border:1px solid red">can't be blank</div> error_message_on :post, :title, :tag => :id, :class => :custom, :style => "border:1px solid red" # => <div class="error">This title can't be blank (or it won't work)</div> error_message_on :post, :title, :prepend => "This title", :append => "(or it won't work)" ``` #### Parameters: * `object` (`[Object](../../../object "Object (class)")`) — The object to display the error for. * `field` (`Symbol`) — The field on the `object` to display the error for. * `options` (`Hash`) *(defaults to: `{}`)* — The options to control the error display. #### Options Hash (`options`): * `:tag` (`[String](../../../string "String (class)")`) — default: `"span"` — The tag that encloses the error. * `:prepend` (`[String](../../../string "String (class)")`) — default: `""` — The text to prepend before the field error. * `:append` (`[String](../../../string "String (class)")`) — default: `""` — The text to append after the field error. #### Returns: * (`[String](../../../string "String (class)")`) — The html display of an error for a particular `object` and `field`. ### #error\_messages\_for(\*objects, options = {}) ⇒ String Constructs list HTML for the errors for a given symbol. #### Examples: ``` error_messages_for :user ``` #### Parameters: * `object` (`Array<[Object](../../../object "Object (class)")>`) — Splat of objects to display errors for. * `options` (`Hash`) *(defaults to: `{}`)* — Error message display options. #### Options Hash (`options`): * `:header_tag` (`[String](../../../string "String (class)")`) — default: `"h2"` — Used for the header of the error div. * `:id` (`[String](../../../string "String (class)")`) — default: `"field-errors"` — The id of the error div. * `:class` (`[String](../../../string "String (class)")`) — default: `"field-errors"` — The class of the error div. * `:object` (`Array<[Object](../../../object "Object (class)")>`) — The object (or array of objects) for which to display errors, if you need to escape the instance variable convention. * `:object_name` (`[String](../../../string "String (class)")`) — The object name to use in the header, or any text that you prefer. If `:object_name` is not set, the name of the first object will be used. * `:header_message` (`[String](../../../string "String (class)")`) — default: `"X errors prohibited this object from being saved"` — The message in the header of the error div. Pass `nil` or an empty string to avoid the header message altogether. * `:message` (`[String](../../../string "String (class)")`) — default: `"There were problems with the following fields:"` — The explanation message after the header message and before the error list. Pass `nil` or an empty string to avoid the explanation message altogether. #### Returns: * (`[String](../../../string "String (class)")`) — The html section with all errors for the specified `objects` padrino Module: Padrino::Helpers::FormHelpers::Options Module: Padrino::Helpers::FormHelpers::Options ============================================== Overview -------- Helpers to generate options list for select tag. Instance Method Summary ------------------------ * `[#**extract\_option\_tags!**(options) ⇒ Object](options#extract_option_tags!-instance_method "#extract_option_tags! (instance method)")` Instance Method Details ----------------------- ### #extract\_option\_tags!(options) ⇒ Object tailwindcss Text Overflow Quick reference --------------- | Class | Properties | | --- | --- | | truncate | overflow: hidden; text-overflow: ellipsis; white-space: nowrap; | | text-ellipsis | text-overflow: ellipsis; | | text-clip | text-overflow: clip; | Basic usage ----------- ### Truncate Use `truncate` to truncate overflowing text with an ellipsis (`…`) if needed. ``` <p class="truncate ...">...</p> ``` ### Ellipsis Use `text-ellipsis` to truncate overflowing text with an ellipsis (`…`) if needed. ``` <p class="text-ellipsis overflow-hidden ...">...</p> ``` ### Clip Use `text-clip` to truncate the text at the limit of the content area. ``` <p class="text-clip overflow-hidden ...">...</p> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:text-clip` to only apply the `text-clip` utility on hover. ``` <p class="truncate hover:text-clip"> <!-- ... --> </p> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:text-clip` to apply the `text-clip` utility at only medium screen sizes and above. ``` <p class="truncate md:text-clip"> <!-- ... --> </p> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Hue Rotate Quick reference --------------- | Class | Properties | | --- | --- | | hue-rotate-0 | filter: hue-rotate(0deg); | | hue-rotate-15 | filter: hue-rotate(15deg); | | hue-rotate-30 | filter: hue-rotate(30deg); | | hue-rotate-60 | filter: hue-rotate(60deg); | | hue-rotate-90 | filter: hue-rotate(90deg); | | hue-rotate-180 | filter: hue-rotate(180deg); | Basic usage ----------- ### Rotating an element's hue Use the `hue-rotate-{amount}` utilities to rotate the hue of an element. ``` <div class="hue-rotate-15 ..."> <!-- ... --> </div> <div class="hue-rotate-90 ..."> <!-- ... --> </div> <div class="hue-rotate-180 ..."> <!-- ... --> </div> <div class="-hue-rotate-60 ..."> <!-- ... --> </div> ``` ### Using negative values To use a negative hue-rotate value, prefix the class name with a dash to convert it to a negative value. ``` <div class="-hue-rotate-60 ..."> <!-- ... --> </div> ``` ### Removing filters To remove all of the filters on an element at once, use the `filter-none` utility: ``` <div class="blur-md invert hue-rotate-180 md:filter-none"> <!-- ... --> </div> ``` This can be useful when you want to remove filters conditionally, such as on hover or at a particular breakpoint. Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:hue-rotate-0` to only apply the `hue-rotate-0` utility on hover. ``` <div class="hue-rotate-60 hover:hue-rotate-0"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:hue-rotate-0` to apply the `hue-rotate-0` utility at only medium screen sizes and above. ``` <div class="hue-rotate-60 md:hue-rotate-0"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind includes a handful of general purpose `hue-rotate` utilities. You can customize these values by editing `theme.hueRotate` or `theme.extend.hueRotate` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { hueRotate: { '-270': '-270deg', 270: '270deg', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `hue-rotate` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="hue-rotate-[270deg]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Plugins Overview -------- Plugins let you register new styles for Tailwind to inject into the user’s stylesheet using JavaScript instead of CSS. To get started with your first plugin, import Tailwind’s `plugin` function from `tailwindcss/plugin`. Then inside your `plugins` array, call the imported `plugin` function with an anonymous function as the first argument. tailwind.config.js ``` const plugin = require('tailwindcss/plugin') module.exports = { plugins: [ plugin(function({ addUtilities, addComponents, e, config }) { // Add your custom styles here }), ] } ``` Plugin functions receive a single object argument that can be [destructured](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment) into several helper functions: * `addUtilities()`, for registering new static utility styles * `matchUtilities()`, for registering new dynamic utility styles * `addComponents()`, for registering new static component styles * `matchComponents()`, for registering new dynamic component styles * `addBase()`, for registering new base styles * `addVariant()`, for registering custom variants * `theme()`, for looking up values in the user’s theme configuration * `config()`, for looking up values in the user’s Tailwind configuration * `corePlugins()`, for checking if a core plugin is enabled * `e()`, for manually escaping strings meant to be used in class names Official plugins ---------------- We’ve developed a handful of official plugins for popular features that for one reason or another don’t belong in core yet. Plugins can be added to your project by installing them via npm, then adding them to your `tailwind.config.js` file: tailwind.config.js ``` module.exports = { // ... plugins: [ require('@tailwindcss/typography'), require('@tailwindcss/forms'), require('@tailwindcss/line-clamp'), require('@tailwindcss/aspect-ratio'), ] } ``` ### Typography The `@tailwindcss/typography` plugin adds a set of `prose` classes that can be used to quickly add sensible typographic styles to content blocks that come from sources like markdown or a CMS database. ``` <article class="prose lg:prose-xl"> <h1>Garlic bread with cheese: What the science tells us</h1> <p> For years parents have espoused the health benefits of eating garlic bread with cheese to their children, with the food earning such an iconic status in our culture that kids will often dress up as warm, cheesy loaf for Halloween. </p> <p> But a recent study shows that the celebrated appetizer may be linked to a series of rabies cases springing up around the country. </p> <!-- ... --> </article> ``` [Learn more about the typography plugin →](typography-plugin) ### Forms The `@tailwindcss/forms` plugin adds an opinionated form reset layer that makes it easier to style form elements with utility classes. ``` <!-- You can actually customize padding on a select element: --> <select class="px-4 py-3 rounded-full"> <!-- ... --> </select> <!-- Or change a checkbox color using text color utilities: --> <input type="checkbox" class="rounded text-pink-500" /> ``` [Learn more about the forms plugin →](https://github.com/tailwindlabs/tailwindcss-forms) ### Line-clamp The `@tailwindcss/line-clamp` plugin adds `line-clamp-{lines}` classes you can use to truncate text to a fixed number of lines. ``` <p class="line-clamp-3 md:line-clamp-none"> Et molestiae hic earum repellat aliquid est doloribus delectus. Enim illum odio porro ut omnis dolor debitis natus. Voluptas possimus deserunt sit delectus est saepe nihil. Qui voluptate possimus et quia. Eligendi voluptas voluptas dolor cum. Rerum est quos quos id ut molestiae fugit. </p> ``` [Learn more about the line-clamp plugin →](https://github.com/tailwindlabs/tailwindcss-line-clamp) ### Aspect ratio The `@tailwindcss/aspect-ratio` plugin adds `aspect-w-{n}` and `aspect-h-{n}` classes that can be combined to give an element a fixed aspect ratio. ``` <div class="aspect-w-16 aspect-h-9"> <iframe src="https://www.youtube.com/embed/dQw4w9WgXcQ" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> </div> ``` [Learn more about the aspect ratio plugin →](https://github.com/tailwindlabs/tailwindcss-aspect-ratio) Adding utilities ---------------- The `addUtilities` and `matchUtilities` functions allow you to register new styles in Tailwind’s `utilities` layer. Like with the utilities Tailwind includes by default, utilities added by a plugin will only be included in the generated CSS if they are actually being used in the project. ### Static utilities Use the `addUtilities` function to register simple static utilities that don’t support user-provided values: tailwind.config.js ``` const plugin = require('tailwindcss/plugin') module.exports = { plugins: [ plugin(function({ addUtilities }) { addUtilities({ '.content-auto': { 'content-visibility': 'auto', }, '.content-hidden': { 'content-visibility': 'hidden', }, '.content-visible': { 'content-visibility': 'visible', }, }) }) ] } ``` Learn more about to represent your styles in JavaScript in the [CSS-in-JS syntax](#css-in-js-syntax) reference. ### Dynamic utilities Use the `matchUtilities` function to register utilities that map to values defined in the user’s `theme` configuration: tailwind.config.js ``` const plugin = require('tailwindcss/plugin') module.exports = { theme: { tabSize: { 1: '1', 2: '2', 4: '4', 8: '8', } }, plugins: [ plugin(function({ matchUtilities, theme }) { matchUtilities( { tab: (value) => ({ tabSize: value }), }, { values: theme('tabSize') } ) }) ] } ``` Utilities defined this way also support [arbitrary values](adding-custom-styles#using-arbitrary-values), which means you can use values not present in the theme using square bracket notation: ``` <div class="tab-[13]"> <!-- ... --> </div> ``` ### Prefix and important By default, plugin utilities automatically respect the user’s [`prefix`](configuration#prefix) and [`important`](configuration#important) preferences. That means that given this Tailwind configuration: tailwind.config.js ``` module.exports = { prefix: 'tw-', important: true, // ... } ``` …the example plugin above would generate the following CSS: ``` .tw-content-auto { content-visibility: auto !important; } .tw-content-hidden { content-visibility: hidden !important; } .tw-content-visible { content-visibility: visible !important; } ``` ### Using with modifiers Any custom utilities added using `addUtilities` can automatically be used with modifiers: ``` <div class="content-auto lg:content-visible"> <!-- ... --> </div> ``` Learn more in the [Hover, Focus, and Other States](hover-focus-and-other-states) documentation. ### Providing default values Utility plugins can provide default values by including a configuration object as the second argument to the `plugin` function: ./plugins/tab-size.js ``` const plugin = require('tailwindcss/plugin') module.exports = plugin(function({ matchUtilities, theme }) { matchUtilities( { tab: (value) => ({ tabSize: value }), }, { values: theme('tabSize') } ) }, { theme: { tabSize: { 1: '1', 2: '2', 4: '4', 8: '8', } } }) ``` These values behave just like the values in the default configuration, and can be overridden or extended by the end user. Adding components ----------------- The `addComponents` function allows you to register new styles in Tailwind’s `components` layer. Use it to add more opinionated, complex classes like buttons, form controls, alerts, etc; the sort of pre-built components you often see in other frameworks that you might need to override with utility classes. To add new component styles from a plugin, call `addComponents`, passing in your styles using [CSS-in-JS syntax](#css-in-js-syntax): tailwind.config.js ``` const plugin = require('tailwindcss/plugin') module.exports = { plugins: [ plugin(function({ addComponents }) { addComponents({ '.btn': { padding: '.5rem 1rem', borderRadius: '.25rem', fontWeight: '600', }, '.btn-blue': { backgroundColor: '#3490dc', color: '#fff', '&:hover': { backgroundColor: '#2779bd' }, }, '.btn-red': { backgroundColor: '#e3342f', color: '#fff', '&:hover': { backgroundColor: '#cc1f1a' }, }, }) }) ] } ``` Like with other component classes in Tailwind, component classes added by a plugin will only be included in the generated CSS if they are actually being used in the project. ### Prefix and important By default, component classes automatically respect the user’s `prefix` preference, but *they are not affected* by the user’s `important` preference. That means that given this Tailwind configuration: tailwind.config.js ``` module.exports = { prefix: 'tw-', important: true, // ... } ``` …the example plugin above would generate the following CSS: ``` .tw-btn { padding: .5rem 1rem; border-radius: .25rem; font-weight: 600; } .tw-btn-blue { background-color: #3490dc; color: #fff; } .tw-btn-blue:hover { background-color: #2779bd; } .tw-btn-red { background-color: #e3342f; color: #fff; } .tw-btn-red:hover { background-color: #cc1f1a; } ``` Although there’s rarely a good reason to make component declarations important, if you really need to do it you can always add `!important` manually: tailwind.config.js ``` const plugin = require('tailwindcss/plugin') module.exports = { plugins: [ plugin(function({ addComponents }) { addComponents({ '.btn': { padding: '.5rem 1rem !important', borderRadius: '.25rem !important', fontWeight: '600 !important', }, // ... }) }) ] } ``` All classes in a selector will be prefixed by default, so if you add a more complex style like: tailwind.config.js ``` const plugin = require('tailwindcss/plugin') module.exports = { prefix: 'tw-', plugins: [ plugin(function({ addComponents }) { const components = { // ... '.navbar-inverse a.nav-link': { color: '#fff', } } addComponents(components) }) ] } ``` …the following CSS would be generated: ``` .tw-navbar-inverse a.tw-nav-link { color: #fff; } ``` ### Using with modifiers Any component classes added using `addComponents` can automatically be used with modifiers: ``` <div class="btn md:btn-lg"> <!-- ... --> </div> ``` Learn more in the [Hover, Focus, and Other States](hover-focus-and-other-states) documentation. Adding base styles ------------------ The `addBase` function allows you to register new styles in Tailwind’s `base` layer. Use it to add things like base typography styles, opinionated global resets, or `@font-face` rules. To add new base styles from a plugin, call `addBase`, passing in your styles using [CSS-in-JS syntax](#css-in-js-syntax): tailwind.config.js ``` const plugin = require('tailwindcss/plugin') module.exports = { plugins: [ plugin(function({ addBase, theme }) { addBase({ 'h1': { fontSize: theme('fontSize.2xl') }, 'h2': { fontSize: theme('fontSize.xl') }, 'h3': { fontSize: theme('fontSize.lg') }, }) }) ] } ``` Since base styles are meant to target bare selectors like `div` or `h1`, they do not respect the user’s `prefix` or `important` configuration. Adding variants --------------- The `addVariant` function allows you to register your own custom [modifiers](hover-focus-and-other-states) that can be used just like the built-in hover, focus, active, etc. variants. To add a new variant, call the `addVariant` function, passing in the name of your custom variant, and a format string that represents how the selector should be modified. tailwind.config.js ``` const plugin = require('tailwindcss/plugin') module.exports = { // ... plugins: [ plugin(function({ addVariant }) { addVariant('optional', '&:optional') addVariant('hocus', ['&:hover', '&:focus']) addVariant('supports-grid', '@supports (display: grid)') }) ] } ``` The first argument is the modifier name that users will use in their HTML, so the above example would make it possible to write classes like these: ``` <form class="flex supports-grid:grid ..."> <input class="optional:border-gray-300 ..." /> <button class="bg-blue-500 hocus:bg-blue-600">...</button> </form> ``` ### Parent and sibling states Your custom modifiers won’t automatically work with Tailwind’s [parent](hover-focus-and-other-states#styling-based-on-parent-state) and [sibling](hover-focus-and-other-states#styling-based-on-sibling-state) state modifiers. To support the `group-*` and `peer-*` versions of your own custom modifiers, register them as separate variants using the special `:merge` directive to ensure the `.group` and `.peer` classes only appear once in the final selector. tailwind.config.js ``` const plugin = require('tailwindcss/plugin') module.exports = { // ... plugins: [ plugin(function({ addVariant }) { addVariant('optional', '&:optional') addVariant('group-optional', ':merge(.group):optional &') addVariant('peer-optional', ':merge(.peer):optional ~ &') }) ] } ``` Extending the configuration --------------------------- Plugins can merge their own set of configuration values into the user’s `tailwind.config.js` configuration by providing an object as the second argument to the `plugin` function: ./plugins/tab-size.js ``` const plugin = require('tailwindcss/plugin') module.exports = plugin(function({ matchUtilities, theme }) { matchUtilities( { tab: (value) => ({ tabSize: value }), }, { values: theme('tabSize') } ) }, { theme: { tabSize: { 1: '1', 2: '2', 4: '4', 8: '8', } } }) ``` This can be useful for things like providing default `theme` values for the classes your plugin generates. Exposing options ---------------- Sometimes it makes sense for a plugin to be configurable in a way that doesn’t really belong under `theme`, like perhaps you want users to be able to customize the class name your plugin uses. For cases like this, you can use `plugin.withOptions` to define a plugin that can be invoked with a configuration object. This API is similar to the regular `plugin` API, except each argument should be a function that receives the user’s `options` and returns the value that you would have normally passed in using the regular API: ./plugins/markdown.js ``` const plugin = require('tailwindcss/plugin') module.exports = plugin.withOptions(function (options = {}) { return function({ addComponents }) { const className = options.className ?? 'markdown' addComponents({ [`.${className}`]: { // ... } }) } }, function (options) { return { theme: { markdown: { // ... } }, } }) ``` The user would invoke your plugin passing along their options when registering it in their `plugins` configuration: tailwind.config.js ``` module.exports = { theme: { // ... }, plugins: [ require('./plugins/markdown.js')({ className: 'wysiwyg' }) ], } ``` The user can also register plugins created this way normally without invoking them if they don’t need to pass in any custom options: tailwind.config.js ``` module.exports = { theme: { // ... }, plugins: [ require('./plugins/markdown.js') ], } ``` CSS-in-JS syntax ---------------- Tailwind’s plugin system expect CSS rules written as JavaScript objects, using the same sort of syntax you might recognize from CSS-in-JS libraries like [Emotion](https://emotion.sh/docs/object-styles), powered by [postcss-js](https://github.com/postcss/postcss-js) under-the-hood. Consider this simple CSS rule: ``` .card { background-color: #fff; border-radius: .25rem; box-shadow: 0 2px 4px rgba(0,0,0,0.2); } ``` Translating this to a CSS-in-JS object would look like this: ``` addComponents({ '.card': { 'background-color': '#fff', 'border-radius': '.25rem', 'box-shadow': '0 2px 4px rgba(0,0,0,0.2)', } }) ``` For convenience, property names can also be written in camelCase and will be automatically translated to dash-case: ``` addComponents({ '.card': { backgroundColor: '#fff', borderRadius: '.25rem', boxShadow: '0 2px 4px rgba(0,0,0,0.2)', } }) ``` Nesting is also supported (powered by [postcss-nested](https://github.com/postcss/postcss-nested)), using the same syntax you might be familiar with from Sass or Less: ``` addComponents({ '.card': { backgroundColor: '#fff', borderRadius: '.25rem', boxShadow: '0 2px 4px rgba(0,0,0,0.2)', '&:hover': { boxShadow: '0 10px 15px rgba(0,0,0,0.2)', }, '@media (min-width: 500px)': { borderRadius: '.5rem', } } }) ``` Multiple rules can be defined in the same object: ``` addComponents({ '.btn': { padding: '.5rem 1rem', borderRadius: '.25rem', fontWeight: '600', }, '.btn-blue': { backgroundColor: '#3490dc', color: '#fff', '&:hover': { backgroundColor: '#2779bd' }, }, '.btn-red': { backgroundColor: '#e3342f', color: '#fff', '&:hover': { backgroundColor: '#cc1f1a' }, }, }) ``` …or as an array of objects in case you need to repeat the same key: ``` addComponents([ { '@media (min-width: 500px)': { // ... } }, { '@media (min-width: 500px)': { // ... } }, { '@media (min-width: 500px)': { // ... } }, ]) ```
programming_docs
tailwindcss Outline Offset Quick reference --------------- | Class | Properties | | --- | --- | | outline-offset-0 | outline-offset: 0px; | | outline-offset-1 | outline-offset: 1px; | | outline-offset-2 | outline-offset: 2px; | | outline-offset-4 | outline-offset: 4px; | | outline-offset-8 | outline-offset: 8px; | Basic usage ----------- ### Setting the outline offset Use the `outline-{offset}` utilities to change the offset of an element’s outline. ``` <button class="outline outline-offset-0 ...">Button A</button> <button class="outline outline-offset-2 ...">Button B</button> <button class="outline outline-offset-4 ...">Button C</button> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:outline-offset-2` to only apply the `outline-offset-2` utility on hover. ``` <button class="outline hover:outline-offset-2"> <!-- ... --> </button> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:outline-offset-2` to apply the `outline-offset-2` utility at only medium screen sizes and above. ``` <button class="outline md:outline-offset-2"> <!-- ... --> </button> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme You can customize the `outline-offset-{width}` utilities by editing `theme.outlineOffset` or `theme.extend.outlineOffset` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { outlineOffset: { 3: '3px', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `outline-offset` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <button class="outline-offset-[3px]"> <!-- ... --> </button> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Background Color Quick reference --------------- | Class | Properties | Preview | | --- | --- | --- | | bg-inherit | background-color: inherit; | | | bg-current | background-color: currentColor; | | | bg-transparent | background-color: transparent; | | | bg-black | background-color: rgb(0 0 0); | | | bg-white | background-color: rgb(255 255 255); | | | bg-slate-50 | background-color: rgb(248 250 252); | | | bg-slate-100 | background-color: rgb(241 245 249); | | | bg-slate-200 | background-color: rgb(226 232 240); | | | bg-slate-300 | background-color: rgb(203 213 225); | | | bg-slate-400 | background-color: rgb(148 163 184); | | | bg-slate-500 | background-color: rgb(100 116 139); | | | bg-slate-600 | background-color: rgb(71 85 105); | | | bg-slate-700 | background-color: rgb(51 65 85); | | | bg-slate-800 | background-color: rgb(30 41 59); | | | bg-slate-900 | background-color: rgb(15 23 42); | | | bg-gray-50 | background-color: rgb(249 250 251); | | | bg-gray-100 | background-color: rgb(243 244 246); | | | bg-gray-200 | background-color: rgb(229 231 235); | | | bg-gray-300 | background-color: rgb(209 213 219); | | | bg-gray-400 | background-color: rgb(156 163 175); | | | bg-gray-500 | background-color: rgb(107 114 128); | | | bg-gray-600 | background-color: rgb(75 85 99); | | | bg-gray-700 | background-color: rgb(55 65 81); | | | bg-gray-800 | background-color: rgb(31 41 55); | | | bg-gray-900 | background-color: rgb(17 24 39); | | | bg-zinc-50 | background-color: rgb(250 250 250); | | | bg-zinc-100 | background-color: rgb(244 244 245); | | | bg-zinc-200 | background-color: rgb(228 228 231); | | | bg-zinc-300 | background-color: rgb(212 212 216); | | | bg-zinc-400 | background-color: rgb(161 161 170); | | | bg-zinc-500 | background-color: rgb(113 113 122); | | | bg-zinc-600 | background-color: rgb(82 82 91); | | | bg-zinc-700 | background-color: rgb(63 63 70); | | | bg-zinc-800 | background-color: rgb(39 39 42); | | | bg-zinc-900 | background-color: rgb(24 24 27); | | | bg-neutral-50 | background-color: rgb(250 250 250); | | | bg-neutral-100 | background-color: rgb(245 245 245); | | | bg-neutral-200 | background-color: rgb(229 229 229); | | | bg-neutral-300 | background-color: rgb(212 212 212); | | | bg-neutral-400 | background-color: rgb(163 163 163); | | | bg-neutral-500 | background-color: rgb(115 115 115); | | | bg-neutral-600 | background-color: rgb(82 82 82); | | | bg-neutral-700 | background-color: rgb(64 64 64); | | | bg-neutral-800 | background-color: rgb(38 38 38); | | | bg-neutral-900 | background-color: rgb(23 23 23); | | | bg-stone-50 | background-color: rgb(250 250 249); | | | bg-stone-100 | background-color: rgb(245 245 244); | | | bg-stone-200 | background-color: rgb(231 229 228); | | | bg-stone-300 | background-color: rgb(214 211 209); | | | bg-stone-400 | background-color: rgb(168 162 158); | | | bg-stone-500 | background-color: rgb(120 113 108); | | | bg-stone-600 | background-color: rgb(87 83 78); | | | bg-stone-700 | background-color: rgb(68 64 60); | | | bg-stone-800 | background-color: rgb(41 37 36); | | | bg-stone-900 | background-color: rgb(28 25 23); | | | bg-red-50 | background-color: rgb(254 242 242); | | | bg-red-100 | background-color: rgb(254 226 226); | | | bg-red-200 | background-color: rgb(254 202 202); | | | bg-red-300 | background-color: rgb(252 165 165); | | | bg-red-400 | background-color: rgb(248 113 113); | | | bg-red-500 | background-color: rgb(239 68 68); | | | bg-red-600 | background-color: rgb(220 38 38); | | | bg-red-700 | background-color: rgb(185 28 28); | | | bg-red-800 | background-color: rgb(153 27 27); | | | bg-red-900 | background-color: rgb(127 29 29); | | | bg-orange-50 | background-color: rgb(255 247 237); | | | bg-orange-100 | background-color: rgb(255 237 213); | | | bg-orange-200 | background-color: rgb(254 215 170); | | | bg-orange-300 | background-color: rgb(253 186 116); | | | bg-orange-400 | background-color: rgb(251 146 60); | | | bg-orange-500 | background-color: rgb(249 115 22); | | | bg-orange-600 | background-color: rgb(234 88 12); | | | bg-orange-700 | background-color: rgb(194 65 12); | | | bg-orange-800 | background-color: rgb(154 52 18); | | | bg-orange-900 | background-color: rgb(124 45 18); | | | bg-amber-50 | background-color: rgb(255 251 235); | | | bg-amber-100 | background-color: rgb(254 243 199); | | | bg-amber-200 | background-color: rgb(253 230 138); | | | bg-amber-300 | background-color: rgb(252 211 77); | | | bg-amber-400 | background-color: rgb(251 191 36); | | | bg-amber-500 | background-color: rgb(245 158 11); | | | bg-amber-600 | background-color: rgb(217 119 6); | | | bg-amber-700 | background-color: rgb(180 83 9); | | | bg-amber-800 | background-color: rgb(146 64 14); | | | bg-amber-900 | background-color: rgb(120 53 15); | | | bg-yellow-50 | background-color: rgb(254 252 232); | | | bg-yellow-100 | background-color: rgb(254 249 195); | | | bg-yellow-200 | background-color: rgb(254 240 138); | | | bg-yellow-300 | background-color: rgb(253 224 71); | | | bg-yellow-400 | background-color: rgb(250 204 21); | | | bg-yellow-500 | background-color: rgb(234 179 8); | | | bg-yellow-600 | background-color: rgb(202 138 4); | | | bg-yellow-700 | background-color: rgb(161 98 7); | | | bg-yellow-800 | background-color: rgb(133 77 14); | | | bg-yellow-900 | background-color: rgb(113 63 18); | | | bg-lime-50 | background-color: rgb(247 254 231); | | | bg-lime-100 | background-color: rgb(236 252 203); | | | bg-lime-200 | background-color: rgb(217 249 157); | | | bg-lime-300 | background-color: rgb(190 242 100); | | | bg-lime-400 | background-color: rgb(163 230 53); | | | bg-lime-500 | background-color: rgb(132 204 22); | | | bg-lime-600 | background-color: rgb(101 163 13); | | | bg-lime-700 | background-color: rgb(77 124 15); | | | bg-lime-800 | background-color: rgb(63 98 18); | | | bg-lime-900 | background-color: rgb(54 83 20); | | | bg-green-50 | background-color: rgb(240 253 244); | | | bg-green-100 | background-color: rgb(220 252 231); | | | bg-green-200 | background-color: rgb(187 247 208); | | | bg-green-300 | background-color: rgb(134 239 172); | | | bg-green-400 | background-color: rgb(74 222 128); | | | bg-green-500 | background-color: rgb(34 197 94); | | | bg-green-600 | background-color: rgb(22 163 74); | | | bg-green-700 | background-color: rgb(21 128 61); | | | bg-green-800 | background-color: rgb(22 101 52); | | | bg-green-900 | background-color: rgb(20 83 45); | | | bg-emerald-50 | background-color: rgb(236 253 245); | | | bg-emerald-100 | background-color: rgb(209 250 229); | | | bg-emerald-200 | background-color: rgb(167 243 208); | | | bg-emerald-300 | background-color: rgb(110 231 183); | | | bg-emerald-400 | background-color: rgb(52 211 153); | | | bg-emerald-500 | background-color: rgb(16 185 129); | | | bg-emerald-600 | background-color: rgb(5 150 105); | | | bg-emerald-700 | background-color: rgb(4 120 87); | | | bg-emerald-800 | background-color: rgb(6 95 70); | | | bg-emerald-900 | background-color: rgb(6 78 59); | | | bg-teal-50 | background-color: rgb(240 253 250); | | | bg-teal-100 | background-color: rgb(204 251 241); | | | bg-teal-200 | background-color: rgb(153 246 228); | | | bg-teal-300 | background-color: rgb(94 234 212); | | | bg-teal-400 | background-color: rgb(45 212 191); | | | bg-teal-500 | background-color: rgb(20 184 166); | | | bg-teal-600 | background-color: rgb(13 148 136); | | | bg-teal-700 | background-color: rgb(15 118 110); | | | bg-teal-800 | background-color: rgb(17 94 89); | | | bg-teal-900 | background-color: rgb(19 78 74); | | | bg-cyan-50 | background-color: rgb(236 254 255); | | | bg-cyan-100 | background-color: rgb(207 250 254); | | | bg-cyan-200 | background-color: rgb(165 243 252); | | | bg-cyan-300 | background-color: rgb(103 232 249); | | | bg-cyan-400 | background-color: rgb(34 211 238); | | | bg-cyan-500 | background-color: rgb(6 182 212); | | | bg-cyan-600 | background-color: rgb(8 145 178); | | | bg-cyan-700 | background-color: rgb(14 116 144); | | | bg-cyan-800 | background-color: rgb(21 94 117); | | | bg-cyan-900 | background-color: rgb(22 78 99); | | | bg-sky-50 | background-color: rgb(240 249 255); | | | bg-sky-100 | background-color: rgb(224 242 254); | | | bg-sky-200 | background-color: rgb(186 230 253); | | | bg-sky-300 | background-color: rgb(125 211 252); | | | bg-sky-400 | background-color: rgb(56 189 248); | | | bg-sky-500 | background-color: rgb(14 165 233); | | | bg-sky-600 | background-color: rgb(2 132 199); | | | bg-sky-700 | background-color: rgb(3 105 161); | | | bg-sky-800 | background-color: rgb(7 89 133); | | | bg-sky-900 | background-color: rgb(12 74 110); | | | bg-blue-50 | background-color: rgb(239 246 255); | | | bg-blue-100 | background-color: rgb(219 234 254); | | | bg-blue-200 | background-color: rgb(191 219 254); | | | bg-blue-300 | background-color: rgb(147 197 253); | | | bg-blue-400 | background-color: rgb(96 165 250); | | | bg-blue-500 | background-color: rgb(59 130 246); | | | bg-blue-600 | background-color: rgb(37 99 235); | | | bg-blue-700 | background-color: rgb(29 78 216); | | | bg-blue-800 | background-color: rgb(30 64 175); | | | bg-blue-900 | background-color: rgb(30 58 138); | | | bg-indigo-50 | background-color: rgb(238 242 255); | | | bg-indigo-100 | background-color: rgb(224 231 255); | | | bg-indigo-200 | background-color: rgb(199 210 254); | | | bg-indigo-300 | background-color: rgb(165 180 252); | | | bg-indigo-400 | background-color: rgb(129 140 248); | | | bg-indigo-500 | background-color: rgb(99 102 241); | | | bg-indigo-600 | background-color: rgb(79 70 229); | | | bg-indigo-700 | background-color: rgb(67 56 202); | | | bg-indigo-800 | background-color: rgb(55 48 163); | | | bg-indigo-900 | background-color: rgb(49 46 129); | | | bg-violet-50 | background-color: rgb(245 243 255); | | | bg-violet-100 | background-color: rgb(237 233 254); | | | bg-violet-200 | background-color: rgb(221 214 254); | | | bg-violet-300 | background-color: rgb(196 181 253); | | | bg-violet-400 | background-color: rgb(167 139 250); | | | bg-violet-500 | background-color: rgb(139 92 246); | | | bg-violet-600 | background-color: rgb(124 58 237); | | | bg-violet-700 | background-color: rgb(109 40 217); | | | bg-violet-800 | background-color: rgb(91 33 182); | | | bg-violet-900 | background-color: rgb(76 29 149); | | | bg-purple-50 | background-color: rgb(250 245 255); | | | bg-purple-100 | background-color: rgb(243 232 255); | | | bg-purple-200 | background-color: rgb(233 213 255); | | | bg-purple-300 | background-color: rgb(216 180 254); | | | bg-purple-400 | background-color: rgb(192 132 252); | | | bg-purple-500 | background-color: rgb(168 85 247); | | | bg-purple-600 | background-color: rgb(147 51 234); | | | bg-purple-700 | background-color: rgb(126 34 206); | | | bg-purple-800 | background-color: rgb(107 33 168); | | | bg-purple-900 | background-color: rgb(88 28 135); | | | bg-fuchsia-50 | background-color: rgb(253 244 255); | | | bg-fuchsia-100 | background-color: rgb(250 232 255); | | | bg-fuchsia-200 | background-color: rgb(245 208 254); | | | bg-fuchsia-300 | background-color: rgb(240 171 252); | | | bg-fuchsia-400 | background-color: rgb(232 121 249); | | | bg-fuchsia-500 | background-color: rgb(217 70 239); | | | bg-fuchsia-600 | background-color: rgb(192 38 211); | | | bg-fuchsia-700 | background-color: rgb(162 28 175); | | | bg-fuchsia-800 | background-color: rgb(134 25 143); | | | bg-fuchsia-900 | background-color: rgb(112 26 117); | | | bg-pink-50 | background-color: rgb(253 242 248); | | | bg-pink-100 | background-color: rgb(252 231 243); | | | bg-pink-200 | background-color: rgb(251 207 232); | | | bg-pink-300 | background-color: rgb(249 168 212); | | | bg-pink-400 | background-color: rgb(244 114 182); | | | bg-pink-500 | background-color: rgb(236 72 153); | | | bg-pink-600 | background-color: rgb(219 39 119); | | | bg-pink-700 | background-color: rgb(190 24 93); | | | bg-pink-800 | background-color: rgb(157 23 77); | | | bg-pink-900 | background-color: rgb(131 24 67); | | | bg-rose-50 | background-color: rgb(255 241 242); | | | bg-rose-100 | background-color: rgb(255 228 230); | | | bg-rose-200 | background-color: rgb(254 205 211); | | | bg-rose-300 | background-color: rgb(253 164 175); | | | bg-rose-400 | background-color: rgb(251 113 133); | | | bg-rose-500 | background-color: rgb(244 63 94); | | | bg-rose-600 | background-color: rgb(225 29 72); | | | bg-rose-700 | background-color: rgb(190 18 60); | | | bg-rose-800 | background-color: rgb(159 18 57); | | | bg-rose-900 | background-color: rgb(136 19 55); | | Basic usage ----------- ### Setting the background color Control the background color of an element using the `bg-{color}` utilities. ``` <button class="bg-indigo-500 ..."> Save changes </button> ``` ### Changing the opacity Control the opacity of an element’s background color using the color opacity modifier. ``` <button class="bg-sky-500/100 ..."></button> <button class="bg-sky-500/75 ..."></button> <button class="bg-sky-500/50 ..."></button> ``` You can use any value defined in your [opacity scale](opacity), or use arbitrary values if you need to deviate from your design tokens. ``` <div class="bg-sky-500/[.06] ..."></div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:bg-cyan-600` to only apply the `bg-cyan-600` utility on hover. ``` <button class="bg-cyan-500 hover:bg-cyan-600 ...">Subscribe</button> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:bg-green-500` to apply the `bg-green-500` utility at only medium screen sizes and above. ``` <button class="bg-blue-500 md:bg-green-500 ...">Subscribe</button> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind makes the entire [default color palette](customizing-colors#default-color-palette) available as background colors. You can [customize your color palette](/docs/customizing-colors#customizing) by editing `theme.colors` or `theme.extend.colors` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { colors: { 'regal-blue': '#243c5a', }, } } } ``` Alternatively, you can customize just your background colors by editing `theme.backgroundColor` or `theme.extend.backgroundColor` in your `tailwind.config.js` file. Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `color` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <p class="bg-[#50d71e]"> <!-- ... --> </p> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Text Color Quick reference --------------- | Class | Properties | Preview | | --- | --- | --- | | text-inherit | color: inherit; | Aa | | text-current | color: currentColor; | Aa | | text-transparent | color: transparent; | Aa | | text-black | color: rgb(0 0 0); | Aa | | text-white | color: rgb(255 255 255); | Aa | | text-slate-50 | color: rgb(248 250 252); | Aa | | text-slate-100 | color: rgb(241 245 249); | Aa | | text-slate-200 | color: rgb(226 232 240); | Aa | | text-slate-300 | color: rgb(203 213 225); | Aa | | text-slate-400 | color: rgb(148 163 184); | Aa | | text-slate-500 | color: rgb(100 116 139); | Aa | | text-slate-600 | color: rgb(71 85 105); | Aa | | text-slate-700 | color: rgb(51 65 85); | Aa | | text-slate-800 | color: rgb(30 41 59); | Aa | | text-slate-900 | color: rgb(15 23 42); | Aa | | text-gray-50 | color: rgb(249 250 251); | Aa | | text-gray-100 | color: rgb(243 244 246); | Aa | | text-gray-200 | color: rgb(229 231 235); | Aa | | text-gray-300 | color: rgb(209 213 219); | Aa | | text-gray-400 | color: rgb(156 163 175); | Aa | | text-gray-500 | color: rgb(107 114 128); | Aa | | text-gray-600 | color: rgb(75 85 99); | Aa | | text-gray-700 | color: rgb(55 65 81); | Aa | | text-gray-800 | color: rgb(31 41 55); | Aa | | text-gray-900 | color: rgb(17 24 39); | Aa | | text-zinc-50 | color: rgb(250 250 250); | Aa | | text-zinc-100 | color: rgb(244 244 245); | Aa | | text-zinc-200 | color: rgb(228 228 231); | Aa | | text-zinc-300 | color: rgb(212 212 216); | Aa | | text-zinc-400 | color: rgb(161 161 170); | Aa | | text-zinc-500 | color: rgb(113 113 122); | Aa | | text-zinc-600 | color: rgb(82 82 91); | Aa | | text-zinc-700 | color: rgb(63 63 70); | Aa | | text-zinc-800 | color: rgb(39 39 42); | Aa | | text-zinc-900 | color: rgb(24 24 27); | Aa | | text-neutral-50 | color: rgb(250 250 250); | Aa | | text-neutral-100 | color: rgb(245 245 245); | Aa | | text-neutral-200 | color: rgb(229 229 229); | Aa | | text-neutral-300 | color: rgb(212 212 212); | Aa | | text-neutral-400 | color: rgb(163 163 163); | Aa | | text-neutral-500 | color: rgb(115 115 115); | Aa | | text-neutral-600 | color: rgb(82 82 82); | Aa | | text-neutral-700 | color: rgb(64 64 64); | Aa | | text-neutral-800 | color: rgb(38 38 38); | Aa | | text-neutral-900 | color: rgb(23 23 23); | Aa | | text-stone-50 | color: rgb(250 250 249); | Aa | | text-stone-100 | color: rgb(245 245 244); | Aa | | text-stone-200 | color: rgb(231 229 228); | Aa | | text-stone-300 | color: rgb(214 211 209); | Aa | | text-stone-400 | color: rgb(168 162 158); | Aa | | text-stone-500 | color: rgb(120 113 108); | Aa | | text-stone-600 | color: rgb(87 83 78); | Aa | | text-stone-700 | color: rgb(68 64 60); | Aa | | text-stone-800 | color: rgb(41 37 36); | Aa | | text-stone-900 | color: rgb(28 25 23); | Aa | | text-red-50 | color: rgb(254 242 242); | Aa | | text-red-100 | color: rgb(254 226 226); | Aa | | text-red-200 | color: rgb(254 202 202); | Aa | | text-red-300 | color: rgb(252 165 165); | Aa | | text-red-400 | color: rgb(248 113 113); | Aa | | text-red-500 | color: rgb(239 68 68); | Aa | | text-red-600 | color: rgb(220 38 38); | Aa | | text-red-700 | color: rgb(185 28 28); | Aa | | text-red-800 | color: rgb(153 27 27); | Aa | | text-red-900 | color: rgb(127 29 29); | Aa | | text-orange-50 | color: rgb(255 247 237); | Aa | | text-orange-100 | color: rgb(255 237 213); | Aa | | text-orange-200 | color: rgb(254 215 170); | Aa | | text-orange-300 | color: rgb(253 186 116); | Aa | | text-orange-400 | color: rgb(251 146 60); | Aa | | text-orange-500 | color: rgb(249 115 22); | Aa | | text-orange-600 | color: rgb(234 88 12); | Aa | | text-orange-700 | color: rgb(194 65 12); | Aa | | text-orange-800 | color: rgb(154 52 18); | Aa | | text-orange-900 | color: rgb(124 45 18); | Aa | | text-amber-50 | color: rgb(255 251 235); | Aa | | text-amber-100 | color: rgb(254 243 199); | Aa | | text-amber-200 | color: rgb(253 230 138); | Aa | | text-amber-300 | color: rgb(252 211 77); | Aa | | text-amber-400 | color: rgb(251 191 36); | Aa | | text-amber-500 | color: rgb(245 158 11); | Aa | | text-amber-600 | color: rgb(217 119 6); | Aa | | text-amber-700 | color: rgb(180 83 9); | Aa | | text-amber-800 | color: rgb(146 64 14); | Aa | | text-amber-900 | color: rgb(120 53 15); | Aa | | text-yellow-50 | color: rgb(254 252 232); | Aa | | text-yellow-100 | color: rgb(254 249 195); | Aa | | text-yellow-200 | color: rgb(254 240 138); | Aa | | text-yellow-300 | color: rgb(253 224 71); | Aa | | text-yellow-400 | color: rgb(250 204 21); | Aa | | text-yellow-500 | color: rgb(234 179 8); | Aa | | text-yellow-600 | color: rgb(202 138 4); | Aa | | text-yellow-700 | color: rgb(161 98 7); | Aa | | text-yellow-800 | color: rgb(133 77 14); | Aa | | text-yellow-900 | color: rgb(113 63 18); | Aa | | text-lime-50 | color: rgb(247 254 231); | Aa | | text-lime-100 | color: rgb(236 252 203); | Aa | | text-lime-200 | color: rgb(217 249 157); | Aa | | text-lime-300 | color: rgb(190 242 100); | Aa | | text-lime-400 | color: rgb(163 230 53); | Aa | | text-lime-500 | color: rgb(132 204 22); | Aa | | text-lime-600 | color: rgb(101 163 13); | Aa | | text-lime-700 | color: rgb(77 124 15); | Aa | | text-lime-800 | color: rgb(63 98 18); | Aa | | text-lime-900 | color: rgb(54 83 20); | Aa | | text-green-50 | color: rgb(240 253 244); | Aa | | text-green-100 | color: rgb(220 252 231); | Aa | | text-green-200 | color: rgb(187 247 208); | Aa | | text-green-300 | color: rgb(134 239 172); | Aa | | text-green-400 | color: rgb(74 222 128); | Aa | | text-green-500 | color: rgb(34 197 94); | Aa | | text-green-600 | color: rgb(22 163 74); | Aa | | text-green-700 | color: rgb(21 128 61); | Aa | | text-green-800 | color: rgb(22 101 52); | Aa | | text-green-900 | color: rgb(20 83 45); | Aa | | text-emerald-50 | color: rgb(236 253 245); | Aa | | text-emerald-100 | color: rgb(209 250 229); | Aa | | text-emerald-200 | color: rgb(167 243 208); | Aa | | text-emerald-300 | color: rgb(110 231 183); | Aa | | text-emerald-400 | color: rgb(52 211 153); | Aa | | text-emerald-500 | color: rgb(16 185 129); | Aa | | text-emerald-600 | color: rgb(5 150 105); | Aa | | text-emerald-700 | color: rgb(4 120 87); | Aa | | text-emerald-800 | color: rgb(6 95 70); | Aa | | text-emerald-900 | color: rgb(6 78 59); | Aa | | text-teal-50 | color: rgb(240 253 250); | Aa | | text-teal-100 | color: rgb(204 251 241); | Aa | | text-teal-200 | color: rgb(153 246 228); | Aa | | text-teal-300 | color: rgb(94 234 212); | Aa | | text-teal-400 | color: rgb(45 212 191); | Aa | | text-teal-500 | color: rgb(20 184 166); | Aa | | text-teal-600 | color: rgb(13 148 136); | Aa | | text-teal-700 | color: rgb(15 118 110); | Aa | | text-teal-800 | color: rgb(17 94 89); | Aa | | text-teal-900 | color: rgb(19 78 74); | Aa | | text-cyan-50 | color: rgb(236 254 255); | Aa | | text-cyan-100 | color: rgb(207 250 254); | Aa | | text-cyan-200 | color: rgb(165 243 252); | Aa | | text-cyan-300 | color: rgb(103 232 249); | Aa | | text-cyan-400 | color: rgb(34 211 238); | Aa | | text-cyan-500 | color: rgb(6 182 212); | Aa | | text-cyan-600 | color: rgb(8 145 178); | Aa | | text-cyan-700 | color: rgb(14 116 144); | Aa | | text-cyan-800 | color: rgb(21 94 117); | Aa | | text-cyan-900 | color: rgb(22 78 99); | Aa | | text-sky-50 | color: rgb(240 249 255); | Aa | | text-sky-100 | color: rgb(224 242 254); | Aa | | text-sky-200 | color: rgb(186 230 253); | Aa | | text-sky-300 | color: rgb(125 211 252); | Aa | | text-sky-400 | color: rgb(56 189 248); | Aa | | text-sky-500 | color: rgb(14 165 233); | Aa | | text-sky-600 | color: rgb(2 132 199); | Aa | | text-sky-700 | color: rgb(3 105 161); | Aa | | text-sky-800 | color: rgb(7 89 133); | Aa | | text-sky-900 | color: rgb(12 74 110); | Aa | | text-blue-50 | color: rgb(239 246 255); | Aa | | text-blue-100 | color: rgb(219 234 254); | Aa | | text-blue-200 | color: rgb(191 219 254); | Aa | | text-blue-300 | color: rgb(147 197 253); | Aa | | text-blue-400 | color: rgb(96 165 250); | Aa | | text-blue-500 | color: rgb(59 130 246); | Aa | | text-blue-600 | color: rgb(37 99 235); | Aa | | text-blue-700 | color: rgb(29 78 216); | Aa | | text-blue-800 | color: rgb(30 64 175); | Aa | | text-blue-900 | color: rgb(30 58 138); | Aa | | text-indigo-50 | color: rgb(238 242 255); | Aa | | text-indigo-100 | color: rgb(224 231 255); | Aa | | text-indigo-200 | color: rgb(199 210 254); | Aa | | text-indigo-300 | color: rgb(165 180 252); | Aa | | text-indigo-400 | color: rgb(129 140 248); | Aa | | text-indigo-500 | color: rgb(99 102 241); | Aa | | text-indigo-600 | color: rgb(79 70 229); | Aa | | text-indigo-700 | color: rgb(67 56 202); | Aa | | text-indigo-800 | color: rgb(55 48 163); | Aa | | text-indigo-900 | color: rgb(49 46 129); | Aa | | text-violet-50 | color: rgb(245 243 255); | Aa | | text-violet-100 | color: rgb(237 233 254); | Aa | | text-violet-200 | color: rgb(221 214 254); | Aa | | text-violet-300 | color: rgb(196 181 253); | Aa | | text-violet-400 | color: rgb(167 139 250); | Aa | | text-violet-500 | color: rgb(139 92 246); | Aa | | text-violet-600 | color: rgb(124 58 237); | Aa | | text-violet-700 | color: rgb(109 40 217); | Aa | | text-violet-800 | color: rgb(91 33 182); | Aa | | text-violet-900 | color: rgb(76 29 149); | Aa | | text-purple-50 | color: rgb(250 245 255); | Aa | | text-purple-100 | color: rgb(243 232 255); | Aa | | text-purple-200 | color: rgb(233 213 255); | Aa | | text-purple-300 | color: rgb(216 180 254); | Aa | | text-purple-400 | color: rgb(192 132 252); | Aa | | text-purple-500 | color: rgb(168 85 247); | Aa | | text-purple-600 | color: rgb(147 51 234); | Aa | | text-purple-700 | color: rgb(126 34 206); | Aa | | text-purple-800 | color: rgb(107 33 168); | Aa | | text-purple-900 | color: rgb(88 28 135); | Aa | | text-fuchsia-50 | color: rgb(253 244 255); | Aa | | text-fuchsia-100 | color: rgb(250 232 255); | Aa | | text-fuchsia-200 | color: rgb(245 208 254); | Aa | | text-fuchsia-300 | color: rgb(240 171 252); | Aa | | text-fuchsia-400 | color: rgb(232 121 249); | Aa | | text-fuchsia-500 | color: rgb(217 70 239); | Aa | | text-fuchsia-600 | color: rgb(192 38 211); | Aa | | text-fuchsia-700 | color: rgb(162 28 175); | Aa | | text-fuchsia-800 | color: rgb(134 25 143); | Aa | | text-fuchsia-900 | color: rgb(112 26 117); | Aa | | text-pink-50 | color: rgb(253 242 248); | Aa | | text-pink-100 | color: rgb(252 231 243); | Aa | | text-pink-200 | color: rgb(251 207 232); | Aa | | text-pink-300 | color: rgb(249 168 212); | Aa | | text-pink-400 | color: rgb(244 114 182); | Aa | | text-pink-500 | color: rgb(236 72 153); | Aa | | text-pink-600 | color: rgb(219 39 119); | Aa | | text-pink-700 | color: rgb(190 24 93); | Aa | | text-pink-800 | color: rgb(157 23 77); | Aa | | text-pink-900 | color: rgb(131 24 67); | Aa | | text-rose-50 | color: rgb(255 241 242); | Aa | | text-rose-100 | color: rgb(255 228 230); | Aa | | text-rose-200 | color: rgb(254 205 211); | Aa | | text-rose-300 | color: rgb(253 164 175); | Aa | | text-rose-400 | color: rgb(251 113 133); | Aa | | text-rose-500 | color: rgb(244 63 94); | Aa | | text-rose-600 | color: rgb(225 29 72); | Aa | | text-rose-700 | color: rgb(190 18 60); | Aa | | text-rose-800 | color: rgb(159 18 57); | Aa | | text-rose-900 | color: rgb(136 19 55); | Aa | Basic usage ----------- ### Setting the text color Control the text color of an element using the `text-{color}` utilities. ``` <p class="text-blue-600">The quick brown fox...</p><p class="text-sky-400">The quick brown fox...</p> ``` ### Changing the opacity Control the opacity of an element’s text color using the color opacity modifier. ``` <p class="text-blue-600/100">The quick brown fox...</p> <p class="text-blue-600/75">The quick brown fox...</p> <p class="text-blue-600/50">The quick brown fox...</p> <p class="text-blue-600/25">The quick brown fox...</p> <p class="text-blue-600/0">The quick brown fox...</p><p class="text-sky-400/100">The quick brown fox...</p> <p class="text-sky-400/75">The quick brown fox...</p> <p class="text-sky-400/50">The quick brown fox...</p> <p class="text-sky-400/25">The quick brown fox...</p> <p class="text-sky-400/0">The quick brown fox...</p> ``` You can use any value defined in your [opacity scale](opacity), or use arbitrary values if you need to deviate from your design tokens. ``` <p class="text-blue-600/[.06]">The quick brown fox...</p> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:text-blue-600` to only apply the `text-blue-600` utility on hover. ``` <p class="text-slate-500 hover:text-blue-600">The quick brown fox...</p><p class="text-slate-400 hover:text-sky-400">The quick brown fox...</p> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:text-green-600` to apply the `text-green-600` utility at only medium screen sizes and above. ``` <p class="text-blue-600 md:text-green-600"> <!-- ... --> </p> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind makes the entire [default color palette](customizing-colors#default-color-palette) available as text colors. You can [customize your color palette](/docs/customizing-colors#customizing) by editing `theme.colors` or `theme.extend.colors` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { colors: { 'regal-blue': '#243c5a', }, } } } ``` Alternatively, you can customize just your text colors by editing `theme.textColor` or `theme.extend.textColor` in your `tailwind.config.js` file. Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `color` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <p class="text-[#50d71e]"> <!-- ... --> </p> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation.
programming_docs
tailwindcss Border Color Quick reference --------------- | Class | Properties | | --- | --- | | border-inherit | border-color: inherit; | | border-current | border-color: currentColor; | | border-transparent | border-color: transparent; | | border-black | border-color: rgb(0 0 0); | | border-white | border-color: rgb(255 255 255); | | border-slate-50 | border-color: rgb(248 250 252); | | border-slate-100 | border-color: rgb(241 245 249); | | border-slate-200 | border-color: rgb(226 232 240); | | border-slate-300 | border-color: rgb(203 213 225); | | border-slate-400 | border-color: rgb(148 163 184); | | border-slate-500 | border-color: rgb(100 116 139); | | border-slate-600 | border-color: rgb(71 85 105); | | border-slate-700 | border-color: rgb(51 65 85); | | border-slate-800 | border-color: rgb(30 41 59); | | border-slate-900 | border-color: rgb(15 23 42); | | border-gray-50 | border-color: rgb(249 250 251); | | border-gray-100 | border-color: rgb(243 244 246); | | border-gray-200 | border-color: rgb(229 231 235); | | border-gray-300 | border-color: rgb(209 213 219); | | border-gray-400 | border-color: rgb(156 163 175); | | border-gray-500 | border-color: rgb(107 114 128); | | border-gray-600 | border-color: rgb(75 85 99); | | border-gray-700 | border-color: rgb(55 65 81); | | border-gray-800 | border-color: rgb(31 41 55); | | border-gray-900 | border-color: rgb(17 24 39); | | border-zinc-50 | border-color: rgb(250 250 250); | | border-zinc-100 | border-color: rgb(244 244 245); | | border-zinc-200 | border-color: rgb(228 228 231); | | border-zinc-300 | border-color: rgb(212 212 216); | | border-zinc-400 | border-color: rgb(161 161 170); | | border-zinc-500 | border-color: rgb(113 113 122); | | border-zinc-600 | border-color: rgb(82 82 91); | | border-zinc-700 | border-color: rgb(63 63 70); | | border-zinc-800 | border-color: rgb(39 39 42); | | border-zinc-900 | border-color: rgb(24 24 27); | | border-neutral-50 | border-color: rgb(250 250 250); | | border-neutral-100 | border-color: rgb(245 245 245); | | border-neutral-200 | border-color: rgb(229 229 229); | | border-neutral-300 | border-color: rgb(212 212 212); | | border-neutral-400 | border-color: rgb(163 163 163); | | border-neutral-500 | border-color: rgb(115 115 115); | | border-neutral-600 | border-color: rgb(82 82 82); | | border-neutral-700 | border-color: rgb(64 64 64); | | border-neutral-800 | border-color: rgb(38 38 38); | | border-neutral-900 | border-color: rgb(23 23 23); | | border-stone-50 | border-color: rgb(250 250 249); | | border-stone-100 | border-color: rgb(245 245 244); | | border-stone-200 | border-color: rgb(231 229 228); | | border-stone-300 | border-color: rgb(214 211 209); | | border-stone-400 | border-color: rgb(168 162 158); | | border-stone-500 | border-color: rgb(120 113 108); | | border-stone-600 | border-color: rgb(87 83 78); | | border-stone-700 | border-color: rgb(68 64 60); | | border-stone-800 | border-color: rgb(41 37 36); | | border-stone-900 | border-color: rgb(28 25 23); | | border-red-50 | border-color: rgb(254 242 242); | | border-red-100 | border-color: rgb(254 226 226); | | border-red-200 | border-color: rgb(254 202 202); | | border-red-300 | border-color: rgb(252 165 165); | | border-red-400 | border-color: rgb(248 113 113); | | border-red-500 | border-color: rgb(239 68 68); | | border-red-600 | border-color: rgb(220 38 38); | | border-red-700 | border-color: rgb(185 28 28); | | border-red-800 | border-color: rgb(153 27 27); | | border-red-900 | border-color: rgb(127 29 29); | | border-orange-50 | border-color: rgb(255 247 237); | | border-orange-100 | border-color: rgb(255 237 213); | | border-orange-200 | border-color: rgb(254 215 170); | | border-orange-300 | border-color: rgb(253 186 116); | | border-orange-400 | border-color: rgb(251 146 60); | | border-orange-500 | border-color: rgb(249 115 22); | | border-orange-600 | border-color: rgb(234 88 12); | | border-orange-700 | border-color: rgb(194 65 12); | | border-orange-800 | border-color: rgb(154 52 18); | | border-orange-900 | border-color: rgb(124 45 18); | | border-amber-50 | border-color: rgb(255 251 235); | | border-amber-100 | border-color: rgb(254 243 199); | | border-amber-200 | border-color: rgb(253 230 138); | | border-amber-300 | border-color: rgb(252 211 77); | | border-amber-400 | border-color: rgb(251 191 36); | | border-amber-500 | border-color: rgb(245 158 11); | | border-amber-600 | border-color: rgb(217 119 6); | | border-amber-700 | border-color: rgb(180 83 9); | | border-amber-800 | border-color: rgb(146 64 14); | | border-amber-900 | border-color: rgb(120 53 15); | | border-yellow-50 | border-color: rgb(254 252 232); | | border-yellow-100 | border-color: rgb(254 249 195); | | border-yellow-200 | border-color: rgb(254 240 138); | | border-yellow-300 | border-color: rgb(253 224 71); | | border-yellow-400 | border-color: rgb(250 204 21); | | border-yellow-500 | border-color: rgb(234 179 8); | | border-yellow-600 | border-color: rgb(202 138 4); | | border-yellow-700 | border-color: rgb(161 98 7); | | border-yellow-800 | border-color: rgb(133 77 14); | | border-yellow-900 | border-color: rgb(113 63 18); | | border-lime-50 | border-color: rgb(247 254 231); | | border-lime-100 | border-color: rgb(236 252 203); | | border-lime-200 | border-color: rgb(217 249 157); | | border-lime-300 | border-color: rgb(190 242 100); | | border-lime-400 | border-color: rgb(163 230 53); | | border-lime-500 | border-color: rgb(132 204 22); | | border-lime-600 | border-color: rgb(101 163 13); | | border-lime-700 | border-color: rgb(77 124 15); | | border-lime-800 | border-color: rgb(63 98 18); | | border-lime-900 | border-color: rgb(54 83 20); | | border-green-50 | border-color: rgb(240 253 244); | | border-green-100 | border-color: rgb(220 252 231); | | border-green-200 | border-color: rgb(187 247 208); | | border-green-300 | border-color: rgb(134 239 172); | | border-green-400 | border-color: rgb(74 222 128); | | border-green-500 | border-color: rgb(34 197 94); | | border-green-600 | border-color: rgb(22 163 74); | | border-green-700 | border-color: rgb(21 128 61); | | border-green-800 | border-color: rgb(22 101 52); | | border-green-900 | border-color: rgb(20 83 45); | | border-emerald-50 | border-color: rgb(236 253 245); | | border-emerald-100 | border-color: rgb(209 250 229); | | border-emerald-200 | border-color: rgb(167 243 208); | | border-emerald-300 | border-color: rgb(110 231 183); | | border-emerald-400 | border-color: rgb(52 211 153); | | border-emerald-500 | border-color: rgb(16 185 129); | | border-emerald-600 | border-color: rgb(5 150 105); | | border-emerald-700 | border-color: rgb(4 120 87); | | border-emerald-800 | border-color: rgb(6 95 70); | | border-emerald-900 | border-color: rgb(6 78 59); | | border-teal-50 | border-color: rgb(240 253 250); | | border-teal-100 | border-color: rgb(204 251 241); | | border-teal-200 | border-color: rgb(153 246 228); | | border-teal-300 | border-color: rgb(94 234 212); | | border-teal-400 | border-color: rgb(45 212 191); | | border-teal-500 | border-color: rgb(20 184 166); | | border-teal-600 | border-color: rgb(13 148 136); | | border-teal-700 | border-color: rgb(15 118 110); | | border-teal-800 | border-color: rgb(17 94 89); | | border-teal-900 | border-color: rgb(19 78 74); | | border-cyan-50 | border-color: rgb(236 254 255); | | border-cyan-100 | border-color: rgb(207 250 254); | | border-cyan-200 | border-color: rgb(165 243 252); | | border-cyan-300 | border-color: rgb(103 232 249); | | border-cyan-400 | border-color: rgb(34 211 238); | | border-cyan-500 | border-color: rgb(6 182 212); | | border-cyan-600 | border-color: rgb(8 145 178); | | border-cyan-700 | border-color: rgb(14 116 144); | | border-cyan-800 | border-color: rgb(21 94 117); | | border-cyan-900 | border-color: rgb(22 78 99); | | border-sky-50 | border-color: rgb(240 249 255); | | border-sky-100 | border-color: rgb(224 242 254); | | border-sky-200 | border-color: rgb(186 230 253); | | border-sky-300 | border-color: rgb(125 211 252); | | border-sky-400 | border-color: rgb(56 189 248); | | border-sky-500 | border-color: rgb(14 165 233); | | border-sky-600 | border-color: rgb(2 132 199); | | border-sky-700 | border-color: rgb(3 105 161); | | border-sky-800 | border-color: rgb(7 89 133); | | border-sky-900 | border-color: rgb(12 74 110); | | border-blue-50 | border-color: rgb(239 246 255); | | border-blue-100 | border-color: rgb(219 234 254); | | border-blue-200 | border-color: rgb(191 219 254); | | border-blue-300 | border-color: rgb(147 197 253); | | border-blue-400 | border-color: rgb(96 165 250); | | border-blue-500 | border-color: rgb(59 130 246); | | border-blue-600 | border-color: rgb(37 99 235); | | border-blue-700 | border-color: rgb(29 78 216); | | border-blue-800 | border-color: rgb(30 64 175); | | border-blue-900 | border-color: rgb(30 58 138); | | border-indigo-50 | border-color: rgb(238 242 255); | | border-indigo-100 | border-color: rgb(224 231 255); | | border-indigo-200 | border-color: rgb(199 210 254); | | border-indigo-300 | border-color: rgb(165 180 252); | | border-indigo-400 | border-color: rgb(129 140 248); | | border-indigo-500 | border-color: rgb(99 102 241); | | border-indigo-600 | border-color: rgb(79 70 229); | | border-indigo-700 | border-color: rgb(67 56 202); | | border-indigo-800 | border-color: rgb(55 48 163); | | border-indigo-900 | border-color: rgb(49 46 129); | | border-violet-50 | border-color: rgb(245 243 255); | | border-violet-100 | border-color: rgb(237 233 254); | | border-violet-200 | border-color: rgb(221 214 254); | | border-violet-300 | border-color: rgb(196 181 253); | | border-violet-400 | border-color: rgb(167 139 250); | | border-violet-500 | border-color: rgb(139 92 246); | | border-violet-600 | border-color: rgb(124 58 237); | | border-violet-700 | border-color: rgb(109 40 217); | | border-violet-800 | border-color: rgb(91 33 182); | | border-violet-900 | border-color: rgb(76 29 149); | | border-purple-50 | border-color: rgb(250 245 255); | | border-purple-100 | border-color: rgb(243 232 255); | | border-purple-200 | border-color: rgb(233 213 255); | | border-purple-300 | border-color: rgb(216 180 254); | | border-purple-400 | border-color: rgb(192 132 252); | | border-purple-500 | border-color: rgb(168 85 247); | | border-purple-600 | border-color: rgb(147 51 234); | | border-purple-700 | border-color: rgb(126 34 206); | | border-purple-800 | border-color: rgb(107 33 168); | | border-purple-900 | border-color: rgb(88 28 135); | | border-fuchsia-50 | border-color: rgb(253 244 255); | | border-fuchsia-100 | border-color: rgb(250 232 255); | | border-fuchsia-200 | border-color: rgb(245 208 254); | | border-fuchsia-300 | border-color: rgb(240 171 252); | | border-fuchsia-400 | border-color: rgb(232 121 249); | | border-fuchsia-500 | border-color: rgb(217 70 239); | | border-fuchsia-600 | border-color: rgb(192 38 211); | | border-fuchsia-700 | border-color: rgb(162 28 175); | | border-fuchsia-800 | border-color: rgb(134 25 143); | | border-fuchsia-900 | border-color: rgb(112 26 117); | | border-pink-50 | border-color: rgb(253 242 248); | | border-pink-100 | border-color: rgb(252 231 243); | | border-pink-200 | border-color: rgb(251 207 232); | | border-pink-300 | border-color: rgb(249 168 212); | | border-pink-400 | border-color: rgb(244 114 182); | | border-pink-500 | border-color: rgb(236 72 153); | | border-pink-600 | border-color: rgb(219 39 119); | | border-pink-700 | border-color: rgb(190 24 93); | | border-pink-800 | border-color: rgb(157 23 77); | | border-pink-900 | border-color: rgb(131 24 67); | | border-rose-50 | border-color: rgb(255 241 242); | | border-rose-100 | border-color: rgb(255 228 230); | | border-rose-200 | border-color: rgb(254 205 211); | | border-rose-300 | border-color: rgb(253 164 175); | | border-rose-400 | border-color: rgb(251 113 133); | | border-rose-500 | border-color: rgb(244 63 94); | | border-rose-600 | border-color: rgb(225 29 72); | | border-rose-700 | border-color: rgb(190 18 60); | | border-rose-800 | border-color: rgb(159 18 57); | | border-rose-900 | border-color: rgb(136 19 55); | | border-x-inherit | border-left-color: inherit; border-right-color: inherit; | | border-x-current | border-left-color: currentColor; border-right-color: currentColor; | | border-x-transparent | border-left-color: transparent; border-right-color: transparent; | | border-x-black | border-left-color: rgb(0 0 0); border-right-color: rgb(0 0 0); | | border-x-white | border-left-color: rgb(255 255 255); border-right-color: rgb(255 255 255); | | border-x-slate-50 | border-left-color: rgb(248 250 252); border-right-color: rgb(248 250 252); | | border-x-slate-100 | border-left-color: rgb(241 245 249); border-right-color: rgb(241 245 249); | | border-x-slate-200 | border-left-color: rgb(226 232 240); border-right-color: rgb(226 232 240); | | border-x-slate-300 | border-left-color: rgb(203 213 225); border-right-color: rgb(203 213 225); | | border-x-slate-400 | border-left-color: rgb(148 163 184); border-right-color: rgb(148 163 184); | | border-x-slate-500 | border-left-color: rgb(100 116 139); border-right-color: rgb(100 116 139); | | border-x-slate-600 | border-left-color: rgb(71 85 105); border-right-color: rgb(71 85 105); | | border-x-slate-700 | border-left-color: rgb(51 65 85); border-right-color: rgb(51 65 85); | | border-x-slate-800 | border-left-color: rgb(30 41 59); border-right-color: rgb(30 41 59); | | border-x-slate-900 | border-left-color: rgb(15 23 42); border-right-color: rgb(15 23 42); | | border-x-gray-50 | border-left-color: rgb(249 250 251); border-right-color: rgb(249 250 251); | | border-x-gray-100 | border-left-color: rgb(243 244 246); border-right-color: rgb(243 244 246); | | border-x-gray-200 | border-left-color: rgb(229 231 235); border-right-color: rgb(229 231 235); | | border-x-gray-300 | border-left-color: rgb(209 213 219); border-right-color: rgb(209 213 219); | | border-x-gray-400 | border-left-color: rgb(156 163 175); border-right-color: rgb(156 163 175); | | border-x-gray-500 | border-left-color: rgb(107 114 128); border-right-color: rgb(107 114 128); | | border-x-gray-600 | border-left-color: rgb(75 85 99); border-right-color: rgb(75 85 99); | | border-x-gray-700 | border-left-color: rgb(55 65 81); border-right-color: rgb(55 65 81); | | border-x-gray-800 | border-left-color: rgb(31 41 55); border-right-color: rgb(31 41 55); | | border-x-gray-900 | border-left-color: rgb(17 24 39); border-right-color: rgb(17 24 39); | | border-x-zinc-50 | border-left-color: rgb(250 250 250); border-right-color: rgb(250 250 250); | | border-x-zinc-100 | border-left-color: rgb(244 244 245); border-right-color: rgb(244 244 245); | | border-x-zinc-200 | border-left-color: rgb(228 228 231); border-right-color: rgb(228 228 231); | | border-x-zinc-300 | border-left-color: rgb(212 212 216); border-right-color: rgb(212 212 216); | | border-x-zinc-400 | border-left-color: rgb(161 161 170); border-right-color: rgb(161 161 170); | | border-x-zinc-500 | border-left-color: rgb(113 113 122); border-right-color: rgb(113 113 122); | | border-x-zinc-600 | border-left-color: rgb(82 82 91); border-right-color: rgb(82 82 91); | | border-x-zinc-700 | border-left-color: rgb(63 63 70); border-right-color: rgb(63 63 70); | | border-x-zinc-800 | border-left-color: rgb(39 39 42); border-right-color: rgb(39 39 42); | | border-x-zinc-900 | border-left-color: rgb(24 24 27); border-right-color: rgb(24 24 27); | | border-x-neutral-50 | border-left-color: rgb(250 250 250); border-right-color: rgb(250 250 250); | | border-x-neutral-100 | border-left-color: rgb(245 245 245); border-right-color: rgb(245 245 245); | | border-x-neutral-200 | border-left-color: rgb(229 229 229); border-right-color: rgb(229 229 229); | | border-x-neutral-300 | border-left-color: rgb(212 212 212); border-right-color: rgb(212 212 212); | | border-x-neutral-400 | border-left-color: rgb(163 163 163); border-right-color: rgb(163 163 163); | | border-x-neutral-500 | border-left-color: rgb(115 115 115); border-right-color: rgb(115 115 115); | | border-x-neutral-600 | border-left-color: rgb(82 82 82); border-right-color: rgb(82 82 82); | | border-x-neutral-700 | border-left-color: rgb(64 64 64); border-right-color: rgb(64 64 64); | | border-x-neutral-800 | border-left-color: rgb(38 38 38); border-right-color: rgb(38 38 38); | | border-x-neutral-900 | border-left-color: rgb(23 23 23); border-right-color: rgb(23 23 23); | | border-x-stone-50 | border-left-color: rgb(250 250 249); border-right-color: rgb(250 250 249); | | border-x-stone-100 | border-left-color: rgb(245 245 244); border-right-color: rgb(245 245 244); | | border-x-stone-200 | border-left-color: rgb(231 229 228); border-right-color: rgb(231 229 228); | | border-x-stone-300 | border-left-color: rgb(214 211 209); border-right-color: rgb(214 211 209); | | border-x-stone-400 | border-left-color: rgb(168 162 158); border-right-color: rgb(168 162 158); | | border-x-stone-500 | border-left-color: rgb(120 113 108); border-right-color: rgb(120 113 108); | | border-x-stone-600 | border-left-color: rgb(87 83 78); border-right-color: rgb(87 83 78); | | border-x-stone-700 | border-left-color: rgb(68 64 60); border-right-color: rgb(68 64 60); | | border-x-stone-800 | border-left-color: rgb(41 37 36); border-right-color: rgb(41 37 36); | | border-x-stone-900 | border-left-color: rgb(28 25 23); border-right-color: rgb(28 25 23); | | border-x-red-50 | border-left-color: rgb(254 242 242); border-right-color: rgb(254 242 242); | | border-x-red-100 | border-left-color: rgb(254 226 226); border-right-color: rgb(254 226 226); | | border-x-red-200 | border-left-color: rgb(254 202 202); border-right-color: rgb(254 202 202); | | border-x-red-300 | border-left-color: rgb(252 165 165); border-right-color: rgb(252 165 165); | | border-x-red-400 | border-left-color: rgb(248 113 113); border-right-color: rgb(248 113 113); | | border-x-red-500 | border-left-color: rgb(239 68 68); border-right-color: rgb(239 68 68); | | border-x-red-600 | border-left-color: rgb(220 38 38); border-right-color: rgb(220 38 38); | | border-x-red-700 | border-left-color: rgb(185 28 28); border-right-color: rgb(185 28 28); | | border-x-red-800 | border-left-color: rgb(153 27 27); border-right-color: rgb(153 27 27); | | border-x-red-900 | border-left-color: rgb(127 29 29); border-right-color: rgb(127 29 29); | | border-x-orange-50 | border-left-color: rgb(255 247 237); border-right-color: rgb(255 247 237); | | border-x-orange-100 | border-left-color: rgb(255 237 213); border-right-color: rgb(255 237 213); | | border-x-orange-200 | border-left-color: rgb(254 215 170); border-right-color: rgb(254 215 170); | | border-x-orange-300 | border-left-color: rgb(253 186 116); border-right-color: rgb(253 186 116); | | border-x-orange-400 | border-left-color: rgb(251 146 60); border-right-color: rgb(251 146 60); | | border-x-orange-500 | border-left-color: rgb(249 115 22); border-right-color: rgb(249 115 22); | | border-x-orange-600 | border-left-color: rgb(234 88 12); border-right-color: rgb(234 88 12); | | border-x-orange-700 | border-left-color: rgb(194 65 12); border-right-color: rgb(194 65 12); | | border-x-orange-800 | border-left-color: rgb(154 52 18); border-right-color: rgb(154 52 18); | | border-x-orange-900 | border-left-color: rgb(124 45 18); border-right-color: rgb(124 45 18); | | border-x-amber-50 | border-left-color: rgb(255 251 235); border-right-color: rgb(255 251 235); | | border-x-amber-100 | border-left-color: rgb(254 243 199); border-right-color: rgb(254 243 199); | | border-x-amber-200 | border-left-color: rgb(253 230 138); border-right-color: rgb(253 230 138); | | border-x-amber-300 | border-left-color: rgb(252 211 77); border-right-color: rgb(252 211 77); | | border-x-amber-400 | border-left-color: rgb(251 191 36); border-right-color: rgb(251 191 36); | | border-x-amber-500 | border-left-color: rgb(245 158 11); border-right-color: rgb(245 158 11); | | border-x-amber-600 | border-left-color: rgb(217 119 6); border-right-color: rgb(217 119 6); | | border-x-amber-700 | border-left-color: rgb(180 83 9); border-right-color: rgb(180 83 9); | | border-x-amber-800 | border-left-color: rgb(146 64 14); border-right-color: rgb(146 64 14); | | border-x-amber-900 | border-left-color: rgb(120 53 15); border-right-color: rgb(120 53 15); | | border-x-yellow-50 | border-left-color: rgb(254 252 232); border-right-color: rgb(254 252 232); | | border-x-yellow-100 | border-left-color: rgb(254 249 195); border-right-color: rgb(254 249 195); | | border-x-yellow-200 | border-left-color: rgb(254 240 138); border-right-color: rgb(254 240 138); | | border-x-yellow-300 | border-left-color: rgb(253 224 71); border-right-color: rgb(253 224 71); | | border-x-yellow-400 | border-left-color: rgb(250 204 21); border-right-color: rgb(250 204 21); | | border-x-yellow-500 | border-left-color: rgb(234 179 8); border-right-color: rgb(234 179 8); | | border-x-yellow-600 | border-left-color: rgb(202 138 4); border-right-color: rgb(202 138 4); | | border-x-yellow-700 | border-left-color: rgb(161 98 7); border-right-color: rgb(161 98 7); | | border-x-yellow-800 | border-left-color: rgb(133 77 14); border-right-color: rgb(133 77 14); | | border-x-yellow-900 | border-left-color: rgb(113 63 18); border-right-color: rgb(113 63 18); | | border-x-lime-50 | border-left-color: rgb(247 254 231); border-right-color: rgb(247 254 231); | | border-x-lime-100 | border-left-color: rgb(236 252 203); border-right-color: rgb(236 252 203); | | border-x-lime-200 | border-left-color: rgb(217 249 157); border-right-color: rgb(217 249 157); | | border-x-lime-300 | border-left-color: rgb(190 242 100); border-right-color: rgb(190 242 100); | | border-x-lime-400 | border-left-color: rgb(163 230 53); border-right-color: rgb(163 230 53); | | border-x-lime-500 | border-left-color: rgb(132 204 22); border-right-color: rgb(132 204 22); | | border-x-lime-600 | border-left-color: rgb(101 163 13); border-right-color: rgb(101 163 13); | | border-x-lime-700 | border-left-color: rgb(77 124 15); border-right-color: rgb(77 124 15); | | border-x-lime-800 | border-left-color: rgb(63 98 18); border-right-color: rgb(63 98 18); | | border-x-lime-900 | border-left-color: rgb(54 83 20); border-right-color: rgb(54 83 20); | | border-x-green-50 | border-left-color: rgb(240 253 244); border-right-color: rgb(240 253 244); | | border-x-green-100 | border-left-color: rgb(220 252 231); border-right-color: rgb(220 252 231); | | border-x-green-200 | border-left-color: rgb(187 247 208); border-right-color: rgb(187 247 208); | | border-x-green-300 | border-left-color: rgb(134 239 172); border-right-color: rgb(134 239 172); | | border-x-green-400 | border-left-color: rgb(74 222 128); border-right-color: rgb(74 222 128); | | border-x-green-500 | border-left-color: rgb(34 197 94); border-right-color: rgb(34 197 94); | | border-x-green-600 | border-left-color: rgb(22 163 74); border-right-color: rgb(22 163 74); | | border-x-green-700 | border-left-color: rgb(21 128 61); border-right-color: rgb(21 128 61); | | border-x-green-800 | border-left-color: rgb(22 101 52); border-right-color: rgb(22 101 52); | | border-x-green-900 | border-left-color: rgb(20 83 45); border-right-color: rgb(20 83 45); | | border-x-emerald-50 | border-left-color: rgb(236 253 245); border-right-color: rgb(236 253 245); | | border-x-emerald-100 | border-left-color: rgb(209 250 229); border-right-color: rgb(209 250 229); | | border-x-emerald-200 | border-left-color: rgb(167 243 208); border-right-color: rgb(167 243 208); | | border-x-emerald-300 | border-left-color: rgb(110 231 183); border-right-color: rgb(110 231 183); | | border-x-emerald-400 | border-left-color: rgb(52 211 153); border-right-color: rgb(52 211 153); | | border-x-emerald-500 | border-left-color: rgb(16 185 129); border-right-color: rgb(16 185 129); | | border-x-emerald-600 | border-left-color: rgb(5 150 105); border-right-color: rgb(5 150 105); | | border-x-emerald-700 | border-left-color: rgb(4 120 87); border-right-color: rgb(4 120 87); | | border-x-emerald-800 | border-left-color: rgb(6 95 70); border-right-color: rgb(6 95 70); | | border-x-emerald-900 | border-left-color: rgb(6 78 59); border-right-color: rgb(6 78 59); | | border-x-teal-50 | border-left-color: rgb(240 253 250); border-right-color: rgb(240 253 250); | | border-x-teal-100 | border-left-color: rgb(204 251 241); border-right-color: rgb(204 251 241); | | border-x-teal-200 | border-left-color: rgb(153 246 228); border-right-color: rgb(153 246 228); | | border-x-teal-300 | border-left-color: rgb(94 234 212); border-right-color: rgb(94 234 212); | | border-x-teal-400 | border-left-color: rgb(45 212 191); border-right-color: rgb(45 212 191); | | border-x-teal-500 | border-left-color: rgb(20 184 166); border-right-color: rgb(20 184 166); | | border-x-teal-600 | border-left-color: rgb(13 148 136); border-right-color: rgb(13 148 136); | | border-x-teal-700 | border-left-color: rgb(15 118 110); border-right-color: rgb(15 118 110); | | border-x-teal-800 | border-left-color: rgb(17 94 89); border-right-color: rgb(17 94 89); | | border-x-teal-900 | border-left-color: rgb(19 78 74); border-right-color: rgb(19 78 74); | | border-x-cyan-50 | border-left-color: rgb(236 254 255); border-right-color: rgb(236 254 255); | | border-x-cyan-100 | border-left-color: rgb(207 250 254); border-right-color: rgb(207 250 254); | | border-x-cyan-200 | border-left-color: rgb(165 243 252); border-right-color: rgb(165 243 252); | | border-x-cyan-300 | border-left-color: rgb(103 232 249); border-right-color: rgb(103 232 249); | | border-x-cyan-400 | border-left-color: rgb(34 211 238); border-right-color: rgb(34 211 238); | | border-x-cyan-500 | border-left-color: rgb(6 182 212); border-right-color: rgb(6 182 212); | | border-x-cyan-600 | border-left-color: rgb(8 145 178); border-right-color: rgb(8 145 178); | | border-x-cyan-700 | border-left-color: rgb(14 116 144); border-right-color: rgb(14 116 144); | | border-x-cyan-800 | border-left-color: rgb(21 94 117); border-right-color: rgb(21 94 117); | | border-x-cyan-900 | border-left-color: rgb(22 78 99); border-right-color: rgb(22 78 99); | | border-x-sky-50 | border-left-color: rgb(240 249 255); border-right-color: rgb(240 249 255); | | border-x-sky-100 | border-left-color: rgb(224 242 254); border-right-color: rgb(224 242 254); | | border-x-sky-200 | border-left-color: rgb(186 230 253); border-right-color: rgb(186 230 253); | | border-x-sky-300 | border-left-color: rgb(125 211 252); border-right-color: rgb(125 211 252); | | border-x-sky-400 | border-left-color: rgb(56 189 248); border-right-color: rgb(56 189 248); | | border-x-sky-500 | border-left-color: rgb(14 165 233); border-right-color: rgb(14 165 233); | | border-x-sky-600 | border-left-color: rgb(2 132 199); border-right-color: rgb(2 132 199); | | border-x-sky-700 | border-left-color: rgb(3 105 161); border-right-color: rgb(3 105 161); | | border-x-sky-800 | border-left-color: rgb(7 89 133); border-right-color: rgb(7 89 133); | | border-x-sky-900 | border-left-color: rgb(12 74 110); border-right-color: rgb(12 74 110); | | border-x-blue-50 | border-left-color: rgb(239 246 255); border-right-color: rgb(239 246 255); | | border-x-blue-100 | border-left-color: rgb(219 234 254); border-right-color: rgb(219 234 254); | | border-x-blue-200 | border-left-color: rgb(191 219 254); border-right-color: rgb(191 219 254); | | border-x-blue-300 | border-left-color: rgb(147 197 253); border-right-color: rgb(147 197 253); | | border-x-blue-400 | border-left-color: rgb(96 165 250); border-right-color: rgb(96 165 250); | | border-x-blue-500 | border-left-color: rgb(59 130 246); border-right-color: rgb(59 130 246); | | border-x-blue-600 | border-left-color: rgb(37 99 235); border-right-color: rgb(37 99 235); | | border-x-blue-700 | border-left-color: rgb(29 78 216); border-right-color: rgb(29 78 216); | | border-x-blue-800 | border-left-color: rgb(30 64 175); border-right-color: rgb(30 64 175); | | border-x-blue-900 | border-left-color: rgb(30 58 138); border-right-color: rgb(30 58 138); | | border-x-indigo-50 | border-left-color: rgb(238 242 255); border-right-color: rgb(238 242 255); | | border-x-indigo-100 | border-left-color: rgb(224 231 255); border-right-color: rgb(224 231 255); | | border-x-indigo-200 | border-left-color: rgb(199 210 254); border-right-color: rgb(199 210 254); | | border-x-indigo-300 | border-left-color: rgb(165 180 252); border-right-color: rgb(165 180 252); | | border-x-indigo-400 | border-left-color: rgb(129 140 248); border-right-color: rgb(129 140 248); | | border-x-indigo-500 | border-left-color: rgb(99 102 241); border-right-color: rgb(99 102 241); | | border-x-indigo-600 | border-left-color: rgb(79 70 229); border-right-color: rgb(79 70 229); | | border-x-indigo-700 | border-left-color: rgb(67 56 202); border-right-color: rgb(67 56 202); | | border-x-indigo-800 | border-left-color: rgb(55 48 163); border-right-color: rgb(55 48 163); | | border-x-indigo-900 | border-left-color: rgb(49 46 129); border-right-color: rgb(49 46 129); | | border-x-violet-50 | border-left-color: rgb(245 243 255); border-right-color: rgb(245 243 255); | | border-x-violet-100 | border-left-color: rgb(237 233 254); border-right-color: rgb(237 233 254); | | border-x-violet-200 | border-left-color: rgb(221 214 254); border-right-color: rgb(221 214 254); | | border-x-violet-300 | border-left-color: rgb(196 181 253); border-right-color: rgb(196 181 253); | | border-x-violet-400 | border-left-color: rgb(167 139 250); border-right-color: rgb(167 139 250); | | border-x-violet-500 | border-left-color: rgb(139 92 246); border-right-color: rgb(139 92 246); | | border-x-violet-600 | border-left-color: rgb(124 58 237); border-right-color: rgb(124 58 237); | | border-x-violet-700 | border-left-color: rgb(109 40 217); border-right-color: rgb(109 40 217); | | border-x-violet-800 | border-left-color: rgb(91 33 182); border-right-color: rgb(91 33 182); | | border-x-violet-900 | border-left-color: rgb(76 29 149); border-right-color: rgb(76 29 149); | | border-x-purple-50 | border-left-color: rgb(250 245 255); border-right-color: rgb(250 245 255); | | border-x-purple-100 | border-left-color: rgb(243 232 255); border-right-color: rgb(243 232 255); | | border-x-purple-200 | border-left-color: rgb(233 213 255); border-right-color: rgb(233 213 255); | | border-x-purple-300 | border-left-color: rgb(216 180 254); border-right-color: rgb(216 180 254); | | border-x-purple-400 | border-left-color: rgb(192 132 252); border-right-color: rgb(192 132 252); | | border-x-purple-500 | border-left-color: rgb(168 85 247); border-right-color: rgb(168 85 247); | | border-x-purple-600 | border-left-color: rgb(147 51 234); border-right-color: rgb(147 51 234); | | border-x-purple-700 | border-left-color: rgb(126 34 206); border-right-color: rgb(126 34 206); | | border-x-purple-800 | border-left-color: rgb(107 33 168); border-right-color: rgb(107 33 168); | | border-x-purple-900 | border-left-color: rgb(88 28 135); border-right-color: rgb(88 28 135); | | border-x-fuchsia-50 | border-left-color: rgb(253 244 255); border-right-color: rgb(253 244 255); | | border-x-fuchsia-100 | border-left-color: rgb(250 232 255); border-right-color: rgb(250 232 255); | | border-x-fuchsia-200 | border-left-color: rgb(245 208 254); border-right-color: rgb(245 208 254); | | border-x-fuchsia-300 | border-left-color: rgb(240 171 252); border-right-color: rgb(240 171 252); | | border-x-fuchsia-400 | border-left-color: rgb(232 121 249); border-right-color: rgb(232 121 249); | | border-x-fuchsia-500 | border-left-color: rgb(217 70 239); border-right-color: rgb(217 70 239); | | border-x-fuchsia-600 | border-left-color: rgb(192 38 211); border-right-color: rgb(192 38 211); | | border-x-fuchsia-700 | border-left-color: rgb(162 28 175); border-right-color: rgb(162 28 175); | | border-x-fuchsia-800 | border-left-color: rgb(134 25 143); border-right-color: rgb(134 25 143); | | border-x-fuchsia-900 | border-left-color: rgb(112 26 117); border-right-color: rgb(112 26 117); | | border-x-pink-50 | border-left-color: rgb(253 242 248); border-right-color: rgb(253 242 248); | | border-x-pink-100 | border-left-color: rgb(252 231 243); border-right-color: rgb(252 231 243); | | border-x-pink-200 | border-left-color: rgb(251 207 232); border-right-color: rgb(251 207 232); | | border-x-pink-300 | border-left-color: rgb(249 168 212); border-right-color: rgb(249 168 212); | | border-x-pink-400 | border-left-color: rgb(244 114 182); border-right-color: rgb(244 114 182); | | border-x-pink-500 | border-left-color: rgb(236 72 153); border-right-color: rgb(236 72 153); | | border-x-pink-600 | border-left-color: rgb(219 39 119); border-right-color: rgb(219 39 119); | | border-x-pink-700 | border-left-color: rgb(190 24 93); border-right-color: rgb(190 24 93); | | border-x-pink-800 | border-left-color: rgb(157 23 77); border-right-color: rgb(157 23 77); | | border-x-pink-900 | border-left-color: rgb(131 24 67); border-right-color: rgb(131 24 67); | | border-x-rose-50 | border-left-color: rgb(255 241 242); border-right-color: rgb(255 241 242); | | border-x-rose-100 | border-left-color: rgb(255 228 230); border-right-color: rgb(255 228 230); | | border-x-rose-200 | border-left-color: rgb(254 205 211); border-right-color: rgb(254 205 211); | | border-x-rose-300 | border-left-color: rgb(253 164 175); border-right-color: rgb(253 164 175); | | border-x-rose-400 | border-left-color: rgb(251 113 133); border-right-color: rgb(251 113 133); | | border-x-rose-500 | border-left-color: rgb(244 63 94); border-right-color: rgb(244 63 94); | | border-x-rose-600 | border-left-color: rgb(225 29 72); border-right-color: rgb(225 29 72); | | border-x-rose-700 | border-left-color: rgb(190 18 60); border-right-color: rgb(190 18 60); | | border-x-rose-800 | border-left-color: rgb(159 18 57); border-right-color: rgb(159 18 57); | | border-x-rose-900 | border-left-color: rgb(136 19 55); border-right-color: rgb(136 19 55); | | border-y-inherit | border-top-color: inherit; border-bottom-color: inherit; | | border-y-current | border-top-color: currentColor; border-bottom-color: currentColor; | | border-y-transparent | border-top-color: transparent; border-bottom-color: transparent; | | border-y-black | border-top-color: rgb(0 0 0); border-bottom-color: rgb(0 0 0); | | border-y-white | border-top-color: rgb(255 255 255); border-bottom-color: rgb(255 255 255); | | border-y-slate-50 | border-top-color: rgb(248 250 252); border-bottom-color: rgb(248 250 252); | | border-y-slate-100 | border-top-color: rgb(241 245 249); border-bottom-color: rgb(241 245 249); | | border-y-slate-200 | border-top-color: rgb(226 232 240); border-bottom-color: rgb(226 232 240); | | border-y-slate-300 | border-top-color: rgb(203 213 225); border-bottom-color: rgb(203 213 225); | | border-y-slate-400 | border-top-color: rgb(148 163 184); border-bottom-color: rgb(148 163 184); | | border-y-slate-500 | border-top-color: rgb(100 116 139); border-bottom-color: rgb(100 116 139); | | border-y-slate-600 | border-top-color: rgb(71 85 105); border-bottom-color: rgb(71 85 105); | | border-y-slate-700 | border-top-color: rgb(51 65 85); border-bottom-color: rgb(51 65 85); | | border-y-slate-800 | border-top-color: rgb(30 41 59); border-bottom-color: rgb(30 41 59); | | border-y-slate-900 | border-top-color: rgb(15 23 42); border-bottom-color: rgb(15 23 42); | | border-y-gray-50 | border-top-color: rgb(249 250 251); border-bottom-color: rgb(249 250 251); | | border-y-gray-100 | border-top-color: rgb(243 244 246); border-bottom-color: rgb(243 244 246); | | border-y-gray-200 | border-top-color: rgb(229 231 235); border-bottom-color: rgb(229 231 235); | | border-y-gray-300 | border-top-color: rgb(209 213 219); border-bottom-color: rgb(209 213 219); | | border-y-gray-400 | border-top-color: rgb(156 163 175); border-bottom-color: rgb(156 163 175); | | border-y-gray-500 | border-top-color: rgb(107 114 128); border-bottom-color: rgb(107 114 128); | | border-y-gray-600 | border-top-color: rgb(75 85 99); border-bottom-color: rgb(75 85 99); | | border-y-gray-700 | border-top-color: rgb(55 65 81); border-bottom-color: rgb(55 65 81); | | border-y-gray-800 | border-top-color: rgb(31 41 55); border-bottom-color: rgb(31 41 55); | | border-y-gray-900 | border-top-color: rgb(17 24 39); border-bottom-color: rgb(17 24 39); | | border-y-zinc-50 | border-top-color: rgb(250 250 250); border-bottom-color: rgb(250 250 250); | | border-y-zinc-100 | border-top-color: rgb(244 244 245); border-bottom-color: rgb(244 244 245); | | border-y-zinc-200 | border-top-color: rgb(228 228 231); border-bottom-color: rgb(228 228 231); | | border-y-zinc-300 | border-top-color: rgb(212 212 216); border-bottom-color: rgb(212 212 216); | | border-y-zinc-400 | border-top-color: rgb(161 161 170); border-bottom-color: rgb(161 161 170); | | border-y-zinc-500 | border-top-color: rgb(113 113 122); border-bottom-color: rgb(113 113 122); | | border-y-zinc-600 | border-top-color: rgb(82 82 91); border-bottom-color: rgb(82 82 91); | | border-y-zinc-700 | border-top-color: rgb(63 63 70); border-bottom-color: rgb(63 63 70); | | border-y-zinc-800 | border-top-color: rgb(39 39 42); border-bottom-color: rgb(39 39 42); | | border-y-zinc-900 | border-top-color: rgb(24 24 27); border-bottom-color: rgb(24 24 27); | | border-y-neutral-50 | border-top-color: rgb(250 250 250); border-bottom-color: rgb(250 250 250); | | border-y-neutral-100 | border-top-color: rgb(245 245 245); border-bottom-color: rgb(245 245 245); | | border-y-neutral-200 | border-top-color: rgb(229 229 229); border-bottom-color: rgb(229 229 229); | | border-y-neutral-300 | border-top-color: rgb(212 212 212); border-bottom-color: rgb(212 212 212); | | border-y-neutral-400 | border-top-color: rgb(163 163 163); border-bottom-color: rgb(163 163 163); | | border-y-neutral-500 | border-top-color: rgb(115 115 115); border-bottom-color: rgb(115 115 115); | | border-y-neutral-600 | border-top-color: rgb(82 82 82); border-bottom-color: rgb(82 82 82); | | border-y-neutral-700 | border-top-color: rgb(64 64 64); border-bottom-color: rgb(64 64 64); | | border-y-neutral-800 | border-top-color: rgb(38 38 38); border-bottom-color: rgb(38 38 38); | | border-y-neutral-900 | border-top-color: rgb(23 23 23); border-bottom-color: rgb(23 23 23); | | border-y-stone-50 | border-top-color: rgb(250 250 249); border-bottom-color: rgb(250 250 249); | | border-y-stone-100 | border-top-color: rgb(245 245 244); border-bottom-color: rgb(245 245 244); | | border-y-stone-200 | border-top-color: rgb(231 229 228); border-bottom-color: rgb(231 229 228); | | border-y-stone-300 | border-top-color: rgb(214 211 209); border-bottom-color: rgb(214 211 209); | | border-y-stone-400 | border-top-color: rgb(168 162 158); border-bottom-color: rgb(168 162 158); | | border-y-stone-500 | border-top-color: rgb(120 113 108); border-bottom-color: rgb(120 113 108); | | border-y-stone-600 | border-top-color: rgb(87 83 78); border-bottom-color: rgb(87 83 78); | | border-y-stone-700 | border-top-color: rgb(68 64 60); border-bottom-color: rgb(68 64 60); | | border-y-stone-800 | border-top-color: rgb(41 37 36); border-bottom-color: rgb(41 37 36); | | border-y-stone-900 | border-top-color: rgb(28 25 23); border-bottom-color: rgb(28 25 23); | | border-y-red-50 | border-top-color: rgb(254 242 242); border-bottom-color: rgb(254 242 242); | | border-y-red-100 | border-top-color: rgb(254 226 226); border-bottom-color: rgb(254 226 226); | | border-y-red-200 | border-top-color: rgb(254 202 202); border-bottom-color: rgb(254 202 202); | | border-y-red-300 | border-top-color: rgb(252 165 165); border-bottom-color: rgb(252 165 165); | | border-y-red-400 | border-top-color: rgb(248 113 113); border-bottom-color: rgb(248 113 113); | | border-y-red-500 | border-top-color: rgb(239 68 68); border-bottom-color: rgb(239 68 68); | | border-y-red-600 | border-top-color: rgb(220 38 38); border-bottom-color: rgb(220 38 38); | | border-y-red-700 | border-top-color: rgb(185 28 28); border-bottom-color: rgb(185 28 28); | | border-y-red-800 | border-top-color: rgb(153 27 27); border-bottom-color: rgb(153 27 27); | | border-y-red-900 | border-top-color: rgb(127 29 29); border-bottom-color: rgb(127 29 29); | | border-y-orange-50 | border-top-color: rgb(255 247 237); border-bottom-color: rgb(255 247 237); | | border-y-orange-100 | border-top-color: rgb(255 237 213); border-bottom-color: rgb(255 237 213); | | border-y-orange-200 | border-top-color: rgb(254 215 170); border-bottom-color: rgb(254 215 170); | | border-y-orange-300 | border-top-color: rgb(253 186 116); border-bottom-color: rgb(253 186 116); | | border-y-orange-400 | border-top-color: rgb(251 146 60); border-bottom-color: rgb(251 146 60); | | border-y-orange-500 | border-top-color: rgb(249 115 22); border-bottom-color: rgb(249 115 22); | | border-y-orange-600 | border-top-color: rgb(234 88 12); border-bottom-color: rgb(234 88 12); | | border-y-orange-700 | border-top-color: rgb(194 65 12); border-bottom-color: rgb(194 65 12); | | border-y-orange-800 | border-top-color: rgb(154 52 18); border-bottom-color: rgb(154 52 18); | | border-y-orange-900 | border-top-color: rgb(124 45 18); border-bottom-color: rgb(124 45 18); | | border-y-amber-50 | border-top-color: rgb(255 251 235); border-bottom-color: rgb(255 251 235); | | border-y-amber-100 | border-top-color: rgb(254 243 199); border-bottom-color: rgb(254 243 199); | | border-y-amber-200 | border-top-color: rgb(253 230 138); border-bottom-color: rgb(253 230 138); | | border-y-amber-300 | border-top-color: rgb(252 211 77); border-bottom-color: rgb(252 211 77); | | border-y-amber-400 | border-top-color: rgb(251 191 36); border-bottom-color: rgb(251 191 36); | | border-y-amber-500 | border-top-color: rgb(245 158 11); border-bottom-color: rgb(245 158 11); | | border-y-amber-600 | border-top-color: rgb(217 119 6); border-bottom-color: rgb(217 119 6); | | border-y-amber-700 | border-top-color: rgb(180 83 9); border-bottom-color: rgb(180 83 9); | | border-y-amber-800 | border-top-color: rgb(146 64 14); border-bottom-color: rgb(146 64 14); | | border-y-amber-900 | border-top-color: rgb(120 53 15); border-bottom-color: rgb(120 53 15); | | border-y-yellow-50 | border-top-color: rgb(254 252 232); border-bottom-color: rgb(254 252 232); | | border-y-yellow-100 | border-top-color: rgb(254 249 195); border-bottom-color: rgb(254 249 195); | | border-y-yellow-200 | border-top-color: rgb(254 240 138); border-bottom-color: rgb(254 240 138); | | border-y-yellow-300 | border-top-color: rgb(253 224 71); border-bottom-color: rgb(253 224 71); | | border-y-yellow-400 | border-top-color: rgb(250 204 21); border-bottom-color: rgb(250 204 21); | | border-y-yellow-500 | border-top-color: rgb(234 179 8); border-bottom-color: rgb(234 179 8); | | border-y-yellow-600 | border-top-color: rgb(202 138 4); border-bottom-color: rgb(202 138 4); | | border-y-yellow-700 | border-top-color: rgb(161 98 7); border-bottom-color: rgb(161 98 7); | | border-y-yellow-800 | border-top-color: rgb(133 77 14); border-bottom-color: rgb(133 77 14); | | border-y-yellow-900 | border-top-color: rgb(113 63 18); border-bottom-color: rgb(113 63 18); | | border-y-lime-50 | border-top-color: rgb(247 254 231); border-bottom-color: rgb(247 254 231); | | border-y-lime-100 | border-top-color: rgb(236 252 203); border-bottom-color: rgb(236 252 203); | | border-y-lime-200 | border-top-color: rgb(217 249 157); border-bottom-color: rgb(217 249 157); | | border-y-lime-300 | border-top-color: rgb(190 242 100); border-bottom-color: rgb(190 242 100); | | border-y-lime-400 | border-top-color: rgb(163 230 53); border-bottom-color: rgb(163 230 53); | | border-y-lime-500 | border-top-color: rgb(132 204 22); border-bottom-color: rgb(132 204 22); | | border-y-lime-600 | border-top-color: rgb(101 163 13); border-bottom-color: rgb(101 163 13); | | border-y-lime-700 | border-top-color: rgb(77 124 15); border-bottom-color: rgb(77 124 15); | | border-y-lime-800 | border-top-color: rgb(63 98 18); border-bottom-color: rgb(63 98 18); | | border-y-lime-900 | border-top-color: rgb(54 83 20); border-bottom-color: rgb(54 83 20); | | border-y-green-50 | border-top-color: rgb(240 253 244); border-bottom-color: rgb(240 253 244); | | border-y-green-100 | border-top-color: rgb(220 252 231); border-bottom-color: rgb(220 252 231); | | border-y-green-200 | border-top-color: rgb(187 247 208); border-bottom-color: rgb(187 247 208); | | border-y-green-300 | border-top-color: rgb(134 239 172); border-bottom-color: rgb(134 239 172); | | border-y-green-400 | border-top-color: rgb(74 222 128); border-bottom-color: rgb(74 222 128); | | border-y-green-500 | border-top-color: rgb(34 197 94); border-bottom-color: rgb(34 197 94); | | border-y-green-600 | border-top-color: rgb(22 163 74); border-bottom-color: rgb(22 163 74); | | border-y-green-700 | border-top-color: rgb(21 128 61); border-bottom-color: rgb(21 128 61); | | border-y-green-800 | border-top-color: rgb(22 101 52); border-bottom-color: rgb(22 101 52); | | border-y-green-900 | border-top-color: rgb(20 83 45); border-bottom-color: rgb(20 83 45); | | border-y-emerald-50 | border-top-color: rgb(236 253 245); border-bottom-color: rgb(236 253 245); | | border-y-emerald-100 | border-top-color: rgb(209 250 229); border-bottom-color: rgb(209 250 229); | | border-y-emerald-200 | border-top-color: rgb(167 243 208); border-bottom-color: rgb(167 243 208); | | border-y-emerald-300 | border-top-color: rgb(110 231 183); border-bottom-color: rgb(110 231 183); | | border-y-emerald-400 | border-top-color: rgb(52 211 153); border-bottom-color: rgb(52 211 153); | | border-y-emerald-500 | border-top-color: rgb(16 185 129); border-bottom-color: rgb(16 185 129); | | border-y-emerald-600 | border-top-color: rgb(5 150 105); border-bottom-color: rgb(5 150 105); | | border-y-emerald-700 | border-top-color: rgb(4 120 87); border-bottom-color: rgb(4 120 87); | | border-y-emerald-800 | border-top-color: rgb(6 95 70); border-bottom-color: rgb(6 95 70); | | border-y-emerald-900 | border-top-color: rgb(6 78 59); border-bottom-color: rgb(6 78 59); | | border-y-teal-50 | border-top-color: rgb(240 253 250); border-bottom-color: rgb(240 253 250); | | border-y-teal-100 | border-top-color: rgb(204 251 241); border-bottom-color: rgb(204 251 241); | | border-y-teal-200 | border-top-color: rgb(153 246 228); border-bottom-color: rgb(153 246 228); | | border-y-teal-300 | border-top-color: rgb(94 234 212); border-bottom-color: rgb(94 234 212); | | border-y-teal-400 | border-top-color: rgb(45 212 191); border-bottom-color: rgb(45 212 191); | | border-y-teal-500 | border-top-color: rgb(20 184 166); border-bottom-color: rgb(20 184 166); | | border-y-teal-600 | border-top-color: rgb(13 148 136); border-bottom-color: rgb(13 148 136); | | border-y-teal-700 | border-top-color: rgb(15 118 110); border-bottom-color: rgb(15 118 110); | | border-y-teal-800 | border-top-color: rgb(17 94 89); border-bottom-color: rgb(17 94 89); | | border-y-teal-900 | border-top-color: rgb(19 78 74); border-bottom-color: rgb(19 78 74); | | border-y-cyan-50 | border-top-color: rgb(236 254 255); border-bottom-color: rgb(236 254 255); | | border-y-cyan-100 | border-top-color: rgb(207 250 254); border-bottom-color: rgb(207 250 254); | | border-y-cyan-200 | border-top-color: rgb(165 243 252); border-bottom-color: rgb(165 243 252); | | border-y-cyan-300 | border-top-color: rgb(103 232 249); border-bottom-color: rgb(103 232 249); | | border-y-cyan-400 | border-top-color: rgb(34 211 238); border-bottom-color: rgb(34 211 238); | | border-y-cyan-500 | border-top-color: rgb(6 182 212); border-bottom-color: rgb(6 182 212); | | border-y-cyan-600 | border-top-color: rgb(8 145 178); border-bottom-color: rgb(8 145 178); | | border-y-cyan-700 | border-top-color: rgb(14 116 144); border-bottom-color: rgb(14 116 144); | | border-y-cyan-800 | border-top-color: rgb(21 94 117); border-bottom-color: rgb(21 94 117); | | border-y-cyan-900 | border-top-color: rgb(22 78 99); border-bottom-color: rgb(22 78 99); | | border-y-sky-50 | border-top-color: rgb(240 249 255); border-bottom-color: rgb(240 249 255); | | border-y-sky-100 | border-top-color: rgb(224 242 254); border-bottom-color: rgb(224 242 254); | | border-y-sky-200 | border-top-color: rgb(186 230 253); border-bottom-color: rgb(186 230 253); | | border-y-sky-300 | border-top-color: rgb(125 211 252); border-bottom-color: rgb(125 211 252); | | border-y-sky-400 | border-top-color: rgb(56 189 248); border-bottom-color: rgb(56 189 248); | | border-y-sky-500 | border-top-color: rgb(14 165 233); border-bottom-color: rgb(14 165 233); | | border-y-sky-600 | border-top-color: rgb(2 132 199); border-bottom-color: rgb(2 132 199); | | border-y-sky-700 | border-top-color: rgb(3 105 161); border-bottom-color: rgb(3 105 161); | | border-y-sky-800 | border-top-color: rgb(7 89 133); border-bottom-color: rgb(7 89 133); | | border-y-sky-900 | border-top-color: rgb(12 74 110); border-bottom-color: rgb(12 74 110); | | border-y-blue-50 | border-top-color: rgb(239 246 255); border-bottom-color: rgb(239 246 255); | | border-y-blue-100 | border-top-color: rgb(219 234 254); border-bottom-color: rgb(219 234 254); | | border-y-blue-200 | border-top-color: rgb(191 219 254); border-bottom-color: rgb(191 219 254); | | border-y-blue-300 | border-top-color: rgb(147 197 253); border-bottom-color: rgb(147 197 253); | | border-y-blue-400 | border-top-color: rgb(96 165 250); border-bottom-color: rgb(96 165 250); | | border-y-blue-500 | border-top-color: rgb(59 130 246); border-bottom-color: rgb(59 130 246); | | border-y-blue-600 | border-top-color: rgb(37 99 235); border-bottom-color: rgb(37 99 235); | | border-y-blue-700 | border-top-color: rgb(29 78 216); border-bottom-color: rgb(29 78 216); | | border-y-blue-800 | border-top-color: rgb(30 64 175); border-bottom-color: rgb(30 64 175); | | border-y-blue-900 | border-top-color: rgb(30 58 138); border-bottom-color: rgb(30 58 138); | | border-y-indigo-50 | border-top-color: rgb(238 242 255); border-bottom-color: rgb(238 242 255); | | border-y-indigo-100 | border-top-color: rgb(224 231 255); border-bottom-color: rgb(224 231 255); | | border-y-indigo-200 | border-top-color: rgb(199 210 254); border-bottom-color: rgb(199 210 254); | | border-y-indigo-300 | border-top-color: rgb(165 180 252); border-bottom-color: rgb(165 180 252); | | border-y-indigo-400 | border-top-color: rgb(129 140 248); border-bottom-color: rgb(129 140 248); | | border-y-indigo-500 | border-top-color: rgb(99 102 241); border-bottom-color: rgb(99 102 241); | | border-y-indigo-600 | border-top-color: rgb(79 70 229); border-bottom-color: rgb(79 70 229); | | border-y-indigo-700 | border-top-color: rgb(67 56 202); border-bottom-color: rgb(67 56 202); | | border-y-indigo-800 | border-top-color: rgb(55 48 163); border-bottom-color: rgb(55 48 163); | | border-y-indigo-900 | border-top-color: rgb(49 46 129); border-bottom-color: rgb(49 46 129); | | border-y-violet-50 | border-top-color: rgb(245 243 255); border-bottom-color: rgb(245 243 255); | | border-y-violet-100 | border-top-color: rgb(237 233 254); border-bottom-color: rgb(237 233 254); | | border-y-violet-200 | border-top-color: rgb(221 214 254); border-bottom-color: rgb(221 214 254); | | border-y-violet-300 | border-top-color: rgb(196 181 253); border-bottom-color: rgb(196 181 253); | | border-y-violet-400 | border-top-color: rgb(167 139 250); border-bottom-color: rgb(167 139 250); | | border-y-violet-500 | border-top-color: rgb(139 92 246); border-bottom-color: rgb(139 92 246); | | border-y-violet-600 | border-top-color: rgb(124 58 237); border-bottom-color: rgb(124 58 237); | | border-y-violet-700 | border-top-color: rgb(109 40 217); border-bottom-color: rgb(109 40 217); | | border-y-violet-800 | border-top-color: rgb(91 33 182); border-bottom-color: rgb(91 33 182); | | border-y-violet-900 | border-top-color: rgb(76 29 149); border-bottom-color: rgb(76 29 149); | | border-y-purple-50 | border-top-color: rgb(250 245 255); border-bottom-color: rgb(250 245 255); | | border-y-purple-100 | border-top-color: rgb(243 232 255); border-bottom-color: rgb(243 232 255); | | border-y-purple-200 | border-top-color: rgb(233 213 255); border-bottom-color: rgb(233 213 255); | | border-y-purple-300 | border-top-color: rgb(216 180 254); border-bottom-color: rgb(216 180 254); | | border-y-purple-400 | border-top-color: rgb(192 132 252); border-bottom-color: rgb(192 132 252); | | border-y-purple-500 | border-top-color: rgb(168 85 247); border-bottom-color: rgb(168 85 247); | | border-y-purple-600 | border-top-color: rgb(147 51 234); border-bottom-color: rgb(147 51 234); | | border-y-purple-700 | border-top-color: rgb(126 34 206); border-bottom-color: rgb(126 34 206); | | border-y-purple-800 | border-top-color: rgb(107 33 168); border-bottom-color: rgb(107 33 168); | | border-y-purple-900 | border-top-color: rgb(88 28 135); border-bottom-color: rgb(88 28 135); | | border-y-fuchsia-50 | border-top-color: rgb(253 244 255); border-bottom-color: rgb(253 244 255); | | border-y-fuchsia-100 | border-top-color: rgb(250 232 255); border-bottom-color: rgb(250 232 255); | | border-y-fuchsia-200 | border-top-color: rgb(245 208 254); border-bottom-color: rgb(245 208 254); | | border-y-fuchsia-300 | border-top-color: rgb(240 171 252); border-bottom-color: rgb(240 171 252); | | border-y-fuchsia-400 | border-top-color: rgb(232 121 249); border-bottom-color: rgb(232 121 249); | | border-y-fuchsia-500 | border-top-color: rgb(217 70 239); border-bottom-color: rgb(217 70 239); | | border-y-fuchsia-600 | border-top-color: rgb(192 38 211); border-bottom-color: rgb(192 38 211); | | border-y-fuchsia-700 | border-top-color: rgb(162 28 175); border-bottom-color: rgb(162 28 175); | | border-y-fuchsia-800 | border-top-color: rgb(134 25 143); border-bottom-color: rgb(134 25 143); | | border-y-fuchsia-900 | border-top-color: rgb(112 26 117); border-bottom-color: rgb(112 26 117); | | border-y-pink-50 | border-top-color: rgb(253 242 248); border-bottom-color: rgb(253 242 248); | | border-y-pink-100 | border-top-color: rgb(252 231 243); border-bottom-color: rgb(252 231 243); | | border-y-pink-200 | border-top-color: rgb(251 207 232); border-bottom-color: rgb(251 207 232); | | border-y-pink-300 | border-top-color: rgb(249 168 212); border-bottom-color: rgb(249 168 212); | | border-y-pink-400 | border-top-color: rgb(244 114 182); border-bottom-color: rgb(244 114 182); | | border-y-pink-500 | border-top-color: rgb(236 72 153); border-bottom-color: rgb(236 72 153); | | border-y-pink-600 | border-top-color: rgb(219 39 119); border-bottom-color: rgb(219 39 119); | | border-y-pink-700 | border-top-color: rgb(190 24 93); border-bottom-color: rgb(190 24 93); | | border-y-pink-800 | border-top-color: rgb(157 23 77); border-bottom-color: rgb(157 23 77); | | border-y-pink-900 | border-top-color: rgb(131 24 67); border-bottom-color: rgb(131 24 67); | | border-y-rose-50 | border-top-color: rgb(255 241 242); border-bottom-color: rgb(255 241 242); | | border-y-rose-100 | border-top-color: rgb(255 228 230); border-bottom-color: rgb(255 228 230); | | border-y-rose-200 | border-top-color: rgb(254 205 211); border-bottom-color: rgb(254 205 211); | | border-y-rose-300 | border-top-color: rgb(253 164 175); border-bottom-color: rgb(253 164 175); | | border-y-rose-400 | border-top-color: rgb(251 113 133); border-bottom-color: rgb(251 113 133); | | border-y-rose-500 | border-top-color: rgb(244 63 94); border-bottom-color: rgb(244 63 94); | | border-y-rose-600 | border-top-color: rgb(225 29 72); border-bottom-color: rgb(225 29 72); | | border-y-rose-700 | border-top-color: rgb(190 18 60); border-bottom-color: rgb(190 18 60); | | border-y-rose-800 | border-top-color: rgb(159 18 57); border-bottom-color: rgb(159 18 57); | | border-y-rose-900 | border-top-color: rgb(136 19 55); border-bottom-color: rgb(136 19 55); | | border-t-inherit | border-top-color: inherit; | | border-t-current | border-top-color: currentColor; | | border-t-transparent | border-top-color: transparent; | | border-t-black | border-top-color: rgb(0 0 0); | | border-t-white | border-top-color: rgb(255 255 255); | | border-t-slate-50 | border-top-color: rgb(248 250 252); | | border-t-slate-100 | border-top-color: rgb(241 245 249); | | border-t-slate-200 | border-top-color: rgb(226 232 240); | | border-t-slate-300 | border-top-color: rgb(203 213 225); | | border-t-slate-400 | border-top-color: rgb(148 163 184); | | border-t-slate-500 | border-top-color: rgb(100 116 139); | | border-t-slate-600 | border-top-color: rgb(71 85 105); | | border-t-slate-700 | border-top-color: rgb(51 65 85); | | border-t-slate-800 | border-top-color: rgb(30 41 59); | | border-t-slate-900 | border-top-color: rgb(15 23 42); | | border-t-gray-50 | border-top-color: rgb(249 250 251); | | border-t-gray-100 | border-top-color: rgb(243 244 246); | | border-t-gray-200 | border-top-color: rgb(229 231 235); | | border-t-gray-300 | border-top-color: rgb(209 213 219); | | border-t-gray-400 | border-top-color: rgb(156 163 175); | | border-t-gray-500 | border-top-color: rgb(107 114 128); | | border-t-gray-600 | border-top-color: rgb(75 85 99); | | border-t-gray-700 | border-top-color: rgb(55 65 81); | | border-t-gray-800 | border-top-color: rgb(31 41 55); | | border-t-gray-900 | border-top-color: rgb(17 24 39); | | border-t-zinc-50 | border-top-color: rgb(250 250 250); | | border-t-zinc-100 | border-top-color: rgb(244 244 245); | | border-t-zinc-200 | border-top-color: rgb(228 228 231); | | border-t-zinc-300 | border-top-color: rgb(212 212 216); | | border-t-zinc-400 | border-top-color: rgb(161 161 170); | | border-t-zinc-500 | border-top-color: rgb(113 113 122); | | border-t-zinc-600 | border-top-color: rgb(82 82 91); | | border-t-zinc-700 | border-top-color: rgb(63 63 70); | | border-t-zinc-800 | border-top-color: rgb(39 39 42); | | border-t-zinc-900 | border-top-color: rgb(24 24 27); | | border-t-neutral-50 | border-top-color: rgb(250 250 250); | | border-t-neutral-100 | border-top-color: rgb(245 245 245); | | border-t-neutral-200 | border-top-color: rgb(229 229 229); | | border-t-neutral-300 | border-top-color: rgb(212 212 212); | | border-t-neutral-400 | border-top-color: rgb(163 163 163); | | border-t-neutral-500 | border-top-color: rgb(115 115 115); | | border-t-neutral-600 | border-top-color: rgb(82 82 82); | | border-t-neutral-700 | border-top-color: rgb(64 64 64); | | border-t-neutral-800 | border-top-color: rgb(38 38 38); | | border-t-neutral-900 | border-top-color: rgb(23 23 23); | | border-t-stone-50 | border-top-color: rgb(250 250 249); | | border-t-stone-100 | border-top-color: rgb(245 245 244); | | border-t-stone-200 | border-top-color: rgb(231 229 228); | | border-t-stone-300 | border-top-color: rgb(214 211 209); | | border-t-stone-400 | border-top-color: rgb(168 162 158); | | border-t-stone-500 | border-top-color: rgb(120 113 108); | | border-t-stone-600 | border-top-color: rgb(87 83 78); | | border-t-stone-700 | border-top-color: rgb(68 64 60); | | border-t-stone-800 | border-top-color: rgb(41 37 36); | | border-t-stone-900 | border-top-color: rgb(28 25 23); | | border-t-red-50 | border-top-color: rgb(254 242 242); | | border-t-red-100 | border-top-color: rgb(254 226 226); | | border-t-red-200 | border-top-color: rgb(254 202 202); | | border-t-red-300 | border-top-color: rgb(252 165 165); | | border-t-red-400 | border-top-color: rgb(248 113 113); | | border-t-red-500 | border-top-color: rgb(239 68 68); | | border-t-red-600 | border-top-color: rgb(220 38 38); | | border-t-red-700 | border-top-color: rgb(185 28 28); | | border-t-red-800 | border-top-color: rgb(153 27 27); | | border-t-red-900 | border-top-color: rgb(127 29 29); | | border-t-orange-50 | border-top-color: rgb(255 247 237); | | border-t-orange-100 | border-top-color: rgb(255 237 213); | | border-t-orange-200 | border-top-color: rgb(254 215 170); | | border-t-orange-300 | border-top-color: rgb(253 186 116); | | border-t-orange-400 | border-top-color: rgb(251 146 60); | | border-t-orange-500 | border-top-color: rgb(249 115 22); | | border-t-orange-600 | border-top-color: rgb(234 88 12); | | border-t-orange-700 | border-top-color: rgb(194 65 12); | | border-t-orange-800 | border-top-color: rgb(154 52 18); | | border-t-orange-900 | border-top-color: rgb(124 45 18); | | border-t-amber-50 | border-top-color: rgb(255 251 235); | | border-t-amber-100 | border-top-color: rgb(254 243 199); | | border-t-amber-200 | border-top-color: rgb(253 230 138); | | border-t-amber-300 | border-top-color: rgb(252 211 77); | | border-t-amber-400 | border-top-color: rgb(251 191 36); | | border-t-amber-500 | border-top-color: rgb(245 158 11); | | border-t-amber-600 | border-top-color: rgb(217 119 6); | | border-t-amber-700 | border-top-color: rgb(180 83 9); | | border-t-amber-800 | border-top-color: rgb(146 64 14); | | border-t-amber-900 | border-top-color: rgb(120 53 15); | | border-t-yellow-50 | border-top-color: rgb(254 252 232); | | border-t-yellow-100 | border-top-color: rgb(254 249 195); | | border-t-yellow-200 | border-top-color: rgb(254 240 138); | | border-t-yellow-300 | border-top-color: rgb(253 224 71); | | border-t-yellow-400 | border-top-color: rgb(250 204 21); | | border-t-yellow-500 | border-top-color: rgb(234 179 8); | | border-t-yellow-600 | border-top-color: rgb(202 138 4); | | border-t-yellow-700 | border-top-color: rgb(161 98 7); | | border-t-yellow-800 | border-top-color: rgb(133 77 14); | | border-t-yellow-900 | border-top-color: rgb(113 63 18); | | border-t-lime-50 | border-top-color: rgb(247 254 231); | | border-t-lime-100 | border-top-color: rgb(236 252 203); | | border-t-lime-200 | border-top-color: rgb(217 249 157); | | border-t-lime-300 | border-top-color: rgb(190 242 100); | | border-t-lime-400 | border-top-color: rgb(163 230 53); | | border-t-lime-500 | border-top-color: rgb(132 204 22); | | border-t-lime-600 | border-top-color: rgb(101 163 13); | | border-t-lime-700 | border-top-color: rgb(77 124 15); | | border-t-lime-800 | border-top-color: rgb(63 98 18); | | border-t-lime-900 | border-top-color: rgb(54 83 20); | | border-t-green-50 | border-top-color: rgb(240 253 244); | | border-t-green-100 | border-top-color: rgb(220 252 231); | | border-t-green-200 | border-top-color: rgb(187 247 208); | | border-t-green-300 | border-top-color: rgb(134 239 172); | | border-t-green-400 | border-top-color: rgb(74 222 128); | | border-t-green-500 | border-top-color: rgb(34 197 94); | | border-t-green-600 | border-top-color: rgb(22 163 74); | | border-t-green-700 | border-top-color: rgb(21 128 61); | | border-t-green-800 | border-top-color: rgb(22 101 52); | | border-t-green-900 | border-top-color: rgb(20 83 45); | | border-t-emerald-50 | border-top-color: rgb(236 253 245); | | border-t-emerald-100 | border-top-color: rgb(209 250 229); | | border-t-emerald-200 | border-top-color: rgb(167 243 208); | | border-t-emerald-300 | border-top-color: rgb(110 231 183); | | border-t-emerald-400 | border-top-color: rgb(52 211 153); | | border-t-emerald-500 | border-top-color: rgb(16 185 129); | | border-t-emerald-600 | border-top-color: rgb(5 150 105); | | border-t-emerald-700 | border-top-color: rgb(4 120 87); | | border-t-emerald-800 | border-top-color: rgb(6 95 70); | | border-t-emerald-900 | border-top-color: rgb(6 78 59); | | border-t-teal-50 | border-top-color: rgb(240 253 250); | | border-t-teal-100 | border-top-color: rgb(204 251 241); | | border-t-teal-200 | border-top-color: rgb(153 246 228); | | border-t-teal-300 | border-top-color: rgb(94 234 212); | | border-t-teal-400 | border-top-color: rgb(45 212 191); | | border-t-teal-500 | border-top-color: rgb(20 184 166); | | border-t-teal-600 | border-top-color: rgb(13 148 136); | | border-t-teal-700 | border-top-color: rgb(15 118 110); | | border-t-teal-800 | border-top-color: rgb(17 94 89); | | border-t-teal-900 | border-top-color: rgb(19 78 74); | | border-t-cyan-50 | border-top-color: rgb(236 254 255); | | border-t-cyan-100 | border-top-color: rgb(207 250 254); | | border-t-cyan-200 | border-top-color: rgb(165 243 252); | | border-t-cyan-300 | border-top-color: rgb(103 232 249); | | border-t-cyan-400 | border-top-color: rgb(34 211 238); | | border-t-cyan-500 | border-top-color: rgb(6 182 212); | | border-t-cyan-600 | border-top-color: rgb(8 145 178); | | border-t-cyan-700 | border-top-color: rgb(14 116 144); | | border-t-cyan-800 | border-top-color: rgb(21 94 117); | | border-t-cyan-900 | border-top-color: rgb(22 78 99); | | border-t-sky-50 | border-top-color: rgb(240 249 255); | | border-t-sky-100 | border-top-color: rgb(224 242 254); | | border-t-sky-200 | border-top-color: rgb(186 230 253); | | border-t-sky-300 | border-top-color: rgb(125 211 252); | | border-t-sky-400 | border-top-color: rgb(56 189 248); | | border-t-sky-500 | border-top-color: rgb(14 165 233); | | border-t-sky-600 | border-top-color: rgb(2 132 199); | | border-t-sky-700 | border-top-color: rgb(3 105 161); | | border-t-sky-800 | border-top-color: rgb(7 89 133); | | border-t-sky-900 | border-top-color: rgb(12 74 110); | | border-t-blue-50 | border-top-color: rgb(239 246 255); | | border-t-blue-100 | border-top-color: rgb(219 234 254); | | border-t-blue-200 | border-top-color: rgb(191 219 254); | | border-t-blue-300 | border-top-color: rgb(147 197 253); | | border-t-blue-400 | border-top-color: rgb(96 165 250); | | border-t-blue-500 | border-top-color: rgb(59 130 246); | | border-t-blue-600 | border-top-color: rgb(37 99 235); | | border-t-blue-700 | border-top-color: rgb(29 78 216); | | border-t-blue-800 | border-top-color: rgb(30 64 175); | | border-t-blue-900 | border-top-color: rgb(30 58 138); | | border-t-indigo-50 | border-top-color: rgb(238 242 255); | | border-t-indigo-100 | border-top-color: rgb(224 231 255); | | border-t-indigo-200 | border-top-color: rgb(199 210 254); | | border-t-indigo-300 | border-top-color: rgb(165 180 252); | | border-t-indigo-400 | border-top-color: rgb(129 140 248); | | border-t-indigo-500 | border-top-color: rgb(99 102 241); | | border-t-indigo-600 | border-top-color: rgb(79 70 229); | | border-t-indigo-700 | border-top-color: rgb(67 56 202); | | border-t-indigo-800 | border-top-color: rgb(55 48 163); | | border-t-indigo-900 | border-top-color: rgb(49 46 129); | | border-t-violet-50 | border-top-color: rgb(245 243 255); | | border-t-violet-100 | border-top-color: rgb(237 233 254); | | border-t-violet-200 | border-top-color: rgb(221 214 254); | | border-t-violet-300 | border-top-color: rgb(196 181 253); | | border-t-violet-400 | border-top-color: rgb(167 139 250); | | border-t-violet-500 | border-top-color: rgb(139 92 246); | | border-t-violet-600 | border-top-color: rgb(124 58 237); | | border-t-violet-700 | border-top-color: rgb(109 40 217); | | border-t-violet-800 | border-top-color: rgb(91 33 182); | | border-t-violet-900 | border-top-color: rgb(76 29 149); | | border-t-purple-50 | border-top-color: rgb(250 245 255); | | border-t-purple-100 | border-top-color: rgb(243 232 255); | | border-t-purple-200 | border-top-color: rgb(233 213 255); | | border-t-purple-300 | border-top-color: rgb(216 180 254); | | border-t-purple-400 | border-top-color: rgb(192 132 252); | | border-t-purple-500 | border-top-color: rgb(168 85 247); | | border-t-purple-600 | border-top-color: rgb(147 51 234); | | border-t-purple-700 | border-top-color: rgb(126 34 206); | | border-t-purple-800 | border-top-color: rgb(107 33 168); | | border-t-purple-900 | border-top-color: rgb(88 28 135); | | border-t-fuchsia-50 | border-top-color: rgb(253 244 255); | | border-t-fuchsia-100 | border-top-color: rgb(250 232 255); | | border-t-fuchsia-200 | border-top-color: rgb(245 208 254); | | border-t-fuchsia-300 | border-top-color: rgb(240 171 252); | | border-t-fuchsia-400 | border-top-color: rgb(232 121 249); | | border-t-fuchsia-500 | border-top-color: rgb(217 70 239); | | border-t-fuchsia-600 | border-top-color: rgb(192 38 211); | | border-t-fuchsia-700 | border-top-color: rgb(162 28 175); | | border-t-fuchsia-800 | border-top-color: rgb(134 25 143); | | border-t-fuchsia-900 | border-top-color: rgb(112 26 117); | | border-t-pink-50 | border-top-color: rgb(253 242 248); | | border-t-pink-100 | border-top-color: rgb(252 231 243); | | border-t-pink-200 | border-top-color: rgb(251 207 232); | | border-t-pink-300 | border-top-color: rgb(249 168 212); | | border-t-pink-400 | border-top-color: rgb(244 114 182); | | border-t-pink-500 | border-top-color: rgb(236 72 153); | | border-t-pink-600 | border-top-color: rgb(219 39 119); | | border-t-pink-700 | border-top-color: rgb(190 24 93); | | border-t-pink-800 | border-top-color: rgb(157 23 77); | | border-t-pink-900 | border-top-color: rgb(131 24 67); | | border-t-rose-50 | border-top-color: rgb(255 241 242); | | border-t-rose-100 | border-top-color: rgb(255 228 230); | | border-t-rose-200 | border-top-color: rgb(254 205 211); | | border-t-rose-300 | border-top-color: rgb(253 164 175); | | border-t-rose-400 | border-top-color: rgb(251 113 133); | | border-t-rose-500 | border-top-color: rgb(244 63 94); | | border-t-rose-600 | border-top-color: rgb(225 29 72); | | border-t-rose-700 | border-top-color: rgb(190 18 60); | | border-t-rose-800 | border-top-color: rgb(159 18 57); | | border-t-rose-900 | border-top-color: rgb(136 19 55); | | border-r-inherit | border-right-color: inherit; | | border-r-current | border-right-color: currentColor; | | border-r-transparent | border-right-color: transparent; | | border-r-black | border-right-color: rgb(0 0 0); | | border-r-white | border-right-color: rgb(255 255 255); | | border-r-slate-50 | border-right-color: rgb(248 250 252); | | border-r-slate-100 | border-right-color: rgb(241 245 249); | | border-r-slate-200 | border-right-color: rgb(226 232 240); | | border-r-slate-300 | border-right-color: rgb(203 213 225); | | border-r-slate-400 | border-right-color: rgb(148 163 184); | | border-r-slate-500 | border-right-color: rgb(100 116 139); | | border-r-slate-600 | border-right-color: rgb(71 85 105); | | border-r-slate-700 | border-right-color: rgb(51 65 85); | | border-r-slate-800 | border-right-color: rgb(30 41 59); | | border-r-slate-900 | border-right-color: rgb(15 23 42); | | border-r-gray-50 | border-right-color: rgb(249 250 251); | | border-r-gray-100 | border-right-color: rgb(243 244 246); | | border-r-gray-200 | border-right-color: rgb(229 231 235); | | border-r-gray-300 | border-right-color: rgb(209 213 219); | | border-r-gray-400 | border-right-color: rgb(156 163 175); | | border-r-gray-500 | border-right-color: rgb(107 114 128); | | border-r-gray-600 | border-right-color: rgb(75 85 99); | | border-r-gray-700 | border-right-color: rgb(55 65 81); | | border-r-gray-800 | border-right-color: rgb(31 41 55); | | border-r-gray-900 | border-right-color: rgb(17 24 39); | | border-r-zinc-50 | border-right-color: rgb(250 250 250); | | border-r-zinc-100 | border-right-color: rgb(244 244 245); | | border-r-zinc-200 | border-right-color: rgb(228 228 231); | | border-r-zinc-300 | border-right-color: rgb(212 212 216); | | border-r-zinc-400 | border-right-color: rgb(161 161 170); | | border-r-zinc-500 | border-right-color: rgb(113 113 122); | | border-r-zinc-600 | border-right-color: rgb(82 82 91); | | border-r-zinc-700 | border-right-color: rgb(63 63 70); | | border-r-zinc-800 | border-right-color: rgb(39 39 42); | | border-r-zinc-900 | border-right-color: rgb(24 24 27); | | border-r-neutral-50 | border-right-color: rgb(250 250 250); | | border-r-neutral-100 | border-right-color: rgb(245 245 245); | | border-r-neutral-200 | border-right-color: rgb(229 229 229); | | border-r-neutral-300 | border-right-color: rgb(212 212 212); | | border-r-neutral-400 | border-right-color: rgb(163 163 163); | | border-r-neutral-500 | border-right-color: rgb(115 115 115); | | border-r-neutral-600 | border-right-color: rgb(82 82 82); | | border-r-neutral-700 | border-right-color: rgb(64 64 64); | | border-r-neutral-800 | border-right-color: rgb(38 38 38); | | border-r-neutral-900 | border-right-color: rgb(23 23 23); | | border-r-stone-50 | border-right-color: rgb(250 250 249); | | border-r-stone-100 | border-right-color: rgb(245 245 244); | | border-r-stone-200 | border-right-color: rgb(231 229 228); | | border-r-stone-300 | border-right-color: rgb(214 211 209); | | border-r-stone-400 | border-right-color: rgb(168 162 158); | | border-r-stone-500 | border-right-color: rgb(120 113 108); | | border-r-stone-600 | border-right-color: rgb(87 83 78); | | border-r-stone-700 | border-right-color: rgb(68 64 60); | | border-r-stone-800 | border-right-color: rgb(41 37 36); | | border-r-stone-900 | border-right-color: rgb(28 25 23); | | border-r-red-50 | border-right-color: rgb(254 242 242); | | border-r-red-100 | border-right-color: rgb(254 226 226); | | border-r-red-200 | border-right-color: rgb(254 202 202); | | border-r-red-300 | border-right-color: rgb(252 165 165); | | border-r-red-400 | border-right-color: rgb(248 113 113); | | border-r-red-500 | border-right-color: rgb(239 68 68); | | border-r-red-600 | border-right-color: rgb(220 38 38); | | border-r-red-700 | border-right-color: rgb(185 28 28); | | border-r-red-800 | border-right-color: rgb(153 27 27); | | border-r-red-900 | border-right-color: rgb(127 29 29); | | border-r-orange-50 | border-right-color: rgb(255 247 237); | | border-r-orange-100 | border-right-color: rgb(255 237 213); | | border-r-orange-200 | border-right-color: rgb(254 215 170); | | border-r-orange-300 | border-right-color: rgb(253 186 116); | | border-r-orange-400 | border-right-color: rgb(251 146 60); | | border-r-orange-500 | border-right-color: rgb(249 115 22); | | border-r-orange-600 | border-right-color: rgb(234 88 12); | | border-r-orange-700 | border-right-color: rgb(194 65 12); | | border-r-orange-800 | border-right-color: rgb(154 52 18); | | border-r-orange-900 | border-right-color: rgb(124 45 18); | | border-r-amber-50 | border-right-color: rgb(255 251 235); | | border-r-amber-100 | border-right-color: rgb(254 243 199); | | border-r-amber-200 | border-right-color: rgb(253 230 138); | | border-r-amber-300 | border-right-color: rgb(252 211 77); | | border-r-amber-400 | border-right-color: rgb(251 191 36); | | border-r-amber-500 | border-right-color: rgb(245 158 11); | | border-r-amber-600 | border-right-color: rgb(217 119 6); | | border-r-amber-700 | border-right-color: rgb(180 83 9); | | border-r-amber-800 | border-right-color: rgb(146 64 14); | | border-r-amber-900 | border-right-color: rgb(120 53 15); | | border-r-yellow-50 | border-right-color: rgb(254 252 232); | | border-r-yellow-100 | border-right-color: rgb(254 249 195); | | border-r-yellow-200 | border-right-color: rgb(254 240 138); | | border-r-yellow-300 | border-right-color: rgb(253 224 71); | | border-r-yellow-400 | border-right-color: rgb(250 204 21); | | border-r-yellow-500 | border-right-color: rgb(234 179 8); | | border-r-yellow-600 | border-right-color: rgb(202 138 4); | | border-r-yellow-700 | border-right-color: rgb(161 98 7); | | border-r-yellow-800 | border-right-color: rgb(133 77 14); | | border-r-yellow-900 | border-right-color: rgb(113 63 18); | | border-r-lime-50 | border-right-color: rgb(247 254 231); | | border-r-lime-100 | border-right-color: rgb(236 252 203); | | border-r-lime-200 | border-right-color: rgb(217 249 157); | | border-r-lime-300 | border-right-color: rgb(190 242 100); | | border-r-lime-400 | border-right-color: rgb(163 230 53); | | border-r-lime-500 | border-right-color: rgb(132 204 22); | | border-r-lime-600 | border-right-color: rgb(101 163 13); | | border-r-lime-700 | border-right-color: rgb(77 124 15); | | border-r-lime-800 | border-right-color: rgb(63 98 18); | | border-r-lime-900 | border-right-color: rgb(54 83 20); | | border-r-green-50 | border-right-color: rgb(240 253 244); | | border-r-green-100 | border-right-color: rgb(220 252 231); | | border-r-green-200 | border-right-color: rgb(187 247 208); | | border-r-green-300 | border-right-color: rgb(134 239 172); | | border-r-green-400 | border-right-color: rgb(74 222 128); | | border-r-green-500 | border-right-color: rgb(34 197 94); | | border-r-green-600 | border-right-color: rgb(22 163 74); | | border-r-green-700 | border-right-color: rgb(21 128 61); | | border-r-green-800 | border-right-color: rgb(22 101 52); | | border-r-green-900 | border-right-color: rgb(20 83 45); | | border-r-emerald-50 | border-right-color: rgb(236 253 245); | | border-r-emerald-100 | border-right-color: rgb(209 250 229); | | border-r-emerald-200 | border-right-color: rgb(167 243 208); | | border-r-emerald-300 | border-right-color: rgb(110 231 183); | | border-r-emerald-400 | border-right-color: rgb(52 211 153); | | border-r-emerald-500 | border-right-color: rgb(16 185 129); | | border-r-emerald-600 | border-right-color: rgb(5 150 105); | | border-r-emerald-700 | border-right-color: rgb(4 120 87); | | border-r-emerald-800 | border-right-color: rgb(6 95 70); | | border-r-emerald-900 | border-right-color: rgb(6 78 59); | | border-r-teal-50 | border-right-color: rgb(240 253 250); | | border-r-teal-100 | border-right-color: rgb(204 251 241); | | border-r-teal-200 | border-right-color: rgb(153 246 228); | | border-r-teal-300 | border-right-color: rgb(94 234 212); | | border-r-teal-400 | border-right-color: rgb(45 212 191); | | border-r-teal-500 | border-right-color: rgb(20 184 166); | | border-r-teal-600 | border-right-color: rgb(13 148 136); | | border-r-teal-700 | border-right-color: rgb(15 118 110); | | border-r-teal-800 | border-right-color: rgb(17 94 89); | | border-r-teal-900 | border-right-color: rgb(19 78 74); | | border-r-cyan-50 | border-right-color: rgb(236 254 255); | | border-r-cyan-100 | border-right-color: rgb(207 250 254); | | border-r-cyan-200 | border-right-color: rgb(165 243 252); | | border-r-cyan-300 | border-right-color: rgb(103 232 249); | | border-r-cyan-400 | border-right-color: rgb(34 211 238); | | border-r-cyan-500 | border-right-color: rgb(6 182 212); | | border-r-cyan-600 | border-right-color: rgb(8 145 178); | | border-r-cyan-700 | border-right-color: rgb(14 116 144); | | border-r-cyan-800 | border-right-color: rgb(21 94 117); | | border-r-cyan-900 | border-right-color: rgb(22 78 99); | | border-r-sky-50 | border-right-color: rgb(240 249 255); | | border-r-sky-100 | border-right-color: rgb(224 242 254); | | border-r-sky-200 | border-right-color: rgb(186 230 253); | | border-r-sky-300 | border-right-color: rgb(125 211 252); | | border-r-sky-400 | border-right-color: rgb(56 189 248); | | border-r-sky-500 | border-right-color: rgb(14 165 233); | | border-r-sky-600 | border-right-color: rgb(2 132 199); | | border-r-sky-700 | border-right-color: rgb(3 105 161); | | border-r-sky-800 | border-right-color: rgb(7 89 133); | | border-r-sky-900 | border-right-color: rgb(12 74 110); | | border-r-blue-50 | border-right-color: rgb(239 246 255); | | border-r-blue-100 | border-right-color: rgb(219 234 254); | | border-r-blue-200 | border-right-color: rgb(191 219 254); | | border-r-blue-300 | border-right-color: rgb(147 197 253); | | border-r-blue-400 | border-right-color: rgb(96 165 250); | | border-r-blue-500 | border-right-color: rgb(59 130 246); | | border-r-blue-600 | border-right-color: rgb(37 99 235); | | border-r-blue-700 | border-right-color: rgb(29 78 216); | | border-r-blue-800 | border-right-color: rgb(30 64 175); | | border-r-blue-900 | border-right-color: rgb(30 58 138); | | border-r-indigo-50 | border-right-color: rgb(238 242 255); | | border-r-indigo-100 | border-right-color: rgb(224 231 255); | | border-r-indigo-200 | border-right-color: rgb(199 210 254); | | border-r-indigo-300 | border-right-color: rgb(165 180 252); | | border-r-indigo-400 | border-right-color: rgb(129 140 248); | | border-r-indigo-500 | border-right-color: rgb(99 102 241); | | border-r-indigo-600 | border-right-color: rgb(79 70 229); | | border-r-indigo-700 | border-right-color: rgb(67 56 202); | | border-r-indigo-800 | border-right-color: rgb(55 48 163); | | border-r-indigo-900 | border-right-color: rgb(49 46 129); | | border-r-violet-50 | border-right-color: rgb(245 243 255); | | border-r-violet-100 | border-right-color: rgb(237 233 254); | | border-r-violet-200 | border-right-color: rgb(221 214 254); | | border-r-violet-300 | border-right-color: rgb(196 181 253); | | border-r-violet-400 | border-right-color: rgb(167 139 250); | | border-r-violet-500 | border-right-color: rgb(139 92 246); | | border-r-violet-600 | border-right-color: rgb(124 58 237); | | border-r-violet-700 | border-right-color: rgb(109 40 217); | | border-r-violet-800 | border-right-color: rgb(91 33 182); | | border-r-violet-900 | border-right-color: rgb(76 29 149); | | border-r-purple-50 | border-right-color: rgb(250 245 255); | | border-r-purple-100 | border-right-color: rgb(243 232 255); | | border-r-purple-200 | border-right-color: rgb(233 213 255); | | border-r-purple-300 | border-right-color: rgb(216 180 254); | | border-r-purple-400 | border-right-color: rgb(192 132 252); | | border-r-purple-500 | border-right-color: rgb(168 85 247); | | border-r-purple-600 | border-right-color: rgb(147 51 234); | | border-r-purple-700 | border-right-color: rgb(126 34 206); | | border-r-purple-800 | border-right-color: rgb(107 33 168); | | border-r-purple-900 | border-right-color: rgb(88 28 135); | | border-r-fuchsia-50 | border-right-color: rgb(253 244 255); | | border-r-fuchsia-100 | border-right-color: rgb(250 232 255); | | border-r-fuchsia-200 | border-right-color: rgb(245 208 254); | | border-r-fuchsia-300 | border-right-color: rgb(240 171 252); | | border-r-fuchsia-400 | border-right-color: rgb(232 121 249); | | border-r-fuchsia-500 | border-right-color: rgb(217 70 239); | | border-r-fuchsia-600 | border-right-color: rgb(192 38 211); | | border-r-fuchsia-700 | border-right-color: rgb(162 28 175); | | border-r-fuchsia-800 | border-right-color: rgb(134 25 143); | | border-r-fuchsia-900 | border-right-color: rgb(112 26 117); | | border-r-pink-50 | border-right-color: rgb(253 242 248); | | border-r-pink-100 | border-right-color: rgb(252 231 243); | | border-r-pink-200 | border-right-color: rgb(251 207 232); | | border-r-pink-300 | border-right-color: rgb(249 168 212); | | border-r-pink-400 | border-right-color: rgb(244 114 182); | | border-r-pink-500 | border-right-color: rgb(236 72 153); | | border-r-pink-600 | border-right-color: rgb(219 39 119); | | border-r-pink-700 | border-right-color: rgb(190 24 93); | | border-r-pink-800 | border-right-color: rgb(157 23 77); | | border-r-pink-900 | border-right-color: rgb(131 24 67); | | border-r-rose-50 | border-right-color: rgb(255 241 242); | | border-r-rose-100 | border-right-color: rgb(255 228 230); | | border-r-rose-200 | border-right-color: rgb(254 205 211); | | border-r-rose-300 | border-right-color: rgb(253 164 175); | | border-r-rose-400 | border-right-color: rgb(251 113 133); | | border-r-rose-500 | border-right-color: rgb(244 63 94); | | border-r-rose-600 | border-right-color: rgb(225 29 72); | | border-r-rose-700 | border-right-color: rgb(190 18 60); | | border-r-rose-800 | border-right-color: rgb(159 18 57); | | border-r-rose-900 | border-right-color: rgb(136 19 55); | | border-b-inherit | border-bottom-color: inherit; | | border-b-current | border-bottom-color: currentColor; | | border-b-transparent | border-bottom-color: transparent; | | border-b-black | border-bottom-color: rgb(0 0 0); | | border-b-white | border-bottom-color: rgb(255 255 255); | | border-b-slate-50 | border-bottom-color: rgb(248 250 252); | | border-b-slate-100 | border-bottom-color: rgb(241 245 249); | | border-b-slate-200 | border-bottom-color: rgb(226 232 240); | | border-b-slate-300 | border-bottom-color: rgb(203 213 225); | | border-b-slate-400 | border-bottom-color: rgb(148 163 184); | | border-b-slate-500 | border-bottom-color: rgb(100 116 139); | | border-b-slate-600 | border-bottom-color: rgb(71 85 105); | | border-b-slate-700 | border-bottom-color: rgb(51 65 85); | | border-b-slate-800 | border-bottom-color: rgb(30 41 59); | | border-b-slate-900 | border-bottom-color: rgb(15 23 42); | | border-b-gray-50 | border-bottom-color: rgb(249 250 251); | | border-b-gray-100 | border-bottom-color: rgb(243 244 246); | | border-b-gray-200 | border-bottom-color: rgb(229 231 235); | | border-b-gray-300 | border-bottom-color: rgb(209 213 219); | | border-b-gray-400 | border-bottom-color: rgb(156 163 175); | | border-b-gray-500 | border-bottom-color: rgb(107 114 128); | | border-b-gray-600 | border-bottom-color: rgb(75 85 99); | | border-b-gray-700 | border-bottom-color: rgb(55 65 81); | | border-b-gray-800 | border-bottom-color: rgb(31 41 55); | | border-b-gray-900 | border-bottom-color: rgb(17 24 39); | | border-b-zinc-50 | border-bottom-color: rgb(250 250 250); | | border-b-zinc-100 | border-bottom-color: rgb(244 244 245); | | border-b-zinc-200 | border-bottom-color: rgb(228 228 231); | | border-b-zinc-300 | border-bottom-color: rgb(212 212 216); | | border-b-zinc-400 | border-bottom-color: rgb(161 161 170); | | border-b-zinc-500 | border-bottom-color: rgb(113 113 122); | | border-b-zinc-600 | border-bottom-color: rgb(82 82 91); | | border-b-zinc-700 | border-bottom-color: rgb(63 63 70); | | border-b-zinc-800 | border-bottom-color: rgb(39 39 42); | | border-b-zinc-900 | border-bottom-color: rgb(24 24 27); | | border-b-neutral-50 | border-bottom-color: rgb(250 250 250); | | border-b-neutral-100 | border-bottom-color: rgb(245 245 245); | | border-b-neutral-200 | border-bottom-color: rgb(229 229 229); | | border-b-neutral-300 | border-bottom-color: rgb(212 212 212); | | border-b-neutral-400 | border-bottom-color: rgb(163 163 163); | | border-b-neutral-500 | border-bottom-color: rgb(115 115 115); | | border-b-neutral-600 | border-bottom-color: rgb(82 82 82); | | border-b-neutral-700 | border-bottom-color: rgb(64 64 64); | | border-b-neutral-800 | border-bottom-color: rgb(38 38 38); | | border-b-neutral-900 | border-bottom-color: rgb(23 23 23); | | border-b-stone-50 | border-bottom-color: rgb(250 250 249); | | border-b-stone-100 | border-bottom-color: rgb(245 245 244); | | border-b-stone-200 | border-bottom-color: rgb(231 229 228); | | border-b-stone-300 | border-bottom-color: rgb(214 211 209); | | border-b-stone-400 | border-bottom-color: rgb(168 162 158); | | border-b-stone-500 | border-bottom-color: rgb(120 113 108); | | border-b-stone-600 | border-bottom-color: rgb(87 83 78); | | border-b-stone-700 | border-bottom-color: rgb(68 64 60); | | border-b-stone-800 | border-bottom-color: rgb(41 37 36); | | border-b-stone-900 | border-bottom-color: rgb(28 25 23); | | border-b-red-50 | border-bottom-color: rgb(254 242 242); | | border-b-red-100 | border-bottom-color: rgb(254 226 226); | | border-b-red-200 | border-bottom-color: rgb(254 202 202); | | border-b-red-300 | border-bottom-color: rgb(252 165 165); | | border-b-red-400 | border-bottom-color: rgb(248 113 113); | | border-b-red-500 | border-bottom-color: rgb(239 68 68); | | border-b-red-600 | border-bottom-color: rgb(220 38 38); | | border-b-red-700 | border-bottom-color: rgb(185 28 28); | | border-b-red-800 | border-bottom-color: rgb(153 27 27); | | border-b-red-900 | border-bottom-color: rgb(127 29 29); | | border-b-orange-50 | border-bottom-color: rgb(255 247 237); | | border-b-orange-100 | border-bottom-color: rgb(255 237 213); | | border-b-orange-200 | border-bottom-color: rgb(254 215 170); | | border-b-orange-300 | border-bottom-color: rgb(253 186 116); | | border-b-orange-400 | border-bottom-color: rgb(251 146 60); | | border-b-orange-500 | border-bottom-color: rgb(249 115 22); | | border-b-orange-600 | border-bottom-color: rgb(234 88 12); | | border-b-orange-700 | border-bottom-color: rgb(194 65 12); | | border-b-orange-800 | border-bottom-color: rgb(154 52 18); | | border-b-orange-900 | border-bottom-color: rgb(124 45 18); | | border-b-amber-50 | border-bottom-color: rgb(255 251 235); | | border-b-amber-100 | border-bottom-color: rgb(254 243 199); | | border-b-amber-200 | border-bottom-color: rgb(253 230 138); | | border-b-amber-300 | border-bottom-color: rgb(252 211 77); | | border-b-amber-400 | border-bottom-color: rgb(251 191 36); | | border-b-amber-500 | border-bottom-color: rgb(245 158 11); | | border-b-amber-600 | border-bottom-color: rgb(217 119 6); | | border-b-amber-700 | border-bottom-color: rgb(180 83 9); | | border-b-amber-800 | border-bottom-color: rgb(146 64 14); | | border-b-amber-900 | border-bottom-color: rgb(120 53 15); | | border-b-yellow-50 | border-bottom-color: rgb(254 252 232); | | border-b-yellow-100 | border-bottom-color: rgb(254 249 195); | | border-b-yellow-200 | border-bottom-color: rgb(254 240 138); | | border-b-yellow-300 | border-bottom-color: rgb(253 224 71); | | border-b-yellow-400 | border-bottom-color: rgb(250 204 21); | | border-b-yellow-500 | border-bottom-color: rgb(234 179 8); | | border-b-yellow-600 | border-bottom-color: rgb(202 138 4); | | border-b-yellow-700 | border-bottom-color: rgb(161 98 7); | | border-b-yellow-800 | border-bottom-color: rgb(133 77 14); | | border-b-yellow-900 | border-bottom-color: rgb(113 63 18); | | border-b-lime-50 | border-bottom-color: rgb(247 254 231); | | border-b-lime-100 | border-bottom-color: rgb(236 252 203); | | border-b-lime-200 | border-bottom-color: rgb(217 249 157); | | border-b-lime-300 | border-bottom-color: rgb(190 242 100); | | border-b-lime-400 | border-bottom-color: rgb(163 230 53); | | border-b-lime-500 | border-bottom-color: rgb(132 204 22); | | border-b-lime-600 | border-bottom-color: rgb(101 163 13); | | border-b-lime-700 | border-bottom-color: rgb(77 124 15); | | border-b-lime-800 | border-bottom-color: rgb(63 98 18); | | border-b-lime-900 | border-bottom-color: rgb(54 83 20); | | border-b-green-50 | border-bottom-color: rgb(240 253 244); | | border-b-green-100 | border-bottom-color: rgb(220 252 231); | | border-b-green-200 | border-bottom-color: rgb(187 247 208); | | border-b-green-300 | border-bottom-color: rgb(134 239 172); | | border-b-green-400 | border-bottom-color: rgb(74 222 128); | | border-b-green-500 | border-bottom-color: rgb(34 197 94); | | border-b-green-600 | border-bottom-color: rgb(22 163 74); | | border-b-green-700 | border-bottom-color: rgb(21 128 61); | | border-b-green-800 | border-bottom-color: rgb(22 101 52); | | border-b-green-900 | border-bottom-color: rgb(20 83 45); | | border-b-emerald-50 | border-bottom-color: rgb(236 253 245); | | border-b-emerald-100 | border-bottom-color: rgb(209 250 229); | | border-b-emerald-200 | border-bottom-color: rgb(167 243 208); | | border-b-emerald-300 | border-bottom-color: rgb(110 231 183); | | border-b-emerald-400 | border-bottom-color: rgb(52 211 153); | | border-b-emerald-500 | border-bottom-color: rgb(16 185 129); | | border-b-emerald-600 | border-bottom-color: rgb(5 150 105); | | border-b-emerald-700 | border-bottom-color: rgb(4 120 87); | | border-b-emerald-800 | border-bottom-color: rgb(6 95 70); | | border-b-emerald-900 | border-bottom-color: rgb(6 78 59); | | border-b-teal-50 | border-bottom-color: rgb(240 253 250); | | border-b-teal-100 | border-bottom-color: rgb(204 251 241); | | border-b-teal-200 | border-bottom-color: rgb(153 246 228); | | border-b-teal-300 | border-bottom-color: rgb(94 234 212); | | border-b-teal-400 | border-bottom-color: rgb(45 212 191); | | border-b-teal-500 | border-bottom-color: rgb(20 184 166); | | border-b-teal-600 | border-bottom-color: rgb(13 148 136); | | border-b-teal-700 | border-bottom-color: rgb(15 118 110); | | border-b-teal-800 | border-bottom-color: rgb(17 94 89); | | border-b-teal-900 | border-bottom-color: rgb(19 78 74); | | border-b-cyan-50 | border-bottom-color: rgb(236 254 255); | | border-b-cyan-100 | border-bottom-color: rgb(207 250 254); | | border-b-cyan-200 | border-bottom-color: rgb(165 243 252); | | border-b-cyan-300 | border-bottom-color: rgb(103 232 249); | | border-b-cyan-400 | border-bottom-color: rgb(34 211 238); | | border-b-cyan-500 | border-bottom-color: rgb(6 182 212); | | border-b-cyan-600 | border-bottom-color: rgb(8 145 178); | | border-b-cyan-700 | border-bottom-color: rgb(14 116 144); | | border-b-cyan-800 | border-bottom-color: rgb(21 94 117); | | border-b-cyan-900 | border-bottom-color: rgb(22 78 99); | | border-b-sky-50 | border-bottom-color: rgb(240 249 255); | | border-b-sky-100 | border-bottom-color: rgb(224 242 254); | | border-b-sky-200 | border-bottom-color: rgb(186 230 253); | | border-b-sky-300 | border-bottom-color: rgb(125 211 252); | | border-b-sky-400 | border-bottom-color: rgb(56 189 248); | | border-b-sky-500 | border-bottom-color: rgb(14 165 233); | | border-b-sky-600 | border-bottom-color: rgb(2 132 199); | | border-b-sky-700 | border-bottom-color: rgb(3 105 161); | | border-b-sky-800 | border-bottom-color: rgb(7 89 133); | | border-b-sky-900 | border-bottom-color: rgb(12 74 110); | | border-b-blue-50 | border-bottom-color: rgb(239 246 255); | | border-b-blue-100 | border-bottom-color: rgb(219 234 254); | | border-b-blue-200 | border-bottom-color: rgb(191 219 254); | | border-b-blue-300 | border-bottom-color: rgb(147 197 253); | | border-b-blue-400 | border-bottom-color: rgb(96 165 250); | | border-b-blue-500 | border-bottom-color: rgb(59 130 246); | | border-b-blue-600 | border-bottom-color: rgb(37 99 235); | | border-b-blue-700 | border-bottom-color: rgb(29 78 216); | | border-b-blue-800 | border-bottom-color: rgb(30 64 175); | | border-b-blue-900 | border-bottom-color: rgb(30 58 138); | | border-b-indigo-50 | border-bottom-color: rgb(238 242 255); | | border-b-indigo-100 | border-bottom-color: rgb(224 231 255); | | border-b-indigo-200 | border-bottom-color: rgb(199 210 254); | | border-b-indigo-300 | border-bottom-color: rgb(165 180 252); | | border-b-indigo-400 | border-bottom-color: rgb(129 140 248); | | border-b-indigo-500 | border-bottom-color: rgb(99 102 241); | | border-b-indigo-600 | border-bottom-color: rgb(79 70 229); | | border-b-indigo-700 | border-bottom-color: rgb(67 56 202); | | border-b-indigo-800 | border-bottom-color: rgb(55 48 163); | | border-b-indigo-900 | border-bottom-color: rgb(49 46 129); | | border-b-violet-50 | border-bottom-color: rgb(245 243 255); | | border-b-violet-100 | border-bottom-color: rgb(237 233 254); | | border-b-violet-200 | border-bottom-color: rgb(221 214 254); | | border-b-violet-300 | border-bottom-color: rgb(196 181 253); | | border-b-violet-400 | border-bottom-color: rgb(167 139 250); | | border-b-violet-500 | border-bottom-color: rgb(139 92 246); | | border-b-violet-600 | border-bottom-color: rgb(124 58 237); | | border-b-violet-700 | border-bottom-color: rgb(109 40 217); | | border-b-violet-800 | border-bottom-color: rgb(91 33 182); | | border-b-violet-900 | border-bottom-color: rgb(76 29 149); | | border-b-purple-50 | border-bottom-color: rgb(250 245 255); | | border-b-purple-100 | border-bottom-color: rgb(243 232 255); | | border-b-purple-200 | border-bottom-color: rgb(233 213 255); | | border-b-purple-300 | border-bottom-color: rgb(216 180 254); | | border-b-purple-400 | border-bottom-color: rgb(192 132 252); | | border-b-purple-500 | border-bottom-color: rgb(168 85 247); | | border-b-purple-600 | border-bottom-color: rgb(147 51 234); | | border-b-purple-700 | border-bottom-color: rgb(126 34 206); | | border-b-purple-800 | border-bottom-color: rgb(107 33 168); | | border-b-purple-900 | border-bottom-color: rgb(88 28 135); | | border-b-fuchsia-50 | border-bottom-color: rgb(253 244 255); | | border-b-fuchsia-100 | border-bottom-color: rgb(250 232 255); | | border-b-fuchsia-200 | border-bottom-color: rgb(245 208 254); | | border-b-fuchsia-300 | border-bottom-color: rgb(240 171 252); | | border-b-fuchsia-400 | border-bottom-color: rgb(232 121 249); | | border-b-fuchsia-500 | border-bottom-color: rgb(217 70 239); | | border-b-fuchsia-600 | border-bottom-color: rgb(192 38 211); | | border-b-fuchsia-700 | border-bottom-color: rgb(162 28 175); | | border-b-fuchsia-800 | border-bottom-color: rgb(134 25 143); | | border-b-fuchsia-900 | border-bottom-color: rgb(112 26 117); | | border-b-pink-50 | border-bottom-color: rgb(253 242 248); | | border-b-pink-100 | border-bottom-color: rgb(252 231 243); | | border-b-pink-200 | border-bottom-color: rgb(251 207 232); | | border-b-pink-300 | border-bottom-color: rgb(249 168 212); | | border-b-pink-400 | border-bottom-color: rgb(244 114 182); | | border-b-pink-500 | border-bottom-color: rgb(236 72 153); | | border-b-pink-600 | border-bottom-color: rgb(219 39 119); | | border-b-pink-700 | border-bottom-color: rgb(190 24 93); | | border-b-pink-800 | border-bottom-color: rgb(157 23 77); | | border-b-pink-900 | border-bottom-color: rgb(131 24 67); | | border-b-rose-50 | border-bottom-color: rgb(255 241 242); | | border-b-rose-100 | border-bottom-color: rgb(255 228 230); | | border-b-rose-200 | border-bottom-color: rgb(254 205 211); | | border-b-rose-300 | border-bottom-color: rgb(253 164 175); | | border-b-rose-400 | border-bottom-color: rgb(251 113 133); | | border-b-rose-500 | border-bottom-color: rgb(244 63 94); | | border-b-rose-600 | border-bottom-color: rgb(225 29 72); | | border-b-rose-700 | border-bottom-color: rgb(190 18 60); | | border-b-rose-800 | border-bottom-color: rgb(159 18 57); | | border-b-rose-900 | border-bottom-color: rgb(136 19 55); | | border-l-inherit | border-left-color: inherit; | | border-l-current | border-left-color: currentColor; | | border-l-transparent | border-left-color: transparent; | | border-l-black | border-left-color: rgb(0 0 0); | | border-l-white | border-left-color: rgb(255 255 255); | | border-l-slate-50 | border-left-color: rgb(248 250 252); | | border-l-slate-100 | border-left-color: rgb(241 245 249); | | border-l-slate-200 | border-left-color: rgb(226 232 240); | | border-l-slate-300 | border-left-color: rgb(203 213 225); | | border-l-slate-400 | border-left-color: rgb(148 163 184); | | border-l-slate-500 | border-left-color: rgb(100 116 139); | | border-l-slate-600 | border-left-color: rgb(71 85 105); | | border-l-slate-700 | border-left-color: rgb(51 65 85); | | border-l-slate-800 | border-left-color: rgb(30 41 59); | | border-l-slate-900 | border-left-color: rgb(15 23 42); | | border-l-gray-50 | border-left-color: rgb(249 250 251); | | border-l-gray-100 | border-left-color: rgb(243 244 246); | | border-l-gray-200 | border-left-color: rgb(229 231 235); | | border-l-gray-300 | border-left-color: rgb(209 213 219); | | border-l-gray-400 | border-left-color: rgb(156 163 175); | | border-l-gray-500 | border-left-color: rgb(107 114 128); | | border-l-gray-600 | border-left-color: rgb(75 85 99); | | border-l-gray-700 | border-left-color: rgb(55 65 81); | | border-l-gray-800 | border-left-color: rgb(31 41 55); | | border-l-gray-900 | border-left-color: rgb(17 24 39); | | border-l-zinc-50 | border-left-color: rgb(250 250 250); | | border-l-zinc-100 | border-left-color: rgb(244 244 245); | | border-l-zinc-200 | border-left-color: rgb(228 228 231); | | border-l-zinc-300 | border-left-color: rgb(212 212 216); | | border-l-zinc-400 | border-left-color: rgb(161 161 170); | | border-l-zinc-500 | border-left-color: rgb(113 113 122); | | border-l-zinc-600 | border-left-color: rgb(82 82 91); | | border-l-zinc-700 | border-left-color: rgb(63 63 70); | | border-l-zinc-800 | border-left-color: rgb(39 39 42); | | border-l-zinc-900 | border-left-color: rgb(24 24 27); | | border-l-neutral-50 | border-left-color: rgb(250 250 250); | | border-l-neutral-100 | border-left-color: rgb(245 245 245); | | border-l-neutral-200 | border-left-color: rgb(229 229 229); | | border-l-neutral-300 | border-left-color: rgb(212 212 212); | | border-l-neutral-400 | border-left-color: rgb(163 163 163); | | border-l-neutral-500 | border-left-color: rgb(115 115 115); | | border-l-neutral-600 | border-left-color: rgb(82 82 82); | | border-l-neutral-700 | border-left-color: rgb(64 64 64); | | border-l-neutral-800 | border-left-color: rgb(38 38 38); | | border-l-neutral-900 | border-left-color: rgb(23 23 23); | | border-l-stone-50 | border-left-color: rgb(250 250 249); | | border-l-stone-100 | border-left-color: rgb(245 245 244); | | border-l-stone-200 | border-left-color: rgb(231 229 228); | | border-l-stone-300 | border-left-color: rgb(214 211 209); | | border-l-stone-400 | border-left-color: rgb(168 162 158); | | border-l-stone-500 | border-left-color: rgb(120 113 108); | | border-l-stone-600 | border-left-color: rgb(87 83 78); | | border-l-stone-700 | border-left-color: rgb(68 64 60); | | border-l-stone-800 | border-left-color: rgb(41 37 36); | | border-l-stone-900 | border-left-color: rgb(28 25 23); | | border-l-red-50 | border-left-color: rgb(254 242 242); | | border-l-red-100 | border-left-color: rgb(254 226 226); | | border-l-red-200 | border-left-color: rgb(254 202 202); | | border-l-red-300 | border-left-color: rgb(252 165 165); | | border-l-red-400 | border-left-color: rgb(248 113 113); | | border-l-red-500 | border-left-color: rgb(239 68 68); | | border-l-red-600 | border-left-color: rgb(220 38 38); | | border-l-red-700 | border-left-color: rgb(185 28 28); | | border-l-red-800 | border-left-color: rgb(153 27 27); | | border-l-red-900 | border-left-color: rgb(127 29 29); | | border-l-orange-50 | border-left-color: rgb(255 247 237); | | border-l-orange-100 | border-left-color: rgb(255 237 213); | | border-l-orange-200 | border-left-color: rgb(254 215 170); | | border-l-orange-300 | border-left-color: rgb(253 186 116); | | border-l-orange-400 | border-left-color: rgb(251 146 60); | | border-l-orange-500 | border-left-color: rgb(249 115 22); | | border-l-orange-600 | border-left-color: rgb(234 88 12); | | border-l-orange-700 | border-left-color: rgb(194 65 12); | | border-l-orange-800 | border-left-color: rgb(154 52 18); | | border-l-orange-900 | border-left-color: rgb(124 45 18); | | border-l-amber-50 | border-left-color: rgb(255 251 235); | | border-l-amber-100 | border-left-color: rgb(254 243 199); | | border-l-amber-200 | border-left-color: rgb(253 230 138); | | border-l-amber-300 | border-left-color: rgb(252 211 77); | | border-l-amber-400 | border-left-color: rgb(251 191 36); | | border-l-amber-500 | border-left-color: rgb(245 158 11); | | border-l-amber-600 | border-left-color: rgb(217 119 6); | | border-l-amber-700 | border-left-color: rgb(180 83 9); | | border-l-amber-800 | border-left-color: rgb(146 64 14); | | border-l-amber-900 | border-left-color: rgb(120 53 15); | | border-l-yellow-50 | border-left-color: rgb(254 252 232); | | border-l-yellow-100 | border-left-color: rgb(254 249 195); | | border-l-yellow-200 | border-left-color: rgb(254 240 138); | | border-l-yellow-300 | border-left-color: rgb(253 224 71); | | border-l-yellow-400 | border-left-color: rgb(250 204 21); | | border-l-yellow-500 | border-left-color: rgb(234 179 8); | | border-l-yellow-600 | border-left-color: rgb(202 138 4); | | border-l-yellow-700 | border-left-color: rgb(161 98 7); | | border-l-yellow-800 | border-left-color: rgb(133 77 14); | | border-l-yellow-900 | border-left-color: rgb(113 63 18); | | border-l-lime-50 | border-left-color: rgb(247 254 231); | | border-l-lime-100 | border-left-color: rgb(236 252 203); | | border-l-lime-200 | border-left-color: rgb(217 249 157); | | border-l-lime-300 | border-left-color: rgb(190 242 100); | | border-l-lime-400 | border-left-color: rgb(163 230 53); | | border-l-lime-500 | border-left-color: rgb(132 204 22); | | border-l-lime-600 | border-left-color: rgb(101 163 13); | | border-l-lime-700 | border-left-color: rgb(77 124 15); | | border-l-lime-800 | border-left-color: rgb(63 98 18); | | border-l-lime-900 | border-left-color: rgb(54 83 20); | | border-l-green-50 | border-left-color: rgb(240 253 244); | | border-l-green-100 | border-left-color: rgb(220 252 231); | | border-l-green-200 | border-left-color: rgb(187 247 208); | | border-l-green-300 | border-left-color: rgb(134 239 172); | | border-l-green-400 | border-left-color: rgb(74 222 128); | | border-l-green-500 | border-left-color: rgb(34 197 94); | | border-l-green-600 | border-left-color: rgb(22 163 74); | | border-l-green-700 | border-left-color: rgb(21 128 61); | | border-l-green-800 | border-left-color: rgb(22 101 52); | | border-l-green-900 | border-left-color: rgb(20 83 45); | | border-l-emerald-50 | border-left-color: rgb(236 253 245); | | border-l-emerald-100 | border-left-color: rgb(209 250 229); | | border-l-emerald-200 | border-left-color: rgb(167 243 208); | | border-l-emerald-300 | border-left-color: rgb(110 231 183); | | border-l-emerald-400 | border-left-color: rgb(52 211 153); | | border-l-emerald-500 | border-left-color: rgb(16 185 129); | | border-l-emerald-600 | border-left-color: rgb(5 150 105); | | border-l-emerald-700 | border-left-color: rgb(4 120 87); | | border-l-emerald-800 | border-left-color: rgb(6 95 70); | | border-l-emerald-900 | border-left-color: rgb(6 78 59); | | border-l-teal-50 | border-left-color: rgb(240 253 250); | | border-l-teal-100 | border-left-color: rgb(204 251 241); | | border-l-teal-200 | border-left-color: rgb(153 246 228); | | border-l-teal-300 | border-left-color: rgb(94 234 212); | | border-l-teal-400 | border-left-color: rgb(45 212 191); | | border-l-teal-500 | border-left-color: rgb(20 184 166); | | border-l-teal-600 | border-left-color: rgb(13 148 136); | | border-l-teal-700 | border-left-color: rgb(15 118 110); | | border-l-teal-800 | border-left-color: rgb(17 94 89); | | border-l-teal-900 | border-left-color: rgb(19 78 74); | | border-l-cyan-50 | border-left-color: rgb(236 254 255); | | border-l-cyan-100 | border-left-color: rgb(207 250 254); | | border-l-cyan-200 | border-left-color: rgb(165 243 252); | | border-l-cyan-300 | border-left-color: rgb(103 232 249); | | border-l-cyan-400 | border-left-color: rgb(34 211 238); | | border-l-cyan-500 | border-left-color: rgb(6 182 212); | | border-l-cyan-600 | border-left-color: rgb(8 145 178); | | border-l-cyan-700 | border-left-color: rgb(14 116 144); | | border-l-cyan-800 | border-left-color: rgb(21 94 117); | | border-l-cyan-900 | border-left-color: rgb(22 78 99); | | border-l-sky-50 | border-left-color: rgb(240 249 255); | | border-l-sky-100 | border-left-color: rgb(224 242 254); | | border-l-sky-200 | border-left-color: rgb(186 230 253); | | border-l-sky-300 | border-left-color: rgb(125 211 252); | | border-l-sky-400 | border-left-color: rgb(56 189 248); | | border-l-sky-500 | border-left-color: rgb(14 165 233); | | border-l-sky-600 | border-left-color: rgb(2 132 199); | | border-l-sky-700 | border-left-color: rgb(3 105 161); | | border-l-sky-800 | border-left-color: rgb(7 89 133); | | border-l-sky-900 | border-left-color: rgb(12 74 110); | | border-l-blue-50 | border-left-color: rgb(239 246 255); | | border-l-blue-100 | border-left-color: rgb(219 234 254); | | border-l-blue-200 | border-left-color: rgb(191 219 254); | | border-l-blue-300 | border-left-color: rgb(147 197 253); | | border-l-blue-400 | border-left-color: rgb(96 165 250); | | border-l-blue-500 | border-left-color: rgb(59 130 246); | | border-l-blue-600 | border-left-color: rgb(37 99 235); | | border-l-blue-700 | border-left-color: rgb(29 78 216); | | border-l-blue-800 | border-left-color: rgb(30 64 175); | | border-l-blue-900 | border-left-color: rgb(30 58 138); | | border-l-indigo-50 | border-left-color: rgb(238 242 255); | | border-l-indigo-100 | border-left-color: rgb(224 231 255); | | border-l-indigo-200 | border-left-color: rgb(199 210 254); | | border-l-indigo-300 | border-left-color: rgb(165 180 252); | | border-l-indigo-400 | border-left-color: rgb(129 140 248); | | border-l-indigo-500 | border-left-color: rgb(99 102 241); | | border-l-indigo-600 | border-left-color: rgb(79 70 229); | | border-l-indigo-700 | border-left-color: rgb(67 56 202); | | border-l-indigo-800 | border-left-color: rgb(55 48 163); | | border-l-indigo-900 | border-left-color: rgb(49 46 129); | | border-l-violet-50 | border-left-color: rgb(245 243 255); | | border-l-violet-100 | border-left-color: rgb(237 233 254); | | border-l-violet-200 | border-left-color: rgb(221 214 254); | | border-l-violet-300 | border-left-color: rgb(196 181 253); | | border-l-violet-400 | border-left-color: rgb(167 139 250); | | border-l-violet-500 | border-left-color: rgb(139 92 246); | | border-l-violet-600 | border-left-color: rgb(124 58 237); | | border-l-violet-700 | border-left-color: rgb(109 40 217); | | border-l-violet-800 | border-left-color: rgb(91 33 182); | | border-l-violet-900 | border-left-color: rgb(76 29 149); | | border-l-purple-50 | border-left-color: rgb(250 245 255); | | border-l-purple-100 | border-left-color: rgb(243 232 255); | | border-l-purple-200 | border-left-color: rgb(233 213 255); | | border-l-purple-300 | border-left-color: rgb(216 180 254); | | border-l-purple-400 | border-left-color: rgb(192 132 252); | | border-l-purple-500 | border-left-color: rgb(168 85 247); | | border-l-purple-600 | border-left-color: rgb(147 51 234); | | border-l-purple-700 | border-left-color: rgb(126 34 206); | | border-l-purple-800 | border-left-color: rgb(107 33 168); | | border-l-purple-900 | border-left-color: rgb(88 28 135); | | border-l-fuchsia-50 | border-left-color: rgb(253 244 255); | | border-l-fuchsia-100 | border-left-color: rgb(250 232 255); | | border-l-fuchsia-200 | border-left-color: rgb(245 208 254); | | border-l-fuchsia-300 | border-left-color: rgb(240 171 252); | | border-l-fuchsia-400 | border-left-color: rgb(232 121 249); | | border-l-fuchsia-500 | border-left-color: rgb(217 70 239); | | border-l-fuchsia-600 | border-left-color: rgb(192 38 211); | | border-l-fuchsia-700 | border-left-color: rgb(162 28 175); | | border-l-fuchsia-800 | border-left-color: rgb(134 25 143); | | border-l-fuchsia-900 | border-left-color: rgb(112 26 117); | | border-l-pink-50 | border-left-color: rgb(253 242 248); | | border-l-pink-100 | border-left-color: rgb(252 231 243); | | border-l-pink-200 | border-left-color: rgb(251 207 232); | | border-l-pink-300 | border-left-color: rgb(249 168 212); | | border-l-pink-400 | border-left-color: rgb(244 114 182); | | border-l-pink-500 | border-left-color: rgb(236 72 153); | | border-l-pink-600 | border-left-color: rgb(219 39 119); | | border-l-pink-700 | border-left-color: rgb(190 24 93); | | border-l-pink-800 | border-left-color: rgb(157 23 77); | | border-l-pink-900 | border-left-color: rgb(131 24 67); | | border-l-rose-50 | border-left-color: rgb(255 241 242); | | border-l-rose-100 | border-left-color: rgb(255 228 230); | | border-l-rose-200 | border-left-color: rgb(254 205 211); | | border-l-rose-300 | border-left-color: rgb(253 164 175); | | border-l-rose-400 | border-left-color: rgb(251 113 133); | | border-l-rose-500 | border-left-color: rgb(244 63 94); | | border-l-rose-600 | border-left-color: rgb(225 29 72); | | border-l-rose-700 | border-left-color: rgb(190 18 60); | | border-l-rose-800 | border-left-color: rgb(159 18 57); | | border-l-rose-900 | border-left-color: rgb(136 19 55); | Basic usage ----------- ### Setting the border color Control the border color of an element using the `border-{color}` utilities. ``` <input class="border-2 border-rose-600 ..."><input class="border-2 border-rose-500 ..."> ``` ### Changing the opacity Control the opacity of an element’s border color using the color opacity modifier. ``` <div class="border-4 border-indigo-500/100 ..."></div> <div class="border-4 border-indigo-500/75 ..."></div> <div class="border-4 border-indigo-500/50 ..."></div> ``` You can use any value defined in your [opacity scale](opacity), or use arbitrary values if you need to deviate from your design tokens. ``` <div class="border-4 border-indigo-600/[.55] ..."></div> ``` ### Individual sides Use the `border-{side}-{color}` utilities to set the border color for one side of an element. ``` <div class="border-4 border-indigo-200 border-t-indigo-500 ..."></div> <div class="border-4 border-indigo-200 border-r-indigo-500 ..."></div> <div class="border-4 border-indigo-200 border-b-indigo-500 ..."></div> <div class="border-4 border-indigo-200 border-l-indigo-500 ..."></div> ``` ### Horizontal and vertical sides Use the `border-{x|y}-{color}` utilities to set the border color on two sides of an element at the same time. ``` <div class="border-4 border-indigo-200 border-x-indigo-500 ..."></div> <div class="border-4 border-indigo-200 border-y-indigo-500 ..."></div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:border-gray-500` to only apply the `border-gray-500` utility on hover. ``` <button class="border border-slate-300 hover:border-indigo-300 ..."> Send email </button><button class="border border-slate-300 hover:border-slate-400 ..."> Send email </button> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:border-green-500` to apply the `border-green-500` utility at only medium screen sizes and above. ``` <button class="border-blue-500 md:border-green-500"> <!-- ... --> </button> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind makes the entire [default color palette](customizing-colors#default-color-palette) available as border colors. You can [customize your color palette](/docs/customizing-colors#customizing) by editing `theme.colors` or `theme.extend.colors` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { colors: { 'regal-blue': '#243c5a', }, } } } ``` Alternatively, you can customize just your border colors by editing `theme.borderColor` or `theme.extend.borderColor` in your `tailwind.config.js` file. Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `border-color` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <button class="border-[#243c5a]"> <!-- ... --> </button> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation.
programming_docs
tailwindcss Border Width Quick reference --------------- | Class | Properties | | --- | --- | | border-0 | border-width: 0px; | | border-2 | border-width: 2px; | | border-4 | border-width: 4px; | | border-8 | border-width: 8px; | | border | border-width: 1px; | | border-x-0 | border-left-width: 0px; border-right-width: 0px; | | border-x-2 | border-left-width: 2px; border-right-width: 2px; | | border-x-4 | border-left-width: 4px; border-right-width: 4px; | | border-x-8 | border-left-width: 8px; border-right-width: 8px; | | border-x | border-left-width: 1px; border-right-width: 1px; | | border-y-0 | border-top-width: 0px; border-bottom-width: 0px; | | border-y-2 | border-top-width: 2px; border-bottom-width: 2px; | | border-y-4 | border-top-width: 4px; border-bottom-width: 4px; | | border-y-8 | border-top-width: 8px; border-bottom-width: 8px; | | border-y | border-top-width: 1px; border-bottom-width: 1px; | | border-t-0 | border-top-width: 0px; | | border-t-2 | border-top-width: 2px; | | border-t-4 | border-top-width: 4px; | | border-t-8 | border-top-width: 8px; | | border-t | border-top-width: 1px; | | border-r-0 | border-right-width: 0px; | | border-r-2 | border-right-width: 2px; | | border-r-4 | border-right-width: 4px; | | border-r-8 | border-right-width: 8px; | | border-r | border-right-width: 1px; | | border-b-0 | border-bottom-width: 0px; | | border-b-2 | border-bottom-width: 2px; | | border-b-4 | border-bottom-width: 4px; | | border-b-8 | border-bottom-width: 8px; | | border-b | border-bottom-width: 1px; | | border-l-0 | border-left-width: 0px; | | border-l-2 | border-left-width: 2px; | | border-l-4 | border-left-width: 4px; | | border-l-8 | border-left-width: 8px; | | border-l | border-left-width: 1px; | Basic usage ----------- ### All sides Use the `border`, `border-0`, `border-2`, `border-4`, or `border-8` utilities to set the border width for all sides of an element. ``` <div class="border border-indigo-600 ..."></div> <div class="border-2 border-indigo-600 ..."></div> <div class="border-4 border-indigo-600 ..."></div> <div class="border-8 border-indigo-600 ..."></div><div class="border border-sky-500"></div> <div class="border-2 border-sky-500"></div> <div class="border-4 border-sky-500"></div> <div class="border-8 border-sky-500"></div> ``` ### Individual sides Use the `border-{side}`, `border-{side}-0`, `border-{side}-2`, `border-{side}-4`, or `border-{side}-8` utilities to set the border width for one side of an element. ``` <div class="border-t-4 border-indigo-500 ..."></div> <div class="border-r-4 border-indigo-500 ..."></div> <div class="border-b-4 border-indigo-500 ..."></div> <div class="border-l-4 border-indigo-500 ..."></div> ``` ### Horizontal and vertical sides Use the `border-{x|y}-{width}` utilities to set the border width on two sides of an element at the same time. ``` <div class="border-x-4 border-indigo-500 ..."></div> <div class="border-y-4 border-indigo-500 ..."></div> ``` ### Between elements You can also add borders between child elements using the `divide-{x/y}-{width}` and `divide-{color}` utilities. ``` <div class="divide-y divide-slate-200 ..."> <div>01</div> <div>02</div> <div>03</div> </div><div class="divide-y divide-slate-700 ..."> <div>01</div> <div>02</div> <div>03</div> </div> ``` Learn more in the [Divide Width](divide-width) and [Divide Color](divide-color) documentation. Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:border-t-4` to only apply the `border-t-4` utility on hover. ``` <div class="border-2 hover:border-t-4"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:border-t-4` to apply the `border-t-4` utility at only medium screen sizes and above. ``` <div class="border-2 md:border-t-4"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind provides five `border-width` utilities, and the same number of utilities per side (horizontal, vertical, top, right, bottom, and left). You change, add, or remove these by editing the `theme.borderWidth` section of your Tailwind config. tailwind.config.js ``` module.exports = { theme: { borderWidth: { DEFAULT: '1px', '0': '0', '2': '2px', '3': '3px', '4': '4px', '6': '6px', '8': '8px', } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `border-{side}-{width}` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="border-t-[3px]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Fill Quick reference --------------- | Class | Properties | | --- | --- | | fill-inherit | fill: inherit; | | fill-current | fill: currentColor; | | fill-transparent | fill: transparent; | | fill-black | fill: #000; | | fill-white | fill: #fff; | | fill-slate-50 | fill: #f8fafc; | | fill-slate-100 | fill: #f1f5f9; | | fill-slate-200 | fill: #e2e8f0; | | fill-slate-300 | fill: #cbd5e1; | | fill-slate-400 | fill: #94a3b8; | | fill-slate-500 | fill: #64748b; | | fill-slate-600 | fill: #475569; | | fill-slate-700 | fill: #334155; | | fill-slate-800 | fill: #1e293b; | | fill-slate-900 | fill: #0f172a; | | fill-gray-50 | fill: #f9fafb; | | fill-gray-100 | fill: #f3f4f6; | | fill-gray-200 | fill: #e5e7eb; | | fill-gray-300 | fill: #d1d5db; | | fill-gray-400 | fill: #9ca3af; | | fill-gray-500 | fill: #6b7280; | | fill-gray-600 | fill: #4b5563; | | fill-gray-700 | fill: #374151; | | fill-gray-800 | fill: #1f2937; | | fill-gray-900 | fill: #111827; | | fill-zinc-50 | fill: #fafafa; | | fill-zinc-100 | fill: #f4f4f5; | | fill-zinc-200 | fill: #e4e4e7; | | fill-zinc-300 | fill: #d4d4d8; | | fill-zinc-400 | fill: #a1a1aa; | | fill-zinc-500 | fill: #71717a; | | fill-zinc-600 | fill: #52525b; | | fill-zinc-700 | fill: #3f3f46; | | fill-zinc-800 | fill: #27272a; | | fill-zinc-900 | fill: #18181b; | | fill-neutral-50 | fill: #fafafa; | | fill-neutral-100 | fill: #f5f5f5; | | fill-neutral-200 | fill: #e5e5e5; | | fill-neutral-300 | fill: #d4d4d4; | | fill-neutral-400 | fill: #a3a3a3; | | fill-neutral-500 | fill: #737373; | | fill-neutral-600 | fill: #525252; | | fill-neutral-700 | fill: #404040; | | fill-neutral-800 | fill: #262626; | | fill-neutral-900 | fill: #171717; | | fill-stone-50 | fill: #fafaf9; | | fill-stone-100 | fill: #f5f5f4; | | fill-stone-200 | fill: #e7e5e4; | | fill-stone-300 | fill: #d6d3d1; | | fill-stone-400 | fill: #a8a29e; | | fill-stone-500 | fill: #78716c; | | fill-stone-600 | fill: #57534e; | | fill-stone-700 | fill: #44403c; | | fill-stone-800 | fill: #292524; | | fill-stone-900 | fill: #1c1917; | | fill-red-50 | fill: #fef2f2; | | fill-red-100 | fill: #fee2e2; | | fill-red-200 | fill: #fecaca; | | fill-red-300 | fill: #fca5a5; | | fill-red-400 | fill: #f87171; | | fill-red-500 | fill: #ef4444; | | fill-red-600 | fill: #dc2626; | | fill-red-700 | fill: #b91c1c; | | fill-red-800 | fill: #991b1b; | | fill-red-900 | fill: #7f1d1d; | | fill-orange-50 | fill: #fff7ed; | | fill-orange-100 | fill: #ffedd5; | | fill-orange-200 | fill: #fed7aa; | | fill-orange-300 | fill: #fdba74; | | fill-orange-400 | fill: #fb923c; | | fill-orange-500 | fill: #f97316; | | fill-orange-600 | fill: #ea580c; | | fill-orange-700 | fill: #c2410c; | | fill-orange-800 | fill: #9a3412; | | fill-orange-900 | fill: #7c2d12; | | fill-amber-50 | fill: #fffbeb; | | fill-amber-100 | fill: #fef3c7; | | fill-amber-200 | fill: #fde68a; | | fill-amber-300 | fill: #fcd34d; | | fill-amber-400 | fill: #fbbf24; | | fill-amber-500 | fill: #f59e0b; | | fill-amber-600 | fill: #d97706; | | fill-amber-700 | fill: #b45309; | | fill-amber-800 | fill: #92400e; | | fill-amber-900 | fill: #78350f; | | fill-yellow-50 | fill: #fefce8; | | fill-yellow-100 | fill: #fef9c3; | | fill-yellow-200 | fill: #fef08a; | | fill-yellow-300 | fill: #fde047; | | fill-yellow-400 | fill: #facc15; | | fill-yellow-500 | fill: #eab308; | | fill-yellow-600 | fill: #ca8a04; | | fill-yellow-700 | fill: #a16207; | | fill-yellow-800 | fill: #854d0e; | | fill-yellow-900 | fill: #713f12; | | fill-lime-50 | fill: #f7fee7; | | fill-lime-100 | fill: #ecfccb; | | fill-lime-200 | fill: #d9f99d; | | fill-lime-300 | fill: #bef264; | | fill-lime-400 | fill: #a3e635; | | fill-lime-500 | fill: #84cc16; | | fill-lime-600 | fill: #65a30d; | | fill-lime-700 | fill: #4d7c0f; | | fill-lime-800 | fill: #3f6212; | | fill-lime-900 | fill: #365314; | | fill-green-50 | fill: #f0fdf4; | | fill-green-100 | fill: #dcfce7; | | fill-green-200 | fill: #bbf7d0; | | fill-green-300 | fill: #86efac; | | fill-green-400 | fill: #4ade80; | | fill-green-500 | fill: #22c55e; | | fill-green-600 | fill: #16a34a; | | fill-green-700 | fill: #15803d; | | fill-green-800 | fill: #166534; | | fill-green-900 | fill: #14532d; | | fill-emerald-50 | fill: #ecfdf5; | | fill-emerald-100 | fill: #d1fae5; | | fill-emerald-200 | fill: #a7f3d0; | | fill-emerald-300 | fill: #6ee7b7; | | fill-emerald-400 | fill: #34d399; | | fill-emerald-500 | fill: #10b981; | | fill-emerald-600 | fill: #059669; | | fill-emerald-700 | fill: #047857; | | fill-emerald-800 | fill: #065f46; | | fill-emerald-900 | fill: #064e3b; | | fill-teal-50 | fill: #f0fdfa; | | fill-teal-100 | fill: #ccfbf1; | | fill-teal-200 | fill: #99f6e4; | | fill-teal-300 | fill: #5eead4; | | fill-teal-400 | fill: #2dd4bf; | | fill-teal-500 | fill: #14b8a6; | | fill-teal-600 | fill: #0d9488; | | fill-teal-700 | fill: #0f766e; | | fill-teal-800 | fill: #115e59; | | fill-teal-900 | fill: #134e4a; | | fill-cyan-50 | fill: #ecfeff; | | fill-cyan-100 | fill: #cffafe; | | fill-cyan-200 | fill: #a5f3fc; | | fill-cyan-300 | fill: #67e8f9; | | fill-cyan-400 | fill: #22d3ee; | | fill-cyan-500 | fill: #06b6d4; | | fill-cyan-600 | fill: #0891b2; | | fill-cyan-700 | fill: #0e7490; | | fill-cyan-800 | fill: #155e75; | | fill-cyan-900 | fill: #164e63; | | fill-sky-50 | fill: #f0f9ff; | | fill-sky-100 | fill: #e0f2fe; | | fill-sky-200 | fill: #bae6fd; | | fill-sky-300 | fill: #7dd3fc; | | fill-sky-400 | fill: #38bdf8; | | fill-sky-500 | fill: #0ea5e9; | | fill-sky-600 | fill: #0284c7; | | fill-sky-700 | fill: #0369a1; | | fill-sky-800 | fill: #075985; | | fill-sky-900 | fill: #0c4a6e; | | fill-blue-50 | fill: #eff6ff; | | fill-blue-100 | fill: #dbeafe; | | fill-blue-200 | fill: #bfdbfe; | | fill-blue-300 | fill: #93c5fd; | | fill-blue-400 | fill: #60a5fa; | | fill-blue-500 | fill: #3b82f6; | | fill-blue-600 | fill: #2563eb; | | fill-blue-700 | fill: #1d4ed8; | | fill-blue-800 | fill: #1e40af; | | fill-blue-900 | fill: #1e3a8a; | | fill-indigo-50 | fill: #eef2ff; | | fill-indigo-100 | fill: #e0e7ff; | | fill-indigo-200 | fill: #c7d2fe; | | fill-indigo-300 | fill: #a5b4fc; | | fill-indigo-400 | fill: #818cf8; | | fill-indigo-500 | fill: #6366f1; | | fill-indigo-600 | fill: #4f46e5; | | fill-indigo-700 | fill: #4338ca; | | fill-indigo-800 | fill: #3730a3; | | fill-indigo-900 | fill: #312e81; | | fill-violet-50 | fill: #f5f3ff; | | fill-violet-100 | fill: #ede9fe; | | fill-violet-200 | fill: #ddd6fe; | | fill-violet-300 | fill: #c4b5fd; | | fill-violet-400 | fill: #a78bfa; | | fill-violet-500 | fill: #8b5cf6; | | fill-violet-600 | fill: #7c3aed; | | fill-violet-700 | fill: #6d28d9; | | fill-violet-800 | fill: #5b21b6; | | fill-violet-900 | fill: #4c1d95; | | fill-purple-50 | fill: #faf5ff; | | fill-purple-100 | fill: #f3e8ff; | | fill-purple-200 | fill: #e9d5ff; | | fill-purple-300 | fill: #d8b4fe; | | fill-purple-400 | fill: #c084fc; | | fill-purple-500 | fill: #a855f7; | | fill-purple-600 | fill: #9333ea; | | fill-purple-700 | fill: #7e22ce; | | fill-purple-800 | fill: #6b21a8; | | fill-purple-900 | fill: #581c87; | | fill-fuchsia-50 | fill: #fdf4ff; | | fill-fuchsia-100 | fill: #fae8ff; | | fill-fuchsia-200 | fill: #f5d0fe; | | fill-fuchsia-300 | fill: #f0abfc; | | fill-fuchsia-400 | fill: #e879f9; | | fill-fuchsia-500 | fill: #d946ef; | | fill-fuchsia-600 | fill: #c026d3; | | fill-fuchsia-700 | fill: #a21caf; | | fill-fuchsia-800 | fill: #86198f; | | fill-fuchsia-900 | fill: #701a75; | | fill-pink-50 | fill: #fdf2f8; | | fill-pink-100 | fill: #fce7f3; | | fill-pink-200 | fill: #fbcfe8; | | fill-pink-300 | fill: #f9a8d4; | | fill-pink-400 | fill: #f472b6; | | fill-pink-500 | fill: #ec4899; | | fill-pink-600 | fill: #db2777; | | fill-pink-700 | fill: #be185d; | | fill-pink-800 | fill: #9d174d; | | fill-pink-900 | fill: #831843; | | fill-rose-50 | fill: #fff1f2; | | fill-rose-100 | fill: #ffe4e6; | | fill-rose-200 | fill: #fecdd3; | | fill-rose-300 | fill: #fda4af; | | fill-rose-400 | fill: #fb7185; | | fill-rose-500 | fill: #f43f5e; | | fill-rose-600 | fill: #e11d48; | | fill-rose-700 | fill: #be123c; | | fill-rose-800 | fill: #9f1239; | | fill-rose-900 | fill: #881337; | Basic usage ----------- ### Setting the fill color Use the `fill-{color}` utilities to change the fill color of an SVG. ``` <svg class="fill-blue-500 ..."> <!-- ... --> </svg> ``` This can be useful for styling icon sets like [Heroicons](https://heroicons.com). Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:fill-cyan-700` to only apply the `fill-cyan-700` utility on hover. ``` <svg class="fill-cyan-500 hover:fill-cyan-700"> <!-- ... --> </svg> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:fill-cyan-700` to apply the `fill-cyan-700` utility at only medium screen sizes and above. ``` <svg class="fill-cyan-500 md:fill-cyan-700"> <!-- ... --> </svg> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind makes the entire [default color palette](customizing-colors#default-color-palette) available as fill colors. You can [customize your color palette](/docs/customizing-colors#customizing) by editing `theme.colors` or `theme.extend.colors` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { colors: { 'regal-blue': '#243c5a', }, } } } ``` Alternatively, you can customize just your fill colors by editing `theme.fill` or `theme.extend.fill` in your `tailwind.config.js` file. Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `fill` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <svg class="fill-[#243c5a]"> <!-- ... --> </svg> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Vertical Align Quick reference --------------- | Class | Properties | | --- | --- | | align-baseline | vertical-align: baseline; | | align-top | vertical-align: top; | | align-middle | vertical-align: middle; | | align-bottom | vertical-align: bottom; | | align-text-top | vertical-align: text-top; | | align-text-bottom | vertical-align: text-bottom; | | align-sub | vertical-align: sub; | | align-super | vertical-align: super; | Basic usage ----------- ### Baseline Use `align-baseline` to align the baseline of an element with the baseline of its parent. ``` <span class="inline-block align-baseline ...">...</span> ``` ### Top Use `align-top` to align the top of an element and its descendants with the top of the entire line. ``` <span class="inline-block align-top ...">...</span> ``` ### Middle Use `align-middle` to align the middle of an element with the baseline plus half the x-height of the parent. ``` <span class="inline-block align-middle ...">...</span> ``` ### Bottom Use `align-bottom` to align the bottom of an element and its descendants with the bottom of the entire line. ``` <span class="inline-block align-bottom ...">...</span> ``` ### Text Top Use `align-text-top` to align the top of an element with the top of the parent element’s font. ``` <span class="inline-block align-text-top ...">...</span> ``` ### Text Bottom Use `align-text-bottom` to align the bottom of an element with the bottom of the parent element’s font. ``` <span class="inline-block align-text-bottom ...">...</span> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:align-top` to only apply the `align-top` utility on hover. ``` <p class="align-middle hover:align-top"> <!-- ... --> </p> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:align-top` to apply the `align-top` utility at only medium screen sizes and above. ``` <p class="align-middle md:align-top"> <!-- ... --> </p> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Arbitrary values If you need to use a one-off `vertical-align` value that isn't included in Tailwind by default, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="align-[4px]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Font Weight Quick reference --------------- | Class | Properties | | --- | --- | | font-thin | font-weight: 100; | | font-extralight | font-weight: 200; | | font-light | font-weight: 300; | | font-normal | font-weight: 400; | | font-medium | font-weight: 500; | | font-semibold | font-weight: 600; | | font-bold | font-weight: 700; | | font-extrabold | font-weight: 800; | | font-black | font-weight: 900; | Basic usage ----------- ### Setting the font weight Control the font weight of an element using the `font-{weight}` utilities. ``` <p class="font-light ...">The quick brown fox ...</p> <p class="font-normal ...">The quick brown fox ...</p> <p class="font-medium ...">The quick brown fox ...</p> <p class="font-semibold ...">The quick brown fox ...</p> <p class="font-bold ...">The quick brown fox ...</p> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:font-bold` to only apply the `font-bold` utility on hover. ``` <p class="font-normal hover:font-bold"> <!-- ... --> </p> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:font-bold` to apply the `font-bold` utility at only medium screen sizes and above. ``` <p class="font-normal md:font-bold"> <!-- ... --> </p> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind provides nine `font-weight` utilities. You change, add, or remove these by editing the `theme.fontWeight` section of your Tailwind config. tailwind.config.js ``` module.exports = { theme: { fontWeight: { hairline: 100, 'extra-light': 100, thin: 200, light: 300, normal: 400, medium: 500, semibold: 600, bold: 700, extrabold: 800, 'extra-bold': 800, black: 900, } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `font-weight` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <p class="font-[1100]"> <!-- ... --> </p> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation.
programming_docs
tailwindcss Grid Template Rows Quick reference --------------- | Class | Properties | | --- | --- | | grid-rows-1 | grid-template-rows: repeat(1, minmax(0, 1fr)); | | grid-rows-2 | grid-template-rows: repeat(2, minmax(0, 1fr)); | | grid-rows-3 | grid-template-rows: repeat(3, minmax(0, 1fr)); | | grid-rows-4 | grid-template-rows: repeat(4, minmax(0, 1fr)); | | grid-rows-5 | grid-template-rows: repeat(5, minmax(0, 1fr)); | | grid-rows-6 | grid-template-rows: repeat(6, minmax(0, 1fr)); | | grid-rows-none | grid-template-rows: none; | Basic usage ----------- ### Specifying the rows in a grid Use the `grid-rows-{n}` utilities to create grids with *n* equally sized rows. ``` <div class="grid grid-rows-4 grid-flow-col gap-4"> <div>01</div> <!-- ... --> <div>09</div> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:grid-rows-6` to only apply the `grid-rows-6` utility on hover. ``` <div class="grid grid-rows-2 hover:grid-rows-6"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:grid-rows-6` to apply the `grid-rows-6` utility at only medium screen sizes and above. ``` <div class="grid grid-rows-2 md:grid-rows-6"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind includes `grid-template-row` utilities for creating basic grids with up to 6 equal width rows. You can customize these values by editing `theme.gridTemplateRows` or `theme.extend.gridTemplateRows` in your `tailwind.config.js` file. You have direct access to the `grid-template-rows` CSS property here so you can make your custom rows values as generic or as complicated and site-specific as you like. tailwind.config.js ``` module.exports = { theme: { extend: { gridTemplateRows: { // Simple 8 row grid '8': 'repeat(8, minmax(0, 1fr))', // Complex site-specific row configuration 'layout': '200px minmax(900px, 1fr) 100px', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `grid-template-rows` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="grid grid-rows-[200px_minmax(900px,_1fr)_100px]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss List Style Position Quick reference --------------- | Class | Properties | | --- | --- | | list-inside | list-style-position: inside; | | list-outside | list-style-position: outside; | Basic usage ----------- ### Setting the list style position Control the position of the markers and text indentation in a list using the `list-inside` and `list-outside` utilities. ``` <ul class="list-inside ..."> <li>5 cups chopped Porcini mushrooms</li> <!-- ... --> </ul> <ul class="list-outside ..."> <li>5 cups chopped Porcini mushrooms</li> <!-- ... --> </ul> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:list-inside` to only apply the `list-inside` utility on hover. ``` <ul class="list-outside hover:list-inside"> <!-- ... --> </ul> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:list-inside` to apply the `list-inside` utility at only medium screen sizes and above. ``` <ul class="list-outside md:list-inside"> <!-- ... --> </ul> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Backdrop Sepia Quick reference --------------- | Class | Properties | | --- | --- | | backdrop-sepia-0 | backdrop-filter: sepia(0); | | backdrop-sepia | backdrop-filter: sepia(100%); | Basic usage ----------- ### Adding backdrop sepia filters Use the `backdrop-sepia` and `backdrop-sepia-0` utilities to control whether an element’s backdrop should be rendered as sepia or in full color. ``` <div class="backdrop-sepia-0 bg-white/30 ..."> <!-- ... --> </div> <div class="backdrop-sepia bg-white/30 ..."> <!-- ... --> </div> ``` ### Removing backdrop filters To remove all of the backdrop filters on an element at once, use the `backdrop-filter-none` utility: ``` <div class="backdrop-blur-md backdrop-sepia md:backdrop-filter-none"> <!-- ... --> </div> ``` This can be useful when you want to remove backdrop filters conditionally, such as on hover or at a particular breakpoint. Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:backdrop-sepia-0` to only apply the `backdrop-sepia-0` utility on hover. ``` <div class="backdrop-sepia hover:backdrop-sepia-0"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:backdrop-sepia-0` to apply the `backdrop-sepia-0` utility at only medium screen sizes and above. ``` <div class="backdrop-sepia md:backdrop-sepia-0"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind includes a handful of general purpose `backdrop-sepia` utilities. You can customize these values by editing `theme.backdropSepia` or `theme.extend.backdropSepia` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { backdropSepia: { 25: '.25', 75: '.75', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `backdrop-sepia` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="backdrop-sepia-[.25]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Backdrop Invert Quick reference --------------- | Class | Properties | | --- | --- | | backdrop-invert-0 | backdrop-filter: invert(0); | | backdrop-invert | backdrop-filter: invert(100%); | Basic usage ----------- ### Inverting an element's backdrop Use the `backdrop-invert` and `backdrop-invert-0` utilities to control whether an element should be rendered with inverted backdrop colors or normally. ``` <div class="backdrop-invert-0 bg-white/30 ..."> <!-- ... --> </div> <div class="backdrop-invert bg-white/30 ..."> <!-- ... --> </div> ``` ### Removing backdrop filters To remove all of the backdrop filters on an element at once, use the `backdrop-filter-none` utility: ``` <div class="backdrop-blur-md backdrop-invert md:backdrop-filter-none"> <!-- ... --> </div> ``` This can be useful when you want to remove backdrop filters conditionally, such as on hover or at a particular breakpoint. Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:backdrop-invert-0` to only apply the `backdrop-invert-0` utility on hover. ``` <div class="backdrop-invert hover:backdrop-invert-0"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:backdrop-invert-0` to apply the `backdrop-invert-0` utility at only medium screen sizes and above. ``` <div class="backdrop-invert md:backdrop-invert-0"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind includes a handful of general purpose `backdrop-invert` utilities. You can customize these values by editing `theme.backdropInvert` or `theme.extend.backdropInvert` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { backdropInvert: { 25: '.25', 75: '.75', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `backdrop-invert` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="backdrop-invert-[.25]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Order Quick reference --------------- | Class | Properties | | --- | --- | | order-1 | order: 1; | | order-2 | order: 2; | | order-3 | order: 3; | | order-4 | order: 4; | | order-5 | order: 5; | | order-6 | order: 6; | | order-7 | order: 7; | | order-8 | order: 8; | | order-9 | order: 9; | | order-10 | order: 10; | | order-11 | order: 11; | | order-12 | order: 12; | | order-first | order: -9999; | | order-last | order: 9999; | | order-none | order: 0; | Basic usage ----------- ### Ordering flex and grid items Use `order-{order}` to render flex and grid items in a different order than they appear in the DOM. ``` <div class="flex justify-between ..."> <div class="order-last">01</div> <div>02</div> <div>03</div> </div> ``` ### Using negative values To use a negative order value, prefix the class name with a dash to convert it to a negative value. ``` <div class="-order-1"> <!-- ... --> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:order-last` to only apply the `order-last` utility on hover. ``` <div class="order-first hover:order-last"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:order-last` to apply the `order-last` utility at only medium screen sizes and above. ``` <div class="order-first md:order-last"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind provides utilities for `order-first`, `order-last`, `order-none`, and an `order-{number}` utility for the numbers 1 through 12. You can customize these values by editing `theme.order` or `theme.extend.order` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { order: { '13': '13' } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `order` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="order-[13]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Box Sizing Quick reference --------------- | Class | Properties | | --- | --- | | box-border | box-sizing: border-box; | | box-content | box-sizing: content-box; | Basic usage ----------- ### Including borders and padding Use `box-border` to set an element’s `box-sizing` to `border-box`, telling the browser to include the element’s borders and padding when you give it a height or width. This means a 100px × 100px element with a 2px border and 4px of padding on all sides will be rendered as 100px × 100px, with an internal content area of 88px × 88px. Tailwind makes this the default for all elements in our [preflight base styles](preflight). ``` <div class="box-border h-32 w-32 p-4 border-4 ..."> <!-- ... --> </div> ``` ### Excluding borders and padding Use `box-content` to set an element’s `box-sizing` to `content-box`, telling the browser to add borders and padding on top of the element’s specified width or height. This means a 100px × 100px element with a 2px border and 4px of padding on all sides will actually be rendered as 112px × 112px, with an internal content area of 100px × 100px. ``` <div class="box-content h-32 w-32 p-4 border-4 ..."> <!-- ... --> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:box-content` to only apply the `box-content` utility on hover. ``` <div class="box-border hover:box-content"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:box-content` to apply the `box-content` utility at only medium screen sizes and above. ``` <div class="box-border md:box-content"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Brightness Quick reference --------------- | Class | Properties | | --- | --- | | brightness-0 | filter: brightness(0); | | brightness-50 | filter: brightness(.5); | | brightness-75 | filter: brightness(.75); | | brightness-90 | filter: brightness(.9); | | brightness-95 | filter: brightness(.95); | | brightness-100 | filter: brightness(1); | | brightness-105 | filter: brightness(1.05); | | brightness-110 | filter: brightness(1.1); | | brightness-125 | filter: brightness(1.25); | | brightness-150 | filter: brightness(1.5); | | brightness-200 | filter: brightness(2); | Basic usage ----------- ### Changing element brightness Use the `brightness-{amount?}` utilities to control an element’s brightness. ``` <div class="brightness-50 ..."> <!-- ... --> </div> <div class="brightness-100 ..."> <!-- ... --> </div> <div class="brightness-125 ..."> <!-- ... --> </div> <div class="brightness-200 ..."> <!-- ... --> </div> ``` ### Removing filters To remove all of the filters on an element at once, use the `filter-none` utility: ``` <div class="blur-md invert brightness-150 md:filter-none"> <!-- ... --> </div> ``` This can be useful when you want to remove filters conditionally, such as on hover or at a particular breakpoint. Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:brightness-150` to only apply the `brightness-150` utility on hover. ``` <div class="brightness-110 hover:brightness-150"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:brightness-150` to apply the `brightness-150` utility at only medium screen sizes and above. ``` <div class="brightness-110 md:brightness-150"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind includes a handful of general purpose `brightness` utilities. You can customize these values by editing `theme.brightness` or `theme.extend.brightness` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { brightness: { 25: '.25', 175: '1.75', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `brightness` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="brightness-[1.75]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Appearance Quick reference --------------- | Class | Properties | | --- | --- | | appearance-none | appearance: none; | Basic usage ----------- ### Removing default element appearance Use `appearance-none` to reset any browser specific styling on an element. This utility is often used when creating [custom form components](examples/forms). ``` <select> <option>Yes</option> <option>No</option> <option>Maybe</option> </select> <select class="appearance-none"> <option>Yes</option> <option>No</option> <option>Maybe</option> </select> ```
programming_docs
tailwindcss Scroll Behavior Quick reference --------------- | Class | Properties | | --- | --- | | scroll-auto | scroll-behavior: auto; | | scroll-smooth | scroll-behavior: smooth; | Basic usage ----------- ### Adding smooth scrolling Use the `scroll-smooth` utilities to enable smooth scrolling within an element. ``` <html class="scroll-smooth"> <!-- ... --> </html> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:scroll-auto` to only apply the `scroll-auto` utility on hover. ``` <html class="scroll-smooth hover:scroll-auto"> <!-- ... --> </html> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:scroll-auto` to apply the `scroll-auto` utility at only medium screen sizes and above. ``` <html class="scroll-smooth md:scroll-auto"> <!-- ... --> </html> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Max-Width Quick reference --------------- | Class | Properties | | --- | --- | | max-w-0 | max-width: 0rem; /\* 0px \*/ | | max-w-none | max-width: none; | | max-w-xs | max-width: 20rem; /\* 320px \*/ | | max-w-sm | max-width: 24rem; /\* 384px \*/ | | max-w-md | max-width: 28rem; /\* 448px \*/ | | max-w-lg | max-width: 32rem; /\* 512px \*/ | | max-w-xl | max-width: 36rem; /\* 576px \*/ | | max-w-2xl | max-width: 42rem; /\* 672px \*/ | | max-w-3xl | max-width: 48rem; /\* 768px \*/ | | max-w-4xl | max-width: 56rem; /\* 896px \*/ | | max-w-5xl | max-width: 64rem; /\* 1024px \*/ | | max-w-6xl | max-width: 72rem; /\* 1152px \*/ | | max-w-7xl | max-width: 80rem; /\* 1280px \*/ | | max-w-full | max-width: 100%; | | max-w-min | max-width: min-content; | | max-w-max | max-width: max-content; | | max-w-fit | max-width: fit-content; | | max-w-prose | max-width: 65ch; | | max-w-screen-sm | max-width: 640px; | | max-w-screen-md | max-width: 768px; | | max-w-screen-lg | max-width: 1024px; | | max-w-screen-xl | max-width: 1280px; | | max-w-screen-2xl | max-width: 1536px; | Basic usage ----------- ### Setting the maximum width Set the maximum width of an element using the `max-w-{size}` utilities. ``` <div class="max-w-md ..."> <!-- ... --> </div> ``` ### Reading width The `max-w-prose` utility gives an element a max-width optimized for readability and adapts based on the font size. ``` <div class="text-sm max-w-prose ..."> <p>Oh yeah. It's the best part. It's crunchy, it's explosive, it's where the muffin breaks free of the pan and sort of does it's own thing. I'll tell you. That's a million dollar idea right there. Just sell the tops.</p> </div> <div class="text-base max-w-prose ..."> <p>Oh yeah. It's the best part. It's crunchy, it's explosive, it's where the muffin breaks free of the pan and sort of does it's own thing. I'll tell you. That's a million dollar idea right there. Just sell the tops.</p> </div> <div class="text-xl max-w-prose ..."> <p>Oh yeah. It's the best part. It's crunchy, it's explosive, it's where the muffin breaks free of the pan and sort of does it's own thing. I'll tell you. That's a million dollar idea right there. Just sell the tops.</p> </div> ``` ### Constraining to your breakpoints The `max-w-screen-{breakpoint}` classes can be used to give an element a max-width matching a specific breakpoint. These values are automatically derived from the [`theme.screens` section](theme#screens) of your `tailwind.config.js` file. ``` <div class="max-w-screen-2xl"> <!-- ... --> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:max-w-lg` to only apply the `max-w-lg` utility on hover. ``` <div class="max-w-sm hover:max-w-lg"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:max-w-lg` to apply the `max-w-lg` utility at only medium screen sizes and above. ``` <div class="max-w-sm md:max-w-lg"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme You can customize your `max-width` scale by editing `theme.maxWidth` or `theme.extend.maxWidth` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { maxWidth: { '1/2': '50%', } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `max-width` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="max-w-[50%]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Line Height Quick reference --------------- | Class | Properties | | --- | --- | | leading-3 | line-height: .75rem; /\* 12px \*/ | | leading-4 | line-height: 1rem; /\* 16px \*/ | | leading-5 | line-height: 1.25rem; /\* 20px \*/ | | leading-6 | line-height: 1.5rem; /\* 24px \*/ | | leading-7 | line-height: 1.75rem; /\* 28px \*/ | | leading-8 | line-height: 2rem; /\* 32px \*/ | | leading-9 | line-height: 2.25rem; /\* 36px \*/ | | leading-10 | line-height: 2.5rem; /\* 40px \*/ | | leading-none | line-height: 1; | | leading-tight | line-height: 1.25; | | leading-snug | line-height: 1.375; | | leading-normal | line-height: 1.5; | | leading-relaxed | line-height: 1.625; | | leading-loose | line-height: 2; | Basic usage ----------- ### Relative line-heights Use the `leading-none`, `leading-tight`, `leading-snug`, `leading-normal`, `leading-relaxed`, and `leading-loose` utilities to give an element a relative line-height based on its current font-size. ``` <p class="leading-normal ...">So I started to walk into the water...</p> <p class="leading-relaxed ...">So I started to walk into the water...</p> <p class="leading-loose ...">So I started to walk into the water...</p> ``` ### Fixed line-heights Use the `leading-{size}` utilities to give an element a fixed line-height, irrespective of the current font-size. These are useful when you need very precise control over an element’s final size. ``` <p class="leading-6 ...">So I started to walk into the water...</p> <p class="leading-7 ...">So I started to walk into the water...</p> <p class="leading-8 ...">So I started to walk into the water...</p> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:leading-loose` to only apply the `leading-loose` utility on hover. ``` <p class="leading-none hover:leading-loose"> <!-- ... --> </p> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:leading-loose` to apply the `leading-loose` utility at only medium screen sizes and above. ``` <p class="leading-none md:leading-loose"> <!-- ... --> </p> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). ### Overriding default line-heights It’s important to note that by default, Tailwind’s <font-size> utilities each set their own default line-height. This means that any time you use a responsive font-size utility like `sm:text-xl`, any explicit line-height you have set for a smaller breakpoint will be overridden. ``` <!-- The `leading-loose` class will be overridden at the `md` breakpoint --> <p class="text-lg leading-loose md:text-xl"> Maybe we can live without libraries... </p> ``` If you want to override the default line-height after setting a breakpoint-specific font-size, make sure to set a breakpoint-specific line-height as well: ``` <!-- The `leading-loose` class will be overridden at the `md` breakpoint --> <p class="text-lg leading-loose md:text-xl md:leading-loose"> Maybe we can live without libraries... </p> ``` Using the same line-height across different font sizes is generally not going to give you good typographic results. Line-height should typically get smaller as font-size increases, so the default behavior here usually saves you a ton of work. If you find yourself fighting it, you can always [customize your font-size scale](font-size#customizing) to not include default line-heights. Using custom values ------------------- ### Customizing your theme By default, Tailwind provides six relative and eight fixed `line-height` utilities. You change, add, or remove these by customizing the `lineHeight` section of your Tailwind theme config. tailwind.config.js ``` module.exports = { theme: { extend: { lineHeight: { 'extra-loose': '2.5', '12': '3rem', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `line-height` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <p class="leading-[3rem]"> <!-- ... --> </p> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Backdrop Grayscale Quick reference --------------- | Class | Properties | | --- | --- | | backdrop-grayscale-0 | backdrop-filter: grayscale(0); | | backdrop-grayscale | backdrop-filter: grayscale(100%); | Basic usage ----------- ### Making an element grayscale Use the `backdrop-grayscale` and `backdrop-grayscale-0` utilities to control whether an element’s backdrop should be rendered as grayscale or in full color. ``` <div class="backdrop-grayscale-0 bg-white/30 ..."> <!-- ... --> </div> <div class="backdrop-grayscale bg-white/30 ..."> <!-- ... --> </div> ``` ### Removing backdrop filters To remove all of the backdrop filters on an element at once, use the `backdrop-filter-none` utility: ``` <div class="backdrop-blur-md backdrop-grayscale md:backdrop-filter-none"> <!-- ... --> </div> ``` This can be useful when you want to remove backdrop filters conditionally, such as on hover or at a particular breakpoint. Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:backdrop-grayscale-0` to only apply the `backdrop-grayscale-0` utility on hover. ``` <div class="backdrop-grayscale hover:backdrop-grayscale-0"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:backdrop-grayscale-0` to apply the `backdrop-grayscale-0` utility at only medium screen sizes and above. ``` <div class="backdrop-grayscale md:backdrop-grayscale-0"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind includes a handful of general purpose `backdrop-grayscale` utilities. You can customize these values by editing `theme.backdropGrayscale` or `theme.extend.backdropGrayscale` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { backdropGrayscale: { 50: '.5', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `backdrop-grayscale` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="backdrop-grayscale-[.5]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Font Style Quick reference --------------- | Class | Properties | | --- | --- | | italic | font-style: italic; | | not-italic | font-style: normal; | Basic usage ----------- ### Italicizing text The `italic` utility can be used to make text italic. Likewise, the `not-italic` utility can be used to display text normally — typically to reset italic text at different breakpoints. ``` <p class="italic ...">The quick brown fox ...</p> <p class="not-italic ...">The quick brown fox ...</p> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:not-italic` to only apply the `not-italic` utility on hover. ``` <p class="italic hover:not-italic"> <!-- ... --> </p> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:not-italic` to apply the `not-italic` utility at only medium screen sizes and above. ``` <p class="italic md:not-italic"> <!-- ... --> </p> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Get started with Tailwind CSS Installation ------------ * [Tailwind CLI](https://tailwindcss.com/docs/installation) --------------------------------------------------------- * [Using PostCSS](/docs/installation) ----------------------------------- * [Framework Guides](/docs/installation) -------------------------------------- * [Play CDN](/docs/installation) ------------------------------ ### Installing Tailwind CLI The simplest and fastest way to get up and running with Tailwind CSS from scratch is with the Tailwind CLI tool. The CLI is also available as a [standalone executable](https://tailwindcss.com/blog/standalone-cli) if you want to use it without installing Node.js. 1. #### Install Tailwind CSS Install `tailwindcss` via npm, and create your `tailwind.config.js` file. Terminal ``` npm install -D tailwindcssnpx tailwindcss init ``` 2. #### Configure your template paths Add the paths to all of your template files in your `tailwind.config.js` file. tailwind.config.js ``` /** @type {import('tailwindcss').Config} */ module.exports = { content: ["./src/**/*.{html,js}"], theme: { extend: {}, }, plugins: [], } ``` 3. #### Add the Tailwind directives to your CSS Add the `@tailwind` directives for each of Tailwind’s layers to your main CSS file. src/input.css ``` @tailwind base; @tailwind components; @tailwind utilities; ``` 4. #### Start the Tailwind CLI build process Run the CLI tool to scan your template files for classes and build your CSS. Terminal ``` npx tailwindcss -i ./src/input.css -o ./dist/output.css --watch ``` 5. #### Start using Tailwind in your HTML Add your compiled CSS file to the `<head>` and start using Tailwind’s utility classes to style your content. src/index.html ``` <!doctype html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="/dist/output.css" rel="stylesheet"> </head> <body> <h1 class="text-3xl font-bold underline"> Hello world! </h1> </body> </html> ``` What to read next ----------------- Get familiar with some of the core concepts that make Tailwind CSS different from writing traditional CSS. * ### [Utility-First Fundamentals](utility-first) Using a utility-first workflow to build complex components from a constrained set of primitive utilities. * ### [Responsive Design](responsive-design) Build fully responsive user interfaces that adapt to any screen size using responsive modifiers. * ### [Hover, Focus & Other States](hover-focus-and-other-states) Style elements in interactive states like hover, focus, and more using conditional modifiers. * ### [Dark Mode](dark-mode) Optimize your site for dark mode directly in your HTML using the dark mode modifier. * ### [Reusing Styles](reusing-styles) Manage duplication and keep your projects maintainable by creating reusable abstractions. * ### [Customizing the Framework](adding-custom-styles) Customize the framework to match your brand and extend it with your own custom styles. tailwindcss Outline Style Quick reference --------------- | Class | Properties | | --- | --- | | outline-none | outline: 2px solid transparent; outline-offset: 2px; | | outline | outline-style: solid; | | outline-dashed | outline-style: dashed; | | outline-dotted | outline-style: dotted; | | outline-double | outline-style: double; | | outline-hidden | outline-style: hidden; | Basic usage ----------- ### Setting the outline style Use the `outline-{style}` utilities to change the style of an element’s outline. ``` <button class="outline outline-2 outline-offset-2 ...">Button A</button> <button class="outline-dashed outline-2 outline-offset-2 ...">Button B</button> <button class="outline-dotted outline-2 outline-offset-2 ...">Button C</button> <button class="outline-double outline-3 outline-offset-2 ...">Button D</button> ``` ### Removing outlines Use `outline-none` to hide the default browser outline on focused elements. It is highly recommended to apply your own focus styling for accessibility when using this utility. ``` <input type="text" placeholder="Default focus style" class="..." /> <input type="text" placeholder="Custom focus style" class="focus:outline-none focus:ring focus:border-blue-500 ..." /> ``` The `outline-none` utility is implemented using a transparent outline under the hood to ensure elements are still visibly focused to [Windows high contrast mode](https://blogs.windows.com/msedgedev/2020/09/17/styling-for-windows-high-contrast-with-new-standards-for-forced-colors/) users. Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:outline-dashed` to only apply the `outline-dashed` utility on hover. ``` <div class="outline hover:outline-dashed"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:outline-dashed` to apply the `outline-dashed` utility at only medium screen sizes and above. ``` <div class="outline md:outline-dashed"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries).
programming_docs
tailwindcss Preflight Overview -------- Built on top of [modern-normalize](https://github.com/sindresorhus/modern-normalize), Preflight is a set of base styles for Tailwind projects that are designed to smooth over cross-browser inconsistencies and make it easier for you to work within the constraints of your design system. Tailwind automatically injects these styles when you include `@tailwind base` in your CSS: ``` @tailwind base; /* Preflight will be injected here */ @tailwind components; @tailwind utilities; ``` While most of the styles in Preflight are meant to go unnoticed — they simply make things behave more like you’d expect them to — some are more opinionated and can be surprising when you first encounter them. For a complete reference of all the styles applied by Preflight, [see the stylesheet](https://unpkg.com/tailwindcss@%5E3/src/css/preflight.css). Default margins are removed --------------------------- Preflight removes all of the default margins from elements like headings, blockquotes, paragraphs, etc. ``` blockquote, dl, dd, h1, h2, h3, h4, h5, h6, hr, figure, p, pre { margin: 0; } ``` This makes it harder to accidentally rely on margin values applied by the user-agent stylesheet that are not part of your spacing scale. Headings are unstyled --------------------- All heading elements are completely unstyled by default, and have the same font-size and font-weight as normal text. ``` h1, h2, h3, h4, h5, h6 { font-size: inherit; font-weight: inherit; } ``` The reason for this is two-fold: * **It helps you avoid accidentally deviating from your type scale**. By default, the browsers assigns sizes to headings that don’t exist in Tailwind’s default type scale, and aren’t guaranteed to exist in your own type scale. * **In UI development, headings should often be visually de-emphasized**. Making headings unstyled by default means any styling you apply to headings happens consciously and deliberately. You can always add default header styles to your project by [adding your own base styles](/docs/adding-custom-styles#adding-base-styles). If you’d like to selectively introduce sensible default heading styles into article-style parts of a page, we recommend the [@tailwindcss/typography plugin](typography-plugin). Lists are unstyled ------------------ Ordered and unordered lists are unstyled by default, with no bullets/numbers and no margin or padding. ``` ol, ul { list-style: none; margin: 0; padding: 0; } ``` If you’d like to style a list, you can do so using the <list-style-type> and <list-style-position> utilities: ``` <ul class="list-disc list-inside"> <li>One</li> <li>Two</li> <li>Three</li> </ul> ``` You can always add default list styles to your project by [adding your own base styles](/docs/adding-custom-styles#adding-base-styles). If you’d like to selectively introduce default list styles into article-style parts of a page, we recommend the [@tailwindcss/typography plugin](typography-plugin). ### Accessibility considerations Unstyled lists are [not announced as lists by VoiceOver](https://unfetteredthoughts.net/2017/09/26/voiceover-and-list-style-type-none/). If your content is truly a list but you would like to keep it unstyled, [add a “list” role](https://www.scottohara.me/blog/2019/01/12/lists-and-safari.html) to the element: ``` <ul role="list"> <li>One</li> <li>Two</li> <li>Three</li> </ul> ``` Images are block-level ---------------------- Images and other replaced elements (like `svg`, `video`, `canvas`, and others) are `display: block` by default. ``` img, svg, video, canvas, audio, iframe, embed, object { display: block; vertical-align: middle; } ``` This helps to avoid unexpected alignment issues that you often run into using the browser default of `display: inline`. If you ever need to make one of these elements `inline` instead of `block`, simply use the `inline` utility: ``` <img class="inline" src="..." alt="..."> ``` Border styles are reset globally -------------------------------- In order to make it easy to add a border by simply adding the `border` class, Tailwind overrides the default border styles for all elements with the following rules: ``` *, ::before, ::after { border-width: 0; border-style: solid; border-color: theme('borderColor.DEFAULT', currentColor); } ``` Since the `border` class only sets the `border-width` property, this reset ensures that adding that class always adds a solid 1px border using your configured default border color. This can cause some unexpected results when integrating certain third-party libraries, like [Google maps](https://github.com/tailwindlabs/tailwindcss/issues/484) for example. When you run into situations like this, you can work around them by overriding the Preflight styles with your own custom CSS: ``` .google-map * { border-style: none; } ``` Buttons have a default outline ------------------------------ To ensure that we provide accessible styles out of the box, we made sure that buttons have a default outline. You can of course override this by applying `focus:ring` or similar utilities to your buttons. ``` button:focus { outline: 1px dotted; outline: 5px auto -webkit-focus-ring-color; } ``` Extending Preflight ------------------- If you’d like to add your own base styles on top of Preflight, simply add them to your CSS within a `@layer base` directive: ``` @tailwind base; @layer base { h1 { @apply text-2xl; } h2 { @apply text-xl; } h3 { @apply text-lg; } a { @apply text-blue-600 underline; } } @tailwind components; @tailwind utilities; ``` Learn more in the [adding base styles documentation](/docs/adding-custom-styles#adding-base-styles). Disabling Preflight ------------------- If you’d like to completely disable Preflight — perhaps because you’re integrating Tailwind into an existing project or because you’d like to provide your own base styles — all you need to do is set `preflight` to `false` in the `corePlugins` section of your `tailwind.config.js` file: tailwind.config.js ``` module.exports = { corePlugins: { preflight: false, } } ``` tailwindcss Grid Template Columns Quick reference --------------- | Class | Properties | | --- | --- | | grid-cols-1 | grid-template-columns: repeat(1, minmax(0, 1fr)); | | grid-cols-2 | grid-template-columns: repeat(2, minmax(0, 1fr)); | | grid-cols-3 | grid-template-columns: repeat(3, minmax(0, 1fr)); | | grid-cols-4 | grid-template-columns: repeat(4, minmax(0, 1fr)); | | grid-cols-5 | grid-template-columns: repeat(5, minmax(0, 1fr)); | | grid-cols-6 | grid-template-columns: repeat(6, minmax(0, 1fr)); | | grid-cols-7 | grid-template-columns: repeat(7, minmax(0, 1fr)); | | grid-cols-8 | grid-template-columns: repeat(8, minmax(0, 1fr)); | | grid-cols-9 | grid-template-columns: repeat(9, minmax(0, 1fr)); | | grid-cols-10 | grid-template-columns: repeat(10, minmax(0, 1fr)); | | grid-cols-11 | grid-template-columns: repeat(11, minmax(0, 1fr)); | | grid-cols-12 | grid-template-columns: repeat(12, minmax(0, 1fr)); | | grid-cols-none | grid-template-columns: none; | Basic usage ----------- ### Specifying the columns in a grid Use the `grid-cols-{n}` utilities to create grids with *n* equally sized columns. ``` <div class="grid grid-cols-4 gap-4"> <div>01</div> <!-- ... --> <div>09</div> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:grid-cols-6` to only apply the `grid-cols-6` utility on hover. ``` <div class="grid grid-cols-1 hover:grid-cols-6"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:grid-cols-6` to apply the `grid-cols-6` utility at only medium screen sizes and above. ``` <div class="grid grid-cols-1 md:grid-cols-6"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind includes `grid-template-column` utilities for creating basic grids with up to 12 equal width columns. You can customize these values by editing `theme.gridTemplateColumns` or `theme.extend.gridTemplateColumns` in your `tailwind.config.js` file. You have direct access to the `grid-template-columns` CSS property here so you can make your custom column values as generic or as complicated and site-specific as you like. tailwind.config.js ``` module.exports = { theme: { extend: { gridTemplateColumns: { // Simple 16 column grid '16': 'repeat(16, minmax(0, 1fr))', // Complex site-specific column configuration 'footer': '200px minmax(900px, 1fr) 100px', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `grid-template-columns` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="grid grid-cols-[200px_minmax(900px,_1fr)_100px]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Gradient Color Stops Quick reference --------------- | Class | Properties | Preview | | --- | --- | --- | | from-inherit | --tw-gradient-from: inherit; --tw-gradient-to: rgb(255 255 255 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-current | --tw-gradient-from: currentColor; --tw-gradient-to: rgb(255 255 255 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-transparent | --tw-gradient-from: transparent; --tw-gradient-to: rgb(0 0 0 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-black | --tw-gradient-from: #000; --tw-gradient-to: rgb(0 0 0 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-white | --tw-gradient-from: #fff; --tw-gradient-to: rgb(255 255 255 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-slate-50 | --tw-gradient-from: #f8fafc; --tw-gradient-to: rgb(248 250 252 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-slate-100 | --tw-gradient-from: #f1f5f9; --tw-gradient-to: rgb(241 245 249 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-slate-200 | --tw-gradient-from: #e2e8f0; --tw-gradient-to: rgb(226 232 240 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-slate-300 | --tw-gradient-from: #cbd5e1; --tw-gradient-to: rgb(203 213 225 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-slate-400 | --tw-gradient-from: #94a3b8; --tw-gradient-to: rgb(148 163 184 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-slate-500 | --tw-gradient-from: #64748b; --tw-gradient-to: rgb(100 116 139 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-slate-600 | --tw-gradient-from: #475569; --tw-gradient-to: rgb(71 85 105 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-slate-700 | --tw-gradient-from: #334155; --tw-gradient-to: rgb(51 65 85 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-slate-800 | --tw-gradient-from: #1e293b; --tw-gradient-to: rgb(30 41 59 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-slate-900 | --tw-gradient-from: #0f172a; --tw-gradient-to: rgb(15 23 42 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-gray-50 | --tw-gradient-from: #f9fafb; --tw-gradient-to: rgb(249 250 251 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-gray-100 | --tw-gradient-from: #f3f4f6; --tw-gradient-to: rgb(243 244 246 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-gray-200 | --tw-gradient-from: #e5e7eb; --tw-gradient-to: rgb(229 231 235 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-gray-300 | --tw-gradient-from: #d1d5db; --tw-gradient-to: rgb(209 213 219 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-gray-400 | --tw-gradient-from: #9ca3af; --tw-gradient-to: rgb(156 163 175 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-gray-500 | --tw-gradient-from: #6b7280; --tw-gradient-to: rgb(107 114 128 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-gray-600 | --tw-gradient-from: #4b5563; --tw-gradient-to: rgb(75 85 99 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-gray-700 | --tw-gradient-from: #374151; --tw-gradient-to: rgb(55 65 81 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-gray-800 | --tw-gradient-from: #1f2937; --tw-gradient-to: rgb(31 41 55 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-gray-900 | --tw-gradient-from: #111827; --tw-gradient-to: rgb(17 24 39 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-zinc-50 | --tw-gradient-from: #fafafa; --tw-gradient-to: rgb(250 250 250 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-zinc-100 | --tw-gradient-from: #f4f4f5; --tw-gradient-to: rgb(244 244 245 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-zinc-200 | --tw-gradient-from: #e4e4e7; --tw-gradient-to: rgb(228 228 231 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-zinc-300 | --tw-gradient-from: #d4d4d8; --tw-gradient-to: rgb(212 212 216 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-zinc-400 | --tw-gradient-from: #a1a1aa; --tw-gradient-to: rgb(161 161 170 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-zinc-500 | --tw-gradient-from: #71717a; --tw-gradient-to: rgb(113 113 122 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-zinc-600 | --tw-gradient-from: #52525b; --tw-gradient-to: rgb(82 82 91 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-zinc-700 | --tw-gradient-from: #3f3f46; --tw-gradient-to: rgb(63 63 70 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-zinc-800 | --tw-gradient-from: #27272a; --tw-gradient-to: rgb(39 39 42 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-zinc-900 | --tw-gradient-from: #18181b; --tw-gradient-to: rgb(24 24 27 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-neutral-50 | --tw-gradient-from: #fafafa; --tw-gradient-to: rgb(250 250 250 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-neutral-100 | --tw-gradient-from: #f5f5f5; --tw-gradient-to: rgb(245 245 245 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-neutral-200 | --tw-gradient-from: #e5e5e5; --tw-gradient-to: rgb(229 229 229 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-neutral-300 | --tw-gradient-from: #d4d4d4; --tw-gradient-to: rgb(212 212 212 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-neutral-400 | --tw-gradient-from: #a3a3a3; --tw-gradient-to: rgb(163 163 163 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-neutral-500 | --tw-gradient-from: #737373; --tw-gradient-to: rgb(115 115 115 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-neutral-600 | --tw-gradient-from: #525252; --tw-gradient-to: rgb(82 82 82 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-neutral-700 | --tw-gradient-from: #404040; --tw-gradient-to: rgb(64 64 64 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-neutral-800 | --tw-gradient-from: #262626; --tw-gradient-to: rgb(38 38 38 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-neutral-900 | --tw-gradient-from: #171717; --tw-gradient-to: rgb(23 23 23 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-stone-50 | --tw-gradient-from: #fafaf9; --tw-gradient-to: rgb(250 250 249 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-stone-100 | --tw-gradient-from: #f5f5f4; --tw-gradient-to: rgb(245 245 244 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-stone-200 | --tw-gradient-from: #e7e5e4; --tw-gradient-to: rgb(231 229 228 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-stone-300 | --tw-gradient-from: #d6d3d1; --tw-gradient-to: rgb(214 211 209 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-stone-400 | --tw-gradient-from: #a8a29e; --tw-gradient-to: rgb(168 162 158 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-stone-500 | --tw-gradient-from: #78716c; --tw-gradient-to: rgb(120 113 108 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-stone-600 | --tw-gradient-from: #57534e; --tw-gradient-to: rgb(87 83 78 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-stone-700 | --tw-gradient-from: #44403c; --tw-gradient-to: rgb(68 64 60 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-stone-800 | --tw-gradient-from: #292524; --tw-gradient-to: rgb(41 37 36 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-stone-900 | --tw-gradient-from: #1c1917; --tw-gradient-to: rgb(28 25 23 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-red-50 | --tw-gradient-from: #fef2f2; --tw-gradient-to: rgb(254 242 242 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-red-100 | --tw-gradient-from: #fee2e2; --tw-gradient-to: rgb(254 226 226 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-red-200 | --tw-gradient-from: #fecaca; --tw-gradient-to: rgb(254 202 202 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-red-300 | --tw-gradient-from: #fca5a5; --tw-gradient-to: rgb(252 165 165 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-red-400 | --tw-gradient-from: #f87171; --tw-gradient-to: rgb(248 113 113 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-red-500 | --tw-gradient-from: #ef4444; --tw-gradient-to: rgb(239 68 68 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-red-600 | --tw-gradient-from: #dc2626; --tw-gradient-to: rgb(220 38 38 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-red-700 | --tw-gradient-from: #b91c1c; --tw-gradient-to: rgb(185 28 28 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-red-800 | --tw-gradient-from: #991b1b; --tw-gradient-to: rgb(153 27 27 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-red-900 | --tw-gradient-from: #7f1d1d; --tw-gradient-to: rgb(127 29 29 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-orange-50 | --tw-gradient-from: #fff7ed; --tw-gradient-to: rgb(255 247 237 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-orange-100 | --tw-gradient-from: #ffedd5; --tw-gradient-to: rgb(255 237 213 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-orange-200 | --tw-gradient-from: #fed7aa; --tw-gradient-to: rgb(254 215 170 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-orange-300 | --tw-gradient-from: #fdba74; --tw-gradient-to: rgb(253 186 116 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-orange-400 | --tw-gradient-from: #fb923c; --tw-gradient-to: rgb(251 146 60 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-orange-500 | --tw-gradient-from: #f97316; --tw-gradient-to: rgb(249 115 22 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-orange-600 | --tw-gradient-from: #ea580c; --tw-gradient-to: rgb(234 88 12 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-orange-700 | --tw-gradient-from: #c2410c; --tw-gradient-to: rgb(194 65 12 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-orange-800 | --tw-gradient-from: #9a3412; --tw-gradient-to: rgb(154 52 18 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-orange-900 | --tw-gradient-from: #7c2d12; --tw-gradient-to: rgb(124 45 18 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-amber-50 | --tw-gradient-from: #fffbeb; --tw-gradient-to: rgb(255 251 235 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-amber-100 | --tw-gradient-from: #fef3c7; --tw-gradient-to: rgb(254 243 199 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-amber-200 | --tw-gradient-from: #fde68a; --tw-gradient-to: rgb(253 230 138 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-amber-300 | --tw-gradient-from: #fcd34d; --tw-gradient-to: rgb(252 211 77 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-amber-400 | --tw-gradient-from: #fbbf24; --tw-gradient-to: rgb(251 191 36 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-amber-500 | --tw-gradient-from: #f59e0b; --tw-gradient-to: rgb(245 158 11 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-amber-600 | --tw-gradient-from: #d97706; --tw-gradient-to: rgb(217 119 6 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-amber-700 | --tw-gradient-from: #b45309; --tw-gradient-to: rgb(180 83 9 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-amber-800 | --tw-gradient-from: #92400e; --tw-gradient-to: rgb(146 64 14 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-amber-900 | --tw-gradient-from: #78350f; --tw-gradient-to: rgb(120 53 15 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-yellow-50 | --tw-gradient-from: #fefce8; --tw-gradient-to: rgb(254 252 232 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-yellow-100 | --tw-gradient-from: #fef9c3; --tw-gradient-to: rgb(254 249 195 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-yellow-200 | --tw-gradient-from: #fef08a; --tw-gradient-to: rgb(254 240 138 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-yellow-300 | --tw-gradient-from: #fde047; --tw-gradient-to: rgb(253 224 71 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-yellow-400 | --tw-gradient-from: #facc15; --tw-gradient-to: rgb(250 204 21 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-yellow-500 | --tw-gradient-from: #eab308; --tw-gradient-to: rgb(234 179 8 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-yellow-600 | --tw-gradient-from: #ca8a04; --tw-gradient-to: rgb(202 138 4 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-yellow-700 | --tw-gradient-from: #a16207; --tw-gradient-to: rgb(161 98 7 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-yellow-800 | --tw-gradient-from: #854d0e; --tw-gradient-to: rgb(133 77 14 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-yellow-900 | --tw-gradient-from: #713f12; --tw-gradient-to: rgb(113 63 18 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-lime-50 | --tw-gradient-from: #f7fee7; --tw-gradient-to: rgb(247 254 231 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-lime-100 | --tw-gradient-from: #ecfccb; --tw-gradient-to: rgb(236 252 203 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-lime-200 | --tw-gradient-from: #d9f99d; --tw-gradient-to: rgb(217 249 157 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-lime-300 | --tw-gradient-from: #bef264; --tw-gradient-to: rgb(190 242 100 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-lime-400 | --tw-gradient-from: #a3e635; --tw-gradient-to: rgb(163 230 53 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-lime-500 | --tw-gradient-from: #84cc16; --tw-gradient-to: rgb(132 204 22 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-lime-600 | --tw-gradient-from: #65a30d; --tw-gradient-to: rgb(101 163 13 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-lime-700 | --tw-gradient-from: #4d7c0f; --tw-gradient-to: rgb(77 124 15 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-lime-800 | --tw-gradient-from: #3f6212; --tw-gradient-to: rgb(63 98 18 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-lime-900 | --tw-gradient-from: #365314; --tw-gradient-to: rgb(54 83 20 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-green-50 | --tw-gradient-from: #f0fdf4; --tw-gradient-to: rgb(240 253 244 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-green-100 | --tw-gradient-from: #dcfce7; --tw-gradient-to: rgb(220 252 231 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-green-200 | --tw-gradient-from: #bbf7d0; --tw-gradient-to: rgb(187 247 208 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-green-300 | --tw-gradient-from: #86efac; --tw-gradient-to: rgb(134 239 172 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-green-400 | --tw-gradient-from: #4ade80; --tw-gradient-to: rgb(74 222 128 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-green-500 | --tw-gradient-from: #22c55e; --tw-gradient-to: rgb(34 197 94 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-green-600 | --tw-gradient-from: #16a34a; --tw-gradient-to: rgb(22 163 74 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-green-700 | --tw-gradient-from: #15803d; --tw-gradient-to: rgb(21 128 61 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-green-800 | --tw-gradient-from: #166534; --tw-gradient-to: rgb(22 101 52 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-green-900 | --tw-gradient-from: #14532d; --tw-gradient-to: rgb(20 83 45 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-emerald-50 | --tw-gradient-from: #ecfdf5; --tw-gradient-to: rgb(236 253 245 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-emerald-100 | --tw-gradient-from: #d1fae5; --tw-gradient-to: rgb(209 250 229 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-emerald-200 | --tw-gradient-from: #a7f3d0; --tw-gradient-to: rgb(167 243 208 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-emerald-300 | --tw-gradient-from: #6ee7b7; --tw-gradient-to: rgb(110 231 183 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-emerald-400 | --tw-gradient-from: #34d399; --tw-gradient-to: rgb(52 211 153 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-emerald-500 | --tw-gradient-from: #10b981; --tw-gradient-to: rgb(16 185 129 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-emerald-600 | --tw-gradient-from: #059669; --tw-gradient-to: rgb(5 150 105 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-emerald-700 | --tw-gradient-from: #047857; --tw-gradient-to: rgb(4 120 87 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-emerald-800 | --tw-gradient-from: #065f46; --tw-gradient-to: rgb(6 95 70 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-emerald-900 | --tw-gradient-from: #064e3b; --tw-gradient-to: rgb(6 78 59 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-teal-50 | --tw-gradient-from: #f0fdfa; --tw-gradient-to: rgb(240 253 250 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-teal-100 | --tw-gradient-from: #ccfbf1; --tw-gradient-to: rgb(204 251 241 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-teal-200 | --tw-gradient-from: #99f6e4; --tw-gradient-to: rgb(153 246 228 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-teal-300 | --tw-gradient-from: #5eead4; --tw-gradient-to: rgb(94 234 212 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-teal-400 | --tw-gradient-from: #2dd4bf; --tw-gradient-to: rgb(45 212 191 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-teal-500 | --tw-gradient-from: #14b8a6; --tw-gradient-to: rgb(20 184 166 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-teal-600 | --tw-gradient-from: #0d9488; --tw-gradient-to: rgb(13 148 136 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-teal-700 | --tw-gradient-from: #0f766e; --tw-gradient-to: rgb(15 118 110 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-teal-800 | --tw-gradient-from: #115e59; --tw-gradient-to: rgb(17 94 89 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-teal-900 | --tw-gradient-from: #134e4a; --tw-gradient-to: rgb(19 78 74 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-cyan-50 | --tw-gradient-from: #ecfeff; --tw-gradient-to: rgb(236 254 255 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-cyan-100 | --tw-gradient-from: #cffafe; --tw-gradient-to: rgb(207 250 254 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-cyan-200 | --tw-gradient-from: #a5f3fc; --tw-gradient-to: rgb(165 243 252 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-cyan-300 | --tw-gradient-from: #67e8f9; --tw-gradient-to: rgb(103 232 249 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-cyan-400 | --tw-gradient-from: #22d3ee; --tw-gradient-to: rgb(34 211 238 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-cyan-500 | --tw-gradient-from: #06b6d4; --tw-gradient-to: rgb(6 182 212 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-cyan-600 | --tw-gradient-from: #0891b2; --tw-gradient-to: rgb(8 145 178 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-cyan-700 | --tw-gradient-from: #0e7490; --tw-gradient-to: rgb(14 116 144 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-cyan-800 | --tw-gradient-from: #155e75; --tw-gradient-to: rgb(21 94 117 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-cyan-900 | --tw-gradient-from: #164e63; --tw-gradient-to: rgb(22 78 99 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-sky-50 | --tw-gradient-from: #f0f9ff; --tw-gradient-to: rgb(240 249 255 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-sky-100 | --tw-gradient-from: #e0f2fe; --tw-gradient-to: rgb(224 242 254 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-sky-200 | --tw-gradient-from: #bae6fd; --tw-gradient-to: rgb(186 230 253 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-sky-300 | --tw-gradient-from: #7dd3fc; --tw-gradient-to: rgb(125 211 252 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-sky-400 | --tw-gradient-from: #38bdf8; --tw-gradient-to: rgb(56 189 248 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-sky-500 | --tw-gradient-from: #0ea5e9; --tw-gradient-to: rgb(14 165 233 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-sky-600 | --tw-gradient-from: #0284c7; --tw-gradient-to: rgb(2 132 199 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-sky-700 | --tw-gradient-from: #0369a1; --tw-gradient-to: rgb(3 105 161 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-sky-800 | --tw-gradient-from: #075985; --tw-gradient-to: rgb(7 89 133 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-sky-900 | --tw-gradient-from: #0c4a6e; --tw-gradient-to: rgb(12 74 110 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-blue-50 | --tw-gradient-from: #eff6ff; --tw-gradient-to: rgb(239 246 255 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-blue-100 | --tw-gradient-from: #dbeafe; --tw-gradient-to: rgb(219 234 254 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-blue-200 | --tw-gradient-from: #bfdbfe; --tw-gradient-to: rgb(191 219 254 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-blue-300 | --tw-gradient-from: #93c5fd; --tw-gradient-to: rgb(147 197 253 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-blue-400 | --tw-gradient-from: #60a5fa; --tw-gradient-to: rgb(96 165 250 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-blue-500 | --tw-gradient-from: #3b82f6; --tw-gradient-to: rgb(59 130 246 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-blue-600 | --tw-gradient-from: #2563eb; --tw-gradient-to: rgb(37 99 235 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-blue-700 | --tw-gradient-from: #1d4ed8; --tw-gradient-to: rgb(29 78 216 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-blue-800 | --tw-gradient-from: #1e40af; --tw-gradient-to: rgb(30 64 175 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-blue-900 | --tw-gradient-from: #1e3a8a; --tw-gradient-to: rgb(30 58 138 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-indigo-50 | --tw-gradient-from: #eef2ff; --tw-gradient-to: rgb(238 242 255 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-indigo-100 | --tw-gradient-from: #e0e7ff; --tw-gradient-to: rgb(224 231 255 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-indigo-200 | --tw-gradient-from: #c7d2fe; --tw-gradient-to: rgb(199 210 254 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-indigo-300 | --tw-gradient-from: #a5b4fc; --tw-gradient-to: rgb(165 180 252 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-indigo-400 | --tw-gradient-from: #818cf8; --tw-gradient-to: rgb(129 140 248 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-indigo-500 | --tw-gradient-from: #6366f1; --tw-gradient-to: rgb(99 102 241 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-indigo-600 | --tw-gradient-from: #4f46e5; --tw-gradient-to: rgb(79 70 229 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-indigo-700 | --tw-gradient-from: #4338ca; --tw-gradient-to: rgb(67 56 202 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-indigo-800 | --tw-gradient-from: #3730a3; --tw-gradient-to: rgb(55 48 163 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-indigo-900 | --tw-gradient-from: #312e81; --tw-gradient-to: rgb(49 46 129 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-violet-50 | --tw-gradient-from: #f5f3ff; --tw-gradient-to: rgb(245 243 255 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-violet-100 | --tw-gradient-from: #ede9fe; --tw-gradient-to: rgb(237 233 254 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-violet-200 | --tw-gradient-from: #ddd6fe; --tw-gradient-to: rgb(221 214 254 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-violet-300 | --tw-gradient-from: #c4b5fd; --tw-gradient-to: rgb(196 181 253 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-violet-400 | --tw-gradient-from: #a78bfa; --tw-gradient-to: rgb(167 139 250 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-violet-500 | --tw-gradient-from: #8b5cf6; --tw-gradient-to: rgb(139 92 246 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-violet-600 | --tw-gradient-from: #7c3aed; --tw-gradient-to: rgb(124 58 237 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-violet-700 | --tw-gradient-from: #6d28d9; --tw-gradient-to: rgb(109 40 217 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-violet-800 | --tw-gradient-from: #5b21b6; --tw-gradient-to: rgb(91 33 182 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-violet-900 | --tw-gradient-from: #4c1d95; --tw-gradient-to: rgb(76 29 149 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-purple-50 | --tw-gradient-from: #faf5ff; --tw-gradient-to: rgb(250 245 255 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-purple-100 | --tw-gradient-from: #f3e8ff; --tw-gradient-to: rgb(243 232 255 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-purple-200 | --tw-gradient-from: #e9d5ff; --tw-gradient-to: rgb(233 213 255 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-purple-300 | --tw-gradient-from: #d8b4fe; --tw-gradient-to: rgb(216 180 254 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-purple-400 | --tw-gradient-from: #c084fc; --tw-gradient-to: rgb(192 132 252 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-purple-500 | --tw-gradient-from: #a855f7; --tw-gradient-to: rgb(168 85 247 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-purple-600 | --tw-gradient-from: #9333ea; --tw-gradient-to: rgb(147 51 234 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-purple-700 | --tw-gradient-from: #7e22ce; --tw-gradient-to: rgb(126 34 206 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-purple-800 | --tw-gradient-from: #6b21a8; --tw-gradient-to: rgb(107 33 168 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-purple-900 | --tw-gradient-from: #581c87; --tw-gradient-to: rgb(88 28 135 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-fuchsia-50 | --tw-gradient-from: #fdf4ff; --tw-gradient-to: rgb(253 244 255 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-fuchsia-100 | --tw-gradient-from: #fae8ff; --tw-gradient-to: rgb(250 232 255 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-fuchsia-200 | --tw-gradient-from: #f5d0fe; --tw-gradient-to: rgb(245 208 254 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-fuchsia-300 | --tw-gradient-from: #f0abfc; --tw-gradient-to: rgb(240 171 252 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-fuchsia-400 | --tw-gradient-from: #e879f9; --tw-gradient-to: rgb(232 121 249 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-fuchsia-500 | --tw-gradient-from: #d946ef; --tw-gradient-to: rgb(217 70 239 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-fuchsia-600 | --tw-gradient-from: #c026d3; --tw-gradient-to: rgb(192 38 211 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-fuchsia-700 | --tw-gradient-from: #a21caf; --tw-gradient-to: rgb(162 28 175 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-fuchsia-800 | --tw-gradient-from: #86198f; --tw-gradient-to: rgb(134 25 143 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-fuchsia-900 | --tw-gradient-from: #701a75; --tw-gradient-to: rgb(112 26 117 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-pink-50 | --tw-gradient-from: #fdf2f8; --tw-gradient-to: rgb(253 242 248 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-pink-100 | --tw-gradient-from: #fce7f3; --tw-gradient-to: rgb(252 231 243 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-pink-200 | --tw-gradient-from: #fbcfe8; --tw-gradient-to: rgb(251 207 232 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-pink-300 | --tw-gradient-from: #f9a8d4; --tw-gradient-to: rgb(249 168 212 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-pink-400 | --tw-gradient-from: #f472b6; --tw-gradient-to: rgb(244 114 182 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-pink-500 | --tw-gradient-from: #ec4899; --tw-gradient-to: rgb(236 72 153 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-pink-600 | --tw-gradient-from: #db2777; --tw-gradient-to: rgb(219 39 119 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-pink-700 | --tw-gradient-from: #be185d; --tw-gradient-to: rgb(190 24 93 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-pink-800 | --tw-gradient-from: #9d174d; --tw-gradient-to: rgb(157 23 77 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-pink-900 | --tw-gradient-from: #831843; --tw-gradient-to: rgb(131 24 67 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-rose-50 | --tw-gradient-from: #fff1f2; --tw-gradient-to: rgb(255 241 242 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-rose-100 | --tw-gradient-from: #ffe4e6; --tw-gradient-to: rgb(255 228 230 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-rose-200 | --tw-gradient-from: #fecdd3; --tw-gradient-to: rgb(254 205 211 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-rose-300 | --tw-gradient-from: #fda4af; --tw-gradient-to: rgb(253 164 175 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-rose-400 | --tw-gradient-from: #fb7185; --tw-gradient-to: rgb(251 113 133 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-rose-500 | --tw-gradient-from: #f43f5e; --tw-gradient-to: rgb(244 63 94 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-rose-600 | --tw-gradient-from: #e11d48; --tw-gradient-to: rgb(225 29 72 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-rose-700 | --tw-gradient-from: #be123c; --tw-gradient-to: rgb(190 18 60 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-rose-800 | --tw-gradient-from: #9f1239; --tw-gradient-to: rgb(159 18 57 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | from-rose-900 | --tw-gradient-from: #881337; --tw-gradient-to: rgb(136 19 55 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); | | | via-inherit | --tw-gradient-to: rgb(255 255 255 / 0); --tw-gradient-stops: var(--tw-gradient-from), inherit, var(--tw-gradient-to); | | | via-current | --tw-gradient-to: rgb(255 255 255 / 0); --tw-gradient-stops: var(--tw-gradient-from), currentColor, var(--tw-gradient-to); | | | via-transparent | --tw-gradient-to: rgb(0 0 0 / 0); --tw-gradient-stops: var(--tw-gradient-from), transparent, var(--tw-gradient-to); | | | via-black | --tw-gradient-to: rgb(0 0 0 / 0); --tw-gradient-stops: var(--tw-gradient-from), #000, var(--tw-gradient-to); | | | via-white | --tw-gradient-to: rgb(255 255 255 / 0); --tw-gradient-stops: var(--tw-gradient-from), #fff, var(--tw-gradient-to); | | | via-slate-50 | --tw-gradient-to: rgb(248 250 252 / 0); --tw-gradient-stops: var(--tw-gradient-from), #f8fafc, var(--tw-gradient-to); | | | via-slate-100 | --tw-gradient-to: rgb(241 245 249 / 0); --tw-gradient-stops: var(--tw-gradient-from), #f1f5f9, var(--tw-gradient-to); | | | via-slate-200 | --tw-gradient-to: rgb(226 232 240 / 0); --tw-gradient-stops: var(--tw-gradient-from), #e2e8f0, var(--tw-gradient-to); | | | via-slate-300 | --tw-gradient-to: rgb(203 213 225 / 0); --tw-gradient-stops: var(--tw-gradient-from), #cbd5e1, var(--tw-gradient-to); | | | via-slate-400 | --tw-gradient-to: rgb(148 163 184 / 0); --tw-gradient-stops: var(--tw-gradient-from), #94a3b8, var(--tw-gradient-to); | | | via-slate-500 | --tw-gradient-to: rgb(100 116 139 / 0); --tw-gradient-stops: var(--tw-gradient-from), #64748b, var(--tw-gradient-to); | | | via-slate-600 | --tw-gradient-to: rgb(71 85 105 / 0); --tw-gradient-stops: var(--tw-gradient-from), #475569, var(--tw-gradient-to); | | | via-slate-700 | --tw-gradient-to: rgb(51 65 85 / 0); --tw-gradient-stops: var(--tw-gradient-from), #334155, var(--tw-gradient-to); | | | via-slate-800 | --tw-gradient-to: rgb(30 41 59 / 0); --tw-gradient-stops: var(--tw-gradient-from), #1e293b, var(--tw-gradient-to); | | | via-slate-900 | --tw-gradient-to: rgb(15 23 42 / 0); --tw-gradient-stops: var(--tw-gradient-from), #0f172a, var(--tw-gradient-to); | | | via-gray-50 | --tw-gradient-to: rgb(249 250 251 / 0); --tw-gradient-stops: var(--tw-gradient-from), #f9fafb, var(--tw-gradient-to); | | | via-gray-100 | --tw-gradient-to: rgb(243 244 246 / 0); --tw-gradient-stops: var(--tw-gradient-from), #f3f4f6, var(--tw-gradient-to); | | | via-gray-200 | --tw-gradient-to: rgb(229 231 235 / 0); --tw-gradient-stops: var(--tw-gradient-from), #e5e7eb, var(--tw-gradient-to); | | | via-gray-300 | --tw-gradient-to: rgb(209 213 219 / 0); --tw-gradient-stops: var(--tw-gradient-from), #d1d5db, var(--tw-gradient-to); | | | via-gray-400 | --tw-gradient-to: rgb(156 163 175 / 0); --tw-gradient-stops: var(--tw-gradient-from), #9ca3af, var(--tw-gradient-to); | | | via-gray-500 | --tw-gradient-to: rgb(107 114 128 / 0); --tw-gradient-stops: var(--tw-gradient-from), #6b7280, var(--tw-gradient-to); | | | via-gray-600 | --tw-gradient-to: rgb(75 85 99 / 0); --tw-gradient-stops: var(--tw-gradient-from), #4b5563, var(--tw-gradient-to); | | | via-gray-700 | --tw-gradient-to: rgb(55 65 81 / 0); --tw-gradient-stops: var(--tw-gradient-from), #374151, var(--tw-gradient-to); | | | via-gray-800 | --tw-gradient-to: rgb(31 41 55 / 0); --tw-gradient-stops: var(--tw-gradient-from), #1f2937, var(--tw-gradient-to); | | | via-gray-900 | --tw-gradient-to: rgb(17 24 39 / 0); --tw-gradient-stops: var(--tw-gradient-from), #111827, var(--tw-gradient-to); | | | via-zinc-50 | --tw-gradient-to: rgb(250 250 250 / 0); --tw-gradient-stops: var(--tw-gradient-from), #fafafa, var(--tw-gradient-to); | | | via-zinc-100 | --tw-gradient-to: rgb(244 244 245 / 0); --tw-gradient-stops: var(--tw-gradient-from), #f4f4f5, var(--tw-gradient-to); | | | via-zinc-200 | --tw-gradient-to: rgb(228 228 231 / 0); --tw-gradient-stops: var(--tw-gradient-from), #e4e4e7, var(--tw-gradient-to); | | | via-zinc-300 | --tw-gradient-to: rgb(212 212 216 / 0); --tw-gradient-stops: var(--tw-gradient-from), #d4d4d8, var(--tw-gradient-to); | | | via-zinc-400 | --tw-gradient-to: rgb(161 161 170 / 0); --tw-gradient-stops: var(--tw-gradient-from), #a1a1aa, var(--tw-gradient-to); | | | via-zinc-500 | --tw-gradient-to: rgb(113 113 122 / 0); --tw-gradient-stops: var(--tw-gradient-from), #71717a, var(--tw-gradient-to); | | | via-zinc-600 | --tw-gradient-to: rgb(82 82 91 / 0); --tw-gradient-stops: var(--tw-gradient-from), #52525b, var(--tw-gradient-to); | | | via-zinc-700 | --tw-gradient-to: rgb(63 63 70 / 0); --tw-gradient-stops: var(--tw-gradient-from), #3f3f46, var(--tw-gradient-to); | | | via-zinc-800 | --tw-gradient-to: rgb(39 39 42 / 0); --tw-gradient-stops: var(--tw-gradient-from), #27272a, var(--tw-gradient-to); | | | via-zinc-900 | --tw-gradient-to: rgb(24 24 27 / 0); --tw-gradient-stops: var(--tw-gradient-from), #18181b, var(--tw-gradient-to); | | | via-neutral-50 | --tw-gradient-to: rgb(250 250 250 / 0); --tw-gradient-stops: var(--tw-gradient-from), #fafafa, var(--tw-gradient-to); | | | via-neutral-100 | --tw-gradient-to: rgb(245 245 245 / 0); --tw-gradient-stops: var(--tw-gradient-from), #f5f5f5, var(--tw-gradient-to); | | | via-neutral-200 | --tw-gradient-to: rgb(229 229 229 / 0); --tw-gradient-stops: var(--tw-gradient-from), #e5e5e5, var(--tw-gradient-to); | | | via-neutral-300 | --tw-gradient-to: rgb(212 212 212 / 0); --tw-gradient-stops: var(--tw-gradient-from), #d4d4d4, var(--tw-gradient-to); | | | via-neutral-400 | --tw-gradient-to: rgb(163 163 163 / 0); --tw-gradient-stops: var(--tw-gradient-from), #a3a3a3, var(--tw-gradient-to); | | | via-neutral-500 | --tw-gradient-to: rgb(115 115 115 / 0); --tw-gradient-stops: var(--tw-gradient-from), #737373, var(--tw-gradient-to); | | | via-neutral-600 | --tw-gradient-to: rgb(82 82 82 / 0); --tw-gradient-stops: var(--tw-gradient-from), #525252, var(--tw-gradient-to); | | | via-neutral-700 | --tw-gradient-to: rgb(64 64 64 / 0); --tw-gradient-stops: var(--tw-gradient-from), #404040, var(--tw-gradient-to); | | | via-neutral-800 | --tw-gradient-to: rgb(38 38 38 / 0); --tw-gradient-stops: var(--tw-gradient-from), #262626, var(--tw-gradient-to); | | | via-neutral-900 | --tw-gradient-to: rgb(23 23 23 / 0); --tw-gradient-stops: var(--tw-gradient-from), #171717, var(--tw-gradient-to); | | | via-stone-50 | --tw-gradient-to: rgb(250 250 249 / 0); --tw-gradient-stops: var(--tw-gradient-from), #fafaf9, var(--tw-gradient-to); | | | via-stone-100 | --tw-gradient-to: rgb(245 245 244 / 0); --tw-gradient-stops: var(--tw-gradient-from), #f5f5f4, var(--tw-gradient-to); | | | via-stone-200 | --tw-gradient-to: rgb(231 229 228 / 0); --tw-gradient-stops: var(--tw-gradient-from), #e7e5e4, var(--tw-gradient-to); | | | via-stone-300 | --tw-gradient-to: rgb(214 211 209 / 0); --tw-gradient-stops: var(--tw-gradient-from), #d6d3d1, var(--tw-gradient-to); | | | via-stone-400 | --tw-gradient-to: rgb(168 162 158 / 0); --tw-gradient-stops: var(--tw-gradient-from), #a8a29e, var(--tw-gradient-to); | | | via-stone-500 | --tw-gradient-to: rgb(120 113 108 / 0); --tw-gradient-stops: var(--tw-gradient-from), #78716c, var(--tw-gradient-to); | | | via-stone-600 | --tw-gradient-to: rgb(87 83 78 / 0); --tw-gradient-stops: var(--tw-gradient-from), #57534e, var(--tw-gradient-to); | | | via-stone-700 | --tw-gradient-to: rgb(68 64 60 / 0); --tw-gradient-stops: var(--tw-gradient-from), #44403c, var(--tw-gradient-to); | | | via-stone-800 | --tw-gradient-to: rgb(41 37 36 / 0); --tw-gradient-stops: var(--tw-gradient-from), #292524, var(--tw-gradient-to); | | | via-stone-900 | --tw-gradient-to: rgb(28 25 23 / 0); --tw-gradient-stops: var(--tw-gradient-from), #1c1917, var(--tw-gradient-to); | | | via-red-50 | --tw-gradient-to: rgb(254 242 242 / 0); --tw-gradient-stops: var(--tw-gradient-from), #fef2f2, var(--tw-gradient-to); | | | via-red-100 | --tw-gradient-to: rgb(254 226 226 / 0); --tw-gradient-stops: var(--tw-gradient-from), #fee2e2, var(--tw-gradient-to); | | | via-red-200 | --tw-gradient-to: rgb(254 202 202 / 0); --tw-gradient-stops: var(--tw-gradient-from), #fecaca, var(--tw-gradient-to); | | | via-red-300 | --tw-gradient-to: rgb(252 165 165 / 0); --tw-gradient-stops: var(--tw-gradient-from), #fca5a5, var(--tw-gradient-to); | | | via-red-400 | --tw-gradient-to: rgb(248 113 113 / 0); --tw-gradient-stops: var(--tw-gradient-from), #f87171, var(--tw-gradient-to); | | | via-red-500 | --tw-gradient-to: rgb(239 68 68 / 0); --tw-gradient-stops: var(--tw-gradient-from), #ef4444, var(--tw-gradient-to); | | | via-red-600 | --tw-gradient-to: rgb(220 38 38 / 0); --tw-gradient-stops: var(--tw-gradient-from), #dc2626, var(--tw-gradient-to); | | | via-red-700 | --tw-gradient-to: rgb(185 28 28 / 0); --tw-gradient-stops: var(--tw-gradient-from), #b91c1c, var(--tw-gradient-to); | | | via-red-800 | --tw-gradient-to: rgb(153 27 27 / 0); --tw-gradient-stops: var(--tw-gradient-from), #991b1b, var(--tw-gradient-to); | | | via-red-900 | --tw-gradient-to: rgb(127 29 29 / 0); --tw-gradient-stops: var(--tw-gradient-from), #7f1d1d, var(--tw-gradient-to); | | | via-orange-50 | --tw-gradient-to: rgb(255 247 237 / 0); --tw-gradient-stops: var(--tw-gradient-from), #fff7ed, var(--tw-gradient-to); | | | via-orange-100 | --tw-gradient-to: rgb(255 237 213 / 0); --tw-gradient-stops: var(--tw-gradient-from), #ffedd5, var(--tw-gradient-to); | | | via-orange-200 | --tw-gradient-to: rgb(254 215 170 / 0); --tw-gradient-stops: var(--tw-gradient-from), #fed7aa, var(--tw-gradient-to); | | | via-orange-300 | --tw-gradient-to: rgb(253 186 116 / 0); --tw-gradient-stops: var(--tw-gradient-from), #fdba74, var(--tw-gradient-to); | | | via-orange-400 | --tw-gradient-to: rgb(251 146 60 / 0); --tw-gradient-stops: var(--tw-gradient-from), #fb923c, var(--tw-gradient-to); | | | via-orange-500 | --tw-gradient-to: rgb(249 115 22 / 0); --tw-gradient-stops: var(--tw-gradient-from), #f97316, var(--tw-gradient-to); | | | via-orange-600 | --tw-gradient-to: rgb(234 88 12 / 0); --tw-gradient-stops: var(--tw-gradient-from), #ea580c, var(--tw-gradient-to); | | | via-orange-700 | --tw-gradient-to: rgb(194 65 12 / 0); --tw-gradient-stops: var(--tw-gradient-from), #c2410c, var(--tw-gradient-to); | | | via-orange-800 | --tw-gradient-to: rgb(154 52 18 / 0); --tw-gradient-stops: var(--tw-gradient-from), #9a3412, var(--tw-gradient-to); | | | via-orange-900 | --tw-gradient-to: rgb(124 45 18 / 0); --tw-gradient-stops: var(--tw-gradient-from), #7c2d12, var(--tw-gradient-to); | | | via-amber-50 | --tw-gradient-to: rgb(255 251 235 / 0); --tw-gradient-stops: var(--tw-gradient-from), #fffbeb, var(--tw-gradient-to); | | | via-amber-100 | --tw-gradient-to: rgb(254 243 199 / 0); --tw-gradient-stops: var(--tw-gradient-from), #fef3c7, var(--tw-gradient-to); | | | via-amber-200 | --tw-gradient-to: rgb(253 230 138 / 0); --tw-gradient-stops: var(--tw-gradient-from), #fde68a, var(--tw-gradient-to); | | | via-amber-300 | --tw-gradient-to: rgb(252 211 77 / 0); --tw-gradient-stops: var(--tw-gradient-from), #fcd34d, var(--tw-gradient-to); | | | via-amber-400 | --tw-gradient-to: rgb(251 191 36 / 0); --tw-gradient-stops: var(--tw-gradient-from), #fbbf24, var(--tw-gradient-to); | | | via-amber-500 | --tw-gradient-to: rgb(245 158 11 / 0); --tw-gradient-stops: var(--tw-gradient-from), #f59e0b, var(--tw-gradient-to); | | | via-amber-600 | --tw-gradient-to: rgb(217 119 6 / 0); --tw-gradient-stops: var(--tw-gradient-from), #d97706, var(--tw-gradient-to); | | | via-amber-700 | --tw-gradient-to: rgb(180 83 9 / 0); --tw-gradient-stops: var(--tw-gradient-from), #b45309, var(--tw-gradient-to); | | | via-amber-800 | --tw-gradient-to: rgb(146 64 14 / 0); --tw-gradient-stops: var(--tw-gradient-from), #92400e, var(--tw-gradient-to); | | | via-amber-900 | --tw-gradient-to: rgb(120 53 15 / 0); --tw-gradient-stops: var(--tw-gradient-from), #78350f, var(--tw-gradient-to); | | | via-yellow-50 | --tw-gradient-to: rgb(254 252 232 / 0); --tw-gradient-stops: var(--tw-gradient-from), #fefce8, var(--tw-gradient-to); | | | via-yellow-100 | --tw-gradient-to: rgb(254 249 195 / 0); --tw-gradient-stops: var(--tw-gradient-from), #fef9c3, var(--tw-gradient-to); | | | via-yellow-200 | --tw-gradient-to: rgb(254 240 138 / 0); --tw-gradient-stops: var(--tw-gradient-from), #fef08a, var(--tw-gradient-to); | | | via-yellow-300 | --tw-gradient-to: rgb(253 224 71 / 0); --tw-gradient-stops: var(--tw-gradient-from), #fde047, var(--tw-gradient-to); | | | via-yellow-400 | --tw-gradient-to: rgb(250 204 21 / 0); --tw-gradient-stops: var(--tw-gradient-from), #facc15, var(--tw-gradient-to); | | | via-yellow-500 | --tw-gradient-to: rgb(234 179 8 / 0); --tw-gradient-stops: var(--tw-gradient-from), #eab308, var(--tw-gradient-to); | | | via-yellow-600 | --tw-gradient-to: rgb(202 138 4 / 0); --tw-gradient-stops: var(--tw-gradient-from), #ca8a04, var(--tw-gradient-to); | | | via-yellow-700 | --tw-gradient-to: rgb(161 98 7 / 0); --tw-gradient-stops: var(--tw-gradient-from), #a16207, var(--tw-gradient-to); | | | via-yellow-800 | --tw-gradient-to: rgb(133 77 14 / 0); --tw-gradient-stops: var(--tw-gradient-from), #854d0e, var(--tw-gradient-to); | | | via-yellow-900 | --tw-gradient-to: rgb(113 63 18 / 0); --tw-gradient-stops: var(--tw-gradient-from), #713f12, var(--tw-gradient-to); | | | via-lime-50 | --tw-gradient-to: rgb(247 254 231 / 0); --tw-gradient-stops: var(--tw-gradient-from), #f7fee7, var(--tw-gradient-to); | | | via-lime-100 | --tw-gradient-to: rgb(236 252 203 / 0); --tw-gradient-stops: var(--tw-gradient-from), #ecfccb, var(--tw-gradient-to); | | | via-lime-200 | --tw-gradient-to: rgb(217 249 157 / 0); --tw-gradient-stops: var(--tw-gradient-from), #d9f99d, var(--tw-gradient-to); | | | via-lime-300 | --tw-gradient-to: rgb(190 242 100 / 0); --tw-gradient-stops: var(--tw-gradient-from), #bef264, var(--tw-gradient-to); | | | via-lime-400 | --tw-gradient-to: rgb(163 230 53 / 0); --tw-gradient-stops: var(--tw-gradient-from), #a3e635, var(--tw-gradient-to); | | | via-lime-500 | --tw-gradient-to: rgb(132 204 22 / 0); --tw-gradient-stops: var(--tw-gradient-from), #84cc16, var(--tw-gradient-to); | | | via-lime-600 | --tw-gradient-to: rgb(101 163 13 / 0); --tw-gradient-stops: var(--tw-gradient-from), #65a30d, var(--tw-gradient-to); | | | via-lime-700 | --tw-gradient-to: rgb(77 124 15 / 0); --tw-gradient-stops: var(--tw-gradient-from), #4d7c0f, var(--tw-gradient-to); | | | via-lime-800 | --tw-gradient-to: rgb(63 98 18 / 0); --tw-gradient-stops: var(--tw-gradient-from), #3f6212, var(--tw-gradient-to); | | | via-lime-900 | --tw-gradient-to: rgb(54 83 20 / 0); --tw-gradient-stops: var(--tw-gradient-from), #365314, var(--tw-gradient-to); | | | via-green-50 | --tw-gradient-to: rgb(240 253 244 / 0); --tw-gradient-stops: var(--tw-gradient-from), #f0fdf4, var(--tw-gradient-to); | | | via-green-100 | --tw-gradient-to: rgb(220 252 231 / 0); --tw-gradient-stops: var(--tw-gradient-from), #dcfce7, var(--tw-gradient-to); | | | via-green-200 | --tw-gradient-to: rgb(187 247 208 / 0); --tw-gradient-stops: var(--tw-gradient-from), #bbf7d0, var(--tw-gradient-to); | | | via-green-300 | --tw-gradient-to: rgb(134 239 172 / 0); --tw-gradient-stops: var(--tw-gradient-from), #86efac, var(--tw-gradient-to); | | | via-green-400 | --tw-gradient-to: rgb(74 222 128 / 0); --tw-gradient-stops: var(--tw-gradient-from), #4ade80, var(--tw-gradient-to); | | | via-green-500 | --tw-gradient-to: rgb(34 197 94 / 0); --tw-gradient-stops: var(--tw-gradient-from), #22c55e, var(--tw-gradient-to); | | | via-green-600 | --tw-gradient-to: rgb(22 163 74 / 0); --tw-gradient-stops: var(--tw-gradient-from), #16a34a, var(--tw-gradient-to); | | | via-green-700 | --tw-gradient-to: rgb(21 128 61 / 0); --tw-gradient-stops: var(--tw-gradient-from), #15803d, var(--tw-gradient-to); | | | via-green-800 | --tw-gradient-to: rgb(22 101 52 / 0); --tw-gradient-stops: var(--tw-gradient-from), #166534, var(--tw-gradient-to); | | | via-green-900 | --tw-gradient-to: rgb(20 83 45 / 0); --tw-gradient-stops: var(--tw-gradient-from), #14532d, var(--tw-gradient-to); | | | via-emerald-50 | --tw-gradient-to: rgb(236 253 245 / 0); --tw-gradient-stops: var(--tw-gradient-from), #ecfdf5, var(--tw-gradient-to); | | | via-emerald-100 | --tw-gradient-to: rgb(209 250 229 / 0); --tw-gradient-stops: var(--tw-gradient-from), #d1fae5, var(--tw-gradient-to); | | | via-emerald-200 | --tw-gradient-to: rgb(167 243 208 / 0); --tw-gradient-stops: var(--tw-gradient-from), #a7f3d0, var(--tw-gradient-to); | | | via-emerald-300 | --tw-gradient-to: rgb(110 231 183 / 0); --tw-gradient-stops: var(--tw-gradient-from), #6ee7b7, var(--tw-gradient-to); | | | via-emerald-400 | --tw-gradient-to: rgb(52 211 153 / 0); --tw-gradient-stops: var(--tw-gradient-from), #34d399, var(--tw-gradient-to); | | | via-emerald-500 | --tw-gradient-to: rgb(16 185 129 / 0); --tw-gradient-stops: var(--tw-gradient-from), #10b981, var(--tw-gradient-to); | | | via-emerald-600 | --tw-gradient-to: rgb(5 150 105 / 0); --tw-gradient-stops: var(--tw-gradient-from), #059669, var(--tw-gradient-to); | | | via-emerald-700 | --tw-gradient-to: rgb(4 120 87 / 0); --tw-gradient-stops: var(--tw-gradient-from), #047857, var(--tw-gradient-to); | | | via-emerald-800 | --tw-gradient-to: rgb(6 95 70 / 0); --tw-gradient-stops: var(--tw-gradient-from), #065f46, var(--tw-gradient-to); | | | via-emerald-900 | --tw-gradient-to: rgb(6 78 59 / 0); --tw-gradient-stops: var(--tw-gradient-from), #064e3b, var(--tw-gradient-to); | | | via-teal-50 | --tw-gradient-to: rgb(240 253 250 / 0); --tw-gradient-stops: var(--tw-gradient-from), #f0fdfa, var(--tw-gradient-to); | | | via-teal-100 | --tw-gradient-to: rgb(204 251 241 / 0); --tw-gradient-stops: var(--tw-gradient-from), #ccfbf1, var(--tw-gradient-to); | | | via-teal-200 | --tw-gradient-to: rgb(153 246 228 / 0); --tw-gradient-stops: var(--tw-gradient-from), #99f6e4, var(--tw-gradient-to); | | | via-teal-300 | --tw-gradient-to: rgb(94 234 212 / 0); --tw-gradient-stops: var(--tw-gradient-from), #5eead4, var(--tw-gradient-to); | | | via-teal-400 | --tw-gradient-to: rgb(45 212 191 / 0); --tw-gradient-stops: var(--tw-gradient-from), #2dd4bf, var(--tw-gradient-to); | | | via-teal-500 | --tw-gradient-to: rgb(20 184 166 / 0); --tw-gradient-stops: var(--tw-gradient-from), #14b8a6, var(--tw-gradient-to); | | | via-teal-600 | --tw-gradient-to: rgb(13 148 136 / 0); --tw-gradient-stops: var(--tw-gradient-from), #0d9488, var(--tw-gradient-to); | | | via-teal-700 | --tw-gradient-to: rgb(15 118 110 / 0); --tw-gradient-stops: var(--tw-gradient-from), #0f766e, var(--tw-gradient-to); | | | via-teal-800 | --tw-gradient-to: rgb(17 94 89 / 0); --tw-gradient-stops: var(--tw-gradient-from), #115e59, var(--tw-gradient-to); | | | via-teal-900 | --tw-gradient-to: rgb(19 78 74 / 0); --tw-gradient-stops: var(--tw-gradient-from), #134e4a, var(--tw-gradient-to); | | | via-cyan-50 | --tw-gradient-to: rgb(236 254 255 / 0); --tw-gradient-stops: var(--tw-gradient-from), #ecfeff, var(--tw-gradient-to); | | | via-cyan-100 | --tw-gradient-to: rgb(207 250 254 / 0); --tw-gradient-stops: var(--tw-gradient-from), #cffafe, var(--tw-gradient-to); | | | via-cyan-200 | --tw-gradient-to: rgb(165 243 252 / 0); --tw-gradient-stops: var(--tw-gradient-from), #a5f3fc, var(--tw-gradient-to); | | | via-cyan-300 | --tw-gradient-to: rgb(103 232 249 / 0); --tw-gradient-stops: var(--tw-gradient-from), #67e8f9, var(--tw-gradient-to); | | | via-cyan-400 | --tw-gradient-to: rgb(34 211 238 / 0); --tw-gradient-stops: var(--tw-gradient-from), #22d3ee, var(--tw-gradient-to); | | | via-cyan-500 | --tw-gradient-to: rgb(6 182 212 / 0); --tw-gradient-stops: var(--tw-gradient-from), #06b6d4, var(--tw-gradient-to); | | | via-cyan-600 | --tw-gradient-to: rgb(8 145 178 / 0); --tw-gradient-stops: var(--tw-gradient-from), #0891b2, var(--tw-gradient-to); | | | via-cyan-700 | --tw-gradient-to: rgb(14 116 144 / 0); --tw-gradient-stops: var(--tw-gradient-from), #0e7490, var(--tw-gradient-to); | | | via-cyan-800 | --tw-gradient-to: rgb(21 94 117 / 0); --tw-gradient-stops: var(--tw-gradient-from), #155e75, var(--tw-gradient-to); | | | via-cyan-900 | --tw-gradient-to: rgb(22 78 99 / 0); --tw-gradient-stops: var(--tw-gradient-from), #164e63, var(--tw-gradient-to); | | | via-sky-50 | --tw-gradient-to: rgb(240 249 255 / 0); --tw-gradient-stops: var(--tw-gradient-from), #f0f9ff, var(--tw-gradient-to); | | | via-sky-100 | --tw-gradient-to: rgb(224 242 254 / 0); --tw-gradient-stops: var(--tw-gradient-from), #e0f2fe, var(--tw-gradient-to); | | | via-sky-200 | --tw-gradient-to: rgb(186 230 253 / 0); --tw-gradient-stops: var(--tw-gradient-from), #bae6fd, var(--tw-gradient-to); | | | via-sky-300 | --tw-gradient-to: rgb(125 211 252 / 0); --tw-gradient-stops: var(--tw-gradient-from), #7dd3fc, var(--tw-gradient-to); | | | via-sky-400 | --tw-gradient-to: rgb(56 189 248 / 0); --tw-gradient-stops: var(--tw-gradient-from), #38bdf8, var(--tw-gradient-to); | | | via-sky-500 | --tw-gradient-to: rgb(14 165 233 / 0); --tw-gradient-stops: var(--tw-gradient-from), #0ea5e9, var(--tw-gradient-to); | | | via-sky-600 | --tw-gradient-to: rgb(2 132 199 / 0); --tw-gradient-stops: var(--tw-gradient-from), #0284c7, var(--tw-gradient-to); | | | via-sky-700 | --tw-gradient-to: rgb(3 105 161 / 0); --tw-gradient-stops: var(--tw-gradient-from), #0369a1, var(--tw-gradient-to); | | | via-sky-800 | --tw-gradient-to: rgb(7 89 133 / 0); --tw-gradient-stops: var(--tw-gradient-from), #075985, var(--tw-gradient-to); | | | via-sky-900 | --tw-gradient-to: rgb(12 74 110 / 0); --tw-gradient-stops: var(--tw-gradient-from), #0c4a6e, var(--tw-gradient-to); | | | via-blue-50 | --tw-gradient-to: rgb(239 246 255 / 0); --tw-gradient-stops: var(--tw-gradient-from), #eff6ff, var(--tw-gradient-to); | | | via-blue-100 | --tw-gradient-to: rgb(219 234 254 / 0); --tw-gradient-stops: var(--tw-gradient-from), #dbeafe, var(--tw-gradient-to); | | | via-blue-200 | --tw-gradient-to: rgb(191 219 254 / 0); --tw-gradient-stops: var(--tw-gradient-from), #bfdbfe, var(--tw-gradient-to); | | | via-blue-300 | --tw-gradient-to: rgb(147 197 253 / 0); --tw-gradient-stops: var(--tw-gradient-from), #93c5fd, var(--tw-gradient-to); | | | via-blue-400 | --tw-gradient-to: rgb(96 165 250 / 0); --tw-gradient-stops: var(--tw-gradient-from), #60a5fa, var(--tw-gradient-to); | | | via-blue-500 | --tw-gradient-to: rgb(59 130 246 / 0); --tw-gradient-stops: var(--tw-gradient-from), #3b82f6, var(--tw-gradient-to); | | | via-blue-600 | --tw-gradient-to: rgb(37 99 235 / 0); --tw-gradient-stops: var(--tw-gradient-from), #2563eb, var(--tw-gradient-to); | | | via-blue-700 | --tw-gradient-to: rgb(29 78 216 / 0); --tw-gradient-stops: var(--tw-gradient-from), #1d4ed8, var(--tw-gradient-to); | | | via-blue-800 | --tw-gradient-to: rgb(30 64 175 / 0); --tw-gradient-stops: var(--tw-gradient-from), #1e40af, var(--tw-gradient-to); | | | via-blue-900 | --tw-gradient-to: rgb(30 58 138 / 0); --tw-gradient-stops: var(--tw-gradient-from), #1e3a8a, var(--tw-gradient-to); | | | via-indigo-50 | --tw-gradient-to: rgb(238 242 255 / 0); --tw-gradient-stops: var(--tw-gradient-from), #eef2ff, var(--tw-gradient-to); | | | via-indigo-100 | --tw-gradient-to: rgb(224 231 255 / 0); --tw-gradient-stops: var(--tw-gradient-from), #e0e7ff, var(--tw-gradient-to); | | | via-indigo-200 | --tw-gradient-to: rgb(199 210 254 / 0); --tw-gradient-stops: var(--tw-gradient-from), #c7d2fe, var(--tw-gradient-to); | | | via-indigo-300 | --tw-gradient-to: rgb(165 180 252 / 0); --tw-gradient-stops: var(--tw-gradient-from), #a5b4fc, var(--tw-gradient-to); | | | via-indigo-400 | --tw-gradient-to: rgb(129 140 248 / 0); --tw-gradient-stops: var(--tw-gradient-from), #818cf8, var(--tw-gradient-to); | | | via-indigo-500 | --tw-gradient-to: rgb(99 102 241 / 0); --tw-gradient-stops: var(--tw-gradient-from), #6366f1, var(--tw-gradient-to); | | | via-indigo-600 | --tw-gradient-to: rgb(79 70 229 / 0); --tw-gradient-stops: var(--tw-gradient-from), #4f46e5, var(--tw-gradient-to); | | | via-indigo-700 | --tw-gradient-to: rgb(67 56 202 / 0); --tw-gradient-stops: var(--tw-gradient-from), #4338ca, var(--tw-gradient-to); | | | via-indigo-800 | --tw-gradient-to: rgb(55 48 163 / 0); --tw-gradient-stops: var(--tw-gradient-from), #3730a3, var(--tw-gradient-to); | | | via-indigo-900 | --tw-gradient-to: rgb(49 46 129 / 0); --tw-gradient-stops: var(--tw-gradient-from), #312e81, var(--tw-gradient-to); | | | via-violet-50 | --tw-gradient-to: rgb(245 243 255 / 0); --tw-gradient-stops: var(--tw-gradient-from), #f5f3ff, var(--tw-gradient-to); | | | via-violet-100 | --tw-gradient-to: rgb(237 233 254 / 0); --tw-gradient-stops: var(--tw-gradient-from), #ede9fe, var(--tw-gradient-to); | | | via-violet-200 | --tw-gradient-to: rgb(221 214 254 / 0); --tw-gradient-stops: var(--tw-gradient-from), #ddd6fe, var(--tw-gradient-to); | | | via-violet-300 | --tw-gradient-to: rgb(196 181 253 / 0); --tw-gradient-stops: var(--tw-gradient-from), #c4b5fd, var(--tw-gradient-to); | | | via-violet-400 | --tw-gradient-to: rgb(167 139 250 / 0); --tw-gradient-stops: var(--tw-gradient-from), #a78bfa, var(--tw-gradient-to); | | | via-violet-500 | --tw-gradient-to: rgb(139 92 246 / 0); --tw-gradient-stops: var(--tw-gradient-from), #8b5cf6, var(--tw-gradient-to); | | | via-violet-600 | --tw-gradient-to: rgb(124 58 237 / 0); --tw-gradient-stops: var(--tw-gradient-from), #7c3aed, var(--tw-gradient-to); | | | via-violet-700 | --tw-gradient-to: rgb(109 40 217 / 0); --tw-gradient-stops: var(--tw-gradient-from), #6d28d9, var(--tw-gradient-to); | | | via-violet-800 | --tw-gradient-to: rgb(91 33 182 / 0); --tw-gradient-stops: var(--tw-gradient-from), #5b21b6, var(--tw-gradient-to); | | | via-violet-900 | --tw-gradient-to: rgb(76 29 149 / 0); --tw-gradient-stops: var(--tw-gradient-from), #4c1d95, var(--tw-gradient-to); | | | via-purple-50 | --tw-gradient-to: rgb(250 245 255 / 0); --tw-gradient-stops: var(--tw-gradient-from), #faf5ff, var(--tw-gradient-to); | | | via-purple-100 | --tw-gradient-to: rgb(243 232 255 / 0); --tw-gradient-stops: var(--tw-gradient-from), #f3e8ff, var(--tw-gradient-to); | | | via-purple-200 | --tw-gradient-to: rgb(233 213 255 / 0); --tw-gradient-stops: var(--tw-gradient-from), #e9d5ff, var(--tw-gradient-to); | | | via-purple-300 | --tw-gradient-to: rgb(216 180 254 / 0); --tw-gradient-stops: var(--tw-gradient-from), #d8b4fe, var(--tw-gradient-to); | | | via-purple-400 | --tw-gradient-to: rgb(192 132 252 / 0); --tw-gradient-stops: var(--tw-gradient-from), #c084fc, var(--tw-gradient-to); | | | via-purple-500 | --tw-gradient-to: rgb(168 85 247 / 0); --tw-gradient-stops: var(--tw-gradient-from), #a855f7, var(--tw-gradient-to); | | | via-purple-600 | --tw-gradient-to: rgb(147 51 234 / 0); --tw-gradient-stops: var(--tw-gradient-from), #9333ea, var(--tw-gradient-to); | | | via-purple-700 | --tw-gradient-to: rgb(126 34 206 / 0); --tw-gradient-stops: var(--tw-gradient-from), #7e22ce, var(--tw-gradient-to); | | | via-purple-800 | --tw-gradient-to: rgb(107 33 168 / 0); --tw-gradient-stops: var(--tw-gradient-from), #6b21a8, var(--tw-gradient-to); | | | via-purple-900 | --tw-gradient-to: rgb(88 28 135 / 0); --tw-gradient-stops: var(--tw-gradient-from), #581c87, var(--tw-gradient-to); | | | via-fuchsia-50 | --tw-gradient-to: rgb(253 244 255 / 0); --tw-gradient-stops: var(--tw-gradient-from), #fdf4ff, var(--tw-gradient-to); | | | via-fuchsia-100 | --tw-gradient-to: rgb(250 232 255 / 0); --tw-gradient-stops: var(--tw-gradient-from), #fae8ff, var(--tw-gradient-to); | | | via-fuchsia-200 | --tw-gradient-to: rgb(245 208 254 / 0); --tw-gradient-stops: var(--tw-gradient-from), #f5d0fe, var(--tw-gradient-to); | | | via-fuchsia-300 | --tw-gradient-to: rgb(240 171 252 / 0); --tw-gradient-stops: var(--tw-gradient-from), #f0abfc, var(--tw-gradient-to); | | | via-fuchsia-400 | --tw-gradient-to: rgb(232 121 249 / 0); --tw-gradient-stops: var(--tw-gradient-from), #e879f9, var(--tw-gradient-to); | | | via-fuchsia-500 | --tw-gradient-to: rgb(217 70 239 / 0); --tw-gradient-stops: var(--tw-gradient-from), #d946ef, var(--tw-gradient-to); | | | via-fuchsia-600 | --tw-gradient-to: rgb(192 38 211 / 0); --tw-gradient-stops: var(--tw-gradient-from), #c026d3, var(--tw-gradient-to); | | | via-fuchsia-700 | --tw-gradient-to: rgb(162 28 175 / 0); --tw-gradient-stops: var(--tw-gradient-from), #a21caf, var(--tw-gradient-to); | | | via-fuchsia-800 | --tw-gradient-to: rgb(134 25 143 / 0); --tw-gradient-stops: var(--tw-gradient-from), #86198f, var(--tw-gradient-to); | | | via-fuchsia-900 | --tw-gradient-to: rgb(112 26 117 / 0); --tw-gradient-stops: var(--tw-gradient-from), #701a75, var(--tw-gradient-to); | | | via-pink-50 | --tw-gradient-to: rgb(253 242 248 / 0); --tw-gradient-stops: var(--tw-gradient-from), #fdf2f8, var(--tw-gradient-to); | | | via-pink-100 | --tw-gradient-to: rgb(252 231 243 / 0); --tw-gradient-stops: var(--tw-gradient-from), #fce7f3, var(--tw-gradient-to); | | | via-pink-200 | --tw-gradient-to: rgb(251 207 232 / 0); --tw-gradient-stops: var(--tw-gradient-from), #fbcfe8, var(--tw-gradient-to); | | | via-pink-300 | --tw-gradient-to: rgb(249 168 212 / 0); --tw-gradient-stops: var(--tw-gradient-from), #f9a8d4, var(--tw-gradient-to); | | | via-pink-400 | --tw-gradient-to: rgb(244 114 182 / 0); --tw-gradient-stops: var(--tw-gradient-from), #f472b6, var(--tw-gradient-to); | | | via-pink-500 | --tw-gradient-to: rgb(236 72 153 / 0); --tw-gradient-stops: var(--tw-gradient-from), #ec4899, var(--tw-gradient-to); | | | via-pink-600 | --tw-gradient-to: rgb(219 39 119 / 0); --tw-gradient-stops: var(--tw-gradient-from), #db2777, var(--tw-gradient-to); | | | via-pink-700 | --tw-gradient-to: rgb(190 24 93 / 0); --tw-gradient-stops: var(--tw-gradient-from), #be185d, var(--tw-gradient-to); | | | via-pink-800 | --tw-gradient-to: rgb(157 23 77 / 0); --tw-gradient-stops: var(--tw-gradient-from), #9d174d, var(--tw-gradient-to); | | | via-pink-900 | --tw-gradient-to: rgb(131 24 67 / 0); --tw-gradient-stops: var(--tw-gradient-from), #831843, var(--tw-gradient-to); | | | via-rose-50 | --tw-gradient-to: rgb(255 241 242 / 0); --tw-gradient-stops: var(--tw-gradient-from), #fff1f2, var(--tw-gradient-to); | | | via-rose-100 | --tw-gradient-to: rgb(255 228 230 / 0); --tw-gradient-stops: var(--tw-gradient-from), #ffe4e6, var(--tw-gradient-to); | | | via-rose-200 | --tw-gradient-to: rgb(254 205 211 / 0); --tw-gradient-stops: var(--tw-gradient-from), #fecdd3, var(--tw-gradient-to); | | | via-rose-300 | --tw-gradient-to: rgb(253 164 175 / 0); --tw-gradient-stops: var(--tw-gradient-from), #fda4af, var(--tw-gradient-to); | | | via-rose-400 | --tw-gradient-to: rgb(251 113 133 / 0); --tw-gradient-stops: var(--tw-gradient-from), #fb7185, var(--tw-gradient-to); | | | via-rose-500 | --tw-gradient-to: rgb(244 63 94 / 0); --tw-gradient-stops: var(--tw-gradient-from), #f43f5e, var(--tw-gradient-to); | | | via-rose-600 | --tw-gradient-to: rgb(225 29 72 / 0); --tw-gradient-stops: var(--tw-gradient-from), #e11d48, var(--tw-gradient-to); | | | via-rose-700 | --tw-gradient-to: rgb(190 18 60 / 0); --tw-gradient-stops: var(--tw-gradient-from), #be123c, var(--tw-gradient-to); | | | via-rose-800 | --tw-gradient-to: rgb(159 18 57 / 0); --tw-gradient-stops: var(--tw-gradient-from), #9f1239, var(--tw-gradient-to); | | | via-rose-900 | --tw-gradient-to: rgb(136 19 55 / 0); --tw-gradient-stops: var(--tw-gradient-from), #881337, var(--tw-gradient-to); | | | to-inherit | --tw-gradient-to: inherit; | | | to-current | --tw-gradient-to: currentColor; | | | to-transparent | --tw-gradient-to: transparent; | | | to-black | --tw-gradient-to: #000; | | | to-white | --tw-gradient-to: #fff; | | | to-slate-50 | --tw-gradient-to: #f8fafc; | | | to-slate-100 | --tw-gradient-to: #f1f5f9; | | | to-slate-200 | --tw-gradient-to: #e2e8f0; | | | to-slate-300 | --tw-gradient-to: #cbd5e1; | | | to-slate-400 | --tw-gradient-to: #94a3b8; | | | to-slate-500 | --tw-gradient-to: #64748b; | | | to-slate-600 | --tw-gradient-to: #475569; | | | to-slate-700 | --tw-gradient-to: #334155; | | | to-slate-800 | --tw-gradient-to: #1e293b; | | | to-slate-900 | --tw-gradient-to: #0f172a; | | | to-gray-50 | --tw-gradient-to: #f9fafb; | | | to-gray-100 | --tw-gradient-to: #f3f4f6; | | | to-gray-200 | --tw-gradient-to: #e5e7eb; | | | to-gray-300 | --tw-gradient-to: #d1d5db; | | | to-gray-400 | --tw-gradient-to: #9ca3af; | | | to-gray-500 | --tw-gradient-to: #6b7280; | | | to-gray-600 | --tw-gradient-to: #4b5563; | | | to-gray-700 | --tw-gradient-to: #374151; | | | to-gray-800 | --tw-gradient-to: #1f2937; | | | to-gray-900 | --tw-gradient-to: #111827; | | | to-zinc-50 | --tw-gradient-to: #fafafa; | | | to-zinc-100 | --tw-gradient-to: #f4f4f5; | | | to-zinc-200 | --tw-gradient-to: #e4e4e7; | | | to-zinc-300 | --tw-gradient-to: #d4d4d8; | | | to-zinc-400 | --tw-gradient-to: #a1a1aa; | | | to-zinc-500 | --tw-gradient-to: #71717a; | | | to-zinc-600 | --tw-gradient-to: #52525b; | | | to-zinc-700 | --tw-gradient-to: #3f3f46; | | | to-zinc-800 | --tw-gradient-to: #27272a; | | | to-zinc-900 | --tw-gradient-to: #18181b; | | | to-neutral-50 | --tw-gradient-to: #fafafa; | | | to-neutral-100 | --tw-gradient-to: #f5f5f5; | | | to-neutral-200 | --tw-gradient-to: #e5e5e5; | | | to-neutral-300 | --tw-gradient-to: #d4d4d4; | | | to-neutral-400 | --tw-gradient-to: #a3a3a3; | | | to-neutral-500 | --tw-gradient-to: #737373; | | | to-neutral-600 | --tw-gradient-to: #525252; | | | to-neutral-700 | --tw-gradient-to: #404040; | | | to-neutral-800 | --tw-gradient-to: #262626; | | | to-neutral-900 | --tw-gradient-to: #171717; | | | to-stone-50 | --tw-gradient-to: #fafaf9; | | | to-stone-100 | --tw-gradient-to: #f5f5f4; | | | to-stone-200 | --tw-gradient-to: #e7e5e4; | | | to-stone-300 | --tw-gradient-to: #d6d3d1; | | | to-stone-400 | --tw-gradient-to: #a8a29e; | | | to-stone-500 | --tw-gradient-to: #78716c; | | | to-stone-600 | --tw-gradient-to: #57534e; | | | to-stone-700 | --tw-gradient-to: #44403c; | | | to-stone-800 | --tw-gradient-to: #292524; | | | to-stone-900 | --tw-gradient-to: #1c1917; | | | to-red-50 | --tw-gradient-to: #fef2f2; | | | to-red-100 | --tw-gradient-to: #fee2e2; | | | to-red-200 | --tw-gradient-to: #fecaca; | | | to-red-300 | --tw-gradient-to: #fca5a5; | | | to-red-400 | --tw-gradient-to: #f87171; | | | to-red-500 | --tw-gradient-to: #ef4444; | | | to-red-600 | --tw-gradient-to: #dc2626; | | | to-red-700 | --tw-gradient-to: #b91c1c; | | | to-red-800 | --tw-gradient-to: #991b1b; | | | to-red-900 | --tw-gradient-to: #7f1d1d; | | | to-orange-50 | --tw-gradient-to: #fff7ed; | | | to-orange-100 | --tw-gradient-to: #ffedd5; | | | to-orange-200 | --tw-gradient-to: #fed7aa; | | | to-orange-300 | --tw-gradient-to: #fdba74; | | | to-orange-400 | --tw-gradient-to: #fb923c; | | | to-orange-500 | --tw-gradient-to: #f97316; | | | to-orange-600 | --tw-gradient-to: #ea580c; | | | to-orange-700 | --tw-gradient-to: #c2410c; | | | to-orange-800 | --tw-gradient-to: #9a3412; | | | to-orange-900 | --tw-gradient-to: #7c2d12; | | | to-amber-50 | --tw-gradient-to: #fffbeb; | | | to-amber-100 | --tw-gradient-to: #fef3c7; | | | to-amber-200 | --tw-gradient-to: #fde68a; | | | to-amber-300 | --tw-gradient-to: #fcd34d; | | | to-amber-400 | --tw-gradient-to: #fbbf24; | | | to-amber-500 | --tw-gradient-to: #f59e0b; | | | to-amber-600 | --tw-gradient-to: #d97706; | | | to-amber-700 | --tw-gradient-to: #b45309; | | | to-amber-800 | --tw-gradient-to: #92400e; | | | to-amber-900 | --tw-gradient-to: #78350f; | | | to-yellow-50 | --tw-gradient-to: #fefce8; | | | to-yellow-100 | --tw-gradient-to: #fef9c3; | | | to-yellow-200 | --tw-gradient-to: #fef08a; | | | to-yellow-300 | --tw-gradient-to: #fde047; | | | to-yellow-400 | --tw-gradient-to: #facc15; | | | to-yellow-500 | --tw-gradient-to: #eab308; | | | to-yellow-600 | --tw-gradient-to: #ca8a04; | | | to-yellow-700 | --tw-gradient-to: #a16207; | | | to-yellow-800 | --tw-gradient-to: #854d0e; | | | to-yellow-900 | --tw-gradient-to: #713f12; | | | to-lime-50 | --tw-gradient-to: #f7fee7; | | | to-lime-100 | --tw-gradient-to: #ecfccb; | | | to-lime-200 | --tw-gradient-to: #d9f99d; | | | to-lime-300 | --tw-gradient-to: #bef264; | | | to-lime-400 | --tw-gradient-to: #a3e635; | | | to-lime-500 | --tw-gradient-to: #84cc16; | | | to-lime-600 | --tw-gradient-to: #65a30d; | | | to-lime-700 | --tw-gradient-to: #4d7c0f; | | | to-lime-800 | --tw-gradient-to: #3f6212; | | | to-lime-900 | --tw-gradient-to: #365314; | | | to-green-50 | --tw-gradient-to: #f0fdf4; | | | to-green-100 | --tw-gradient-to: #dcfce7; | | | to-green-200 | --tw-gradient-to: #bbf7d0; | | | to-green-300 | --tw-gradient-to: #86efac; | | | to-green-400 | --tw-gradient-to: #4ade80; | | | to-green-500 | --tw-gradient-to: #22c55e; | | | to-green-600 | --tw-gradient-to: #16a34a; | | | to-green-700 | --tw-gradient-to: #15803d; | | | to-green-800 | --tw-gradient-to: #166534; | | | to-green-900 | --tw-gradient-to: #14532d; | | | to-emerald-50 | --tw-gradient-to: #ecfdf5; | | | to-emerald-100 | --tw-gradient-to: #d1fae5; | | | to-emerald-200 | --tw-gradient-to: #a7f3d0; | | | to-emerald-300 | --tw-gradient-to: #6ee7b7; | | | to-emerald-400 | --tw-gradient-to: #34d399; | | | to-emerald-500 | --tw-gradient-to: #10b981; | | | to-emerald-600 | --tw-gradient-to: #059669; | | | to-emerald-700 | --tw-gradient-to: #047857; | | | to-emerald-800 | --tw-gradient-to: #065f46; | | | to-emerald-900 | --tw-gradient-to: #064e3b; | | | to-teal-50 | --tw-gradient-to: #f0fdfa; | | | to-teal-100 | --tw-gradient-to: #ccfbf1; | | | to-teal-200 | --tw-gradient-to: #99f6e4; | | | to-teal-300 | --tw-gradient-to: #5eead4; | | | to-teal-400 | --tw-gradient-to: #2dd4bf; | | | to-teal-500 | --tw-gradient-to: #14b8a6; | | | to-teal-600 | --tw-gradient-to: #0d9488; | | | to-teal-700 | --tw-gradient-to: #0f766e; | | | to-teal-800 | --tw-gradient-to: #115e59; | | | to-teal-900 | --tw-gradient-to: #134e4a; | | | to-cyan-50 | --tw-gradient-to: #ecfeff; | | | to-cyan-100 | --tw-gradient-to: #cffafe; | | | to-cyan-200 | --tw-gradient-to: #a5f3fc; | | | to-cyan-300 | --tw-gradient-to: #67e8f9; | | | to-cyan-400 | --tw-gradient-to: #22d3ee; | | | to-cyan-500 | --tw-gradient-to: #06b6d4; | | | to-cyan-600 | --tw-gradient-to: #0891b2; | | | to-cyan-700 | --tw-gradient-to: #0e7490; | | | to-cyan-800 | --tw-gradient-to: #155e75; | | | to-cyan-900 | --tw-gradient-to: #164e63; | | | to-sky-50 | --tw-gradient-to: #f0f9ff; | | | to-sky-100 | --tw-gradient-to: #e0f2fe; | | | to-sky-200 | --tw-gradient-to: #bae6fd; | | | to-sky-300 | --tw-gradient-to: #7dd3fc; | | | to-sky-400 | --tw-gradient-to: #38bdf8; | | | to-sky-500 | --tw-gradient-to: #0ea5e9; | | | to-sky-600 | --tw-gradient-to: #0284c7; | | | to-sky-700 | --tw-gradient-to: #0369a1; | | | to-sky-800 | --tw-gradient-to: #075985; | | | to-sky-900 | --tw-gradient-to: #0c4a6e; | | | to-blue-50 | --tw-gradient-to: #eff6ff; | | | to-blue-100 | --tw-gradient-to: #dbeafe; | | | to-blue-200 | --tw-gradient-to: #bfdbfe; | | | to-blue-300 | --tw-gradient-to: #93c5fd; | | | to-blue-400 | --tw-gradient-to: #60a5fa; | | | to-blue-500 | --tw-gradient-to: #3b82f6; | | | to-blue-600 | --tw-gradient-to: #2563eb; | | | to-blue-700 | --tw-gradient-to: #1d4ed8; | | | to-blue-800 | --tw-gradient-to: #1e40af; | | | to-blue-900 | --tw-gradient-to: #1e3a8a; | | | to-indigo-50 | --tw-gradient-to: #eef2ff; | | | to-indigo-100 | --tw-gradient-to: #e0e7ff; | | | to-indigo-200 | --tw-gradient-to: #c7d2fe; | | | to-indigo-300 | --tw-gradient-to: #a5b4fc; | | | to-indigo-400 | --tw-gradient-to: #818cf8; | | | to-indigo-500 | --tw-gradient-to: #6366f1; | | | to-indigo-600 | --tw-gradient-to: #4f46e5; | | | to-indigo-700 | --tw-gradient-to: #4338ca; | | | to-indigo-800 | --tw-gradient-to: #3730a3; | | | to-indigo-900 | --tw-gradient-to: #312e81; | | | to-violet-50 | --tw-gradient-to: #f5f3ff; | | | to-violet-100 | --tw-gradient-to: #ede9fe; | | | to-violet-200 | --tw-gradient-to: #ddd6fe; | | | to-violet-300 | --tw-gradient-to: #c4b5fd; | | | to-violet-400 | --tw-gradient-to: #a78bfa; | | | to-violet-500 | --tw-gradient-to: #8b5cf6; | | | to-violet-600 | --tw-gradient-to: #7c3aed; | | | to-violet-700 | --tw-gradient-to: #6d28d9; | | | to-violet-800 | --tw-gradient-to: #5b21b6; | | | to-violet-900 | --tw-gradient-to: #4c1d95; | | | to-purple-50 | --tw-gradient-to: #faf5ff; | | | to-purple-100 | --tw-gradient-to: #f3e8ff; | | | to-purple-200 | --tw-gradient-to: #e9d5ff; | | | to-purple-300 | --tw-gradient-to: #d8b4fe; | | | to-purple-400 | --tw-gradient-to: #c084fc; | | | to-purple-500 | --tw-gradient-to: #a855f7; | | | to-purple-600 | --tw-gradient-to: #9333ea; | | | to-purple-700 | --tw-gradient-to: #7e22ce; | | | to-purple-800 | --tw-gradient-to: #6b21a8; | | | to-purple-900 | --tw-gradient-to: #581c87; | | | to-fuchsia-50 | --tw-gradient-to: #fdf4ff; | | | to-fuchsia-100 | --tw-gradient-to: #fae8ff; | | | to-fuchsia-200 | --tw-gradient-to: #f5d0fe; | | | to-fuchsia-300 | --tw-gradient-to: #f0abfc; | | | to-fuchsia-400 | --tw-gradient-to: #e879f9; | | | to-fuchsia-500 | --tw-gradient-to: #d946ef; | | | to-fuchsia-600 | --tw-gradient-to: #c026d3; | | | to-fuchsia-700 | --tw-gradient-to: #a21caf; | | | to-fuchsia-800 | --tw-gradient-to: #86198f; | | | to-fuchsia-900 | --tw-gradient-to: #701a75; | | | to-pink-50 | --tw-gradient-to: #fdf2f8; | | | to-pink-100 | --tw-gradient-to: #fce7f3; | | | to-pink-200 | --tw-gradient-to: #fbcfe8; | | | to-pink-300 | --tw-gradient-to: #f9a8d4; | | | to-pink-400 | --tw-gradient-to: #f472b6; | | | to-pink-500 | --tw-gradient-to: #ec4899; | | | to-pink-600 | --tw-gradient-to: #db2777; | | | to-pink-700 | --tw-gradient-to: #be185d; | | | to-pink-800 | --tw-gradient-to: #9d174d; | | | to-pink-900 | --tw-gradient-to: #831843; | | | to-rose-50 | --tw-gradient-to: #fff1f2; | | | to-rose-100 | --tw-gradient-to: #ffe4e6; | | | to-rose-200 | --tw-gradient-to: #fecdd3; | | | to-rose-300 | --tw-gradient-to: #fda4af; | | | to-rose-400 | --tw-gradient-to: #fb7185; | | | to-rose-500 | --tw-gradient-to: #f43f5e; | | | to-rose-600 | --tw-gradient-to: #e11d48; | | | to-rose-700 | --tw-gradient-to: #be123c; | | | to-rose-800 | --tw-gradient-to: #9f1239; | | | to-rose-900 | --tw-gradient-to: #881337; | | Basic usage ----------- ### Starting color Set the starting color of a gradient using the `from-{color}` utilities. ``` <div class="bg-gradient-to-r from-indigo-500 ..."></div> ``` ### Ending color Set the ending color of a gradient using the `to-{color}` utilities. ``` <div class="bg-gradient-to-r from-cyan-500 to-blue-500 ..."></div> ``` Gradients to **do not** fade in from transparent by default. To fade in from transparent, reverse the gradient direction and use a `from-{color}` utility. ### Middle color Add a middle color to a gradient using the `via-{color}` utilities. ``` <div class="bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500 ..."></div> ``` Gradients with a `from-{color}` and `via-{color}` will fade out to transparent by default if no `to-{color}` is present. ### Fading to transparent Gradients fade out to transparent by default, without requiring you to add `to-transparent` explicitly. Tailwind intelligently calculates the *right* “transparent” value to use based on the starting color to avoid [a bug in Safari < 15.4](https://bugs.webkit.org/show_bug.cgi?id=150940) that causes fading to simply the `transparent` keyword to fade through gray, which just looks awful. Don't add `to-transparent` explicitly ``` <div class="bg-gradient-to-r from-blue-500 to-transparent"> <!-- ... --> </div> ``` Only specify a from color and fade to transparent automatically ``` <div class="bg-gradient-to-r from-blue-500"> <!-- ... --> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:from-pink-500` to only apply the `from-pink-500` utility on hover. ``` <button type="button" class="bg-gradient-to-r from-green-400 to-blue-500 hover:from-pink-500 hover:to-yellow-500 ..."> Hover me </button> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:from-yellow-500` to apply the `from-yellow-500` utility at only medium screen sizes and above. ``` <div class="bg-gradient-to-r from-purple-400 md:from-yellow-500"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind makes the entire [default color palette](customizing-colors#default-color-palette) available as gradient colors. You can [customize your color palette](/docs/customizing-colors#customizing) by editing `theme.colors` or `theme.extend.colors` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { colors: { 'regal-blue': '#243c5a', }, } } } ``` Alternatively, you can customize just your gradient colors by editing `theme.gradientColorStops` or `theme.extend.gradientColorStops` in your `tailwind.config.js` file. Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `from|via|to-{color}` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="from-[#243c5a]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation.
programming_docs
tailwindcss Grid Auto Flow Quick reference --------------- | Class | Properties | | --- | --- | | grid-flow-row | grid-auto-flow: row; | | grid-flow-col | grid-auto-flow: column; | | grid-flow-dense | grid-auto-flow: dense; | | grid-flow-row-dense | grid-auto-flow: row dense; | | grid-flow-col-dense | grid-auto-flow: column dense; | Basic usage ----------- ### Controlling grid element placement Use the `grid-flow-{keyword}` utilities to control how the auto-placement algorithm works for a grid layout. ``` <div class="grid grid-flow-row-dense grid-cols-3 grid-rows-3 ..."> <div class="col-span-2">01</div> <div class="col-span-2">02</div> <div>03</div> <div>04</div> <div>05</div> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:grid-flow-row` to only apply the `grid-flow-row` utility on hover. ``` <div class="grid grid-flow-col hover:grid-flow-row"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:grid-flow-row` to apply the `grid-flow-row` utility at only medium screen sizes and above. ``` <div class="grid grid-flow-col md:grid-flow-row"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Divide Color Quick reference --------------- | Class | Properties | Preview | | --- | --- | --- | | divide-inherit > \* + \* | border-color: inherit; | | | divide-current > \* + \* | border-color: currentColor; | | | divide-transparent > \* + \* | border-color: transparent; | | | divide-black > \* + \* | border-color: rgb(0 0 0); | | | divide-white > \* + \* | border-color: rgb(255 255 255); | | | divide-slate-50 > \* + \* | border-color: rgb(248 250 252); | | | divide-slate-100 > \* + \* | border-color: rgb(241 245 249); | | | divide-slate-200 > \* + \* | border-color: rgb(226 232 240); | | | divide-slate-300 > \* + \* | border-color: rgb(203 213 225); | | | divide-slate-400 > \* + \* | border-color: rgb(148 163 184); | | | divide-slate-500 > \* + \* | border-color: rgb(100 116 139); | | | divide-slate-600 > \* + \* | border-color: rgb(71 85 105); | | | divide-slate-700 > \* + \* | border-color: rgb(51 65 85); | | | divide-slate-800 > \* + \* | border-color: rgb(30 41 59); | | | divide-slate-900 > \* + \* | border-color: rgb(15 23 42); | | | divide-gray-50 > \* + \* | border-color: rgb(249 250 251); | | | divide-gray-100 > \* + \* | border-color: rgb(243 244 246); | | | divide-gray-200 > \* + \* | border-color: rgb(229 231 235); | | | divide-gray-300 > \* + \* | border-color: rgb(209 213 219); | | | divide-gray-400 > \* + \* | border-color: rgb(156 163 175); | | | divide-gray-500 > \* + \* | border-color: rgb(107 114 128); | | | divide-gray-600 > \* + \* | border-color: rgb(75 85 99); | | | divide-gray-700 > \* + \* | border-color: rgb(55 65 81); | | | divide-gray-800 > \* + \* | border-color: rgb(31 41 55); | | | divide-gray-900 > \* + \* | border-color: rgb(17 24 39); | | | divide-zinc-50 > \* + \* | border-color: rgb(250 250 250); | | | divide-zinc-100 > \* + \* | border-color: rgb(244 244 245); | | | divide-zinc-200 > \* + \* | border-color: rgb(228 228 231); | | | divide-zinc-300 > \* + \* | border-color: rgb(212 212 216); | | | divide-zinc-400 > \* + \* | border-color: rgb(161 161 170); | | | divide-zinc-500 > \* + \* | border-color: rgb(113 113 122); | | | divide-zinc-600 > \* + \* | border-color: rgb(82 82 91); | | | divide-zinc-700 > \* + \* | border-color: rgb(63 63 70); | | | divide-zinc-800 > \* + \* | border-color: rgb(39 39 42); | | | divide-zinc-900 > \* + \* | border-color: rgb(24 24 27); | | | divide-neutral-50 > \* + \* | border-color: rgb(250 250 250); | | | divide-neutral-100 > \* + \* | border-color: rgb(245 245 245); | | | divide-neutral-200 > \* + \* | border-color: rgb(229 229 229); | | | divide-neutral-300 > \* + \* | border-color: rgb(212 212 212); | | | divide-neutral-400 > \* + \* | border-color: rgb(163 163 163); | | | divide-neutral-500 > \* + \* | border-color: rgb(115 115 115); | | | divide-neutral-600 > \* + \* | border-color: rgb(82 82 82); | | | divide-neutral-700 > \* + \* | border-color: rgb(64 64 64); | | | divide-neutral-800 > \* + \* | border-color: rgb(38 38 38); | | | divide-neutral-900 > \* + \* | border-color: rgb(23 23 23); | | | divide-stone-50 > \* + \* | border-color: rgb(250 250 249); | | | divide-stone-100 > \* + \* | border-color: rgb(245 245 244); | | | divide-stone-200 > \* + \* | border-color: rgb(231 229 228); | | | divide-stone-300 > \* + \* | border-color: rgb(214 211 209); | | | divide-stone-400 > \* + \* | border-color: rgb(168 162 158); | | | divide-stone-500 > \* + \* | border-color: rgb(120 113 108); | | | divide-stone-600 > \* + \* | border-color: rgb(87 83 78); | | | divide-stone-700 > \* + \* | border-color: rgb(68 64 60); | | | divide-stone-800 > \* + \* | border-color: rgb(41 37 36); | | | divide-stone-900 > \* + \* | border-color: rgb(28 25 23); | | | divide-red-50 > \* + \* | border-color: rgb(254 242 242); | | | divide-red-100 > \* + \* | border-color: rgb(254 226 226); | | | divide-red-200 > \* + \* | border-color: rgb(254 202 202); | | | divide-red-300 > \* + \* | border-color: rgb(252 165 165); | | | divide-red-400 > \* + \* | border-color: rgb(248 113 113); | | | divide-red-500 > \* + \* | border-color: rgb(239 68 68); | | | divide-red-600 > \* + \* | border-color: rgb(220 38 38); | | | divide-red-700 > \* + \* | border-color: rgb(185 28 28); | | | divide-red-800 > \* + \* | border-color: rgb(153 27 27); | | | divide-red-900 > \* + \* | border-color: rgb(127 29 29); | | | divide-orange-50 > \* + \* | border-color: rgb(255 247 237); | | | divide-orange-100 > \* + \* | border-color: rgb(255 237 213); | | | divide-orange-200 > \* + \* | border-color: rgb(254 215 170); | | | divide-orange-300 > \* + \* | border-color: rgb(253 186 116); | | | divide-orange-400 > \* + \* | border-color: rgb(251 146 60); | | | divide-orange-500 > \* + \* | border-color: rgb(249 115 22); | | | divide-orange-600 > \* + \* | border-color: rgb(234 88 12); | | | divide-orange-700 > \* + \* | border-color: rgb(194 65 12); | | | divide-orange-800 > \* + \* | border-color: rgb(154 52 18); | | | divide-orange-900 > \* + \* | border-color: rgb(124 45 18); | | | divide-amber-50 > \* + \* | border-color: rgb(255 251 235); | | | divide-amber-100 > \* + \* | border-color: rgb(254 243 199); | | | divide-amber-200 > \* + \* | border-color: rgb(253 230 138); | | | divide-amber-300 > \* + \* | border-color: rgb(252 211 77); | | | divide-amber-400 > \* + \* | border-color: rgb(251 191 36); | | | divide-amber-500 > \* + \* | border-color: rgb(245 158 11); | | | divide-amber-600 > \* + \* | border-color: rgb(217 119 6); | | | divide-amber-700 > \* + \* | border-color: rgb(180 83 9); | | | divide-amber-800 > \* + \* | border-color: rgb(146 64 14); | | | divide-amber-900 > \* + \* | border-color: rgb(120 53 15); | | | divide-yellow-50 > \* + \* | border-color: rgb(254 252 232); | | | divide-yellow-100 > \* + \* | border-color: rgb(254 249 195); | | | divide-yellow-200 > \* + \* | border-color: rgb(254 240 138); | | | divide-yellow-300 > \* + \* | border-color: rgb(253 224 71); | | | divide-yellow-400 > \* + \* | border-color: rgb(250 204 21); | | | divide-yellow-500 > \* + \* | border-color: rgb(234 179 8); | | | divide-yellow-600 > \* + \* | border-color: rgb(202 138 4); | | | divide-yellow-700 > \* + \* | border-color: rgb(161 98 7); | | | divide-yellow-800 > \* + \* | border-color: rgb(133 77 14); | | | divide-yellow-900 > \* + \* | border-color: rgb(113 63 18); | | | divide-lime-50 > \* + \* | border-color: rgb(247 254 231); | | | divide-lime-100 > \* + \* | border-color: rgb(236 252 203); | | | divide-lime-200 > \* + \* | border-color: rgb(217 249 157); | | | divide-lime-300 > \* + \* | border-color: rgb(190 242 100); | | | divide-lime-400 > \* + \* | border-color: rgb(163 230 53); | | | divide-lime-500 > \* + \* | border-color: rgb(132 204 22); | | | divide-lime-600 > \* + \* | border-color: rgb(101 163 13); | | | divide-lime-700 > \* + \* | border-color: rgb(77 124 15); | | | divide-lime-800 > \* + \* | border-color: rgb(63 98 18); | | | divide-lime-900 > \* + \* | border-color: rgb(54 83 20); | | | divide-green-50 > \* + \* | border-color: rgb(240 253 244); | | | divide-green-100 > \* + \* | border-color: rgb(220 252 231); | | | divide-green-200 > \* + \* | border-color: rgb(187 247 208); | | | divide-green-300 > \* + \* | border-color: rgb(134 239 172); | | | divide-green-400 > \* + \* | border-color: rgb(74 222 128); | | | divide-green-500 > \* + \* | border-color: rgb(34 197 94); | | | divide-green-600 > \* + \* | border-color: rgb(22 163 74); | | | divide-green-700 > \* + \* | border-color: rgb(21 128 61); | | | divide-green-800 > \* + \* | border-color: rgb(22 101 52); | | | divide-green-900 > \* + \* | border-color: rgb(20 83 45); | | | divide-emerald-50 > \* + \* | border-color: rgb(236 253 245); | | | divide-emerald-100 > \* + \* | border-color: rgb(209 250 229); | | | divide-emerald-200 > \* + \* | border-color: rgb(167 243 208); | | | divide-emerald-300 > \* + \* | border-color: rgb(110 231 183); | | | divide-emerald-400 > \* + \* | border-color: rgb(52 211 153); | | | divide-emerald-500 > \* + \* | border-color: rgb(16 185 129); | | | divide-emerald-600 > \* + \* | border-color: rgb(5 150 105); | | | divide-emerald-700 > \* + \* | border-color: rgb(4 120 87); | | | divide-emerald-800 > \* + \* | border-color: rgb(6 95 70); | | | divide-emerald-900 > \* + \* | border-color: rgb(6 78 59); | | | divide-teal-50 > \* + \* | border-color: rgb(240 253 250); | | | divide-teal-100 > \* + \* | border-color: rgb(204 251 241); | | | divide-teal-200 > \* + \* | border-color: rgb(153 246 228); | | | divide-teal-300 > \* + \* | border-color: rgb(94 234 212); | | | divide-teal-400 > \* + \* | border-color: rgb(45 212 191); | | | divide-teal-500 > \* + \* | border-color: rgb(20 184 166); | | | divide-teal-600 > \* + \* | border-color: rgb(13 148 136); | | | divide-teal-700 > \* + \* | border-color: rgb(15 118 110); | | | divide-teal-800 > \* + \* | border-color: rgb(17 94 89); | | | divide-teal-900 > \* + \* | border-color: rgb(19 78 74); | | | divide-cyan-50 > \* + \* | border-color: rgb(236 254 255); | | | divide-cyan-100 > \* + \* | border-color: rgb(207 250 254); | | | divide-cyan-200 > \* + \* | border-color: rgb(165 243 252); | | | divide-cyan-300 > \* + \* | border-color: rgb(103 232 249); | | | divide-cyan-400 > \* + \* | border-color: rgb(34 211 238); | | | divide-cyan-500 > \* + \* | border-color: rgb(6 182 212); | | | divide-cyan-600 > \* + \* | border-color: rgb(8 145 178); | | | divide-cyan-700 > \* + \* | border-color: rgb(14 116 144); | | | divide-cyan-800 > \* + \* | border-color: rgb(21 94 117); | | | divide-cyan-900 > \* + \* | border-color: rgb(22 78 99); | | | divide-sky-50 > \* + \* | border-color: rgb(240 249 255); | | | divide-sky-100 > \* + \* | border-color: rgb(224 242 254); | | | divide-sky-200 > \* + \* | border-color: rgb(186 230 253); | | | divide-sky-300 > \* + \* | border-color: rgb(125 211 252); | | | divide-sky-400 > \* + \* | border-color: rgb(56 189 248); | | | divide-sky-500 > \* + \* | border-color: rgb(14 165 233); | | | divide-sky-600 > \* + \* | border-color: rgb(2 132 199); | | | divide-sky-700 > \* + \* | border-color: rgb(3 105 161); | | | divide-sky-800 > \* + \* | border-color: rgb(7 89 133); | | | divide-sky-900 > \* + \* | border-color: rgb(12 74 110); | | | divide-blue-50 > \* + \* | border-color: rgb(239 246 255); | | | divide-blue-100 > \* + \* | border-color: rgb(219 234 254); | | | divide-blue-200 > \* + \* | border-color: rgb(191 219 254); | | | divide-blue-300 > \* + \* | border-color: rgb(147 197 253); | | | divide-blue-400 > \* + \* | border-color: rgb(96 165 250); | | | divide-blue-500 > \* + \* | border-color: rgb(59 130 246); | | | divide-blue-600 > \* + \* | border-color: rgb(37 99 235); | | | divide-blue-700 > \* + \* | border-color: rgb(29 78 216); | | | divide-blue-800 > \* + \* | border-color: rgb(30 64 175); | | | divide-blue-900 > \* + \* | border-color: rgb(30 58 138); | | | divide-indigo-50 > \* + \* | border-color: rgb(238 242 255); | | | divide-indigo-100 > \* + \* | border-color: rgb(224 231 255); | | | divide-indigo-200 > \* + \* | border-color: rgb(199 210 254); | | | divide-indigo-300 > \* + \* | border-color: rgb(165 180 252); | | | divide-indigo-400 > \* + \* | border-color: rgb(129 140 248); | | | divide-indigo-500 > \* + \* | border-color: rgb(99 102 241); | | | divide-indigo-600 > \* + \* | border-color: rgb(79 70 229); | | | divide-indigo-700 > \* + \* | border-color: rgb(67 56 202); | | | divide-indigo-800 > \* + \* | border-color: rgb(55 48 163); | | | divide-indigo-900 > \* + \* | border-color: rgb(49 46 129); | | | divide-violet-50 > \* + \* | border-color: rgb(245 243 255); | | | divide-violet-100 > \* + \* | border-color: rgb(237 233 254); | | | divide-violet-200 > \* + \* | border-color: rgb(221 214 254); | | | divide-violet-300 > \* + \* | border-color: rgb(196 181 253); | | | divide-violet-400 > \* + \* | border-color: rgb(167 139 250); | | | divide-violet-500 > \* + \* | border-color: rgb(139 92 246); | | | divide-violet-600 > \* + \* | border-color: rgb(124 58 237); | | | divide-violet-700 > \* + \* | border-color: rgb(109 40 217); | | | divide-violet-800 > \* + \* | border-color: rgb(91 33 182); | | | divide-violet-900 > \* + \* | border-color: rgb(76 29 149); | | | divide-purple-50 > \* + \* | border-color: rgb(250 245 255); | | | divide-purple-100 > \* + \* | border-color: rgb(243 232 255); | | | divide-purple-200 > \* + \* | border-color: rgb(233 213 255); | | | divide-purple-300 > \* + \* | border-color: rgb(216 180 254); | | | divide-purple-400 > \* + \* | border-color: rgb(192 132 252); | | | divide-purple-500 > \* + \* | border-color: rgb(168 85 247); | | | divide-purple-600 > \* + \* | border-color: rgb(147 51 234); | | | divide-purple-700 > \* + \* | border-color: rgb(126 34 206); | | | divide-purple-800 > \* + \* | border-color: rgb(107 33 168); | | | divide-purple-900 > \* + \* | border-color: rgb(88 28 135); | | | divide-fuchsia-50 > \* + \* | border-color: rgb(253 244 255); | | | divide-fuchsia-100 > \* + \* | border-color: rgb(250 232 255); | | | divide-fuchsia-200 > \* + \* | border-color: rgb(245 208 254); | | | divide-fuchsia-300 > \* + \* | border-color: rgb(240 171 252); | | | divide-fuchsia-400 > \* + \* | border-color: rgb(232 121 249); | | | divide-fuchsia-500 > \* + \* | border-color: rgb(217 70 239); | | | divide-fuchsia-600 > \* + \* | border-color: rgb(192 38 211); | | | divide-fuchsia-700 > \* + \* | border-color: rgb(162 28 175); | | | divide-fuchsia-800 > \* + \* | border-color: rgb(134 25 143); | | | divide-fuchsia-900 > \* + \* | border-color: rgb(112 26 117); | | | divide-pink-50 > \* + \* | border-color: rgb(253 242 248); | | | divide-pink-100 > \* + \* | border-color: rgb(252 231 243); | | | divide-pink-200 > \* + \* | border-color: rgb(251 207 232); | | | divide-pink-300 > \* + \* | border-color: rgb(249 168 212); | | | divide-pink-400 > \* + \* | border-color: rgb(244 114 182); | | | divide-pink-500 > \* + \* | border-color: rgb(236 72 153); | | | divide-pink-600 > \* + \* | border-color: rgb(219 39 119); | | | divide-pink-700 > \* + \* | border-color: rgb(190 24 93); | | | divide-pink-800 > \* + \* | border-color: rgb(157 23 77); | | | divide-pink-900 > \* + \* | border-color: rgb(131 24 67); | | | divide-rose-50 > \* + \* | border-color: rgb(255 241 242); | | | divide-rose-100 > \* + \* | border-color: rgb(255 228 230); | | | divide-rose-200 > \* + \* | border-color: rgb(254 205 211); | | | divide-rose-300 > \* + \* | border-color: rgb(253 164 175); | | | divide-rose-400 > \* + \* | border-color: rgb(251 113 133); | | | divide-rose-500 > \* + \* | border-color: rgb(244 63 94); | | | divide-rose-600 > \* + \* | border-color: rgb(225 29 72); | | | divide-rose-700 > \* + \* | border-color: rgb(190 18 60); | | | divide-rose-800 > \* + \* | border-color: rgb(159 18 57); | | | divide-rose-900 > \* + \* | border-color: rgb(136 19 55); | | Basic usage ----------- ### Setting the divide color Control the border color between elements using the `divide-{color}` utilities. ``` <div class="divide-y divide-blue-200"> <div>01</div> <div>02</div> <div>03</div> </div> ``` ### Changing the opacity Control the opacity of the divide color using the color opacity modifier. ``` <div class="divide-y-4 divide-slate-400/25 ..."> <!-- ... --> </div> ``` You can use any value defined in your [opacity scale](opacity), or use arbitrary values if you need to deviate from your design tokens. ``` <div class="divide-y-4 divide-slate-400/[.24] ..."> <!-- ... --> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:divide-pink-400` to only apply the `divide-pink-400` utility on hover. ``` <div class="divide-y divide-teal-400 hover:divide-pink-400"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:divide-pink-400` to apply the `divide-pink-400` utility at only medium screen sizes and above. ``` <div class="divide-y divide-teal-400 md:divide-pink-400"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind makes the entire [default color palette](customizing-colors#default-color-palette) available as divide colors. You can [customize your color palette](/docs/customizing-colors#customizing) by editing `theme.colors` or `theme.extend.colors` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { colors: { 'regal-blue': '#243c5a', }, } } } ``` Alternatively, you can customize just your divide colors by editing `theme.divideColor` or `theme.extend.divideColor` in your `tailwind.config.js` file. Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `divide-{color}` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="divide-[#243c5a]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation.
programming_docs
tailwindcss Screen Readers Quick reference --------------- | Class | Properties | | --- | --- | | sr-only | position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border-width: 0; | | not-sr-only | position: static; width: auto; height: auto; padding: 0; margin: 0; overflow: visible; clip: auto; white-space: normal; | Basic usage ----------- ### Screen-reader-only elements Use `sr-only` to hide an element visually without hiding it from screen readers: ``` <a href="#"> <svg><!-- ... --></svg> <span class="sr-only">Settings</span> </a> ``` ### Undoing screen-reader-only elements Use `not-sr-only` to undo `sr-only`, making an element visible to sighted users as well as screen readers. This can be useful when you want to visually hide something on small screens but show it on larger screens for example: ``` <a href="#"> <svg><!-- ... --></svg> <span class="sr-only sm:not-sr-only">Settings</span> </a> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `focus:not-sr-only` to only apply the `not-sr-only` utility on focus. ``` <a href="#content" class="sr-only focus:not-sr-only"> Skip to content </a> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:not-sr-only` to apply the `not-sr-only` utility at only medium screen sizes and above. ``` <div class="sr-only md:not-sr-only"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Dark Mode Basic usage ----------- Now that dark mode is a first-class feature of many operating systems, it’s becoming more and more common to design a dark version of your website to go along with the default design. To make this as easy as possible, Tailwind includes a `dark` variant that lets you style your site differently when dark mode is enabled: ``` <div class="bg-white dark:bg-slate-800 rounded-lg px-6 py-8 ring-1 ring-slate-900/5 shadow-xl"> <div> <span class="inline-flex items-center justify-center p-2 bg-indigo-500 rounded-md shadow-lg"> <svg class="h-6 w-6 text-white" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true"><!-- ... --></svg> </span> </div> <h3 class="text-slate-900 dark:text-white mt-5 text-base font-medium tracking-tight">Writes Upside-Down</h3> <p class="text-slate-500 dark:text-slate-400 mt-2 text-sm"> The Zero Gravity Pen can be used to write in any orientation, including upside-down. It even works in outer space. </p> </div> ``` By default this uses the `prefers-color-scheme` CSS media feature, but you can also build sites that support toggling dark mode manually using the [‘class’ strategy](#toggling-dark-mode-manually). Toggling dark mode manually --------------------------- If you want to support toggling dark mode manually instead of relying on the operating system preference, use the `class` strategy instead of the `media` strategy: tailwind.config.js ``` module.exports = { darkMode: 'class', // ... } ``` Now instead of `dark:{class}` classes being applied based on `prefers-color-scheme`, they will be applied whenever `dark` class is present earlier in the HTML tree. ``` <!-- Dark mode not enabled --> <html> <body> <!-- Will be white --> <div class="bg-white dark:bg-black"> <!-- ... --> </div> </body> </html> <!-- Dark mode enabled --> <html class="dark"> <body> <!-- Will be black --> <div class="bg-white dark:bg-black"> <!-- ... --> </div> </body> </html> ``` If you’ve set [a prefix](configuration#prefix) in your Tailwind config, be sure to add that to the `dark` class. For example, if you have a prefix of `tw-`, you’ll need to use the `tw-dark` class to enable dark mode. How you add the `dark` class to the `html` element is up to you, but a common approach is to use a bit of JS that reads a preference from somewhere (like `localStorage`) and updates the DOM accordingly. ### Supporting system preference and manual selection The `class` strategy can be used to support both the user’s system preference *or* a manually selected mode by using the [`Window.matchMedia()` API](https://developer.mozilla.org/en-US/docs/Web/API/Window/matchMedia). Here’s a simple example of how you can support light mode, dark mode, as well as respecting the operating system preference: spaghetti.js ``` // On page load or when changing themes, best to add inline in `head` to avoid FOUC if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) { document.documentElement.classList.add('dark') } else { document.documentElement.classList.remove('dark') } // Whenever the user explicitly chooses light mode localStorage.theme = 'light' // Whenever the user explicitly chooses dark mode localStorage.theme = 'dark' // Whenever the user explicitly chooses to respect the OS preference localStorage.removeItem('theme') ``` Again you can manage this however you like, even storing the preference server-side in a database and rendering the class on the server — it’s totally up to you. ### Customizing the class name Some frameworks (like NativeScript) have their own approach to enabling dark mode and add a different class name when dark mode is active. You can customize the dark mode selector name by setting `darkMode` to an array with your custom selector as the second item: tailwind.config.js ``` module.exports = { darkMode: ['class', '[data-mode="dark"]'], // ... } ``` tailwindcss Divide Width Quick reference --------------- | Class | Properties | | --- | --- | | divide-x-0 > \* + \* | border-right-width: 0px; border-left-width: 0px; | | divide-x-2 > \* + \* | border-right-width: 0px; border-left-width: 2px; | | divide-x-4 > \* + \* | border-right-width: 0px; border-left-width: 4px; | | divide-x-8 > \* + \* | border-right-width: 0px; border-left-width: 8px; | | divide-x > \* + \* | border-right-width: 0px; border-left-width: 1px; | | divide-y-0 > \* + \* | border-top-width: 0px; border-bottom-width: 0px; | | divide-y-2 > \* + \* | border-top-width: 2px; border-bottom-width: 0px; | | divide-y-4 > \* + \* | border-top-width: 4px; border-bottom-width: 0px; | | divide-y-8 > \* + \* | border-top-width: 8px; border-bottom-width: 0px; | | divide-y > \* + \* | border-top-width: 1px; border-bottom-width: 0px; | | divide-y-reverse > \* + \* | --tw-divide-y-reverse: 1; | | divide-x-reverse > \* + \* | --tw-divide-x-reverse: 1; | Basic usage ----------- ### Add borders between horizontal children Add borders between horizontal elements using the `divide-x-{width}` utilities. ``` <div class="grid grid-cols-3 divide-x"> <div>01</div> <div>02</div> <div>03</div> </div> ``` ### Add borders between stacked children Add borders between stacked elements using the `divide-y-{width}` utilities. ``` <div class="grid grid-cols-1 divide-y"> <div>01</div> <div>02</div> <div>03</div> </div> ``` ### Reversing children order If your elements are in reverse order (using say `flex-row-reverse` or `flex-col-reverse`), use the `divide-x-reverse` or `divide-y-reverse` utilities to ensure the border is added to the correct side of each element. ``` <div class="flex flex-col-reverse divide-y divide-y-reverse"> <div>01</div> <div>02</div> <div>03</div> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:divide-y-8` to only apply the `divide-y-8` utility on hover. ``` <div class="divide-y divide-gray-400 hover:divide-y-8"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:divide-y-8` to apply the `divide-y-8` utility at only medium screen sizes and above. ``` <div class="divide-y divide-gray-400 md:divide-y-8"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme The divide width scale inherits its values from the `borderWidth` scale by default, so if you’d like to customize your values for both border width and divide width together, use the `theme.borderWidth` section of your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { borderWidth: { DEFAULT: '1px', '0': '0', '2': '2px', '3': '3px', '4': '4px', '6': '6px', '8': '8px', } } } ``` To customize only the divide width values, use the `theme.divideWidth` section of your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { divideWidth: { DEFAULT: '1px', '0': '0', '2': '2px', '3': '3px', '4': '4px', '6': '6px', '8': '8px', } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `divide-{x|y}-{width}` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="divide-x-[3px]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Blur Quick reference --------------- | Class | Properties | | --- | --- | | blur-none | filter: blur(0); | | blur-sm | filter: blur(4px); | | blur | filter: blur(8px); | | blur-md | filter: blur(12px); | | blur-lg | filter: blur(16px); | | blur-xl | filter: blur(24px); | | blur-2xl | filter: blur(40px); | | blur-3xl | filter: blur(64px); | Basic usage ----------- ### Blurring elements Use the `blur-{amount?}` utilities to blur an element. ``` <div class="blur-none ..."> <!-- ... --> </div> <div class="blur-sm ..."> <!-- ... --> </div> <div class="blur-lg ..."> <!-- ... --> </div> <div class="blur-2xl ..."> <!-- ... --> </div> ``` ### Removing filters To remove all of the filters on an element at once, use the `filter-none` utility: ``` <div class="blur-md invert brightness-150 md:filter-none"> <!-- ... --> </div> ``` This can be useful when you want to remove filters conditionally, such as on hover or at a particular breakpoint. Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:blur-lg` to only apply the `blur-lg` utility on hover. ``` <div class="blur hover:blur-lg"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:blur-lg` to apply the `blur-lg` utility at only medium screen sizes and above. ``` <div class="blur md:blur-lg"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind includes a handful of general purpose `blur` utilities. You can customize these values by editing `theme.blur` or `theme.extend.blur` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { blur: { xs: '2px', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `blur` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="blur-[2px]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Backdrop Brightness Quick reference --------------- | Class | Properties | | --- | --- | | backdrop-brightness-0 | backdrop-filter: brightness(0); | | backdrop-brightness-50 | backdrop-filter: brightness(.5); | | backdrop-brightness-75 | backdrop-filter: brightness(.75); | | backdrop-brightness-90 | backdrop-filter: brightness(.9); | | backdrop-brightness-95 | backdrop-filter: brightness(.95); | | backdrop-brightness-100 | backdrop-filter: brightness(1); | | backdrop-brightness-105 | backdrop-filter: brightness(1.05); | | backdrop-brightness-110 | backdrop-filter: brightness(1.1); | | backdrop-brightness-125 | backdrop-filter: brightness(1.25); | | backdrop-brightness-150 | backdrop-filter: brightness(1.5); | | backdrop-brightness-200 | backdrop-filter: brightness(2); | Basic usage ----------- ### Controlling backdrop brightness Use the `backdrop-brightness-{amount?}` utilities to control an element’s backdrop brightness. ``` <div class="backdrop-brightness-50 bg-white/30 ..."> <!-- ... --> </div> <div class="backdrop-brightness-125 bg-white/30 ..."> <!-- ... --> </div> <div class="backdrop-brightness-200 bg-white/30 ..."> <!-- ... --> </div> ``` ### Removing backdrop filters To remove all of the backdrop filters on an element at once, use the `backdrop-filter-none` utility: ``` <div class="backdrop-blur-md backdrop-brightness-150 md:backdrop-filter-none"> <!-- ... --> </div> ``` This can be useful when you want to remove backdrop filters conditionally, such as on hover or at a particular breakpoint. Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:backdrop-brightness-150` to only apply the `backdrop-brightness-150` utility on hover. ``` <div class="backdrop-brightness-110 hover:backdrop-brightness-150"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:backdrop-brightness-150` to apply the `backdrop-brightness-150` utility at only medium screen sizes and above. ``` <div class="backdrop-brightness-110 md:backdrop-brightness-150"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind includes a handful of general purpose `backdrop-brightness` utilities. You can customize these values by editing `theme.backdropBrightness` or `theme.extend.backdropBrightness` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { backdropBrightness: { 25: '.25', 175: '1.75', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `backdrop-brightness` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="backdrop-brightness-[1.75]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Caret Color Quick reference --------------- | Class | Properties | | --- | --- | | caret-inherit | caret-color: inherit; | | caret-current | caret-color: currentColor; | | caret-transparent | caret-color: transparent; | | caret-black | caret-color: #000; | | caret-white | caret-color: #fff; | | caret-slate-50 | caret-color: #f8fafc; | | caret-slate-100 | caret-color: #f1f5f9; | | caret-slate-200 | caret-color: #e2e8f0; | | caret-slate-300 | caret-color: #cbd5e1; | | caret-slate-400 | caret-color: #94a3b8; | | caret-slate-500 | caret-color: #64748b; | | caret-slate-600 | caret-color: #475569; | | caret-slate-700 | caret-color: #334155; | | caret-slate-800 | caret-color: #1e293b; | | caret-slate-900 | caret-color: #0f172a; | | caret-gray-50 | caret-color: #f9fafb; | | caret-gray-100 | caret-color: #f3f4f6; | | caret-gray-200 | caret-color: #e5e7eb; | | caret-gray-300 | caret-color: #d1d5db; | | caret-gray-400 | caret-color: #9ca3af; | | caret-gray-500 | caret-color: #6b7280; | | caret-gray-600 | caret-color: #4b5563; | | caret-gray-700 | caret-color: #374151; | | caret-gray-800 | caret-color: #1f2937; | | caret-gray-900 | caret-color: #111827; | | caret-zinc-50 | caret-color: #fafafa; | | caret-zinc-100 | caret-color: #f4f4f5; | | caret-zinc-200 | caret-color: #e4e4e7; | | caret-zinc-300 | caret-color: #d4d4d8; | | caret-zinc-400 | caret-color: #a1a1aa; | | caret-zinc-500 | caret-color: #71717a; | | caret-zinc-600 | caret-color: #52525b; | | caret-zinc-700 | caret-color: #3f3f46; | | caret-zinc-800 | caret-color: #27272a; | | caret-zinc-900 | caret-color: #18181b; | | caret-neutral-50 | caret-color: #fafafa; | | caret-neutral-100 | caret-color: #f5f5f5; | | caret-neutral-200 | caret-color: #e5e5e5; | | caret-neutral-300 | caret-color: #d4d4d4; | | caret-neutral-400 | caret-color: #a3a3a3; | | caret-neutral-500 | caret-color: #737373; | | caret-neutral-600 | caret-color: #525252; | | caret-neutral-700 | caret-color: #404040; | | caret-neutral-800 | caret-color: #262626; | | caret-neutral-900 | caret-color: #171717; | | caret-stone-50 | caret-color: #fafaf9; | | caret-stone-100 | caret-color: #f5f5f4; | | caret-stone-200 | caret-color: #e7e5e4; | | caret-stone-300 | caret-color: #d6d3d1; | | caret-stone-400 | caret-color: #a8a29e; | | caret-stone-500 | caret-color: #78716c; | | caret-stone-600 | caret-color: #57534e; | | caret-stone-700 | caret-color: #44403c; | | caret-stone-800 | caret-color: #292524; | | caret-stone-900 | caret-color: #1c1917; | | caret-red-50 | caret-color: #fef2f2; | | caret-red-100 | caret-color: #fee2e2; | | caret-red-200 | caret-color: #fecaca; | | caret-red-300 | caret-color: #fca5a5; | | caret-red-400 | caret-color: #f87171; | | caret-red-500 | caret-color: #ef4444; | | caret-red-600 | caret-color: #dc2626; | | caret-red-700 | caret-color: #b91c1c; | | caret-red-800 | caret-color: #991b1b; | | caret-red-900 | caret-color: #7f1d1d; | | caret-orange-50 | caret-color: #fff7ed; | | caret-orange-100 | caret-color: #ffedd5; | | caret-orange-200 | caret-color: #fed7aa; | | caret-orange-300 | caret-color: #fdba74; | | caret-orange-400 | caret-color: #fb923c; | | caret-orange-500 | caret-color: #f97316; | | caret-orange-600 | caret-color: #ea580c; | | caret-orange-700 | caret-color: #c2410c; | | caret-orange-800 | caret-color: #9a3412; | | caret-orange-900 | caret-color: #7c2d12; | | caret-amber-50 | caret-color: #fffbeb; | | caret-amber-100 | caret-color: #fef3c7; | | caret-amber-200 | caret-color: #fde68a; | | caret-amber-300 | caret-color: #fcd34d; | | caret-amber-400 | caret-color: #fbbf24; | | caret-amber-500 | caret-color: #f59e0b; | | caret-amber-600 | caret-color: #d97706; | | caret-amber-700 | caret-color: #b45309; | | caret-amber-800 | caret-color: #92400e; | | caret-amber-900 | caret-color: #78350f; | | caret-yellow-50 | caret-color: #fefce8; | | caret-yellow-100 | caret-color: #fef9c3; | | caret-yellow-200 | caret-color: #fef08a; | | caret-yellow-300 | caret-color: #fde047; | | caret-yellow-400 | caret-color: #facc15; | | caret-yellow-500 | caret-color: #eab308; | | caret-yellow-600 | caret-color: #ca8a04; | | caret-yellow-700 | caret-color: #a16207; | | caret-yellow-800 | caret-color: #854d0e; | | caret-yellow-900 | caret-color: #713f12; | | caret-lime-50 | caret-color: #f7fee7; | | caret-lime-100 | caret-color: #ecfccb; | | caret-lime-200 | caret-color: #d9f99d; | | caret-lime-300 | caret-color: #bef264; | | caret-lime-400 | caret-color: #a3e635; | | caret-lime-500 | caret-color: #84cc16; | | caret-lime-600 | caret-color: #65a30d; | | caret-lime-700 | caret-color: #4d7c0f; | | caret-lime-800 | caret-color: #3f6212; | | caret-lime-900 | caret-color: #365314; | | caret-green-50 | caret-color: #f0fdf4; | | caret-green-100 | caret-color: #dcfce7; | | caret-green-200 | caret-color: #bbf7d0; | | caret-green-300 | caret-color: #86efac; | | caret-green-400 | caret-color: #4ade80; | | caret-green-500 | caret-color: #22c55e; | | caret-green-600 | caret-color: #16a34a; | | caret-green-700 | caret-color: #15803d; | | caret-green-800 | caret-color: #166534; | | caret-green-900 | caret-color: #14532d; | | caret-emerald-50 | caret-color: #ecfdf5; | | caret-emerald-100 | caret-color: #d1fae5; | | caret-emerald-200 | caret-color: #a7f3d0; | | caret-emerald-300 | caret-color: #6ee7b7; | | caret-emerald-400 | caret-color: #34d399; | | caret-emerald-500 | caret-color: #10b981; | | caret-emerald-600 | caret-color: #059669; | | caret-emerald-700 | caret-color: #047857; | | caret-emerald-800 | caret-color: #065f46; | | caret-emerald-900 | caret-color: #064e3b; | | caret-teal-50 | caret-color: #f0fdfa; | | caret-teal-100 | caret-color: #ccfbf1; | | caret-teal-200 | caret-color: #99f6e4; | | caret-teal-300 | caret-color: #5eead4; | | caret-teal-400 | caret-color: #2dd4bf; | | caret-teal-500 | caret-color: #14b8a6; | | caret-teal-600 | caret-color: #0d9488; | | caret-teal-700 | caret-color: #0f766e; | | caret-teal-800 | caret-color: #115e59; | | caret-teal-900 | caret-color: #134e4a; | | caret-cyan-50 | caret-color: #ecfeff; | | caret-cyan-100 | caret-color: #cffafe; | | caret-cyan-200 | caret-color: #a5f3fc; | | caret-cyan-300 | caret-color: #67e8f9; | | caret-cyan-400 | caret-color: #22d3ee; | | caret-cyan-500 | caret-color: #06b6d4; | | caret-cyan-600 | caret-color: #0891b2; | | caret-cyan-700 | caret-color: #0e7490; | | caret-cyan-800 | caret-color: #155e75; | | caret-cyan-900 | caret-color: #164e63; | | caret-sky-50 | caret-color: #f0f9ff; | | caret-sky-100 | caret-color: #e0f2fe; | | caret-sky-200 | caret-color: #bae6fd; | | caret-sky-300 | caret-color: #7dd3fc; | | caret-sky-400 | caret-color: #38bdf8; | | caret-sky-500 | caret-color: #0ea5e9; | | caret-sky-600 | caret-color: #0284c7; | | caret-sky-700 | caret-color: #0369a1; | | caret-sky-800 | caret-color: #075985; | | caret-sky-900 | caret-color: #0c4a6e; | | caret-blue-50 | caret-color: #eff6ff; | | caret-blue-100 | caret-color: #dbeafe; | | caret-blue-200 | caret-color: #bfdbfe; | | caret-blue-300 | caret-color: #93c5fd; | | caret-blue-400 | caret-color: #60a5fa; | | caret-blue-500 | caret-color: #3b82f6; | | caret-blue-600 | caret-color: #2563eb; | | caret-blue-700 | caret-color: #1d4ed8; | | caret-blue-800 | caret-color: #1e40af; | | caret-blue-900 | caret-color: #1e3a8a; | | caret-indigo-50 | caret-color: #eef2ff; | | caret-indigo-100 | caret-color: #e0e7ff; | | caret-indigo-200 | caret-color: #c7d2fe; | | caret-indigo-300 | caret-color: #a5b4fc; | | caret-indigo-400 | caret-color: #818cf8; | | caret-indigo-500 | caret-color: #6366f1; | | caret-indigo-600 | caret-color: #4f46e5; | | caret-indigo-700 | caret-color: #4338ca; | | caret-indigo-800 | caret-color: #3730a3; | | caret-indigo-900 | caret-color: #312e81; | | caret-violet-50 | caret-color: #f5f3ff; | | caret-violet-100 | caret-color: #ede9fe; | | caret-violet-200 | caret-color: #ddd6fe; | | caret-violet-300 | caret-color: #c4b5fd; | | caret-violet-400 | caret-color: #a78bfa; | | caret-violet-500 | caret-color: #8b5cf6; | | caret-violet-600 | caret-color: #7c3aed; | | caret-violet-700 | caret-color: #6d28d9; | | caret-violet-800 | caret-color: #5b21b6; | | caret-violet-900 | caret-color: #4c1d95; | | caret-purple-50 | caret-color: #faf5ff; | | caret-purple-100 | caret-color: #f3e8ff; | | caret-purple-200 | caret-color: #e9d5ff; | | caret-purple-300 | caret-color: #d8b4fe; | | caret-purple-400 | caret-color: #c084fc; | | caret-purple-500 | caret-color: #a855f7; | | caret-purple-600 | caret-color: #9333ea; | | caret-purple-700 | caret-color: #7e22ce; | | caret-purple-800 | caret-color: #6b21a8; | | caret-purple-900 | caret-color: #581c87; | | caret-fuchsia-50 | caret-color: #fdf4ff; | | caret-fuchsia-100 | caret-color: #fae8ff; | | caret-fuchsia-200 | caret-color: #f5d0fe; | | caret-fuchsia-300 | caret-color: #f0abfc; | | caret-fuchsia-400 | caret-color: #e879f9; | | caret-fuchsia-500 | caret-color: #d946ef; | | caret-fuchsia-600 | caret-color: #c026d3; | | caret-fuchsia-700 | caret-color: #a21caf; | | caret-fuchsia-800 | caret-color: #86198f; | | caret-fuchsia-900 | caret-color: #701a75; | | caret-pink-50 | caret-color: #fdf2f8; | | caret-pink-100 | caret-color: #fce7f3; | | caret-pink-200 | caret-color: #fbcfe8; | | caret-pink-300 | caret-color: #f9a8d4; | | caret-pink-400 | caret-color: #f472b6; | | caret-pink-500 | caret-color: #ec4899; | | caret-pink-600 | caret-color: #db2777; | | caret-pink-700 | caret-color: #be185d; | | caret-pink-800 | caret-color: #9d174d; | | caret-pink-900 | caret-color: #831843; | | caret-rose-50 | caret-color: #fff1f2; | | caret-rose-100 | caret-color: #ffe4e6; | | caret-rose-200 | caret-color: #fecdd3; | | caret-rose-300 | caret-color: #fda4af; | | caret-rose-400 | caret-color: #fb7185; | | caret-rose-500 | caret-color: #f43f5e; | | caret-rose-600 | caret-color: #e11d48; | | caret-rose-700 | caret-color: #be123c; | | caret-rose-800 | caret-color: #9f1239; | | caret-rose-900 | caret-color: #881337; | Basic usage ----------- ### Setting the caret color Use the `caret-{color}` utilities to change the color of the text input cursor. ``` <textarea class="caret-pink-500 ..."></textarea> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `focus:caret-indigo-500` to only apply the `caret-indigo-500` utility on focus. ``` <textarea class="caret-blue-500 focus:caret-indigo-500"></textarea> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:caret-indigo-500` to apply the `caret-indigo-500` utility at only medium screen sizes and above. ``` <textarea class="caret-blue-500 md:caret-indigo-500"></textarea> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind makes the entire [default color palette](customizing-colors#default-color-palette) available as caret colors. You can [customize your color palette](/docs/customizing-colors#customizing) by editing `theme.colors` or `theme.extend.colors` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { colors: { 'regal-blue': '#243c5a', }, } } } ``` Alternatively, you can customize just your caret colors by editing `theme.caretColor` or `theme.extend.caretColor` in your `tailwind.config.js` file. Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `caret-color` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <textarea class="caret-[#50d71e]"></textarea> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation.
programming_docs
tailwindcss Place Self Quick reference --------------- | Class | Properties | | --- | --- | | place-self-auto | place-self: auto; | | place-self-start | place-self: start; | | place-self-end | place-self: end; | | place-self-center | place-self: center; | | place-self-stretch | place-self: stretch; | Basic usage ----------- ### Auto Use `place-self-auto` to align an item based on the value of the container’s `place-items` property: ``` <div class="grid grid-cols-3 gap-4 ..."> <div>01</div> <div class="place-self-auto ...">02</div> <div>03</div> <div>04</div> <div>05</div> <div>06</div> </div> ``` ### Start Use `place-self-start` to align an item to the start on both axes: ``` <div class="grid grid-cols-3 gap-4 ..."> <div>01</div> <div class="place-self-start ...">02</div> <div>03</div> <div>04</div> <div>05</div> <div>06</div> </div> ``` ### Center Use `place-self-center` to align an item at the center on both axes: ``` <div class="grid grid-cols-3 gap-4 ..."> <div>01</div> <div class="place-self-center ...">02</div> <div>03</div> <div>04</div> <div>05</div> <div>06</div> </div> ``` ### End Use `place-self-end` to align an item to the end on both axes: ``` <div class="grid grid-cols-3 gap-4 ..."> <div>01</div> <div class="place-self-end ...">02</div> <div>03</div> <div>04</div> <div>05</div> <div>06</div> </div> ``` ### Stretch Use `place-self-stretch` to stretch an item on both axes: ``` <div class="grid grid-cols-3 gap-2 ..."> <div>01</div> <div class="place-self-stretch ...">02</div> <div>03</div> <div>04</div> <div>05</div> <div>06</div> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:place-self-end` to only apply the `place-self-end` utility on hover. ``` <div class="place-self-start hover:place-self-end"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:place-self-end` to apply the `place-self-end` utility at only medium screen sizes and above. ``` <div class="place-self-start md:place-self-end"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Top / Right / Bottom / Left Quick reference --------------- | Class | Properties | | --- | --- | | inset-0 | top: 0px; right: 0px; bottom: 0px; left: 0px; | | inset-x-0 | left: 0px; right: 0px; | | inset-y-0 | top: 0px; bottom: 0px; | | top-0 | top: 0px; | | right-0 | right: 0px; | | bottom-0 | bottom: 0px; | | left-0 | left: 0px; | | inset-px | top: 1px; right: 1px; bottom: 1px; left: 1px; | | inset-x-px | left: 1px; right: 1px; | | inset-y-px | top: 1px; bottom: 1px; | | top-px | top: 1px; | | right-px | right: 1px; | | bottom-px | bottom: 1px; | | left-px | left: 1px; | | inset-0.5 | top: 0.125rem; /\* 2px \*/ right: 0.125rem; /\* 2px \*/ bottom: 0.125rem; /\* 2px \*/ left: 0.125rem; /\* 2px \*/ | | inset-x-0.5 | left: 0.125rem; /\* 2px \*/ right: 0.125rem; /\* 2px \*/ | | inset-y-0.5 | top: 0.125rem; /\* 2px \*/ bottom: 0.125rem; /\* 2px \*/ | | top-0.5 | top: 0.125rem; /\* 2px \*/ | | right-0.5 | right: 0.125rem; /\* 2px \*/ | | bottom-0.5 | bottom: 0.125rem; /\* 2px \*/ | | left-0.5 | left: 0.125rem; /\* 2px \*/ | | inset-1 | top: 0.25rem; /\* 4px \*/ right: 0.25rem; /\* 4px \*/ bottom: 0.25rem; /\* 4px \*/ left: 0.25rem; /\* 4px \*/ | | inset-x-1 | left: 0.25rem; /\* 4px \*/ right: 0.25rem; /\* 4px \*/ | | inset-y-1 | top: 0.25rem; /\* 4px \*/ bottom: 0.25rem; /\* 4px \*/ | | top-1 | top: 0.25rem; /\* 4px \*/ | | right-1 | right: 0.25rem; /\* 4px \*/ | | bottom-1 | bottom: 0.25rem; /\* 4px \*/ | | left-1 | left: 0.25rem; /\* 4px \*/ | | inset-1.5 | top: 0.375rem; /\* 6px \*/ right: 0.375rem; /\* 6px \*/ bottom: 0.375rem; /\* 6px \*/ left: 0.375rem; /\* 6px \*/ | | inset-x-1.5 | left: 0.375rem; /\* 6px \*/ right: 0.375rem; /\* 6px \*/ | | inset-y-1.5 | top: 0.375rem; /\* 6px \*/ bottom: 0.375rem; /\* 6px \*/ | | top-1.5 | top: 0.375rem; /\* 6px \*/ | | right-1.5 | right: 0.375rem; /\* 6px \*/ | | bottom-1.5 | bottom: 0.375rem; /\* 6px \*/ | | left-1.5 | left: 0.375rem; /\* 6px \*/ | | inset-2 | top: 0.5rem; /\* 8px \*/ right: 0.5rem; /\* 8px \*/ bottom: 0.5rem; /\* 8px \*/ left: 0.5rem; /\* 8px \*/ | | inset-x-2 | left: 0.5rem; /\* 8px \*/ right: 0.5rem; /\* 8px \*/ | | inset-y-2 | top: 0.5rem; /\* 8px \*/ bottom: 0.5rem; /\* 8px \*/ | | top-2 | top: 0.5rem; /\* 8px \*/ | | right-2 | right: 0.5rem; /\* 8px \*/ | | bottom-2 | bottom: 0.5rem; /\* 8px \*/ | | left-2 | left: 0.5rem; /\* 8px \*/ | | inset-2.5 | top: 0.625rem; /\* 10px \*/ right: 0.625rem; /\* 10px \*/ bottom: 0.625rem; /\* 10px \*/ left: 0.625rem; /\* 10px \*/ | | inset-x-2.5 | left: 0.625rem; /\* 10px \*/ right: 0.625rem; /\* 10px \*/ | | inset-y-2.5 | top: 0.625rem; /\* 10px \*/ bottom: 0.625rem; /\* 10px \*/ | | top-2.5 | top: 0.625rem; /\* 10px \*/ | | right-2.5 | right: 0.625rem; /\* 10px \*/ | | bottom-2.5 | bottom: 0.625rem; /\* 10px \*/ | | left-2.5 | left: 0.625rem; /\* 10px \*/ | | inset-3 | top: 0.75rem; /\* 12px \*/ right: 0.75rem; /\* 12px \*/ bottom: 0.75rem; /\* 12px \*/ left: 0.75rem; /\* 12px \*/ | | inset-x-3 | left: 0.75rem; /\* 12px \*/ right: 0.75rem; /\* 12px \*/ | | inset-y-3 | top: 0.75rem; /\* 12px \*/ bottom: 0.75rem; /\* 12px \*/ | | top-3 | top: 0.75rem; /\* 12px \*/ | | right-3 | right: 0.75rem; /\* 12px \*/ | | bottom-3 | bottom: 0.75rem; /\* 12px \*/ | | left-3 | left: 0.75rem; /\* 12px \*/ | | inset-3.5 | top: 0.875rem; /\* 14px \*/ right: 0.875rem; /\* 14px \*/ bottom: 0.875rem; /\* 14px \*/ left: 0.875rem; /\* 14px \*/ | | inset-x-3.5 | left: 0.875rem; /\* 14px \*/ right: 0.875rem; /\* 14px \*/ | | inset-y-3.5 | top: 0.875rem; /\* 14px \*/ bottom: 0.875rem; /\* 14px \*/ | | top-3.5 | top: 0.875rem; /\* 14px \*/ | | right-3.5 | right: 0.875rem; /\* 14px \*/ | | bottom-3.5 | bottom: 0.875rem; /\* 14px \*/ | | left-3.5 | left: 0.875rem; /\* 14px \*/ | | inset-4 | top: 1rem; /\* 16px \*/ right: 1rem; /\* 16px \*/ bottom: 1rem; /\* 16px \*/ left: 1rem; /\* 16px \*/ | | inset-x-4 | left: 1rem; /\* 16px \*/ right: 1rem; /\* 16px \*/ | | inset-y-4 | top: 1rem; /\* 16px \*/ bottom: 1rem; /\* 16px \*/ | | top-4 | top: 1rem; /\* 16px \*/ | | right-4 | right: 1rem; /\* 16px \*/ | | bottom-4 | bottom: 1rem; /\* 16px \*/ | | left-4 | left: 1rem; /\* 16px \*/ | | inset-5 | top: 1.25rem; /\* 20px \*/ right: 1.25rem; /\* 20px \*/ bottom: 1.25rem; /\* 20px \*/ left: 1.25rem; /\* 20px \*/ | | inset-x-5 | left: 1.25rem; /\* 20px \*/ right: 1.25rem; /\* 20px \*/ | | inset-y-5 | top: 1.25rem; /\* 20px \*/ bottom: 1.25rem; /\* 20px \*/ | | top-5 | top: 1.25rem; /\* 20px \*/ | | right-5 | right: 1.25rem; /\* 20px \*/ | | bottom-5 | bottom: 1.25rem; /\* 20px \*/ | | left-5 | left: 1.25rem; /\* 20px \*/ | | inset-6 | top: 1.5rem; /\* 24px \*/ right: 1.5rem; /\* 24px \*/ bottom: 1.5rem; /\* 24px \*/ left: 1.5rem; /\* 24px \*/ | | inset-x-6 | left: 1.5rem; /\* 24px \*/ right: 1.5rem; /\* 24px \*/ | | inset-y-6 | top: 1.5rem; /\* 24px \*/ bottom: 1.5rem; /\* 24px \*/ | | top-6 | top: 1.5rem; /\* 24px \*/ | | right-6 | right: 1.5rem; /\* 24px \*/ | | bottom-6 | bottom: 1.5rem; /\* 24px \*/ | | left-6 | left: 1.5rem; /\* 24px \*/ | | inset-7 | top: 1.75rem; /\* 28px \*/ right: 1.75rem; /\* 28px \*/ bottom: 1.75rem; /\* 28px \*/ left: 1.75rem; /\* 28px \*/ | | inset-x-7 | left: 1.75rem; /\* 28px \*/ right: 1.75rem; /\* 28px \*/ | | inset-y-7 | top: 1.75rem; /\* 28px \*/ bottom: 1.75rem; /\* 28px \*/ | | top-7 | top: 1.75rem; /\* 28px \*/ | | right-7 | right: 1.75rem; /\* 28px \*/ | | bottom-7 | bottom: 1.75rem; /\* 28px \*/ | | left-7 | left: 1.75rem; /\* 28px \*/ | | inset-8 | top: 2rem; /\* 32px \*/ right: 2rem; /\* 32px \*/ bottom: 2rem; /\* 32px \*/ left: 2rem; /\* 32px \*/ | | inset-x-8 | left: 2rem; /\* 32px \*/ right: 2rem; /\* 32px \*/ | | inset-y-8 | top: 2rem; /\* 32px \*/ bottom: 2rem; /\* 32px \*/ | | top-8 | top: 2rem; /\* 32px \*/ | | right-8 | right: 2rem; /\* 32px \*/ | | bottom-8 | bottom: 2rem; /\* 32px \*/ | | left-8 | left: 2rem; /\* 32px \*/ | | inset-9 | top: 2.25rem; /\* 36px \*/ right: 2.25rem; /\* 36px \*/ bottom: 2.25rem; /\* 36px \*/ left: 2.25rem; /\* 36px \*/ | | inset-x-9 | left: 2.25rem; /\* 36px \*/ right: 2.25rem; /\* 36px \*/ | | inset-y-9 | top: 2.25rem; /\* 36px \*/ bottom: 2.25rem; /\* 36px \*/ | | top-9 | top: 2.25rem; /\* 36px \*/ | | right-9 | right: 2.25rem; /\* 36px \*/ | | bottom-9 | bottom: 2.25rem; /\* 36px \*/ | | left-9 | left: 2.25rem; /\* 36px \*/ | | inset-10 | top: 2.5rem; /\* 40px \*/ right: 2.5rem; /\* 40px \*/ bottom: 2.5rem; /\* 40px \*/ left: 2.5rem; /\* 40px \*/ | | inset-x-10 | left: 2.5rem; /\* 40px \*/ right: 2.5rem; /\* 40px \*/ | | inset-y-10 | top: 2.5rem; /\* 40px \*/ bottom: 2.5rem; /\* 40px \*/ | | top-10 | top: 2.5rem; /\* 40px \*/ | | right-10 | right: 2.5rem; /\* 40px \*/ | | bottom-10 | bottom: 2.5rem; /\* 40px \*/ | | left-10 | left: 2.5rem; /\* 40px \*/ | | inset-11 | top: 2.75rem; /\* 44px \*/ right: 2.75rem; /\* 44px \*/ bottom: 2.75rem; /\* 44px \*/ left: 2.75rem; /\* 44px \*/ | | inset-x-11 | left: 2.75rem; /\* 44px \*/ right: 2.75rem; /\* 44px \*/ | | inset-y-11 | top: 2.75rem; /\* 44px \*/ bottom: 2.75rem; /\* 44px \*/ | | top-11 | top: 2.75rem; /\* 44px \*/ | | right-11 | right: 2.75rem; /\* 44px \*/ | | bottom-11 | bottom: 2.75rem; /\* 44px \*/ | | left-11 | left: 2.75rem; /\* 44px \*/ | | inset-12 | top: 3rem; /\* 48px \*/ right: 3rem; /\* 48px \*/ bottom: 3rem; /\* 48px \*/ left: 3rem; /\* 48px \*/ | | inset-x-12 | left: 3rem; /\* 48px \*/ right: 3rem; /\* 48px \*/ | | inset-y-12 | top: 3rem; /\* 48px \*/ bottom: 3rem; /\* 48px \*/ | | top-12 | top: 3rem; /\* 48px \*/ | | right-12 | right: 3rem; /\* 48px \*/ | | bottom-12 | bottom: 3rem; /\* 48px \*/ | | left-12 | left: 3rem; /\* 48px \*/ | | inset-14 | top: 3.5rem; /\* 56px \*/ right: 3.5rem; /\* 56px \*/ bottom: 3.5rem; /\* 56px \*/ left: 3.5rem; /\* 56px \*/ | | inset-x-14 | left: 3.5rem; /\* 56px \*/ right: 3.5rem; /\* 56px \*/ | | inset-y-14 | top: 3.5rem; /\* 56px \*/ bottom: 3.5rem; /\* 56px \*/ | | top-14 | top: 3.5rem; /\* 56px \*/ | | right-14 | right: 3.5rem; /\* 56px \*/ | | bottom-14 | bottom: 3.5rem; /\* 56px \*/ | | left-14 | left: 3.5rem; /\* 56px \*/ | | inset-16 | top: 4rem; /\* 64px \*/ right: 4rem; /\* 64px \*/ bottom: 4rem; /\* 64px \*/ left: 4rem; /\* 64px \*/ | | inset-x-16 | left: 4rem; /\* 64px \*/ right: 4rem; /\* 64px \*/ | | inset-y-16 | top: 4rem; /\* 64px \*/ bottom: 4rem; /\* 64px \*/ | | top-16 | top: 4rem; /\* 64px \*/ | | right-16 | right: 4rem; /\* 64px \*/ | | bottom-16 | bottom: 4rem; /\* 64px \*/ | | left-16 | left: 4rem; /\* 64px \*/ | | inset-20 | top: 5rem; /\* 80px \*/ right: 5rem; /\* 80px \*/ bottom: 5rem; /\* 80px \*/ left: 5rem; /\* 80px \*/ | | inset-x-20 | left: 5rem; /\* 80px \*/ right: 5rem; /\* 80px \*/ | | inset-y-20 | top: 5rem; /\* 80px \*/ bottom: 5rem; /\* 80px \*/ | | top-20 | top: 5rem; /\* 80px \*/ | | right-20 | right: 5rem; /\* 80px \*/ | | bottom-20 | bottom: 5rem; /\* 80px \*/ | | left-20 | left: 5rem; /\* 80px \*/ | | inset-24 | top: 6rem; /\* 96px \*/ right: 6rem; /\* 96px \*/ bottom: 6rem; /\* 96px \*/ left: 6rem; /\* 96px \*/ | | inset-x-24 | left: 6rem; /\* 96px \*/ right: 6rem; /\* 96px \*/ | | inset-y-24 | top: 6rem; /\* 96px \*/ bottom: 6rem; /\* 96px \*/ | | top-24 | top: 6rem; /\* 96px \*/ | | right-24 | right: 6rem; /\* 96px \*/ | | bottom-24 | bottom: 6rem; /\* 96px \*/ | | left-24 | left: 6rem; /\* 96px \*/ | | inset-28 | top: 7rem; /\* 112px \*/ right: 7rem; /\* 112px \*/ bottom: 7rem; /\* 112px \*/ left: 7rem; /\* 112px \*/ | | inset-x-28 | left: 7rem; /\* 112px \*/ right: 7rem; /\* 112px \*/ | | inset-y-28 | top: 7rem; /\* 112px \*/ bottom: 7rem; /\* 112px \*/ | | top-28 | top: 7rem; /\* 112px \*/ | | right-28 | right: 7rem; /\* 112px \*/ | | bottom-28 | bottom: 7rem; /\* 112px \*/ | | left-28 | left: 7rem; /\* 112px \*/ | | inset-32 | top: 8rem; /\* 128px \*/ right: 8rem; /\* 128px \*/ bottom: 8rem; /\* 128px \*/ left: 8rem; /\* 128px \*/ | | inset-x-32 | left: 8rem; /\* 128px \*/ right: 8rem; /\* 128px \*/ | | inset-y-32 | top: 8rem; /\* 128px \*/ bottom: 8rem; /\* 128px \*/ | | top-32 | top: 8rem; /\* 128px \*/ | | right-32 | right: 8rem; /\* 128px \*/ | | bottom-32 | bottom: 8rem; /\* 128px \*/ | | left-32 | left: 8rem; /\* 128px \*/ | | inset-36 | top: 9rem; /\* 144px \*/ right: 9rem; /\* 144px \*/ bottom: 9rem; /\* 144px \*/ left: 9rem; /\* 144px \*/ | | inset-x-36 | left: 9rem; /\* 144px \*/ right: 9rem; /\* 144px \*/ | | inset-y-36 | top: 9rem; /\* 144px \*/ bottom: 9rem; /\* 144px \*/ | | top-36 | top: 9rem; /\* 144px \*/ | | right-36 | right: 9rem; /\* 144px \*/ | | bottom-36 | bottom: 9rem; /\* 144px \*/ | | left-36 | left: 9rem; /\* 144px \*/ | | inset-40 | top: 10rem; /\* 160px \*/ right: 10rem; /\* 160px \*/ bottom: 10rem; /\* 160px \*/ left: 10rem; /\* 160px \*/ | | inset-x-40 | left: 10rem; /\* 160px \*/ right: 10rem; /\* 160px \*/ | | inset-y-40 | top: 10rem; /\* 160px \*/ bottom: 10rem; /\* 160px \*/ | | top-40 | top: 10rem; /\* 160px \*/ | | right-40 | right: 10rem; /\* 160px \*/ | | bottom-40 | bottom: 10rem; /\* 160px \*/ | | left-40 | left: 10rem; /\* 160px \*/ | | inset-44 | top: 11rem; /\* 176px \*/ right: 11rem; /\* 176px \*/ bottom: 11rem; /\* 176px \*/ left: 11rem; /\* 176px \*/ | | inset-x-44 | left: 11rem; /\* 176px \*/ right: 11rem; /\* 176px \*/ | | inset-y-44 | top: 11rem; /\* 176px \*/ bottom: 11rem; /\* 176px \*/ | | top-44 | top: 11rem; /\* 176px \*/ | | right-44 | right: 11rem; /\* 176px \*/ | | bottom-44 | bottom: 11rem; /\* 176px \*/ | | left-44 | left: 11rem; /\* 176px \*/ | | inset-48 | top: 12rem; /\* 192px \*/ right: 12rem; /\* 192px \*/ bottom: 12rem; /\* 192px \*/ left: 12rem; /\* 192px \*/ | | inset-x-48 | left: 12rem; /\* 192px \*/ right: 12rem; /\* 192px \*/ | | inset-y-48 | top: 12rem; /\* 192px \*/ bottom: 12rem; /\* 192px \*/ | | top-48 | top: 12rem; /\* 192px \*/ | | right-48 | right: 12rem; /\* 192px \*/ | | bottom-48 | bottom: 12rem; /\* 192px \*/ | | left-48 | left: 12rem; /\* 192px \*/ | | inset-52 | top: 13rem; /\* 208px \*/ right: 13rem; /\* 208px \*/ bottom: 13rem; /\* 208px \*/ left: 13rem; /\* 208px \*/ | | inset-x-52 | left: 13rem; /\* 208px \*/ right: 13rem; /\* 208px \*/ | | inset-y-52 | top: 13rem; /\* 208px \*/ bottom: 13rem; /\* 208px \*/ | | top-52 | top: 13rem; /\* 208px \*/ | | right-52 | right: 13rem; /\* 208px \*/ | | bottom-52 | bottom: 13rem; /\* 208px \*/ | | left-52 | left: 13rem; /\* 208px \*/ | | inset-56 | top: 14rem; /\* 224px \*/ right: 14rem; /\* 224px \*/ bottom: 14rem; /\* 224px \*/ left: 14rem; /\* 224px \*/ | | inset-x-56 | left: 14rem; /\* 224px \*/ right: 14rem; /\* 224px \*/ | | inset-y-56 | top: 14rem; /\* 224px \*/ bottom: 14rem; /\* 224px \*/ | | top-56 | top: 14rem; /\* 224px \*/ | | right-56 | right: 14rem; /\* 224px \*/ | | bottom-56 | bottom: 14rem; /\* 224px \*/ | | left-56 | left: 14rem; /\* 224px \*/ | | inset-60 | top: 15rem; /\* 240px \*/ right: 15rem; /\* 240px \*/ bottom: 15rem; /\* 240px \*/ left: 15rem; /\* 240px \*/ | | inset-x-60 | left: 15rem; /\* 240px \*/ right: 15rem; /\* 240px \*/ | | inset-y-60 | top: 15rem; /\* 240px \*/ bottom: 15rem; /\* 240px \*/ | | top-60 | top: 15rem; /\* 240px \*/ | | right-60 | right: 15rem; /\* 240px \*/ | | bottom-60 | bottom: 15rem; /\* 240px \*/ | | left-60 | left: 15rem; /\* 240px \*/ | | inset-64 | top: 16rem; /\* 256px \*/ right: 16rem; /\* 256px \*/ bottom: 16rem; /\* 256px \*/ left: 16rem; /\* 256px \*/ | | inset-x-64 | left: 16rem; /\* 256px \*/ right: 16rem; /\* 256px \*/ | | inset-y-64 | top: 16rem; /\* 256px \*/ bottom: 16rem; /\* 256px \*/ | | top-64 | top: 16rem; /\* 256px \*/ | | right-64 | right: 16rem; /\* 256px \*/ | | bottom-64 | bottom: 16rem; /\* 256px \*/ | | left-64 | left: 16rem; /\* 256px \*/ | | inset-72 | top: 18rem; /\* 288px \*/ right: 18rem; /\* 288px \*/ bottom: 18rem; /\* 288px \*/ left: 18rem; /\* 288px \*/ | | inset-x-72 | left: 18rem; /\* 288px \*/ right: 18rem; /\* 288px \*/ | | inset-y-72 | top: 18rem; /\* 288px \*/ bottom: 18rem; /\* 288px \*/ | | top-72 | top: 18rem; /\* 288px \*/ | | right-72 | right: 18rem; /\* 288px \*/ | | bottom-72 | bottom: 18rem; /\* 288px \*/ | | left-72 | left: 18rem; /\* 288px \*/ | | inset-80 | top: 20rem; /\* 320px \*/ right: 20rem; /\* 320px \*/ bottom: 20rem; /\* 320px \*/ left: 20rem; /\* 320px \*/ | | inset-x-80 | left: 20rem; /\* 320px \*/ right: 20rem; /\* 320px \*/ | | inset-y-80 | top: 20rem; /\* 320px \*/ bottom: 20rem; /\* 320px \*/ | | top-80 | top: 20rem; /\* 320px \*/ | | right-80 | right: 20rem; /\* 320px \*/ | | bottom-80 | bottom: 20rem; /\* 320px \*/ | | left-80 | left: 20rem; /\* 320px \*/ | | inset-96 | top: 24rem; /\* 384px \*/ right: 24rem; /\* 384px \*/ bottom: 24rem; /\* 384px \*/ left: 24rem; /\* 384px \*/ | | inset-x-96 | left: 24rem; /\* 384px \*/ right: 24rem; /\* 384px \*/ | | inset-y-96 | top: 24rem; /\* 384px \*/ bottom: 24rem; /\* 384px \*/ | | top-96 | top: 24rem; /\* 384px \*/ | | right-96 | right: 24rem; /\* 384px \*/ | | bottom-96 | bottom: 24rem; /\* 384px \*/ | | left-96 | left: 24rem; /\* 384px \*/ | | inset-auto | top: auto; right: auto; bottom: auto; left: auto; | | inset-1/2 | top: 50%; right: 50%; bottom: 50%; left: 50%; | | inset-1/3 | top: 33.333333%; right: 33.333333%; bottom: 33.333333%; left: 33.333333%; | | inset-2/3 | top: 66.666667%; right: 66.666667%; bottom: 66.666667%; left: 66.666667%; | | inset-1/4 | top: 25%; right: 25%; bottom: 25%; left: 25%; | | inset-2/4 | top: 50%; right: 50%; bottom: 50%; left: 50%; | | inset-3/4 | top: 75%; right: 75%; bottom: 75%; left: 75%; | | inset-full | top: 100%; right: 100%; bottom: 100%; left: 100%; | | inset-x-auto | left: auto; right: auto; | | inset-x-1/2 | left: 50%; right: 50%; | | inset-x-1/3 | left: 33.333333%; right: 33.333333%; | | inset-x-2/3 | left: 66.666667%; right: 66.666667%; | | inset-x-1/4 | left: 25%; right: 25%; | | inset-x-2/4 | left: 50%; right: 50%; | | inset-x-3/4 | left: 75%; right: 75%; | | inset-x-full | left: 100%; right: 100%; | | inset-y-auto | top: auto; bottom: auto; | | inset-y-1/2 | top: 50%; bottom: 50%; | | inset-y-1/3 | top: 33.333333%; bottom: 33.333333%; | | inset-y-2/3 | top: 66.666667%; bottom: 66.666667%; | | inset-y-1/4 | top: 25%; bottom: 25%; | | inset-y-2/4 | top: 50%; bottom: 50%; | | inset-y-3/4 | top: 75%; bottom: 75%; | | inset-y-full | top: 100%; bottom: 100%; | | top-auto | top: auto; | | top-1/2 | top: 50%; | | top-1/3 | top: 33.333333%; | | top-2/3 | top: 66.666667%; | | top-1/4 | top: 25%; | | top-2/4 | top: 50%; | | top-3/4 | top: 75%; | | top-full | top: 100%; | | right-auto | right: auto; | | right-1/2 | right: 50%; | | right-1/3 | right: 33.333333%; | | right-2/3 | right: 66.666667%; | | right-1/4 | right: 25%; | | right-2/4 | right: 50%; | | right-3/4 | right: 75%; | | right-full | right: 100%; | | bottom-auto | bottom: auto; | | bottom-1/2 | bottom: 50%; | | bottom-1/3 | bottom: 33.333333%; | | bottom-2/3 | bottom: 66.666667%; | | bottom-1/4 | bottom: 25%; | | bottom-2/4 | bottom: 50%; | | bottom-3/4 | bottom: 75%; | | bottom-full | bottom: 100%; | | left-auto | left: auto; | | left-1/2 | left: 50%; | | left-1/3 | left: 33.333333%; | | left-2/3 | left: 66.666667%; | | left-1/4 | left: 25%; | | left-2/4 | left: 50%; | | left-3/4 | left: 75%; | | left-full | left: 100%; | Basic usage ----------- ### Placing a positioned element Use the `{top|right|bottom|left|inset}-{size}` utilities to set the horizontal or vertical position of a [positioned element](position). ``` <!-- Pin to top left corner --> <div class="relative h-32 w-32 ..."> <div class="absolute left-0 top-0 h-16 w-16 ...">01</div> </div> <!-- Span top edge --> <div class="relative h-32 w-32 ..."> <div class="absolute inset-x-0 top-0 h-16 ...">02</div> </div> <!-- Pin to top right corner --> <div class="relative h-32 w-32 ..."> <div class="absolute top-0 right-0 h-16 w-16 ...">03</div> </div> <!-- Span left edge --> <div class="relative h-32 w-32 ..."> <div class="absolute inset-y-0 left-0 w-16 ...">04</div> </div> <!-- Fill entire parent --> <div class="relative h-32 w-32 ..."> <div class="absolute inset-0 ...">05</div> </div> <!-- Span right edge --> <div class="relative h-32 w-32 ..."> <div class="absolute inset-y-0 right-0 w-16 ...">06</div> </div> <!-- Pin to bottom left corner --> <div class="relative h-32 w-32 ..."> <div class="absolute bottom-0 left-0 h-16 w-16 ...">07</div> </div> <!-- Span bottom edge --> <div class="relative h-32 w-32 ..."> <div class="absolute inset-x-0 bottom-0 h-16 ...">08</div> </div> <!-- Pin to bottom right corner --> <div class="relative h-32 w-32 ..."> <div class="absolute bottom-0 right-0 h-16 w-16 ...">09</div> </div> ``` ### Using negative values To use a negative top/right/bottom/left value, prefix the class name with a dash to convert it to a negative value. ``` <div class="relative h-32 w-32 ..."> <div class="absolute h-14 w-14 -left-4 -top-4 ..."></div> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:top-6` to only apply the `top-6` utility on hover. ``` <div class="top-4 hover:top-6"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:top-6` to apply the `top-6` utility at only medium screen sizes and above. ``` <div class="top-4 md:top-6"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind provides top/right/bottom/left/inset utilities for a combination of the [default spacing scale](customizing-spacing#default-spacing-scale), `auto`, `full` as well as some additional fraction values. You can customize your spacing scale by editing `theme.spacing` or `theme.extend.spacing` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { spacing: { '3px': '3px', } } } } ``` Alternatively, you can customize just the top/right/bottom/left/inset scale by editing `theme.inset` or `theme.extend.inset` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { inset: { '3px': '3px', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `top/right/bottom/left` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="top-[3px]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation.
programming_docs
tailwindcss Flex Quick reference --------------- | Class | Properties | | --- | --- | | flex-1 | flex: 1 1 0%; | | flex-auto | flex: 1 1 auto; | | flex-initial | flex: 0 1 auto; | | flex-none | flex: none; | Basic usage ----------- ### Initial Use `flex-initial` to allow a flex item to shrink but not grow, taking into account its initial size: ``` <div class="flex"> <div class="flex-none w-14 h-14"> 01 </div> <div class="flex-initial w-64 ..."> 02 </div> <div class="flex-initial w-32 ..."> 03 </div> </div> ``` ### Flex 1 Use `flex-1` to allow a flex item to grow and shrink as needed, ignoring its initial size: ``` <div class="flex"> <div class="flex-none ..."> 01 </div> <div class="flex-1 w-64 ..."> 02 </div> <div class="flex-1 w-32 ..."> 03 </div> </div> ``` ### Auto Use `flex-auto` to allow a flex item to grow and shrink, taking into account its initial size: ``` <div class="flex ..."> <div class="flex-none ..."> 01 </div> <div class="flex-auto w-64 ..."> 02 </div> <div class="flex-auto w-32 ..."> 03 </div> </div> ``` ### None Use `flex-none` to prevent a flex item from growing or shrinking: ``` <div class="flex ..."> <div class="flex-none w-14 h-14 ..."> 01 </div> <div class="flex-none ..."> 02 </div> <div class="flex-1 ..."> 03 </div> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:flex-1` to only apply the `flex-1` utility on hover. ``` <div class="flex-none hover:flex-1"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:flex-1` to apply the `flex-1` utility at only medium screen sizes and above. ``` <div class="flex-none md:flex-1"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind provides four `flex` utilities. You can customize these values by editing `theme.flex` or `theme.extend.flex` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { flex: { '2': '2 2 0%' } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `flex` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="flex-[2_2_0%]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Stroke Width Quick reference --------------- | Class | Properties | | --- | --- | | stroke-0 | stroke-width: 0; | | stroke-1 | stroke-width: 1; | | stroke-2 | stroke-width: 2; | Basic usage ----------- ### Setting the stroke width Use the `stroke-{width}` utilities to set the stroke width of an SVG. ``` <svg class="stroke-1 ..."></svg> <svg class="stroke-2 ..."></svg> ``` This can be useful for styling icon sets like [Heroicons](https://heroicons.com). Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:stroke-2` to only apply the `stroke-2` utility on hover. ``` <svg class="stroke-1 hover:stroke-2"> <!-- ... --> </svg> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:stroke-2` to apply the `stroke-2` utility at only medium screen sizes and above. ``` <svg class="stroke-1 md:stroke-2"> <!-- ... --> </svg> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind includes `stroke-width` utilities for creating basic grids with up to 6 equal width rows. You can customize these values by editing `theme.strokeWidth` or `theme.extend.strokeWidth` in your `tailwind.config.js` file. You have direct access to the `stroke-width` CSS property here so you can make your custom rows values as generic or as complicated and site-specific as you like. tailwind.config.js ``` module.exports = { theme: { extend: { strokeWidth: { '2': '2px', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `stroke-width` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <svg class="stroke-[2px]"> <!-- ... --> </svg> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Scroll Margin Quick reference --------------- | Class | Properties | | --- | --- | | scroll-m-0 | scroll-margin: 0px; | | scroll-mx-0 | scroll-margin-left: 0px; scroll-margin-right: 0px; | | scroll-my-0 | scroll-margin-top: 0px; scroll-margin-bottom: 0px; | | scroll-mt-0 | scroll-margin-top: 0px; | | scroll-mr-0 | scroll-margin-right: 0px; | | scroll-mb-0 | scroll-margin-bottom: 0px; | | scroll-ml-0 | scroll-margin-left: 0px; | | scroll-m-px | scroll-margin: 1px; | | scroll-mx-px | scroll-margin-left: 1px; scroll-margin-right: 1px; | | scroll-my-px | scroll-margin-top: 1px; scroll-margin-bottom: 1px; | | scroll-mt-px | scroll-margin-top: 1px; | | scroll-mr-px | scroll-margin-right: 1px; | | scroll-mb-px | scroll-margin-bottom: 1px; | | scroll-ml-px | scroll-margin-left: 1px; | | scroll-m-0.5 | scroll-margin: 0.125rem; /\* 2px \*/ | | scroll-mx-0.5 | scroll-margin-left: 0.125rem; /\* 2px \*/ scroll-margin-right: 0.125rem; /\* 2px \*/ | | scroll-my-0.5 | scroll-margin-top: 0.125rem; /\* 2px \*/ scroll-margin-bottom: 0.125rem; /\* 2px \*/ | | scroll-mt-0.5 | scroll-margin-top: 0.125rem; /\* 2px \*/ | | scroll-mr-0.5 | scroll-margin-right: 0.125rem; /\* 2px \*/ | | scroll-mb-0.5 | scroll-margin-bottom: 0.125rem; /\* 2px \*/ | | scroll-ml-0.5 | scroll-margin-left: 0.125rem; /\* 2px \*/ | | scroll-m-1 | scroll-margin: 0.25rem; /\* 4px \*/ | | scroll-mx-1 | scroll-margin-left: 0.25rem; /\* 4px \*/ scroll-margin-right: 0.25rem; /\* 4px \*/ | | scroll-my-1 | scroll-margin-top: 0.25rem; /\* 4px \*/ scroll-margin-bottom: 0.25rem; /\* 4px \*/ | | scroll-mt-1 | scroll-margin-top: 0.25rem; /\* 4px \*/ | | scroll-mr-1 | scroll-margin-right: 0.25rem; /\* 4px \*/ | | scroll-mb-1 | scroll-margin-bottom: 0.25rem; /\* 4px \*/ | | scroll-ml-1 | scroll-margin-left: 0.25rem; /\* 4px \*/ | | scroll-m-1.5 | scroll-margin: 0.375rem; /\* 6px \*/ | | scroll-mx-1.5 | scroll-margin-left: 0.375rem; /\* 6px \*/ scroll-margin-right: 0.375rem; /\* 6px \*/ | | scroll-my-1.5 | scroll-margin-top: 0.375rem; /\* 6px \*/ scroll-margin-bottom: 0.375rem; /\* 6px \*/ | | scroll-mt-1.5 | scroll-margin-top: 0.375rem; /\* 6px \*/ | | scroll-mr-1.5 | scroll-margin-right: 0.375rem; /\* 6px \*/ | | scroll-mb-1.5 | scroll-margin-bottom: 0.375rem; /\* 6px \*/ | | scroll-ml-1.5 | scroll-margin-left: 0.375rem; /\* 6px \*/ | | scroll-m-2 | scroll-margin: 0.5rem; /\* 8px \*/ | | scroll-mx-2 | scroll-margin-left: 0.5rem; /\* 8px \*/ scroll-margin-right: 0.5rem; /\* 8px \*/ | | scroll-my-2 | scroll-margin-top: 0.5rem; /\* 8px \*/ scroll-margin-bottom: 0.5rem; /\* 8px \*/ | | scroll-mt-2 | scroll-margin-top: 0.5rem; /\* 8px \*/ | | scroll-mr-2 | scroll-margin-right: 0.5rem; /\* 8px \*/ | | scroll-mb-2 | scroll-margin-bottom: 0.5rem; /\* 8px \*/ | | scroll-ml-2 | scroll-margin-left: 0.5rem; /\* 8px \*/ | | scroll-m-2.5 | scroll-margin: 0.625rem; /\* 10px \*/ | | scroll-mx-2.5 | scroll-margin-left: 0.625rem; /\* 10px \*/ scroll-margin-right: 0.625rem; /\* 10px \*/ | | scroll-my-2.5 | scroll-margin-top: 0.625rem; /\* 10px \*/ scroll-margin-bottom: 0.625rem; /\* 10px \*/ | | scroll-mt-2.5 | scroll-margin-top: 0.625rem; /\* 10px \*/ | | scroll-mr-2.5 | scroll-margin-right: 0.625rem; /\* 10px \*/ | | scroll-mb-2.5 | scroll-margin-bottom: 0.625rem; /\* 10px \*/ | | scroll-ml-2.5 | scroll-margin-left: 0.625rem; /\* 10px \*/ | | scroll-m-3 | scroll-margin: 0.75rem; /\* 12px \*/ | | scroll-mx-3 | scroll-margin-left: 0.75rem; /\* 12px \*/ scroll-margin-right: 0.75rem; /\* 12px \*/ | | scroll-my-3 | scroll-margin-top: 0.75rem; /\* 12px \*/ scroll-margin-bottom: 0.75rem; /\* 12px \*/ | | scroll-mt-3 | scroll-margin-top: 0.75rem; /\* 12px \*/ | | scroll-mr-3 | scroll-margin-right: 0.75rem; /\* 12px \*/ | | scroll-mb-3 | scroll-margin-bottom: 0.75rem; /\* 12px \*/ | | scroll-ml-3 | scroll-margin-left: 0.75rem; /\* 12px \*/ | | scroll-m-3.5 | scroll-margin: 0.875rem; /\* 14px \*/ | | scroll-mx-3.5 | scroll-margin-left: 0.875rem; /\* 14px \*/ scroll-margin-right: 0.875rem; /\* 14px \*/ | | scroll-my-3.5 | scroll-margin-top: 0.875rem; /\* 14px \*/ scroll-margin-bottom: 0.875rem; /\* 14px \*/ | | scroll-mt-3.5 | scroll-margin-top: 0.875rem; /\* 14px \*/ | | scroll-mr-3.5 | scroll-margin-right: 0.875rem; /\* 14px \*/ | | scroll-mb-3.5 | scroll-margin-bottom: 0.875rem; /\* 14px \*/ | | scroll-ml-3.5 | scroll-margin-left: 0.875rem; /\* 14px \*/ | | scroll-m-4 | scroll-margin: 1rem; /\* 16px \*/ | | scroll-mx-4 | scroll-margin-left: 1rem; /\* 16px \*/ scroll-margin-right: 1rem; /\* 16px \*/ | | scroll-my-4 | scroll-margin-top: 1rem; /\* 16px \*/ scroll-margin-bottom: 1rem; /\* 16px \*/ | | scroll-mt-4 | scroll-margin-top: 1rem; /\* 16px \*/ | | scroll-mr-4 | scroll-margin-right: 1rem; /\* 16px \*/ | | scroll-mb-4 | scroll-margin-bottom: 1rem; /\* 16px \*/ | | scroll-ml-4 | scroll-margin-left: 1rem; /\* 16px \*/ | | scroll-m-5 | scroll-margin: 1.25rem; /\* 20px \*/ | | scroll-mx-5 | scroll-margin-left: 1.25rem; /\* 20px \*/ scroll-margin-right: 1.25rem; /\* 20px \*/ | | scroll-my-5 | scroll-margin-top: 1.25rem; /\* 20px \*/ scroll-margin-bottom: 1.25rem; /\* 20px \*/ | | scroll-mt-5 | scroll-margin-top: 1.25rem; /\* 20px \*/ | | scroll-mr-5 | scroll-margin-right: 1.25rem; /\* 20px \*/ | | scroll-mb-5 | scroll-margin-bottom: 1.25rem; /\* 20px \*/ | | scroll-ml-5 | scroll-margin-left: 1.25rem; /\* 20px \*/ | | scroll-m-6 | scroll-margin: 1.5rem; /\* 24px \*/ | | scroll-mx-6 | scroll-margin-left: 1.5rem; /\* 24px \*/ scroll-margin-right: 1.5rem; /\* 24px \*/ | | scroll-my-6 | scroll-margin-top: 1.5rem; /\* 24px \*/ scroll-margin-bottom: 1.5rem; /\* 24px \*/ | | scroll-mt-6 | scroll-margin-top: 1.5rem; /\* 24px \*/ | | scroll-mr-6 | scroll-margin-right: 1.5rem; /\* 24px \*/ | | scroll-mb-6 | scroll-margin-bottom: 1.5rem; /\* 24px \*/ | | scroll-ml-6 | scroll-margin-left: 1.5rem; /\* 24px \*/ | | scroll-m-7 | scroll-margin: 1.75rem; /\* 28px \*/ | | scroll-mx-7 | scroll-margin-left: 1.75rem; /\* 28px \*/ scroll-margin-right: 1.75rem; /\* 28px \*/ | | scroll-my-7 | scroll-margin-top: 1.75rem; /\* 28px \*/ scroll-margin-bottom: 1.75rem; /\* 28px \*/ | | scroll-mt-7 | scroll-margin-top: 1.75rem; /\* 28px \*/ | | scroll-mr-7 | scroll-margin-right: 1.75rem; /\* 28px \*/ | | scroll-mb-7 | scroll-margin-bottom: 1.75rem; /\* 28px \*/ | | scroll-ml-7 | scroll-margin-left: 1.75rem; /\* 28px \*/ | | scroll-m-8 | scroll-margin: 2rem; /\* 32px \*/ | | scroll-mx-8 | scroll-margin-left: 2rem; /\* 32px \*/ scroll-margin-right: 2rem; /\* 32px \*/ | | scroll-my-8 | scroll-margin-top: 2rem; /\* 32px \*/ scroll-margin-bottom: 2rem; /\* 32px \*/ | | scroll-mt-8 | scroll-margin-top: 2rem; /\* 32px \*/ | | scroll-mr-8 | scroll-margin-right: 2rem; /\* 32px \*/ | | scroll-mb-8 | scroll-margin-bottom: 2rem; /\* 32px \*/ | | scroll-ml-8 | scroll-margin-left: 2rem; /\* 32px \*/ | | scroll-m-9 | scroll-margin: 2.25rem; /\* 36px \*/ | | scroll-mx-9 | scroll-margin-left: 2.25rem; /\* 36px \*/ scroll-margin-right: 2.25rem; /\* 36px \*/ | | scroll-my-9 | scroll-margin-top: 2.25rem; /\* 36px \*/ scroll-margin-bottom: 2.25rem; /\* 36px \*/ | | scroll-mt-9 | scroll-margin-top: 2.25rem; /\* 36px \*/ | | scroll-mr-9 | scroll-margin-right: 2.25rem; /\* 36px \*/ | | scroll-mb-9 | scroll-margin-bottom: 2.25rem; /\* 36px \*/ | | scroll-ml-9 | scroll-margin-left: 2.25rem; /\* 36px \*/ | | scroll-m-10 | scroll-margin: 2.5rem; /\* 40px \*/ | | scroll-mx-10 | scroll-margin-left: 2.5rem; /\* 40px \*/ scroll-margin-right: 2.5rem; /\* 40px \*/ | | scroll-my-10 | scroll-margin-top: 2.5rem; /\* 40px \*/ scroll-margin-bottom: 2.5rem; /\* 40px \*/ | | scroll-mt-10 | scroll-margin-top: 2.5rem; /\* 40px \*/ | | scroll-mr-10 | scroll-margin-right: 2.5rem; /\* 40px \*/ | | scroll-mb-10 | scroll-margin-bottom: 2.5rem; /\* 40px \*/ | | scroll-ml-10 | scroll-margin-left: 2.5rem; /\* 40px \*/ | | scroll-m-11 | scroll-margin: 2.75rem; /\* 44px \*/ | | scroll-mx-11 | scroll-margin-left: 2.75rem; /\* 44px \*/ scroll-margin-right: 2.75rem; /\* 44px \*/ | | scroll-my-11 | scroll-margin-top: 2.75rem; /\* 44px \*/ scroll-margin-bottom: 2.75rem; /\* 44px \*/ | | scroll-mt-11 | scroll-margin-top: 2.75rem; /\* 44px \*/ | | scroll-mr-11 | scroll-margin-right: 2.75rem; /\* 44px \*/ | | scroll-mb-11 | scroll-margin-bottom: 2.75rem; /\* 44px \*/ | | scroll-ml-11 | scroll-margin-left: 2.75rem; /\* 44px \*/ | | scroll-m-12 | scroll-margin: 3rem; /\* 48px \*/ | | scroll-mx-12 | scroll-margin-left: 3rem; /\* 48px \*/ scroll-margin-right: 3rem; /\* 48px \*/ | | scroll-my-12 | scroll-margin-top: 3rem; /\* 48px \*/ scroll-margin-bottom: 3rem; /\* 48px \*/ | | scroll-mt-12 | scroll-margin-top: 3rem; /\* 48px \*/ | | scroll-mr-12 | scroll-margin-right: 3rem; /\* 48px \*/ | | scroll-mb-12 | scroll-margin-bottom: 3rem; /\* 48px \*/ | | scroll-ml-12 | scroll-margin-left: 3rem; /\* 48px \*/ | | scroll-m-14 | scroll-margin: 3.5rem; /\* 56px \*/ | | scroll-mx-14 | scroll-margin-left: 3.5rem; /\* 56px \*/ scroll-margin-right: 3.5rem; /\* 56px \*/ | | scroll-my-14 | scroll-margin-top: 3.5rem; /\* 56px \*/ scroll-margin-bottom: 3.5rem; /\* 56px \*/ | | scroll-mt-14 | scroll-margin-top: 3.5rem; /\* 56px \*/ | | scroll-mr-14 | scroll-margin-right: 3.5rem; /\* 56px \*/ | | scroll-mb-14 | scroll-margin-bottom: 3.5rem; /\* 56px \*/ | | scroll-ml-14 | scroll-margin-left: 3.5rem; /\* 56px \*/ | | scroll-m-16 | scroll-margin: 4rem; /\* 64px \*/ | | scroll-mx-16 | scroll-margin-left: 4rem; /\* 64px \*/ scroll-margin-right: 4rem; /\* 64px \*/ | | scroll-my-16 | scroll-margin-top: 4rem; /\* 64px \*/ scroll-margin-bottom: 4rem; /\* 64px \*/ | | scroll-mt-16 | scroll-margin-top: 4rem; /\* 64px \*/ | | scroll-mr-16 | scroll-margin-right: 4rem; /\* 64px \*/ | | scroll-mb-16 | scroll-margin-bottom: 4rem; /\* 64px \*/ | | scroll-ml-16 | scroll-margin-left: 4rem; /\* 64px \*/ | | scroll-m-20 | scroll-margin: 5rem; /\* 80px \*/ | | scroll-mx-20 | scroll-margin-left: 5rem; /\* 80px \*/ scroll-margin-right: 5rem; /\* 80px \*/ | | scroll-my-20 | scroll-margin-top: 5rem; /\* 80px \*/ scroll-margin-bottom: 5rem; /\* 80px \*/ | | scroll-mt-20 | scroll-margin-top: 5rem; /\* 80px \*/ | | scroll-mr-20 | scroll-margin-right: 5rem; /\* 80px \*/ | | scroll-mb-20 | scroll-margin-bottom: 5rem; /\* 80px \*/ | | scroll-ml-20 | scroll-margin-left: 5rem; /\* 80px \*/ | | scroll-m-24 | scroll-margin: 6rem; /\* 96px \*/ | | scroll-mx-24 | scroll-margin-left: 6rem; /\* 96px \*/ scroll-margin-right: 6rem; /\* 96px \*/ | | scroll-my-24 | scroll-margin-top: 6rem; /\* 96px \*/ scroll-margin-bottom: 6rem; /\* 96px \*/ | | scroll-mt-24 | scroll-margin-top: 6rem; /\* 96px \*/ | | scroll-mr-24 | scroll-margin-right: 6rem; /\* 96px \*/ | | scroll-mb-24 | scroll-margin-bottom: 6rem; /\* 96px \*/ | | scroll-ml-24 | scroll-margin-left: 6rem; /\* 96px \*/ | | scroll-m-28 | scroll-margin: 7rem; /\* 112px \*/ | | scroll-mx-28 | scroll-margin-left: 7rem; /\* 112px \*/ scroll-margin-right: 7rem; /\* 112px \*/ | | scroll-my-28 | scroll-margin-top: 7rem; /\* 112px \*/ scroll-margin-bottom: 7rem; /\* 112px \*/ | | scroll-mt-28 | scroll-margin-top: 7rem; /\* 112px \*/ | | scroll-mr-28 | scroll-margin-right: 7rem; /\* 112px \*/ | | scroll-mb-28 | scroll-margin-bottom: 7rem; /\* 112px \*/ | | scroll-ml-28 | scroll-margin-left: 7rem; /\* 112px \*/ | | scroll-m-32 | scroll-margin: 8rem; /\* 128px \*/ | | scroll-mx-32 | scroll-margin-left: 8rem; /\* 128px \*/ scroll-margin-right: 8rem; /\* 128px \*/ | | scroll-my-32 | scroll-margin-top: 8rem; /\* 128px \*/ scroll-margin-bottom: 8rem; /\* 128px \*/ | | scroll-mt-32 | scroll-margin-top: 8rem; /\* 128px \*/ | | scroll-mr-32 | scroll-margin-right: 8rem; /\* 128px \*/ | | scroll-mb-32 | scroll-margin-bottom: 8rem; /\* 128px \*/ | | scroll-ml-32 | scroll-margin-left: 8rem; /\* 128px \*/ | | scroll-m-36 | scroll-margin: 9rem; /\* 144px \*/ | | scroll-mx-36 | scroll-margin-left: 9rem; /\* 144px \*/ scroll-margin-right: 9rem; /\* 144px \*/ | | scroll-my-36 | scroll-margin-top: 9rem; /\* 144px \*/ scroll-margin-bottom: 9rem; /\* 144px \*/ | | scroll-mt-36 | scroll-margin-top: 9rem; /\* 144px \*/ | | scroll-mr-36 | scroll-margin-right: 9rem; /\* 144px \*/ | | scroll-mb-36 | scroll-margin-bottom: 9rem; /\* 144px \*/ | | scroll-ml-36 | scroll-margin-left: 9rem; /\* 144px \*/ | | scroll-m-40 | scroll-margin: 10rem; /\* 160px \*/ | | scroll-mx-40 | scroll-margin-left: 10rem; /\* 160px \*/ scroll-margin-right: 10rem; /\* 160px \*/ | | scroll-my-40 | scroll-margin-top: 10rem; /\* 160px \*/ scroll-margin-bottom: 10rem; /\* 160px \*/ | | scroll-mt-40 | scroll-margin-top: 10rem; /\* 160px \*/ | | scroll-mr-40 | scroll-margin-right: 10rem; /\* 160px \*/ | | scroll-mb-40 | scroll-margin-bottom: 10rem; /\* 160px \*/ | | scroll-ml-40 | scroll-margin-left: 10rem; /\* 160px \*/ | | scroll-m-44 | scroll-margin: 11rem; /\* 176px \*/ | | scroll-mx-44 | scroll-margin-left: 11rem; /\* 176px \*/ scroll-margin-right: 11rem; /\* 176px \*/ | | scroll-my-44 | scroll-margin-top: 11rem; /\* 176px \*/ scroll-margin-bottom: 11rem; /\* 176px \*/ | | scroll-mt-44 | scroll-margin-top: 11rem; /\* 176px \*/ | | scroll-mr-44 | scroll-margin-right: 11rem; /\* 176px \*/ | | scroll-mb-44 | scroll-margin-bottom: 11rem; /\* 176px \*/ | | scroll-ml-44 | scroll-margin-left: 11rem; /\* 176px \*/ | | scroll-m-48 | scroll-margin: 12rem; /\* 192px \*/ | | scroll-mx-48 | scroll-margin-left: 12rem; /\* 192px \*/ scroll-margin-right: 12rem; /\* 192px \*/ | | scroll-my-48 | scroll-margin-top: 12rem; /\* 192px \*/ scroll-margin-bottom: 12rem; /\* 192px \*/ | | scroll-mt-48 | scroll-margin-top: 12rem; /\* 192px \*/ | | scroll-mr-48 | scroll-margin-right: 12rem; /\* 192px \*/ | | scroll-mb-48 | scroll-margin-bottom: 12rem; /\* 192px \*/ | | scroll-ml-48 | scroll-margin-left: 12rem; /\* 192px \*/ | | scroll-m-52 | scroll-margin: 13rem; /\* 208px \*/ | | scroll-mx-52 | scroll-margin-left: 13rem; /\* 208px \*/ scroll-margin-right: 13rem; /\* 208px \*/ | | scroll-my-52 | scroll-margin-top: 13rem; /\* 208px \*/ scroll-margin-bottom: 13rem; /\* 208px \*/ | | scroll-mt-52 | scroll-margin-top: 13rem; /\* 208px \*/ | | scroll-mr-52 | scroll-margin-right: 13rem; /\* 208px \*/ | | scroll-mb-52 | scroll-margin-bottom: 13rem; /\* 208px \*/ | | scroll-ml-52 | scroll-margin-left: 13rem; /\* 208px \*/ | | scroll-m-56 | scroll-margin: 14rem; /\* 224px \*/ | | scroll-mx-56 | scroll-margin-left: 14rem; /\* 224px \*/ scroll-margin-right: 14rem; /\* 224px \*/ | | scroll-my-56 | scroll-margin-top: 14rem; /\* 224px \*/ scroll-margin-bottom: 14rem; /\* 224px \*/ | | scroll-mt-56 | scroll-margin-top: 14rem; /\* 224px \*/ | | scroll-mr-56 | scroll-margin-right: 14rem; /\* 224px \*/ | | scroll-mb-56 | scroll-margin-bottom: 14rem; /\* 224px \*/ | | scroll-ml-56 | scroll-margin-left: 14rem; /\* 224px \*/ | | scroll-m-60 | scroll-margin: 15rem; /\* 240px \*/ | | scroll-mx-60 | scroll-margin-left: 15rem; /\* 240px \*/ scroll-margin-right: 15rem; /\* 240px \*/ | | scroll-my-60 | scroll-margin-top: 15rem; /\* 240px \*/ scroll-margin-bottom: 15rem; /\* 240px \*/ | | scroll-mt-60 | scroll-margin-top: 15rem; /\* 240px \*/ | | scroll-mr-60 | scroll-margin-right: 15rem; /\* 240px \*/ | | scroll-mb-60 | scroll-margin-bottom: 15rem; /\* 240px \*/ | | scroll-ml-60 | scroll-margin-left: 15rem; /\* 240px \*/ | | scroll-m-64 | scroll-margin: 16rem; /\* 256px \*/ | | scroll-mx-64 | scroll-margin-left: 16rem; /\* 256px \*/ scroll-margin-right: 16rem; /\* 256px \*/ | | scroll-my-64 | scroll-margin-top: 16rem; /\* 256px \*/ scroll-margin-bottom: 16rem; /\* 256px \*/ | | scroll-mt-64 | scroll-margin-top: 16rem; /\* 256px \*/ | | scroll-mr-64 | scroll-margin-right: 16rem; /\* 256px \*/ | | scroll-mb-64 | scroll-margin-bottom: 16rem; /\* 256px \*/ | | scroll-ml-64 | scroll-margin-left: 16rem; /\* 256px \*/ | | scroll-m-72 | scroll-margin: 18rem; /\* 288px \*/ | | scroll-mx-72 | scroll-margin-left: 18rem; /\* 288px \*/ scroll-margin-right: 18rem; /\* 288px \*/ | | scroll-my-72 | scroll-margin-top: 18rem; /\* 288px \*/ scroll-margin-bottom: 18rem; /\* 288px \*/ | | scroll-mt-72 | scroll-margin-top: 18rem; /\* 288px \*/ | | scroll-mr-72 | scroll-margin-right: 18rem; /\* 288px \*/ | | scroll-mb-72 | scroll-margin-bottom: 18rem; /\* 288px \*/ | | scroll-ml-72 | scroll-margin-left: 18rem; /\* 288px \*/ | | scroll-m-80 | scroll-margin: 20rem; /\* 320px \*/ | | scroll-mx-80 | scroll-margin-left: 20rem; /\* 320px \*/ scroll-margin-right: 20rem; /\* 320px \*/ | | scroll-my-80 | scroll-margin-top: 20rem; /\* 320px \*/ scroll-margin-bottom: 20rem; /\* 320px \*/ | | scroll-mt-80 | scroll-margin-top: 20rem; /\* 320px \*/ | | scroll-mr-80 | scroll-margin-right: 20rem; /\* 320px \*/ | | scroll-mb-80 | scroll-margin-bottom: 20rem; /\* 320px \*/ | | scroll-ml-80 | scroll-margin-left: 20rem; /\* 320px \*/ | | scroll-m-96 | scroll-margin: 24rem; /\* 384px \*/ | | scroll-mx-96 | scroll-margin-left: 24rem; /\* 384px \*/ scroll-margin-right: 24rem; /\* 384px \*/ | | scroll-my-96 | scroll-margin-top: 24rem; /\* 384px \*/ scroll-margin-bottom: 24rem; /\* 384px \*/ | | scroll-mt-96 | scroll-margin-top: 24rem; /\* 384px \*/ | | scroll-mr-96 | scroll-margin-right: 24rem; /\* 384px \*/ | | scroll-mb-96 | scroll-margin-bottom: 24rem; /\* 384px \*/ | | scroll-ml-96 | scroll-margin-left: 24rem; /\* 384px \*/ | Basic usage ----------- ### Setting the scroll margin Use the `scroll-m{side}-{size}` utilities to set the scroll offset around items within a snap container. ``` <div class="snap-x ..."> <div class="scroll-ml-6 snap-start ..."> <img src="https://images.unsplash.com/photo-1604999565976-8913ad2ddb7c?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="scroll-ml-6 snap-start ..."> <img src="https://images.unsplash.com/photo-1540206351-d6465b3ac5c1?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="scroll-ml-6 snap-start ..."> <img src="https://images.unsplash.com/photo-1622890806166-111d7f6c7c97?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="scroll-ml-6 snap-start ..."> <img src="https://images.unsplash.com/photo-1590523277543-a94d2e4eb00b?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="scroll-ml-6 snap-start ..."> <img src="https://images.unsplash.com/photo-1575424909138-46b05e5919ec?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> </div> ``` ### Using negative values To use a negative scroll margin value, prefix the class name with a dash to convert it to a negative value. ``` <div class="-scroll-ml-6 snap-start ..."> <!-- ... --> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:scroll-m-0` to only apply the `scroll-m-0` utility on hover. ``` <div class="scroll-m-8 hover:scroll-m-0"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:scroll-m-0` to apply the `scroll-m-0` utility at only medium screen sizes and above. ``` <div class="scroll-m-8 md:scroll-m-0"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind’s scroll margin scale uses the [default spacing scale](customizing-spacing). You can customize your spacing scale by editing `theme.spacing` or `theme.extend.spacing` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { spacing: { '96': '24rem', } } } } ``` Alternatively, you can customize just the scroll margin scale by editing `theme.scrollMargin` or `theme.extend.scrollMargin` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { scrollMargin: { '96': '24rem', }, } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `scroll-margin` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="scroll-m-[24rem]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation.
programming_docs
tailwindcss Outline Width Quick reference --------------- | Class | Properties | | --- | --- | | outline-0 | outline-width: 0px; | | outline-1 | outline-width: 1px; | | outline-2 | outline-width: 2px; | | outline-4 | outline-width: 4px; | | outline-8 | outline-width: 8px; | Basic usage ----------- ### Setting the outline width Use the `outline-{width}` utilities to change the width of an element’s outline. ``` <button class="outline outline-offset-2 outline-1 ...">Button A</button> <button class="outline outline-offset-2 outline-2 ...">Button B</button> <button class="outline outline-offset-2 outline-4 ...">Button C</button> ``` The default outline width is `3px`. Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:outline-2` to only apply the `outline-2` utility on hover. ``` <div class="outline hover:outline-2"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:outline-2` to apply the `outline-2` utility at only medium screen sizes and above. ``` <div class="outline md:outline-2"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme You can customize the `outline-{width}` utilities by editing `theme.outlineWidth` or `theme.extend.outlineWidth` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { outlineWidth: { 5: '5px', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `outline-width` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="outline-[5px]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Object Position Quick reference --------------- | Class | Properties | | --- | --- | | object-bottom | object-position: bottom; | | object-center | object-position: center; | | object-left | object-position: left; | | object-left-bottom | object-position: left bottom; | | object-left-top | object-position: left top; | | object-right | object-position: right; | | object-right-bottom | object-position: right bottom; | | object-right-top | object-position: right top; | | object-top | object-position: top; | Basic usage ----------- ### Positioning a replaced element Use the `object-{side}` utilities to specify how a replaced element’s content should be positioned within its container. ``` <img class="object-none object-left-top bg-yellow-300 w-24 h-24 ..." src="..."> <img class="object-none object-top bg-yellow-300 w-24 h-24 ..." src="..."> <img class="object-none object-right-top bg-yellow-300 w-24 h-24 ..." src="..."> <img class="object-none object-left bg-yellow-300 w-24 h-24 ..." src="..."> <img class="object-none object-center bg-yellow-300 w-24 h-24 ..." src="..."> <img class="object-none object-right bg-yellow-300 w-24 h-24 ..." src="..."> <img class="object-none object-left-bottom bg-yellow-300 w-24 h-24 ..." src="..."> <img class="object-none object-bottom bg-yellow-300 w-24 h-24 ..." src="..."> <img class="object-none object-right-bottom bg-yellow-300 w-24 h-24 ..." src="..."> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:object-top` to only apply the `object-top` utility on hover. ``` <img class="object-center hover:object-top" src="..."> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:object-top` to apply the `object-top` utility at only medium screen sizes and above. ``` <img class="object-center md:object-top" src="..."> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind provides nine object position utilities. You can customize these values by editing `theme.objectPosition` or `theme.extend.objectPosition` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { objectPosition: { 'center-bottom': 'center bottom', } }, } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `object-position` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <img class="object-[center_bottom]" src="..."> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Mix Blend Mode Quick reference --------------- | Class | Properties | | --- | --- | | mix-blend-normal | mix-blend-mode: normal; | | mix-blend-multiply | mix-blend-mode: multiply; | | mix-blend-screen | mix-blend-mode: screen; | | mix-blend-overlay | mix-blend-mode: overlay; | | mix-blend-darken | mix-blend-mode: darken; | | mix-blend-lighten | mix-blend-mode: lighten; | | mix-blend-color-dodge | mix-blend-mode: color-dodge; | | mix-blend-color-burn | mix-blend-mode: color-burn; | | mix-blend-hard-light | mix-blend-mode: hard-light; | | mix-blend-soft-light | mix-blend-mode: soft-light; | | mix-blend-difference | mix-blend-mode: difference; | | mix-blend-exclusion | mix-blend-mode: exclusion; | | mix-blend-hue | mix-blend-mode: hue; | | mix-blend-saturation | mix-blend-mode: saturation; | | mix-blend-color | mix-blend-mode: color; | | mix-blend-luminosity | mix-blend-mode: luminosity; | | mix-blend-plus-lighter | mix-blend-mode: plus-lighter; | Basic usage ----------- ### Setting an element's blend mode Use the `mix-blend-{mode}` utilities to control how an element’s content should be blended with the background. ``` <div class="flex justify-center -space-x-14"> <div class="mix-blend-multiply bg-blue-400 ..."></div> <div class="mix-blend-multiply bg-pink-400 ..."></div> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:mix-blend-overlay` to only apply the `mix-blend-overlay` utility on hover. ``` <div class="mix-blend-multiply hover:mix-blend-overlay"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:mix-blend-overlay` to apply the `mix-blend-overlay` utility at only medium screen sizes and above. ``` <div class="mix-blend-multiply md:mix-blend-overlay"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Font Size Quick reference --------------- | Class | Properties | | --- | --- | | text-xs | font-size: 0.75rem; /\* 12px \*/ line-height: 1rem; /\* 16px \*/ | | text-sm | font-size: 0.875rem; /\* 14px \*/ line-height: 1.25rem; /\* 20px \*/ | | text-base | font-size: 1rem; /\* 16px \*/ line-height: 1.5rem; /\* 24px \*/ | | text-lg | font-size: 1.125rem; /\* 18px \*/ line-height: 1.75rem; /\* 28px \*/ | | text-xl | font-size: 1.25rem; /\* 20px \*/ line-height: 1.75rem; /\* 28px \*/ | | text-2xl | font-size: 1.5rem; /\* 24px \*/ line-height: 2rem; /\* 32px \*/ | | text-3xl | font-size: 1.875rem; /\* 30px \*/ line-height: 2.25rem; /\* 36px \*/ | | text-4xl | font-size: 2.25rem; /\* 36px \*/ line-height: 2.5rem; /\* 40px \*/ | | text-5xl | font-size: 3rem; /\* 48px \*/ line-height: 1; | | text-6xl | font-size: 3.75rem; /\* 60px \*/ line-height: 1; | | text-7xl | font-size: 4.5rem; /\* 72px \*/ line-height: 1; | | text-8xl | font-size: 6rem; /\* 96px \*/ line-height: 1; | | text-9xl | font-size: 8rem; /\* 128px \*/ line-height: 1; | Basic usage ----------- ### Setting the font size Control the font size of an element using the `text-{size}` utilities. ``` <p class="text-sm ...">The quick brown fox ...</p> <p class="text-base ...">The quick brown fox ...</p> <p class="text-lg ...">The quick brown fox ...</p> <p class="text-xl ...">The quick brown fox ...</p> <p class="text-2xl ...">The quick brown fox ...</p> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:text-base` to only apply the `text-base` utility on hover. ``` <p class="text-sm hover:text-base"> <!-- ... --> </p> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:text-base` to apply the `text-base` utility at only medium screen sizes and above. ``` <p class="text-sm md:text-base"> <!-- ... --> </p> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme You can configure your own custom set of font size utilities using the `theme.fontSize` section of your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { fontSize: { sm: '0.8rem', base: '1rem', xl: '1.25rem', 2xl: '1.563rem', 3xl: '1.953rem', 4xl: '2.441rem', 5xl: '3.052rem', } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. #### Providing a default line-height Tailwind’s default theme configures a sensible default `line-height` for each `text-{size}` utility. You can configure your own default line heights when using custom font sizes by defining each size using a tuple of the form `[fontSize, lineHeight]` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { fontSize: { sm: ['14px', '20px'], base: ['16px', '24px'], lg: ['20px', '28px'], xl: ['24px', '32px'], } } } ``` You can also specify a default line height using the object syntax, which allows you to also provide default `letter-spacing` and `font-weight` values. You can do this using a tuple of the form `[fontSize, { lineHeight?, letterSpacing?, fontWeight? }]`. tailwind.config.js ``` module.exports = { theme: { fontSize: { '2xl': ['1.5rem', { lineHeight: '2rem', letterSpacing: '-0.01em', fontWeight: '500', }], '3xl': ['1.875rem', { lineHeight: '2.25rem', letterSpacing: '-0.02em', fontWeight: '700', }], } } } ``` ### Arbitrary values If you need to use a one-off `font-size` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <p class="text-[14px]"> <!-- ... --> </p> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Outline Color Quick reference --------------- | Class | Properties | | --- | --- | | outline-inherit | outline-color: inherit; | | outline-current | outline-color: currentColor; | | outline-transparent | outline-color: transparent; | | outline-black | outline-color: #000; | | outline-white | outline-color: #fff; | | outline-slate-50 | outline-color: #f8fafc; | | outline-slate-100 | outline-color: #f1f5f9; | | outline-slate-200 | outline-color: #e2e8f0; | | outline-slate-300 | outline-color: #cbd5e1; | | outline-slate-400 | outline-color: #94a3b8; | | outline-slate-500 | outline-color: #64748b; | | outline-slate-600 | outline-color: #475569; | | outline-slate-700 | outline-color: #334155; | | outline-slate-800 | outline-color: #1e293b; | | outline-slate-900 | outline-color: #0f172a; | | outline-gray-50 | outline-color: #f9fafb; | | outline-gray-100 | outline-color: #f3f4f6; | | outline-gray-200 | outline-color: #e5e7eb; | | outline-gray-300 | outline-color: #d1d5db; | | outline-gray-400 | outline-color: #9ca3af; | | outline-gray-500 | outline-color: #6b7280; | | outline-gray-600 | outline-color: #4b5563; | | outline-gray-700 | outline-color: #374151; | | outline-gray-800 | outline-color: #1f2937; | | outline-gray-900 | outline-color: #111827; | | outline-zinc-50 | outline-color: #fafafa; | | outline-zinc-100 | outline-color: #f4f4f5; | | outline-zinc-200 | outline-color: #e4e4e7; | | outline-zinc-300 | outline-color: #d4d4d8; | | outline-zinc-400 | outline-color: #a1a1aa; | | outline-zinc-500 | outline-color: #71717a; | | outline-zinc-600 | outline-color: #52525b; | | outline-zinc-700 | outline-color: #3f3f46; | | outline-zinc-800 | outline-color: #27272a; | | outline-zinc-900 | outline-color: #18181b; | | outline-neutral-50 | outline-color: #fafafa; | | outline-neutral-100 | outline-color: #f5f5f5; | | outline-neutral-200 | outline-color: #e5e5e5; | | outline-neutral-300 | outline-color: #d4d4d4; | | outline-neutral-400 | outline-color: #a3a3a3; | | outline-neutral-500 | outline-color: #737373; | | outline-neutral-600 | outline-color: #525252; | | outline-neutral-700 | outline-color: #404040; | | outline-neutral-800 | outline-color: #262626; | | outline-neutral-900 | outline-color: #171717; | | outline-stone-50 | outline-color: #fafaf9; | | outline-stone-100 | outline-color: #f5f5f4; | | outline-stone-200 | outline-color: #e7e5e4; | | outline-stone-300 | outline-color: #d6d3d1; | | outline-stone-400 | outline-color: #a8a29e; | | outline-stone-500 | outline-color: #78716c; | | outline-stone-600 | outline-color: #57534e; | | outline-stone-700 | outline-color: #44403c; | | outline-stone-800 | outline-color: #292524; | | outline-stone-900 | outline-color: #1c1917; | | outline-red-50 | outline-color: #fef2f2; | | outline-red-100 | outline-color: #fee2e2; | | outline-red-200 | outline-color: #fecaca; | | outline-red-300 | outline-color: #fca5a5; | | outline-red-400 | outline-color: #f87171; | | outline-red-500 | outline-color: #ef4444; | | outline-red-600 | outline-color: #dc2626; | | outline-red-700 | outline-color: #b91c1c; | | outline-red-800 | outline-color: #991b1b; | | outline-red-900 | outline-color: #7f1d1d; | | outline-orange-50 | outline-color: #fff7ed; | | outline-orange-100 | outline-color: #ffedd5; | | outline-orange-200 | outline-color: #fed7aa; | | outline-orange-300 | outline-color: #fdba74; | | outline-orange-400 | outline-color: #fb923c; | | outline-orange-500 | outline-color: #f97316; | | outline-orange-600 | outline-color: #ea580c; | | outline-orange-700 | outline-color: #c2410c; | | outline-orange-800 | outline-color: #9a3412; | | outline-orange-900 | outline-color: #7c2d12; | | outline-amber-50 | outline-color: #fffbeb; | | outline-amber-100 | outline-color: #fef3c7; | | outline-amber-200 | outline-color: #fde68a; | | outline-amber-300 | outline-color: #fcd34d; | | outline-amber-400 | outline-color: #fbbf24; | | outline-amber-500 | outline-color: #f59e0b; | | outline-amber-600 | outline-color: #d97706; | | outline-amber-700 | outline-color: #b45309; | | outline-amber-800 | outline-color: #92400e; | | outline-amber-900 | outline-color: #78350f; | | outline-yellow-50 | outline-color: #fefce8; | | outline-yellow-100 | outline-color: #fef9c3; | | outline-yellow-200 | outline-color: #fef08a; | | outline-yellow-300 | outline-color: #fde047; | | outline-yellow-400 | outline-color: #facc15; | | outline-yellow-500 | outline-color: #eab308; | | outline-yellow-600 | outline-color: #ca8a04; | | outline-yellow-700 | outline-color: #a16207; | | outline-yellow-800 | outline-color: #854d0e; | | outline-yellow-900 | outline-color: #713f12; | | outline-lime-50 | outline-color: #f7fee7; | | outline-lime-100 | outline-color: #ecfccb; | | outline-lime-200 | outline-color: #d9f99d; | | outline-lime-300 | outline-color: #bef264; | | outline-lime-400 | outline-color: #a3e635; | | outline-lime-500 | outline-color: #84cc16; | | outline-lime-600 | outline-color: #65a30d; | | outline-lime-700 | outline-color: #4d7c0f; | | outline-lime-800 | outline-color: #3f6212; | | outline-lime-900 | outline-color: #365314; | | outline-green-50 | outline-color: #f0fdf4; | | outline-green-100 | outline-color: #dcfce7; | | outline-green-200 | outline-color: #bbf7d0; | | outline-green-300 | outline-color: #86efac; | | outline-green-400 | outline-color: #4ade80; | | outline-green-500 | outline-color: #22c55e; | | outline-green-600 | outline-color: #16a34a; | | outline-green-700 | outline-color: #15803d; | | outline-green-800 | outline-color: #166534; | | outline-green-900 | outline-color: #14532d; | | outline-emerald-50 | outline-color: #ecfdf5; | | outline-emerald-100 | outline-color: #d1fae5; | | outline-emerald-200 | outline-color: #a7f3d0; | | outline-emerald-300 | outline-color: #6ee7b7; | | outline-emerald-400 | outline-color: #34d399; | | outline-emerald-500 | outline-color: #10b981; | | outline-emerald-600 | outline-color: #059669; | | outline-emerald-700 | outline-color: #047857; | | outline-emerald-800 | outline-color: #065f46; | | outline-emerald-900 | outline-color: #064e3b; | | outline-teal-50 | outline-color: #f0fdfa; | | outline-teal-100 | outline-color: #ccfbf1; | | outline-teal-200 | outline-color: #99f6e4; | | outline-teal-300 | outline-color: #5eead4; | | outline-teal-400 | outline-color: #2dd4bf; | | outline-teal-500 | outline-color: #14b8a6; | | outline-teal-600 | outline-color: #0d9488; | | outline-teal-700 | outline-color: #0f766e; | | outline-teal-800 | outline-color: #115e59; | | outline-teal-900 | outline-color: #134e4a; | | outline-cyan-50 | outline-color: #ecfeff; | | outline-cyan-100 | outline-color: #cffafe; | | outline-cyan-200 | outline-color: #a5f3fc; | | outline-cyan-300 | outline-color: #67e8f9; | | outline-cyan-400 | outline-color: #22d3ee; | | outline-cyan-500 | outline-color: #06b6d4; | | outline-cyan-600 | outline-color: #0891b2; | | outline-cyan-700 | outline-color: #0e7490; | | outline-cyan-800 | outline-color: #155e75; | | outline-cyan-900 | outline-color: #164e63; | | outline-sky-50 | outline-color: #f0f9ff; | | outline-sky-100 | outline-color: #e0f2fe; | | outline-sky-200 | outline-color: #bae6fd; | | outline-sky-300 | outline-color: #7dd3fc; | | outline-sky-400 | outline-color: #38bdf8; | | outline-sky-500 | outline-color: #0ea5e9; | | outline-sky-600 | outline-color: #0284c7; | | outline-sky-700 | outline-color: #0369a1; | | outline-sky-800 | outline-color: #075985; | | outline-sky-900 | outline-color: #0c4a6e; | | outline-blue-50 | outline-color: #eff6ff; | | outline-blue-100 | outline-color: #dbeafe; | | outline-blue-200 | outline-color: #bfdbfe; | | outline-blue-300 | outline-color: #93c5fd; | | outline-blue-400 | outline-color: #60a5fa; | | outline-blue-500 | outline-color: #3b82f6; | | outline-blue-600 | outline-color: #2563eb; | | outline-blue-700 | outline-color: #1d4ed8; | | outline-blue-800 | outline-color: #1e40af; | | outline-blue-900 | outline-color: #1e3a8a; | | outline-indigo-50 | outline-color: #eef2ff; | | outline-indigo-100 | outline-color: #e0e7ff; | | outline-indigo-200 | outline-color: #c7d2fe; | | outline-indigo-300 | outline-color: #a5b4fc; | | outline-indigo-400 | outline-color: #818cf8; | | outline-indigo-500 | outline-color: #6366f1; | | outline-indigo-600 | outline-color: #4f46e5; | | outline-indigo-700 | outline-color: #4338ca; | | outline-indigo-800 | outline-color: #3730a3; | | outline-indigo-900 | outline-color: #312e81; | | outline-violet-50 | outline-color: #f5f3ff; | | outline-violet-100 | outline-color: #ede9fe; | | outline-violet-200 | outline-color: #ddd6fe; | | outline-violet-300 | outline-color: #c4b5fd; | | outline-violet-400 | outline-color: #a78bfa; | | outline-violet-500 | outline-color: #8b5cf6; | | outline-violet-600 | outline-color: #7c3aed; | | outline-violet-700 | outline-color: #6d28d9; | | outline-violet-800 | outline-color: #5b21b6; | | outline-violet-900 | outline-color: #4c1d95; | | outline-purple-50 | outline-color: #faf5ff; | | outline-purple-100 | outline-color: #f3e8ff; | | outline-purple-200 | outline-color: #e9d5ff; | | outline-purple-300 | outline-color: #d8b4fe; | | outline-purple-400 | outline-color: #c084fc; | | outline-purple-500 | outline-color: #a855f7; | | outline-purple-600 | outline-color: #9333ea; | | outline-purple-700 | outline-color: #7e22ce; | | outline-purple-800 | outline-color: #6b21a8; | | outline-purple-900 | outline-color: #581c87; | | outline-fuchsia-50 | outline-color: #fdf4ff; | | outline-fuchsia-100 | outline-color: #fae8ff; | | outline-fuchsia-200 | outline-color: #f5d0fe; | | outline-fuchsia-300 | outline-color: #f0abfc; | | outline-fuchsia-400 | outline-color: #e879f9; | | outline-fuchsia-500 | outline-color: #d946ef; | | outline-fuchsia-600 | outline-color: #c026d3; | | outline-fuchsia-700 | outline-color: #a21caf; | | outline-fuchsia-800 | outline-color: #86198f; | | outline-fuchsia-900 | outline-color: #701a75; | | outline-pink-50 | outline-color: #fdf2f8; | | outline-pink-100 | outline-color: #fce7f3; | | outline-pink-200 | outline-color: #fbcfe8; | | outline-pink-300 | outline-color: #f9a8d4; | | outline-pink-400 | outline-color: #f472b6; | | outline-pink-500 | outline-color: #ec4899; | | outline-pink-600 | outline-color: #db2777; | | outline-pink-700 | outline-color: #be185d; | | outline-pink-800 | outline-color: #9d174d; | | outline-pink-900 | outline-color: #831843; | | outline-rose-50 | outline-color: #fff1f2; | | outline-rose-100 | outline-color: #ffe4e6; | | outline-rose-200 | outline-color: #fecdd3; | | outline-rose-300 | outline-color: #fda4af; | | outline-rose-400 | outline-color: #fb7185; | | outline-rose-500 | outline-color: #f43f5e; | | outline-rose-600 | outline-color: #e11d48; | | outline-rose-700 | outline-color: #be123c; | | outline-rose-800 | outline-color: #9f1239; | | outline-rose-900 | outline-color: #881337; | Basic usage ----------- ### Setting the outline color Use the `outline-{color}` utilities to change the color of an element’s outline. ``` <button class="outline outline-offset-2 outline-blue-500 ...">Button A</button> <button class="outline outline-offset-2 outline-cyan-500 ...">Button B</button> <button class="outline outline-offset-2 outline-pink-500 ...">Button C</button> ``` ### Changing the opacity Control the opacity of an element’s outline color using the color opacity modifier. ``` <button class="outline-2 outline-blue-500/50 ...">Save Changes</button> ``` You can use any value defined in your [opacity scale](opacity), or use arbitrary values if you need to deviate from your design tokens. ``` <button class="outline-4 outline-pink-400/[.55] ..."></button> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:outline-blue-400` to only apply the `outline-blue-400` utility on hover. ``` <button class="outline hover:outline-blue-400"> <!-- ... --> </button> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:outline-blue-400` to apply the `outline-blue-400` utility at only medium screen sizes and above. ``` <button class="outline md:outline-blue-400"> <!-- ... --> </button> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind makes the entire [default color palette](customizing-colors#default-color-palette) available as outline colors. You can [customize your color palette](/docs/customizing-colors#customizing) by editing `theme.colors` or `theme.extend.colors` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { colors: { 'regal-blue': '#243c5a', }, } } } ``` Alternatively, you can customize just your outline colors by editing `theme.outlineColor` or `theme.extend.outlineColor` in your `tailwind.config.js` file. Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `outline-color` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <button class="outline-[#243c5a]"> <!-- ... --> </button> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation.
programming_docs
tailwindcss Isolation Quick reference --------------- | Class | Properties | | --- | --- | | isolate | isolation: isolate; | | isolation-auto | isolation: auto; | Basic usage ----------- ### Setting the stacking context Use the `isolate` and `isolation-auto` utilities to control whether an element should explicitly create a new stacking context. ``` <div class="isolate ..."> <!-- ... --> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:isolation-auto` to only apply the `isolation-auto` utility on hover. ``` <div class="isolate hover:isolation-auto"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:isolation-auto` to apply the `isolation-auto` utility at only medium screen sizes and above. ``` <div class="isolate md:isolation-auto"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Backdrop Saturate Quick reference --------------- | Class | Properties | | --- | --- | | backdrop-saturate-0 | backdrop-filter: saturate(0); | | backdrop-saturate-50 | backdrop-filter: saturate(.5); | | backdrop-saturate-100 | backdrop-filter: saturate(1); | | backdrop-saturate-150 | backdrop-filter: saturate(1.5); | | backdrop-saturate-200 | backdrop-filter: saturate(2); | Basic usage ----------- ### Changing backdrop saturation Use the `saturate-{amount}` utilities to control an element’s backdrop saturation. ``` <div class="backdrop-saturate-50 bg-white/30 ..."> <!-- ... --> </div> <div class="backdrop-saturate-125 bg-white/30 ..."> <!-- ... --> </div> <div class="backdrop-saturate-200 bg-white/30 ..."> <!-- ... --> </div> ``` ### Removing backdrop filters To remove all of the backdrop filters on an element at once, use the `backdrop-filter-none` utility: ``` <div class="backdrop-blur-md backdrop-saturate-150 md:backdrop-filter-none"> <!-- ... --> </div> ``` This can be useful when you want to remove backdrop filters conditionally, such as on hover or at a particular breakpoint. Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:backdrop-saturate-150` to only apply the `backdrop-saturate-150` utility on hover. ``` <div class="backdrop-saturate-50 hover:backdrop-saturate-150"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:backdrop-saturate-150` to apply the `backdrop-saturate-150` utility at only medium screen sizes and above. ``` <div class="backdrop-saturate-50 md:backdrop-saturate-150"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind includes a handful of general purpose `backdrop-saturate` utilities. You can customize these values by editing `theme.backdropSaturate` or `theme.extend.backdropSaturate` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { backdropSaturate: { 25: '.25', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `backdrop-saturate` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="backdrop-saturate-[.25]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Gap Quick reference --------------- | Class | Properties | | --- | --- | | gap-0 | gap: 0px; | | gap-x-0 | column-gap: 0px; | | gap-y-0 | row-gap: 0px; | | gap-px | gap: 1px; | | gap-x-px | column-gap: 1px; | | gap-y-px | row-gap: 1px; | | gap-0.5 | gap: 0.125rem; /\* 2px \*/ | | gap-x-0.5 | column-gap: 0.125rem; /\* 2px \*/ | | gap-y-0.5 | row-gap: 0.125rem; /\* 2px \*/ | | gap-1 | gap: 0.25rem; /\* 4px \*/ | | gap-x-1 | column-gap: 0.25rem; /\* 4px \*/ | | gap-y-1 | row-gap: 0.25rem; /\* 4px \*/ | | gap-1.5 | gap: 0.375rem; /\* 6px \*/ | | gap-x-1.5 | column-gap: 0.375rem; /\* 6px \*/ | | gap-y-1.5 | row-gap: 0.375rem; /\* 6px \*/ | | gap-2 | gap: 0.5rem; /\* 8px \*/ | | gap-x-2 | column-gap: 0.5rem; /\* 8px \*/ | | gap-y-2 | row-gap: 0.5rem; /\* 8px \*/ | | gap-2.5 | gap: 0.625rem; /\* 10px \*/ | | gap-x-2.5 | column-gap: 0.625rem; /\* 10px \*/ | | gap-y-2.5 | row-gap: 0.625rem; /\* 10px \*/ | | gap-3 | gap: 0.75rem; /\* 12px \*/ | | gap-x-3 | column-gap: 0.75rem; /\* 12px \*/ | | gap-y-3 | row-gap: 0.75rem; /\* 12px \*/ | | gap-3.5 | gap: 0.875rem; /\* 14px \*/ | | gap-x-3.5 | column-gap: 0.875rem; /\* 14px \*/ | | gap-y-3.5 | row-gap: 0.875rem; /\* 14px \*/ | | gap-4 | gap: 1rem; /\* 16px \*/ | | gap-x-4 | column-gap: 1rem; /\* 16px \*/ | | gap-y-4 | row-gap: 1rem; /\* 16px \*/ | | gap-5 | gap: 1.25rem; /\* 20px \*/ | | gap-x-5 | column-gap: 1.25rem; /\* 20px \*/ | | gap-y-5 | row-gap: 1.25rem; /\* 20px \*/ | | gap-6 | gap: 1.5rem; /\* 24px \*/ | | gap-x-6 | column-gap: 1.5rem; /\* 24px \*/ | | gap-y-6 | row-gap: 1.5rem; /\* 24px \*/ | | gap-7 | gap: 1.75rem; /\* 28px \*/ | | gap-x-7 | column-gap: 1.75rem; /\* 28px \*/ | | gap-y-7 | row-gap: 1.75rem; /\* 28px \*/ | | gap-8 | gap: 2rem; /\* 32px \*/ | | gap-x-8 | column-gap: 2rem; /\* 32px \*/ | | gap-y-8 | row-gap: 2rem; /\* 32px \*/ | | gap-9 | gap: 2.25rem; /\* 36px \*/ | | gap-x-9 | column-gap: 2.25rem; /\* 36px \*/ | | gap-y-9 | row-gap: 2.25rem; /\* 36px \*/ | | gap-10 | gap: 2.5rem; /\* 40px \*/ | | gap-x-10 | column-gap: 2.5rem; /\* 40px \*/ | | gap-y-10 | row-gap: 2.5rem; /\* 40px \*/ | | gap-11 | gap: 2.75rem; /\* 44px \*/ | | gap-x-11 | column-gap: 2.75rem; /\* 44px \*/ | | gap-y-11 | row-gap: 2.75rem; /\* 44px \*/ | | gap-12 | gap: 3rem; /\* 48px \*/ | | gap-x-12 | column-gap: 3rem; /\* 48px \*/ | | gap-y-12 | row-gap: 3rem; /\* 48px \*/ | | gap-14 | gap: 3.5rem; /\* 56px \*/ | | gap-x-14 | column-gap: 3.5rem; /\* 56px \*/ | | gap-y-14 | row-gap: 3.5rem; /\* 56px \*/ | | gap-16 | gap: 4rem; /\* 64px \*/ | | gap-x-16 | column-gap: 4rem; /\* 64px \*/ | | gap-y-16 | row-gap: 4rem; /\* 64px \*/ | | gap-20 | gap: 5rem; /\* 80px \*/ | | gap-x-20 | column-gap: 5rem; /\* 80px \*/ | | gap-y-20 | row-gap: 5rem; /\* 80px \*/ | | gap-24 | gap: 6rem; /\* 96px \*/ | | gap-x-24 | column-gap: 6rem; /\* 96px \*/ | | gap-y-24 | row-gap: 6rem; /\* 96px \*/ | | gap-28 | gap: 7rem; /\* 112px \*/ | | gap-x-28 | column-gap: 7rem; /\* 112px \*/ | | gap-y-28 | row-gap: 7rem; /\* 112px \*/ | | gap-32 | gap: 8rem; /\* 128px \*/ | | gap-x-32 | column-gap: 8rem; /\* 128px \*/ | | gap-y-32 | row-gap: 8rem; /\* 128px \*/ | | gap-36 | gap: 9rem; /\* 144px \*/ | | gap-x-36 | column-gap: 9rem; /\* 144px \*/ | | gap-y-36 | row-gap: 9rem; /\* 144px \*/ | | gap-40 | gap: 10rem; /\* 160px \*/ | | gap-x-40 | column-gap: 10rem; /\* 160px \*/ | | gap-y-40 | row-gap: 10rem; /\* 160px \*/ | | gap-44 | gap: 11rem; /\* 176px \*/ | | gap-x-44 | column-gap: 11rem; /\* 176px \*/ | | gap-y-44 | row-gap: 11rem; /\* 176px \*/ | | gap-48 | gap: 12rem; /\* 192px \*/ | | gap-x-48 | column-gap: 12rem; /\* 192px \*/ | | gap-y-48 | row-gap: 12rem; /\* 192px \*/ | | gap-52 | gap: 13rem; /\* 208px \*/ | | gap-x-52 | column-gap: 13rem; /\* 208px \*/ | | gap-y-52 | row-gap: 13rem; /\* 208px \*/ | | gap-56 | gap: 14rem; /\* 224px \*/ | | gap-x-56 | column-gap: 14rem; /\* 224px \*/ | | gap-y-56 | row-gap: 14rem; /\* 224px \*/ | | gap-60 | gap: 15rem; /\* 240px \*/ | | gap-x-60 | column-gap: 15rem; /\* 240px \*/ | | gap-y-60 | row-gap: 15rem; /\* 240px \*/ | | gap-64 | gap: 16rem; /\* 256px \*/ | | gap-x-64 | column-gap: 16rem; /\* 256px \*/ | | gap-y-64 | row-gap: 16rem; /\* 256px \*/ | | gap-72 | gap: 18rem; /\* 288px \*/ | | gap-x-72 | column-gap: 18rem; /\* 288px \*/ | | gap-y-72 | row-gap: 18rem; /\* 288px \*/ | | gap-80 | gap: 20rem; /\* 320px \*/ | | gap-x-80 | column-gap: 20rem; /\* 320px \*/ | | gap-y-80 | row-gap: 20rem; /\* 320px \*/ | | gap-96 | gap: 24rem; /\* 384px \*/ | | gap-x-96 | column-gap: 24rem; /\* 384px \*/ | | gap-y-96 | row-gap: 24rem; /\* 384px \*/ | Basic usage ----------- ### Setting the gap between elements Use `gap-{size}` to change the gap between both rows and columns in grid and flexbox layouts. ``` <div class="grid gap-4 grid-cols-2"> <div>01</div> <div>02</div> <div>03</div> <div>04</div> </div> ``` ### Changing row and column gaps independently Use `gap-x-{size}` and `gap-y-{size}` to change the gap between rows and columns independently. ``` <div class="grid gap-x-8 gap-y-4 grid-cols-3"> <div>01</div> <div>02</div> <div>03</div> <div>04</div> <div>05</div> <div>06</div> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:gap-6` to only apply the `gap-6` utility on hover. ``` <div class="grid gap-4 hover:gap-6"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:gap-6` to apply the `gap-6` utility at only medium screen sizes and above. ``` <div class="grid gap-4 md:gap-6"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind’s gap scale uses the [default spacing scale](customizing-spacing). You can customize your spacing scale by editing `theme.spacing` or `theme.extend.spacing` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { spacing: { '11': '2.75rem', } } } } ``` Alternatively, you can customize just the gap scale by editing `theme.gap` or `theme.extend.gap` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { gap: { '11': '2.75rem', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `gap` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="grid gap-[2.75rem]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss @tailwindcss/typography The official Tailwind CSS Typography plugin provides a set of `prose` classes you can use to add beautiful typographic defaults to any vanilla HTML you don’t control, like HTML rendered from Markdown, or pulled from a CMS. [![Tailwind CSS IntelliSense extension for Visual Studio Code](https://tailwindcss.com/_next/static/media/typography-demo.e7148517.jpg)](https://play.tailwindcss.com/uj1vGACRJA?layout=preview) ``` <article class="prose lg:prose-xl"> {{ markdown }} </article> ``` To see what it looks like in action, check out our [live demo](https://play.tailwindcss.com/uj1vGACRJA?layout=preview) on Tailwind Play. Installation ------------ Install the plugin from npm: ``` npm install -D @tailwindcss/typography ``` Then add the plugin to your `tailwind.config.js` file: tailwind.config.js ``` module.exports = { theme: { // ... }, plugins: [ require('@tailwindcss/typography'), // ... ], } ``` Basic usage ----------- Now you can use the `prose` classes to add sensible typography styles to any vanilla HTML: ``` <article class="prose lg:prose-xl"> <h1>Garlic bread with cheese: What the science tells us</h1> <p> For years parents have espoused the health benefits of eating garlic bread with cheese to their children, with the food earning such an iconic status in our culture that kids will often dress up as warm, cheesy loaf for Halloween. </p> <p> But a recent study shows that the celebrated appetizer may be linked to a series of rabies cases springing up around the country. </p> <!-- ... --> </article> ``` ### Choosing a gray scale This plugin includes a modifier class for each of the five gray scales Tailwind includes by default so you can easily style your content to match the grays you’re using in your project. ``` <article class="prose prose-slate"> {{ markdown }} </article> ``` Here are the classes that are generated using a totally default Tailwind CSS v2.0 build: | Class | Gray scale | | --- | --- | | `prose-gray` *(default)* | Gray | | `prose-slate` | Slate | | `prose-zinc` | Zinc | | `prose-neutral` | Neutral | | `prose-stone` | Stone | Modifier classes are designed to be used with the [multi-class modifier pattern](http://nicolasgallagher.com/about-html-semantics-front-end-architecture/#component-modifiers) and must be used in conjunction with the base `prose` class. ``` <article class="prose prose-stone"> {{ markdown }} </article> ``` To learn about creating your own color themes, read the [adding custom color themes](#adding-custom-color-themes) documentation. ### Applying a type scale Size modifiers allow you to adjust the overall size of your typography for different contexts. ``` <article class="prose prose-xl"> {{ markdown }} </article> ``` Five different typography sizes are included out of the box: | Class | Body font size | | --- | --- | | `prose-sm` | 0.875rem *(14px)* | | `prose-base` *(default)* | 1rem *(16px)* | | `prose-lg` | 1.125rem *(18px)* | | `prose-xl` | 1.25rem *(20px)* | | `prose-2xl` | 1.5rem *(24px)* | These can be used in combination with Tailwind’s [breakpoint modifiers](responsive-design) to change the overall font size of a piece of content at different viewport sizes: ``` <article class="prose md:prose-lg lg:prose-xl"> {{ markdown }} </article> ``` Everything about the provided size modifiers has been hand-tuned by professional designers to look as beautiful as possible, including the relationships between font sizes, heading spacing, code block padding, and more. Size modifiers are designed to be used with the [multi-class modifier pattern](http://nicolasgallagher.com/about-html-semantics-front-end-architecture/#component-modifiers) and must be used in conjunction with the base `prose` class. ``` <article class="prose prose-lg"> {{ markdown }} </article> ``` To learn about customizing the included type scales, read the documentation on [customizing the CSS](#customizing-the-css). ### Adapting to dark mode Each default color theme includes a hand-designed dark mode version that you can trigger by adding the `prose-invert` class: ``` <article class="prose dark:prose-invert"> {{ markdown }} </article> ``` To learn about creating your own color themes, read the [adding custom color themes](#adding-custom-color-themes) documentation. ### Element modifiers Use element modifiers to customize the style of individual elements in your content directly in your HTML: ``` <article class="prose prose-img:rounded-xl prose-headings:underline prose-a:text-blue-600"> {{ markdown }} </article> ``` This makes it easy to do things like style links to match your brand, add a border radius to images, and tons more. Here’s a complete list of available element modifiers: | Modifier | Target | | --- | --- | | `prose-headings:{utility}` | `h1`, `h2`, `h3`, `h4`, `th` | | `prose-lead:{utility}` | `[class~="lead"]` | | `prose-h1:{utility}` | `h1` | | `prose-h2:{utility}` | `h2` | | `prose-h3:{utility}` | `h3` | | `prose-h4:{utility}` | `h4` | | `prose-p:{utility}` | `p` | | `prose-a:{utility}` | `a` | | `prose-blockquote:{utility}` | `blockquote` | | `prose-figure:{utility}` | `figure` | | `prose-figcaption:{utility}` | `figcaption` | | `prose-strong:{utility}` | `strong` | | `prose-em:{utility}` | `em` | | `prose-code:{utility}` | `code` | | `prose-pre:{utility}` | `pre` | | `prose-ol:{utility}` | `ol` | | `prose-ul:{utility}` | `ul` | | `prose-li:{utility}` | `li` | | `prose-table:{utility}` | `table` | | `prose-thead:{utility}` | `thead` | | `prose-tr:{utility}` | `tr` | | `prose-th:{utility}` | `th` | | `prose-td:{utility}` | `td` | | `prose-img:{utility}` | `img` | | `prose-video:{utility}` | `video` | | `prose-hr:{utility}` | `hr` | When stacking these modifiers with other modifiers like `hover`, you most likely want the other modifier to come first: ``` <article class="prose prose-a:text-blue-600 hover:prose-a:text-blue-500"> {{ markdown }} </article> ``` Read the Tailwind CSS documentation on [ordering stacked modifiers](hover-focus-and-other-states#ordering-stacked-modifiers) to learn more. ### Overriding max-width Each size modifier comes with a baked in `max-width` designed to keep the content as readable as possible. This isn’t always what you want though, and sometimes you’ll want the content to just fill the width of its container. In those cases, all you need to do is add `max-w-none` to your content to override the embedded max-width: ``` <div class="grid grid-cols-4"> <div class="col-span-1"> <!-- ... --> </div> <div class="col-span-3"> <article class="prose max-w-none"> {{ markdown }} </article> </div> </div> ``` Advanced topics --------------- ### Undoing typography styles If you have a block of markup embedded in some content that shouldn’t inherit the `prose` styles, use the `not-prose` class to sandbox it: ``` <article class="prose"> <h1>My Heading</h1> <p>...</p> <div class="not-prose"> <!-- Some example or demo that needs to be prose-free --> </div> <p>...</p> <!-- ... --> </article> ``` Note that you can’t nest new `prose` instances within a `not-prose` block at this time. ### Adding custom color themes You can create your own color theme by adding a new key in the `typography` section of your `tailwind.config.js` file and providing your colors under the `css` key: tailwind.config.js ``` module.exports = { theme: { extend: { typography: ({ theme }) => ({ pink: { css: { '--tw-prose-body': theme('colors.pink[800]'), '--tw-prose-headings': theme('colors.pink[900]'), '--tw-prose-lead': theme('colors.pink[700]'), '--tw-prose-links': theme('colors.pink[900]'), '--tw-prose-bold': theme('colors.pink[900]'), '--tw-prose-counters': theme('colors.pink[600]'), '--tw-prose-bullets': theme('colors.pink[400]'), '--tw-prose-hr': theme('colors.pink[300]'), '--tw-prose-quotes': theme('colors.pink[900]'), '--tw-prose-quote-borders': theme('colors.pink[300]'), '--tw-prose-captions': theme('colors.pink[700]'), '--tw-prose-code': theme('colors.pink[900]'), '--tw-prose-pre-code': theme('colors.pink[100]'), '--tw-prose-pre-bg': theme('colors.pink[900]'), '--tw-prose-th-borders': theme('colors.pink[300]'), '--tw-prose-td-borders': theme('colors.pink[200]'), '--tw-prose-invert-body': theme('colors.pink[200]'), '--tw-prose-invert-headings': theme('colors.white'), '--tw-prose-invert-lead': theme('colors.pink[300]'), '--tw-prose-invert-links': theme('colors.white'), '--tw-prose-invert-bold': theme('colors.white'), '--tw-prose-invert-counters': theme('colors.pink[400]'), '--tw-prose-invert-bullets': theme('colors.pink[600]'), '--tw-prose-invert-hr': theme('colors.pink[700]'), '--tw-prose-invert-quotes': theme('colors.pink[100]'), '--tw-prose-invert-quote-borders': theme('colors.pink[700]'), '--tw-prose-invert-captions': theme('colors.pink[400]'), '--tw-prose-invert-code': theme('colors.white'), '--tw-prose-invert-pre-code': theme('colors.pink[300]'), '--tw-prose-invert-pre-bg': 'rgb(0 0 0 / 50%)', '--tw-prose-invert-th-borders': theme('colors.pink[600]'), '--tw-prose-invert-td-borders': theme('colors.pink[700]'), }, }, }), }, }, plugins: [ require('@tailwindcss/typography'), // ... ], } ``` See our internal [style definitions](https://github.com/tailwindlabs/tailwindcss-typography/blob/master/src/styles.js) for some more examples. ### Changing the default class name If you need to use a class name other than `prose` for any reason, you can do so using the `className` option when registering the plugin: tailwind.config.js ``` module.exports = { theme: { // ... }, plugins: [ require('@tailwindcss/typography')({ className: 'wysiwyg', }), ] ... } ``` Now every instance of `prose` in the default class names will be replaced by your custom class name: ``` <article class="wysiwyg wysiwyg-slate lg:wysiwyg-xl"> <h1>My Heading</h1> <p>...</p> <div class="not-wysiwyg"> <!-- Some example or demo that needs to be prose-free --> </div> <p>...</p> <!-- ... --> </article> ``` ### Customizing the CSS If you want to customize the raw CSS generated by this plugin, add your overrides under the `typography` key in the `theme` section of your `tailwind.config.js` file: tailwind.config.js ``` module.exports = { theme: { extend: { typography: { DEFAULT: { css: { color: '#333', a: { color: '#3182ce', '&:hover': { color: '#2c5282', }, }, }, }, }, }, }, plugins: [ require('@tailwindcss/typography'), // ... ], } ``` Like with all theme customizations in Tailwind, you can also define the `typography` key as a function if you need access to the `theme` helper: tailwind.config.js ``` module.exports = { theme: { extend: { typography: (theme) => ({ DEFAULT: { css: { color: theme('colors.gray.800'), // ... }, }, }), }, }, plugins: [ require('@tailwindcss/typography'), // ... ], } ``` Customizations should be applied to a specific modifier like `DEFAULT` or `xl`, and must be added under the `css` property. Customizations are authored in the same [CSS-in-JS syntax](plugins#css-in-js-syntax) used to write Tailwind plugins. See [the default styles](https://github.com/tailwindlabs/tailwindcss-typography/blob/master/src/styles.js) for this plugin for more in-depth examples of configuring each modifier.
programming_docs
tailwindcss Divide Style Quick reference --------------- | Class | Properties | | --- | --- | | divide-solid > \* + \* | border-style: solid; | | divide-dashed > \* + \* | border-style: dashed; | | divide-dotted > \* + \* | border-style: dotted; | | divide-double > \* + \* | border-style: double; | | divide-none > \* + \* | border-style: none; | Basic usage ----------- ### Set the divide style Control the border style between elements using the `divide-{style}` utilities. ``` <div class="divide-y divide-dashed"> <div>01</div> <div>02</div> <div>03</div> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:divide-solid` to only apply the `divide-solid` utility on hover. ``` <div class="divide-y divide-dashed hover:divide-solid"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:divide-solid` to apply the `divide-solid` utility at only medium screen sizes and above. ``` <div class="divide-y divide-dashed md:divide-solid"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Visibility Quick reference --------------- | Class | Properties | | --- | --- | | visible | visibility: visible; | | invisible | visibility: hidden; | Basic usage ----------- ### Making elements invisible Use `invisible` to hide an element, but still maintain its place in the DOM, affecting the layout of other elements (compare with `.hidden` from the [display](display#hidden) documentation). ``` <div class="grid grid-cols-3 gap-4"> <div>01</div> <div class="invisible ...">02</div> <div>03</div> </div> ``` ### Making elements visible Use `visible` to make an element visible. This is mostly useful for undoing the `invisible` utility at different screen sizes. ``` <div class="grid grid-cols-3 gap-4"> <div>01</div> <div class="visible ...">02</div> <div>03</div> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:invisible` to only apply the `invisible` utility on hover. ``` <div class="visible hover:invisible"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:invisible` to apply the `invisible` utility at only medium screen sizes and above. ``` <div class="visible md:invisible"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Reusing Styles Tailwind encourages a <utility-first> workflow, where designs are implemented using only low-level utility classes. This is a powerful way to avoid premature abstraction and the pain points that come with it. But of course as a project grows, you’ll inevitably find yourself repeating common utility combinations to recreate the same design in many different places. For example, in the template below you can see the utility classes for each avatar image are repeated five separate times: ``` <div> <div class="flex items-center space-x-2 text-base"> <h4 class="font-semibold text-slate-900">Contributors</h4> <span class="rounded-full bg-slate-100 px-2 py-1 text-xs font-semibold text-slate-700">204</span> </div> <div class="mt-3 flex -space-x-2 overflow-hidden"> <img class="inline-block h-12 w-12 rounded-full ring-2 ring-white" src="https://images.unsplash.com/photo-1491528323818-fdd1faba62cc?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80" alt=""/> <img class="inline-block h-12 w-12 rounded-full ring-2 ring-white" src="https://images.unsplash.com/photo-1550525811-e5869dd03032?ixlib=rb-1.2.1&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80" alt=""/> <img class="inline-block h-12 w-12 rounded-full ring-2 ring-white" src="https://images.unsplash.com/photo-1500648767791-00dcc994a43e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2.25&w=256&h=256&q=80" alt=""/> <img class="inline-block h-12 w-12 rounded-full ring-2 ring-white" src="https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80" alt=""/> <img class="inline-block h-12 w-12 rounded-full ring-2 ring-white" src="https://images.unsplash.com/photo-1517365830460-955ce3ccd263?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80" alt=""/> </div> <div class="mt-3 text-sm font-medium"> <a href="#" class="text-blue-500">+ 198 others</a> </div> </div> ``` Don’t panic! In this guide, you’ll learn about different strategies for reusing styles in your project, as well as best practices for when to employ each one. Using editor and language features ---------------------------------- A lot of the time duplication like this isn’t even a real problem because it’s all together in one place, or doesn’t even actually exist because you’re iterating over an array of items and only writing the markup once. If the styles you need to reuse only need to be reused within a single file, multi-cursor editing and loops are the simplest way to manage any duplication. ### Multi-cursor editing When duplication is localized to a group of elements in a single file, the easiest way to deal with it to use [multi-cursor editing](https://code.visualstudio.com/docs/editor/codebasics#_multiple-selections-multicursor) to quickly select and edit the class list for each element at once: ``` <nav class="flex justify-center space-x-4"> <a href="/dashboard" class="font-medium px-3 py-2 text-slate-700 rounded-lg hover:bg-slate-100 hover:text-slate-900">Home</a> <a href="/team" class="font-medium px-3 py-2 text-slate-700 rounded-lg hover:bg-slate-100 hover:text-slate-900">Team</a> <a href="/projects" class="font-medium px-3 py-2 text-slate-700 rounded-lg hover:bg-slate-100 hover:text-slate-900">Projects</a> <a href="/reports" class="font-medium px-3 py-2 text-slate-700 rounded-lg hover:bg-slate-100 hover:text-slate-900">Reports</a> </nav> ``` You’d be surprised at how often this ends up being the best solution. If you can quickly edit all of the duplicated class lists simultaneously, there’s no benefit to introducing any additional abstraction. ### Loops Before you assume you’re going to need to extract a component or create a custom class for something, make sure you’re *actually* using it more than once in your template. A lot of the time a design element that shows up more than once in the rendered page is only actually authored once because the actual markup is rendered in a loop. For example, the duplicate avatars at the beginning of this guide would almost certainly be rendered in a loop in a real project: ``` <div> <div class="flex items-center space-x-2 text-base"> <h4 class="font-semibold text-slate-900">Contributors</h4> <span class="rounded-full bg-slate-100 px-2 py-1 text-xs font-semibold text-slate-700">204</span> </div> <div class="mt-3 flex -space-x-2 overflow-hidden"> {#each contributors as user} <img class="inline-block h-12 w-12 rounded-full ring-2 ring-white" src="{user.avatarUrl}" alt="{user.handle}"/> {/each} </div> <div class="mt-3 text-sm font-medium"> <a href="#" class="text-blue-500">+ 198 others</a> </div> </div> ``` You could even rewrite the navigation example using a loop or `map` if you preferred as well: ``` <nav className="flex sm:justify-center space-x-4"> {[ ['Home', '/dashboard'], ['Team', '/team'], ['Projects', '/projects'], ['Reports', '/reports'], ].map(([title, url]) => ( <a href={url} className="rounded-lg px-3 py-2 text-slate-700 font-medium hover:bg-slate-100 hover:text-slate-900">{title}</a> ))} </nav> ``` When elements are rendered in a loop like this, the actual class list is only written once so there’s no actual duplication problem to solve. Extracting components and partials ---------------------------------- If you need to reuse some styles across multiple files, the best strategy is to create a *component* if you’re using a front-end framework like React, Svelte, or Vue, or a *template partial* if you’re using a templating language like Blade, ERB, Twig, or Nunjucks. VacationCard.vue ``` <template> <div> <img class="rounded" :src="img" :alt="imgAlt"> <div class="mt-2"> <div> <div class="text-xs text-slate-600 uppercase font-bold tracking-wider">{{ eyebrow }}</div> <div class="font-bold text-slate-700 leading-snug"> <a :href="url" class="hover:underline">{{ title }}</a> </div> <div class="mt-2 text-sm text-slate-600">{{ pricing }}</div> </div> </div> </div> </template> <script> export default { props: ['img', 'imgAlt', 'eyebrow', 'title', 'pricing', 'url'] } </script> ``` Now you can use this component in as many places as you like, while still having a single source of truth for the styles so they can easily be updated together in one place. ### Compared to CSS abstractions Unless a component is a single HTML element, the information needed to define it can’t be captured in CSS alone. For anything even remotely complex, the HTML structure is just as important as the CSS. Don't rely on CSS classes to extract complex components ``` <!-- Even with custom CSS, you still need to duplicate this HTML structure --> <div class="chat-notification"> <div class="chat-notification-logo-wrapper"> <img class="chat-notification-logo" src="/img/logo.svg" alt="ChitChat Logo"> </div> <div class="chat-notification-content"> <h4 class="chat-notification-title">ChitChat</h4> <p class="chat-notification-message">You have a new message!</p> </div> </div> <style> .chat-notification { /* ... */ } .chat-notification-logo-wrapper { /* ... */ } .chat-notification-logo { /* ... */ } .chat-notification-content { /* ... */ } .chat-notification-title { /* ... */ } .chat-notification-message { /* ... */ } </style> ``` Even if you create classes for the different elements in a component like this, *you still have to duplicate the HTML every time you want to use this component*. Sure you can update the font-size for every instance in a single place, but what if you need to turn the title into a link? Components and template partials solve this problem much better than CSS-only abstractions because a component can encapsulate the HTML *and* the styles. Changing the font-size for every instance is just as easy as it is with CSS, but now you can turn all of the titles into links in a single place too. Create a template partial or JavaScript component Notification.jsx ``` function Notification({ imageUrl, imageAlt, title, message }) { return ( <div className="p-6 max-w-sm mx-auto bg-white rounded-xl shadow-md flex items-center space-x-4"> <div className="shrink-0"> <img className="h-12 w-12" src={imageUrl.src} alt={imageAlt}> </div> <div> <div className="text-xl font-medium text-black">{title}</div> <p className="text-slate-500">{message}</p> </div> </div> ) } ``` When you create components and template partials like this, there’s no reason to use anything other than utility classes because you already have a single source of truth for the styles. Extracting classes with @apply ------------------------------ If you’re using a traditional templating language like ERB or Twig, creating a template partial for something as small as a button can feel like overkill compared to a simple CSS class like `btn`. While it’s highly recommended that you create proper template partials for more complex components, you can use Tailwind’s `@apply` directive to extract repeated utility patterns to custom CSS classes when a template partial feels heavy-handed. Here’s what a `btn-primary` class might look like using `@apply` to compose it from existing utilities: HTML ``` <!-- Before extracting a custom class --> <button class="py-2 px-4 bg-blue-500 text-white font-semibold rounded-lg shadow-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-400 focus:ring-opacity-75"> Save changes </button> <!-- After extracting a custom class --> <button class="btn-primary"> Save changes </button> ``` CSS ``` @tailwind base; @tailwind components; @tailwind utilities; @layer components { .btn-primary { @apply py-2 px-4 bg-blue-500 text-white font-semibold rounded-lg shadow-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-400 focus:ring-opacity-75; } } ``` Learn more about `@apply` and `@layer` in the [Functions & Directives](functions-and-directives#layer) documentation. ### Avoiding premature abstraction Whatever you do, **don’t use `@apply` just to make things look “cleaner”**. Yes, HTML templates littered with Tailwind classes are kind of ugly. Making changes in a project that has tons of custom CSS is worse. If you start using `@apply` for everything, you are basically just writing CSS again and throwing away all of the workflow and maintainability advantages Tailwind gives you, for example: * **You have to think up class names all the time** — nothing will slow you down or drain your energy like coming up with a class name for something that doesn’t deserve to be named. * **You have to jump between multiple files to make changes** — which is a way bigger workflow killer than you’d think before co-locating everything together. * **Changing styles is scarier** — CSS is global, are you *sure* you can change the min-width value in that class without breaking something in another part of the site? * **Your CSS bundle will be bigger** — oof. If you’re going to use `@apply`, use it for very small, highly reusable things like buttons and form controls — and even then only if you’re not using a framework like React where a component would be a better choice. tailwindcss Sepia Quick reference --------------- | Class | Properties | | --- | --- | | sepia-0 | filter: sepia(0); | | sepia | filter: sepia(100%); | Basic usage ----------- ### Adding sepia filters Use the `sepia` and `sepia-0` utilities to control whether an element should be rendered as sepia or in full color. ``` <div class="sepia-0 ..."> <!-- ... --> </div> <div class="sepia ..."> <!-- ... --> </div> ``` ### Removing filters To remove all of the filters on an element at once, use the `filter-none` utility: ``` <div class="blur-md invert sepia md:filter-none"> <!-- ... --> </div> ``` This can be useful when you want to remove filters conditionally, such as on hover or at a particular breakpoint. Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:sepia-0` to only apply the `sepia-0` utility on hover. ``` <div class="sepia hover:sepia-0"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:sepia-0` to apply the `sepia-0` utility at only medium screen sizes and above. ``` <div class="sepia md:sepia-0"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind includes a handful of general purpose `sepia` utilities. You can customize these values by editing `theme.sepia` or `theme.extend.sepia` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { sepia: { 25: '.25', 75: '.75', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `sepia` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="sepia-[.25]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Align Self Quick reference --------------- | Class | Properties | | --- | --- | | self-auto | align-self: auto; | | self-start | align-self: flex-start; | | self-end | align-self: flex-end; | | self-center | align-self: center; | | self-stretch | align-self: stretch; | | self-baseline | align-self: baseline; | Basic usage ----------- ### Auto Use `self-auto` to align an item based on the value of the container’s `align-items` property: ``` <div class="flex items-stretch ..."> <div>01</div> <div class="self-auto ...">02</div> <div>03</div> </div> ``` ### Start Use `self-start` to align an item to the start of the container’s cross axis, despite the container’s `align-items` value: ``` <div class="flex items-stretch ..."> <div>01</div> <div class="self-start ...">02</div> <div>03</div> </div> ``` ### Center Use `self-center` to align an item along the center of the container’s cross axis, despite the container’s `align-items` value: ``` <div class="flex items-stretch ..."> <div>01</div> <div class="self-center ...">02</div> <div>03</div> </div> ``` ### End Use `self-end` to align an item to the end of the container’s cross axis, despite the container’s `align-items` value: ``` <div class="flex items-stretch ..."> <div>01</div> <div class="self-end ...">02</div> <div>03</div> </div> ``` ### Stretch Use `self-stretch` to stretch an item to fill the container’s cross axis, despite the container’s `align-items` value: ``` <div class="flex items-stretch ..."> <div>01</div> <div class="self-stretch ...">02</div> <div>03</div> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:self-end` to only apply the `self-end` utility on hover. ``` <div class="self-auto hover:self-end"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:self-end` to apply the `self-end` utility at only medium screen sizes and above. ``` <div class="self-auto md:self-end"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries).
programming_docs
tailwindcss Backdrop Blur Quick reference --------------- | Class | Properties | | --- | --- | | backdrop-blur-none | backdrop-filter: blur(0); | | backdrop-blur-sm | backdrop-filter: blur(4px); | | backdrop-blur | backdrop-filter: blur(8px); | | backdrop-blur-md | backdrop-filter: blur(12px); | | backdrop-blur-lg | backdrop-filter: blur(16px); | | backdrop-blur-xl | backdrop-filter: blur(24px); | | backdrop-blur-2xl | backdrop-filter: blur(40px); | | backdrop-blur-3xl | backdrop-filter: blur(64px); | Basic usage ----------- ### Blurring behind an element Use the `backdrop-blur-{amount?}` utilities to control an element’s backdrop blur. ``` <div class="backdrop-blur-sm bg-white/30 ..."> <!-- ... --> </div> <div class="backdrop-blur-md bg-white/30 ..."> <!-- ... --> </div> <div class="backdrop-blur-xl bg-white/30 ..."> <!-- ... --> </div> ``` ### Removing backdrop filters To remove all of the backdrop filters on an element at once, use the `backdrop-filter-none` utility: ``` <div class="backdrop-blur-md backdrop-brightness-150 md:backdrop-filter-none"> <!-- ... --> </div> ``` This can be useful when you want to remove backdrop filters conditionally, such as on hover or at a particular breakpoint. Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:backdrop-blur-lg` to only apply the `backdrop-blur-lg` utility on hover. ``` <div class="backdrop-blur-sm hover:backdrop-blur-lg"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:backdrop-blur-lg` to apply the `backdrop-blur-lg` utility at only medium screen sizes and above. ``` <div class="backdrop-blur-sm md:backdrop-blur-lg"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind includes a handful of general purpose `backdrop-blur` utilities. You can customize these values by editing `theme.backdropBlur` or `theme.extend.backdropBlur` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { backdropBlur: { xs: '2px', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `backdrop-blur` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="backdrop-blur-[2px]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Flex Shrink Quick reference --------------- | Class | Properties | | --- | --- | | shrink | flex-shrink: 1; | | shrink-0 | flex-shrink: 0; | Basic usage ----------- ### Shrink Use `shrink` to allow a flex item to shrink if needed: ``` <div class="flex ..."> <div class="flex-none w-14 h-14 ..."> 01 </div> <div class="shrink w-64 h-14 ..."> 02 </div> <div class="flex-none w-14 h-14 ..."> 03 </div> </div> ``` ### Don't shrink Use `shrink-0` to prevent a flex item from shrinking: ``` <div class="flex ..."> <div class="flex-1 h-16 ..."> 01 </div> <div class="shrink-0 h-16 w-32 ..."> 02 </div> <div class="flex-1 h-16 ..."> 03 </div> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:shrink-0` to only apply the `shrink-0` utility on hover. ``` <div class="shrink hover:shrink-0"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:shrink-0` to apply the `shrink-0` utility at only medium screen sizes and above. ``` <div class="shrink md:shrink-0"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind provides two `shrink` utilities. You can customize these values by editing `theme.flexShrink` or `theme.extend.flexShrink` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { flexShrink: { '2': 2 } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `flex-shrink` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="shrink-[2]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Text Underline Offset Quick reference --------------- | Class | Properties | | --- | --- | | underline-offset-auto | text-underline-offset: auto; | | underline-offset-0 | text-underline-offset: 0px; | | underline-offset-1 | text-underline-offset: 1px; | | underline-offset-2 | text-underline-offset: 2px; | | underline-offset-4 | text-underline-offset: 4px; | | underline-offset-8 | text-underline-offset: 8px; | Basic usage ----------- ### Setting the underline offset Use the `underline-offset-{width}` utilities to change the offset of a text underline. ``` <p class="underline underline-offset-1 ...">The quick brown fox...</p> <p class="underline underline-offset-2 ...">The quick brown fox...</p> <p class="underline underline-offset-4 ...">The quick brown fox...</p> <p class="underline underline-offset-8 ...">The quick brown fox...</p> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:underline-offset-4` to only apply the `underline-offset-4` utility on hover. ``` <p class="underline hover:underline-offset-4"> <!-- ... --> </p> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:underline-offset-4` to apply the `underline-offset-4` utility at only medium screen sizes and above. ``` <p class="underline md:underline-offset-4"> <!-- ... --> </p> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme You can customize the `underline-offset-{width}` utilities by editing `theme.textUnderlineOffset` or `theme.extend.textUnderlineOffset` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { textUnderlineOffset: { 3: '3px', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `text-underline-offset` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <p class="underline-offset-[3px]"> <!-- ... --> </p> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss User Select Quick reference --------------- | Class | Properties | | --- | --- | | select-none | user-select: none; | | select-text | user-select: text; | | select-all | user-select: all; | | select-auto | user-select: auto; | Basic usage ----------- ### Disabling text selection Use `select-none` to prevent selecting text in an element and its children. ``` <div class="select-none ..."> The quick brown fox jumps over the lazy dog. </div> ``` ### Allowing text selection Use `select-text` to allow selecting text in an element and its children. ``` <div class="select-text ..."> The quick brown fox jumps over the lazy dog. </div> ``` ### Selecting all text in one click Use `select-all` to automatically select all the text in an element when a user clicks. ``` <div class="select-all ..."> The quick brown fox jumps over the lazy dog. </div> ``` ### Using auto select behaviour Use `select-auto` to use the default browser behavior for selecting text. Useful for undoing other classes like `.select-none` at different breakpoints. ``` <div class="select-auto ..."> The quick brown fox jumps over the lazy dog. </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:select-all` to only apply the `select-all` utility on hover. ``` <div class="hover:select-all"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:select-all` to apply the `select-all` utility at only medium screen sizes and above. ``` <div class="md:select-all"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Configuration Because Tailwind is a framework for building bespoke user interfaces, it has been designed from the ground up with customization in mind. By default, Tailwind will look for an optional `tailwind.config.js` file at the root of your project where you can define any customizations. tailwind.config.js ``` module.exports = { content: ['./src/**/*.{html,js}'], theme: { colors: { 'blue': '#1fb6ff', 'purple': '#7e5bef', 'pink': '#ff49db', 'orange': '#ff7849', 'green': '#13ce66', 'yellow': '#ffc82c', 'gray-dark': '#273444', 'gray': '#8492a6', 'gray-light': '#d3dce6', }, fontFamily: { sans: ['Graphik', 'sans-serif'], serif: ['Merriweather', 'serif'], }, extend: { spacing: { '8xl': '96rem', '9xl': '128rem', }, borderRadius: { '4xl': '2rem', } } }, } ``` Every section of the config file is optional, so you only have to specify what you’d like to change. Any missing sections will fall back to Tailwind’s [default configuration](https://github.com/tailwindlabs/tailwindcss/blob/master/stubs/defaultConfig.stub.js). Creating your configuration file -------------------------------- Generate a Tailwind config file for your project using the Tailwind CLI utility included when you install the `tailwindcss` npm package: ``` npx tailwindcss init ``` This will create a minimal `tailwind.config.js` file at the root of your project: tailwind.config.js ``` module.exports = { content: [], theme: { extend: {}, }, plugins: [], } ``` ### Using a different file name To use a name other than `tailwind.config.js`, pass it as an argument on the command-line: ``` npx tailwindcss init tailwindcss-config.js ``` When you use a custom file name, you will need to specify it as a command-line argument when compiling your CSS with the Tailwind CLI tool: ``` npx tailwindcss -c ./tailwindcss-config.js -i input.css -o output.css ``` If you’re using Tailwind as a PostCSS plugin, you will need to specify your custom configuration path in your PostCSS configuration: postcss.config.js ``` module.exports = { plugins: { tailwindcss: { config: './tailwindcss-config.js' }, }, } ``` ### Generating a PostCSS configuration file Use the `-p` flag if you’d like to also generate a basic `postcss.config.js` file alongside your `tailwind.config.js` file: ``` npx tailwindcss init -p ``` This will generate a `postcss.config.js` file in your project that looks like this: postcss.config.js ``` module.exports = { plugins: { tailwindcss: {}, autoprefixer: {}, }, } ``` ### Scaffolding the entire default configuration For most users we encourage you to keep your config file as minimal as possible, and only specify the things you want to customize. If you’d rather scaffold a complete configuration file that includes all of Tailwind’s default configuration, use the `--full` option: ``` npx tailwindcss init --full ``` You’ll get a file that matches the [default configuration file](https://unpkg.com/browse/tailwindcss@latest/stubs/defaultConfig.stub.js) Tailwind uses internally. Configuration options --------------------- ### Content The `content` section is where you configure the paths to all of your HTML templates, JS components, and any other files that contain Tailwind class names. tailwind.config.js ``` module.exports = { content: [ './pages/**/*.{html,js}', './components/**/*.{html,js}', ], // ... } ``` Learn more about configuring your content sources in the [Content Configuration](content-configuration) documentation. ### Theme The `theme` section is where you define your color palette, fonts, type scale, border sizes, breakpoints — anything related to the visual design of your site. tailwind.config.js ``` module.exports = { // ... theme: { colors: { 'blue': '#1fb6ff', 'purple': '#7e5bef', 'pink': '#ff49db', 'orange': '#ff7849', 'green': '#13ce66', 'yellow': '#ffc82c', 'gray-dark': '#273444', 'gray': '#8492a6', 'gray-light': '#d3dce6', }, fontFamily: { sans: ['Graphik', 'sans-serif'], serif: ['Merriweather', 'serif'], }, extend: { spacing: { '8xl': '96rem', '9xl': '128rem', }, borderRadius: { '4xl': '2rem', } } } } ``` Learn more about the default theme and how to customize it in the [theme configuration guide](theme). ### Plugins The `plugins` section allows you to register plugins with Tailwind that can be used to generate extra utilities, components, base styles, or custom variants. tailwind.config.js ``` module.exports = { // ... plugins: [ require('@tailwindcss/forms'), require('@tailwindcss/aspect-ratio'), require('@tailwindcss/typography'), require('tailwindcss-children'), ], } ``` Learn more about writing your own plugins in the [plugin authoring guide](plugins). ### Presets The `presets` section allows you to specify your own custom base configuration instead of using Tailwind’s default base configuration. tailwind.config.js ``` module.exports = { // ... presets: [ require('@acmecorp/base-tailwind-config') ], // Project-specific customizations theme: { //... }, } ``` Learn more about presets in the [presets documentation](presets). ### Prefix The `prefix` option allows you to add a custom prefix to all of Tailwind’s generated utility classes. This can be really useful when layering Tailwind on top of existing CSS where there might be naming conflicts. For example, you could add a `tw-` prefix by setting the `prefix` option like so: tailwind.config.js ``` module.exports = { prefix: 'tw-', } ``` Now every class will be generated with the configured prefix: ``` .tw-text-left { text-align: left; } .tw-text-center { text-align: center; } .tw-text-right { text-align: right; } /* etc. */ ``` It’s important to understand that this prefix is added *after* any variant modifiers. That means that classes with responsive or state modifiers like `sm:` or `hover:` will still have the responsive or state modifier *first*, with your custom prefix appearing after the colon: ``` <div class="tw-text-lg md:tw-text-xl tw-bg-red-500 hover:tw-bg-blue-500"> <!-- --> </div> ``` The dash modifier for negative values should be added before your prefix, so `-mt-8` would become `-tw-mt-8` if you’ve configured `tw-` as your prefix: ``` <div class="-tw-mt-8"> <!-- --> </div> ``` Prefixes are only added to classes generated by Tailwind; **no prefix will be added to your own custom classes.** That means if you add your own custom utility like this: ``` @layer utilities { .bg-brand-gradient { /* ... */ } } ``` …the generated variants will not have your configured prefix: ``` .bg-brand-gradient { /* ... */ } .hover\:bg-brand-gradient:hover { /* ... */ } ``` If you’d like to prefix your own utilities as well, just add the prefix to the class definition: ``` @layer utilities { .tw-bg-brand-gradient { /* ... */ } } ``` ### Important The `important` option lets you control whether or not Tailwind’s utilities should be marked with `!important`. This can be really useful when using Tailwind with existing CSS that has high specificity selectors. To generate utilities as `!important`, set the `important` key in your configuration options to `true`: tailwind.config.js ``` module.exports = { important: true, } ``` Now all of Tailwind’s utility classes will be generated as `!important`: ``` .leading-none { line-height: 1 !important; } .leading-tight { line-height: 1.25 !important; } .leading-snug { line-height: 1.375 !important; } /* etc. */ ``` This also applies to any custom utilities you define in your CSS using the `@layer utilities` directive: ``` /* Input */ @layer utilities { .bg-brand-gradient { background-image: linear-gradient(#3490dc, #6574cd); } } /* Output */ .bg-brand-gradient { background-image: linear-gradient(#3490dc, #6574cd) !important; } ``` #### Selector strategy Setting `important` to `true` can introduce some issues when incorporating third-party JS libraries that add inline styles to your elements. In those cases, Tailwind’s `!important` utilities defeat the inline styles, which can break your intended design. To get around this, you can set `important` to an ID selector like `#app` instead: tailwind.config.js ``` module.exports = { // ... important: '#app', } ``` This configuration will prefix all of your utilities with the given selector, effectively increasing their specificity without actually making them `!important`. After you specify the `important` selector, you’ll need to ensure that the root element of your site matches it. Using the example above, we would need to set our root element’s `id` attribute to `app` in order for styles to work properly. After your configuration is all set up and your root element matches the selector in your Tailwind config, all of Tailwind’s utilities will have a high enough specificity to defeat other classes used in your project, **without** interfering with inline styles: ``` <html> <!-- ... --> <style> .high-specificity .nested .selector { color: blue; } </style> <body id="app"> <div class="high-specificity"> <div class="nested"> <!-- Will be red-500 --> <div class="selector text-red-500"><!-- ... --></div> </div> </div> <!-- Will be #bada55 --> <div class="text-red-500" style="color: #bada55;"><!-- ... --></div> </body> </html> ``` When using the selector strategy, be sure that the template file that includes your root selector is included in your [content configuration](https://tailwindcss.com/docs/optimizing-for-production#basic-usage), otherwise all of your CSS will be removed when building for production. #### Important modifier Alternatively, you can make any utility important by adding a `!` character to the beginning: ``` <p class="font-bold !font-medium"> This will be medium even though bold comes later in the CSS. </p> ``` The `!` always goes at the beginning of the utility name, after any variants, but before any prefix: ``` <div class="sm:hover:!tw-font-bold"> ``` This can be useful in rare situations where you need to increase specificity because you’re at war with some styles you don’t control. ### Separator The `separator` option lets you customize which character should be used to separate modifiers (screen sizes, `hover`, `focus`, etc.) from utility names (`text-center`, `items-end`, etc.). We use a colon by default (`:`), but it can be useful to change this if you’re using a templating language like [Pug](https://pugjs.org) that doesn’t support special characters in class names. tailwind.config.js ``` module.exports = { separator: '_', } ``` ### Core Plugins The `corePlugins` section lets you completely disable classes that Tailwind would normally generate by default if you don’t need them for your project. To disable specific core plugins, provide an object for `corePlugins` that sets those plugins to `false`: tailwind.config.js ``` module.exports = { corePlugins: { float: false, objectFit: false, objectPosition: false, } } ``` If you’d like to safelist which core plugins should be enabled, provide an array that includes a list of the core plugins you’d like to use: tailwind.config.js ``` module.exports = { corePlugins: [ 'margin', 'padding', 'backgroundColor', // ... ] } ``` If you’d like to disable all of Tailwind’s core plugins and simply use Tailwind as a tool for processing your own custom plugins, provide an empty array: tailwind.config.js ``` module.exports = { corePlugins: [] } ``` Here’s a list of every core plugin for reference: | Core Plugin | Description | | --- | --- | | `accentColor` | The `accent-color` utilities like `accent-green-700` | | `accessibility` | The `sr-only` and `not-sr-only` utilities | | `alignContent` | The `align-content` utilities like `content-end` | | `alignItems` | The `align-items` utilities like `items-center` | | `alignSelf` | The `align-self` utilities like `self-end` | | `animation` | The `animation` utilities like `animate-ping` | | `appearance` | The `appearance` utilities like `appearance-none` | | `aspectRatio` | The `aspect-ratio` utilities like `aspect-square` | | `backdropBlur` | The `backdrop-blur` utilities like `backdrop-blur-md` | | `backdropBrightness` | The `backdrop-brightness` utilities like `backdrop-brightness-100` | | `backdropContrast` | The `backdrop-contrast` utilities like `backdrop-contrast-100` | | `backdropFilter` | The `backdrop-filter` utilities like `backdrop-filter` | | `backdropGrayscale` | The `backdrop-grayscale` utilities like `backdrop-grayscale-0` | | `backdropHueRotate` | The `backdrop-hue-rotate` utilities like `backdrop-hue-rotate-30` | | `backdropInvert` | The `backdrop-invert` utilities like `backdrop-invert-0` | | `backdropOpacity` | The `backdrop-opacity` utilities like `backdrop-opacity-50` | | `backdropSaturate` | The `backdrop-saturate` utilities like `backdrop-saturate-100` | | `backdropSepia` | The `backdrop-sepia` utilities like `backdrop-sepia-0` | | `backgroundAttachment` | The `background-attachment` utilities like `bg-local` | | `backgroundBlendMode` | The `background-blend-mode` utilities like `bg-blend-color-burn` | | `backgroundClip` | The `background-clip` utilities like `bg-clip-padding` | | `backgroundColor` | The `background-color` utilities like `bg-green-700` | | `backgroundImage` | The `background-image` utilities like `bg-gradient-to-br` | | `backgroundOpacity` | The `background-color` opacity utilities like `bg-opacity-25` | | `backgroundOrigin` | The `background-origin` utilities like `bg-origin-padding` | | `backgroundPosition` | The `background-position` utilities like `bg-left-top` | | `backgroundRepeat` | The `background-repeat` utilities like `bg-repeat-x` | | `backgroundSize` | The `background-size` utilities like `bg-cover` | | `blur` | The `blur` utilities like `blur-md` | | `borderCollapse` | The `border-collapse` utilities like `border-collapse` | | `borderColor` | The `border-color` utilities like `border-t-green-700` | | `borderOpacity` | The `border-color` opacity utilities like `border-opacity-25` | | `borderRadius` | The `border-radius` utilities like `rounded-l-lg` | | `borderSpacing` | The `border-spacing` utilities like `border-spacing-x-28` | | `borderStyle` | The `border-style` utilities like `border-dotted` | | `borderWidth` | The `border-width` utilities like `border-t-4` | | `boxDecorationBreak` | The `box-decoration-break` utilities like `decoration-clone` | | `boxShadow` | The `box-shadow` utilities like `shadow-lg` | | `boxShadowColor` | The `box-shadow-color` utilities like `shadow-green-700` | | `boxSizing` | The `box-sizing` utilities like `box-border` | | `breakAfter` | The `break-after` utilities like `break-after-avoid-page` | | `breakBefore` | The `break-before` utilities like `break-before-avoid-page` | | `breakInside` | The `break-inside` utilities like `break-inside-avoid` | | `brightness` | The `brightness` utilities like `brightness-100` | | `caretColor` | The `caret-color` utilities like `caret-green-700` | | `clear` | The `clear` utilities like `clear-right` | | `columns` | The `columns` utilities like `columns-auto` | | `container` | The `container` component | | `content` | The `content` utilities like `content-none` | | `contrast` | The `contrast` utilities like `contrast-100` | | `cursor` | The `cursor` utilities like `cursor-grab` | | `display` | The `display` utilities like `table-column-group` | | `divideColor` | The between elements `border-color` utilities like `divide-slate-500` | | `divideOpacity` | The `divide-opacity` utilities like `divide-opacity-50` | | `divideStyle` | The `divide-style` utilities like `divide-dotted` | | `divideWidth` | The between elements `border-width` utilities like `divide-x-2` | | `dropShadow` | The `drop-shadow` utilities like `drop-shadow-lg` | | `fill` | The `fill` utilities like `fill-green-700` | | `filter` | The `filter` utilities like `filter` | | `flex` | The `flex` utilities like `flex-auto` | | `flexBasis` | The `flex-basis` utilities like `basis-px` | | `flexDirection` | The `flex-direction` utilities like `flex-row-reverse` | | `flexGrow` | The `flex-grow` utilities like `flex-grow` | | `flexShrink` | The `flex-shrink` utilities like `flex-shrink` | | `flexWrap` | The `flex-wrap` utilities like `flex-wrap-reverse` | | `float` | The `float` utilities like `float-left` | | `fontFamily` | The `font-family` utilities like `font-serif` | | `fontSize` | The `font-size` utilities like `text-3xl` | | `fontSmoothing` | The `font-smoothing` utilities like `antialiased` | | `fontStyle` | The `font-style` utilities like `italic` | | `fontVariantNumeric` | The `font-variant-numeric` utilities like `oldstyle-nums` | | `fontWeight` | The `font-weight` utilities like `font-medium` | | `gap` | The `gap` utilities like `gap-x-28` | | `gradientColorStops` | The `gradient-color-stops` utilities like `via-green-700` | | `grayscale` | The `grayscale` utilities like `grayscale-0` | | `gridAutoColumns` | The `grid-auto-columns` utilities like `auto-cols-min` | | `gridAutoFlow` | The `grid-auto-flow` utilities like `grid-flow-dense` | | `gridAutoRows` | The `grid-auto-rows` utilities like `auto-rows-min` | | `gridColumn` | The `grid-column` utilities like `col-span-6` | | `gridColumnEnd` | The `grid-column-end` utilities like `col-end-7` | | `gridColumnStart` | The `grid-column-start` utilities like `col-start-7` | | `gridRow` | The `grid-row` utilities like `row-span-3` | | `gridRowEnd` | The `grid-row-end` utilities like `row-end-4` | | `gridRowStart` | The `grid-row-start` utilities like `row-start-4` | | `gridTemplateColumns` | The `grid-template-columns` utilities like `grid-cols-7` | | `gridTemplateRows` | The `grid-template-rows` utilities like `grid-rows-4` | | `height` | The `height` utilities like `h-72` | | `hueRotate` | The `hue-rotate` utilities like `hue-rotate-30` | | `inset` | The `inset` utilities like `top-44` | | `invert` | The `invert` utilities like `invert-0` | | `isolation` | The `isolation` utilities like `isolate` | | `justifyContent` | The `justify-content` utilities like `justify-center` | | `justifyItems` | The `justify-items` utilities like `justify-items-end` | | `justifySelf` | The `justify-self` utilities like `justify-self-end` | | `letterSpacing` | The `letter-spacing` utilities like `tracking-normal` | | `lineHeight` | The `line-height` utilities like `leading-9` | | `listStylePosition` | The `list-style-position` utilities like `list-inside` | | `listStyleType` | The `list-style-type` utilities like `list-disc` | | `margin` | The `margin` utilities like `mt-28` | | `maxHeight` | The `max-height` utilities like `max-h-36` | | `maxWidth` | The `max-width` utilities like `max-w-6xl` | | `minHeight` | The `min-height` utilities like `min-h-screen` | | `minWidth` | The `min-width` utilities like `min-w-min` | | `mixBlendMode` | The `mix-blend-mode` utilities like `mix-blend-hard-light` | | `objectFit` | The `object-fit` utilities like `object-fill` | | `objectPosition` | The `object-position` utilities like `object-left-top` | | `opacity` | The `opacity` utilities like `opacity-50` | | `order` | The `order` utilities like `order-8` | | `outlineColor` | The `outline-color` utilities like `outline-green-700` | | `outlineOffset` | The `outline-offset` utilities like `outline-offset-2` | | `outlineStyle` | The `outline-style` utilities like `outline-dashed` | | `outlineWidth` | The `outline-width` utilities like `outline-2` | | `overflow` | The `overflow` utilities like `overflow-x-hidden` | | `overscrollBehavior` | The `overscroll-behavior` utilities like `overscroll-y-contain` | | `padding` | The `padding` utilities like `pt-28` | | `placeContent` | The `place-content` utilities like `place-content-between` | | `placeItems` | The `place-items` utilities like `place-items-end` | | `placeSelf` | The `place-self` utilities like `place-self-end` | | `placeholderColor` | The placeholder `color` utilities like `placeholder-red-600` | | `placeholderOpacity` | The placeholder `color` opacity utilities like `placeholder-opacity-25` | | `pointerEvents` | The `pointer-events` utilities like `pointer-events-none` | | `position` | The `position` utilities like `absolute` | | `preflight` | Tailwind's base/reset styles | | `resize` | The `resize` utilities like `resize-y` | | `ringColor` | The `ring-color` utilities like `ring-green-700` | | `ringOffsetColor` | The `ring-offset-color` utilities like `ring-offset-green-700` | | `ringOffsetWidth` | The `ring-offset-width` utilities like `ring-offset-2` | | `ringOpacity` | The `ring-opacity` utilities like `ring-opacity-50` | | `ringWidth` | The `ring-width` utilities like `ring-4` | | `rotate` | The `rotate` utilities like `rotate-6` | | `saturate` | The `saturate` utilities like `saturate-100` | | `scale` | The `scale` utilities like `scale-x-95` | | `scrollBehavior` | The `scroll-behavior` utilities like `scroll-auto` | | `scrollMargin` | The `scroll-margin` utilities like `scroll-mt-28` | | `scrollPadding` | The `scroll-padding` utilities like `scroll-pt-28` | | `scrollSnapAlign` | The `scroll-snap-align` utilities like `snap-end` | | `scrollSnapStop` | The `scroll-snap-stop` utilities like `snap-normal` | | `scrollSnapType` | The `scroll-snap-type` utilities like `snap-y` | | `sepia` | The `sepia` utilities like `sepia-0` | | `skew` | The `skew` utilities like `skew-x-12` | | `space` | The "space-between" utilities like `space-x-4` | | `stroke` | The `stroke` utilities like `stroke-green-700` | | `strokeWidth` | The `stroke-width` utilities like `stroke-1` | | `tableLayout` | The `table-layout` utilities like `table-auto` | | `textAlign` | The `text-align` utilities like `text-right` | | `textColor` | The `text-color` utilities like `text-green-700` | | `textDecoration` | The `text-decoration` utilities like `overline` | | `textDecorationColor` | The `text-decoration-color` utilities like `decoration-green-700` | | `textDecorationStyle` | The `text-decoration-style` utilities like `decoration-dotted` | | `textDecorationThickness` | The `text-decoration-thickness` utilities like `decoration-4` | | `textIndent` | The `text-indent` utilities like `indent-28` | | `textOpacity` | The `text-opacity` utilities like `text-opacity-50` | | `textOverflow` | The `text-overflow` utilities like `overflow-ellipsis` | | `textTransform` | The `text-transform` utilities like `lowercase` | | `textUnderlineOffset` | The `text-underline-offset` utilities like `underline-offset-2` | | `touchAction` | The `touch-action` utilities like `touch-pan-right` | | `transform` | The `transform` utility (for enabling transform features) | | `transformOrigin` | The `transform-origin` utilities like `origin-bottom-right` | | `transitionDelay` | The `transition-delay` utilities like `delay-200` | | `transitionDuration` | The `transition-duration` utilities like `duration-200` | | `transitionProperty` | The `transition-property` utilities like `transition-colors` | | `transitionTimingFunction` | The `transition-timing-function` utilities like `ease-in` | | `translate` | The `translate` utilities like `translate-x-full` | | `userSelect` | The `user-select` utilities like `select-text` | | `verticalAlign` | The `vertical-align` utilities like `align-bottom` | | `visibility` | The `visibility` utilities like `visible` | | `whitespace` | The `whitespace` utilities like `whitespace-pre` | | `width` | The `width` utilities like `w-1.5` | | `willChange` | The `will-change` utilities like `will-change-scroll` | | `wordBreak` | The `word-break` utilities like `break-words` | | `zIndex` | The `z-index` utilities like `z-30` | Referencing in JavaScript ------------------------- It can often be useful to reference your configuration values in your own client-side JavaScript — for example to access some of your theme values when dynamically applying inline styles in a React or Vue component. To make this easy, Tailwind provides a `resolveConfig` helper you can use to generate a fully merged version of your configuration object: ``` import resolveConfig from 'tailwindcss/resolveConfig' import tailwindConfig from './tailwind.config.js' const fullConfig = resolveConfig(tailwindConfig) fullConfig.theme.width[4] // => '1rem' fullConfig.theme.screens.md // => '768px' fullConfig.theme.boxShadow['2xl'] // => '0 25px 50px -12px rgba(0, 0, 0, 0.25)' ``` Note that this will transitively pull in a lot of our build-time dependencies, resulting in bigger bundle client-side size. To avoid this, we recommend using a tool like [babel-plugin-preval](https://github.com/kentcdodds/babel-plugin-preval) to generate a static version of your configuration at build-time. TypeScript types ---------------- We ship first-party TypeScript types for the `tailwind.config.js` file which give you all sorts of useful IDE support, and makes it a lot easier to make changes to your configuration without referencing the documentation quite as much. Configuration files generated with Tailwind CLI include the necessary type annotation by default, but to configure TypeScript types manually, just add the type annotation above your configuration object: tailwind.config.js ``` /** @type {import('tailwindcss').Config} */ module.exports = { content: [ // ... ], theme: { extend: {}, }, plugins: [], } ```
programming_docs
tailwindcss Saturate Quick reference --------------- | Class | Properties | | --- | --- | | saturate-0 | filter: saturate(0); | | saturate-50 | filter: saturate(.5); | | saturate-100 | filter: saturate(1); | | saturate-150 | filter: saturate(1.5); | | saturate-200 | filter: saturate(2); | Basic usage ----------- ### Changing element saturation Use the `saturate-{amount}` utilities to control an element’s saturation. ``` <div class="saturate-50 ..."> <!-- ... --> </div> <div class="saturate-100 ..."> <!-- ... --> </div> <div class="saturate-150 ..."> <!-- ... --> </div> <div class="saturate-200 ..."> <!-- ... --> </div> ``` ### Removing filters To remove all of the filters on an element at once, use the `filter-none` utility: ``` <div class="blur-md invert saturate-150 md:filter-none"> <!-- ... --> </div> ``` This can be useful when you want to remove filters conditionally, such as on hover or at a particular breakpoint. Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:saturate-150` to only apply the `saturate-150` utility on hover. ``` <div class="saturate-50 hover:saturate-150"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:saturate-150` to apply the `saturate-150` utility at only medium screen sizes and above. ``` <div class="saturate-50 md:saturate-150"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind includes a handful of general purpose `saturate` utilities. You can customize these values by editing `theme.saturate` or `theme.extend.saturate` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { saturate: { 25: '.25', 75: '.75', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `saturate` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="saturate-[.25]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Backdrop Hue Rotate Quick reference --------------- | Class | Properties | | --- | --- | | backdrop-hue-rotate-0 | backdrop-filter: hue-rotate(0deg); | | backdrop-hue-rotate-15 | backdrop-filter: hue-rotate(15deg); | | backdrop-hue-rotate-30 | backdrop-filter: hue-rotate(30deg); | | backdrop-hue-rotate-60 | backdrop-filter: hue-rotate(60deg); | | backdrop-hue-rotate-90 | backdrop-filter: hue-rotate(90deg); | | backdrop-hue-rotate-180 | backdrop-filter: hue-rotate(180deg); | Basic usage ----------- ### Rotating the backdrop's hue Use the `backdrop-hue-rotate-{amount}` utilities to rotate the hue of an element’s backdrop. ``` <div class="backdrop-hue-rotate-90 bg-white/30 ..."> <!-- ... --> </div> <div class="backdrop-hue-rotate-180 bg-white/30 ..."> <!-- ... --> </div> <div class="-backdrop-hue-rotate-60 bg-white/30 ..."> <!-- ... --> </div> ``` ### Using negative values To use a negative backdrop hue rotate value, prefix the class name with a dash to convert it to a negative value. ``` <div class="-backdrop-hue-rotate-60"> <!-- ... --> </div> ``` ### Removing backdrop filters To remove all of the backdrop filters on an element at once, use the `backdrop-filter-none` utility: ``` <div class="backdrop-blur-md backdrop-hue-rotate-180 md:backdrop-filter-none"> <!-- ... --> </div> ``` This can be useful when you want to remove backdrop filters conditionally, such as on hover or at a particular breakpoint. Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:backdrop-hue-rotate-60` to only apply the `backdrop-hue-rotate-60` utility on hover. ``` <div class="backdrop-hue-rotate-15 hover:backdrop-hue-rotate-60"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:backdrop-hue-rotate-60` to apply the `backdrop-hue-rotate-60` utility at only medium screen sizes and above. ``` <div class="backdrop-hue-rotate-15 md:backdrop-hue-rotate-60"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind includes a handful of general purpose `backdrop-hue-rotate` utilities. You can customize these values by editing `theme.backdropHueRotate` or `theme.extend.backdropHueRotate` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { backdropHueRotate: { '-270': '-270deg', 270: '270deg', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `backdrop-hue-rotate` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="backdrop-hue-rotate-[270deg]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Justify Self Quick reference --------------- | Class | Properties | | --- | --- | | justify-self-auto | justify-self: auto; | | justify-self-start | justify-self: start; | | justify-self-end | justify-self: end; | | justify-self-center | justify-self: center; | | justify-self-stretch | justify-self: stretch; | Basic usage ----------- ### Auto Use `justify-self-auto` to align an item based on the value of the grid’s `justify-items` property: ``` <div class="grid justify-items-stretch ..."> <!-- ... --> <div class="justify-self-auto ...">02</div> <!-- ... --> <!-- ... --> <!-- ... --> <!-- ... --> </div> ``` ### Start Use `justify-self-start` to align a grid item to the start its inline axis: ``` <div class="grid justify-items-stretch ..."> <!-- ... --> <div class="justify-self-start ...">02</div> <!-- ... --> <!-- ... --> <!-- ... --> <!-- ... --> </div> ``` ### Center Use `justify-self-center` to align a grid item along the center its inline axis: ``` <div class="grid justify-items-stretch ..."> <!-- ... --> <div class="justify-self-center ...">02</div> <!-- ... --> <!-- ... --> <!-- ... --> <!-- ... --> </div> ``` ### End Use `justify-self-end` to align a grid item to the end its inline axis: ``` <div class="grid justify-items-stretch ..."> <!-- ... --> <div class="justify-self-end ...">02</div> <!-- ... --> <!-- ... --> <!-- ... --> <!-- ... --> </div> ``` ### Stretch Use `justify-self-stretch` to stretch a grid item to fill the grid area on its inline axis: ``` <div class="grid justify-items-start ..."> <!-- ... --> <div class="justify-self-stretch ...">02</div> <!-- ... --> <!-- ... --> <!-- ... --> <!-- ... --> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:justify-self-end` to only apply the `justify-self-end` utility on hover. ``` <div class="justify-self-start hover:justify-self-end"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:justify-self-end` to apply the `justify-self-end` utility at only medium screen sizes and above. ``` <div class="justify-self-start md:justify-self-end"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Font Smoothing Quick reference --------------- | Class | Properties | | --- | --- | | antialiased | -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; | | subpixel-antialiased | -webkit-font-smoothing: auto; -moz-osx-font-smoothing: auto; | Basic usage ----------- ### Applying font smoothing Use the `subpixel-antialiased` utility to render text using subpixel antialiasing and the `antialiased` utility to render text using grayscale antialiasing. ``` <p class="subpixel-antialiased ...">The quick brown fox ...</p> <p class="antialiased ...">The quick brown fox ...</p> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:subpixel-antialiased` to only apply the `subpixel-antialiased` utility on hover. ``` <p class="antialiased hover:subpixel-antialiased"> <!-- ... --> </p> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:subpixel-antialiased` to apply the `subpixel-antialiased` utility at only medium screen sizes and above. ``` <p class="antialiased md:subpixel-antialiased"> <!-- ... --> </p> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Text Align Quick reference --------------- | Class | Properties | | --- | --- | | text-left | text-align: left; | | text-center | text-align: center; | | text-right | text-align: right; | | text-justify | text-align: justify; | | text-start | text-align: start; | | text-end | text-align: end; | Basic usage ----------- ### Setting the text alignment Control the text alignment of an element using the `text-left`, `text-center`, `text-right`, and `text-justify` utilities. ``` <p class="text-left ...">So I started to walk into the water...</p> ``` ``` <p class="text-center ...">So I started to walk into the water...</p> ``` ``` <p class="text-right ...">So I started to walk into the water...</p> ``` ``` <p class="text-justify ...">So I started to walk into the water...</p> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:text-center` to only apply the `text-center` utility on hover. ``` <p class="text-left hover:text-center"> <!-- ... --> </p> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:text-center` to apply the `text-center` utility at only medium screen sizes and above. ``` <p class="text-left md:text-center"> <!-- ... --> </p> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Skew Quick reference --------------- | Class | Properties | | --- | --- | | skew-x-0 | transform: skewX(0deg); | | skew-y-0 | transform: skewY(0deg); | | skew-x-1 | transform: skewX(1deg); | | skew-y-1 | transform: skewY(1deg); | | skew-x-2 | transform: skewX(2deg); | | skew-y-2 | transform: skewY(2deg); | | skew-x-3 | transform: skewX(3deg); | | skew-y-3 | transform: skewY(3deg); | | skew-x-6 | transform: skewX(6deg); | | skew-y-6 | transform: skewY(6deg); | | skew-x-12 | transform: skewX(12deg); | | skew-y-12 | transform: skewY(12deg); | Basic usage ----------- ### Skewing an element Use the `skew-x-{amount}` and `skew-y-{amount}` utilities to skew an element. ``` <img class="skew-y-0 ..."> <img class="skew-y-3 ..."> <img class="skew-y-6 ..."> <img class="skew-y-12 ..."> ``` ### Using negative values To use a negative skew value, prefix the class name with a dash to convert it to a negative value. ``` <img class="-skew-y-6 ..."> ``` ### Removing transforms To remove all of the transforms on an element at once, use the `transform-none` utility: ``` <div class="scale-75 translate-x-4 skew-y-3 md:transform-none"> <!-- ... --> </div> ``` This can be useful when you want to remove transforms conditionally, such as on hover or at a particular breakpoint. ### Hardware acceleration If your transition performs better when rendered by the GPU instead of the CPU, you can force hardware acceleration by adding the `transform-gpu` utility: ``` <div class="skew-y-6 transform-gpu"> <!-- ... --> </div> ``` Use `transform-cpu` to force things back to the CPU if you need to undo this conditionally. Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:skew-y-12` to only apply the `skew-y-12` utility on hover. ``` <div class="hover:skew-y-12"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:skew-y-12` to apply the `skew-y-12` utility at only medium screen sizes and above. ``` <div class="md:skew-y-12"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind includes a handful of general purpose `skew` utilities. You can customize these values by editing `theme.skew` or `theme.extend.skew` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { skew: { '17': '17deg', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `skew` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="skew-y-[17deg]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Border Style Quick reference --------------- | Class | Properties | | --- | --- | | border-solid | border-style: solid; | | border-dashed | border-style: dashed; | | border-dotted | border-style: dotted; | | border-double | border-style: double; | | border-hidden | border-style: hidden; | | border-none | border-style: none; | Basic usage ----------- ### Setting the border style Use `border-{style}` to control an element’s border style. ``` <div class="border-solid border-2 border-indigo-600 ..."></div> <div class="border-dashed border-2 border-indigo-600 ..."></div> <div class="border-dotted border-2 border-indigo-600 ..."></div> <div class="border-double border-4 border-indigo-600 ..."></div><div class="border-solid border-2 border-sky-500 ..."></div> <div class="border-dashed border-2 border-sky-500 ..."></div> <div class="border-dotted border-2 border-sky-500 ..."></div> <div class="border-double border-4 border-sky-500 ..."></div> ``` ### No style Use `border-none` to remove an existing border style from an element. This is most commonly used to remove a border style that was applied at a smaller breakpoint. ``` <button class="border-none ...">Save Changes</button> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:border-dotted` to only apply the `border-dotted` utility on hover. ``` <div class="border-solid hover:border-dotted"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:border-dotted` to apply the `border-dotted` utility at only medium screen sizes and above. ``` <div class="border-solid md:border-dotted"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Break Inside Quick reference --------------- | Class | Properties | | --- | --- | | break-inside-auto | break-inside: auto; | | break-inside-avoid | break-inside: avoid; | | break-inside-avoid-page | break-inside: avoid-page; | | break-inside-avoid-column | break-inside: avoid-column; | Basic usage ----------- ### Setting the break-inside behavior Use the `break-inside-{value}` utilities to control how a column or page break should behave within an element. For example, use the `break-inside-avoid-column` utility to avoid a column break within an element. ``` <div class="columns-2"> <p>Well, let me tell you something, ...</p> <p class="break-inside-avoid-column">Sure, go ahead, laugh...</p> <p>Maybe we can live without...</p> <p>Look. If you think this is...</p> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:break-inside-avoid-column` to only apply the `break-inside-avoid-column` utility on hover. ``` <div class="hover:break-inside-avoid-column"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:break-inside-avoid-column` to apply the `break-inside-avoid-column` utility at only medium screen sizes and above. ``` <div class="md:break-inside-avoid-column"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries).
programming_docs
tailwindcss Background Clip Quick reference --------------- | Class | Properties | | --- | --- | | bg-clip-border | background-clip: border-box; | | bg-clip-padding | background-clip: padding-box; | | bg-clip-content | background-clip: content-box; | | bg-clip-text | background-clip: text; | Basic usage ----------- ### Setting the background clip Use the `bg-clip-{keyword}` utilities to control the bounding box of an element’s background. ``` <div class="bg-clip-border p-6 bg-violet-600 border-4 border-violet-300 border-dashed"></div> <div class="bg-clip-padding p-6 bg-violet-600 border-4 border-violet-300 border-dashed"></div> <div class="bg-clip-content p-6 bg-violet-600 border-4 border-violet-300 border-dashed"></div> ``` ### Cropping to text Use `bg-clip-text` to crop an element’s background to match the shape of the text. Useful for effects where you want a background image to be visible through the text. ``` <div class="text-5xl font-extrabold ..."> <span class="bg-clip-text text-transparent bg-gradient-to-r from-pink-500 to-violet-500"> Hello world </span> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:bg-clip-padding` to only apply the `bg-clip-padding` utility on hover. ``` <div class="bg-clip-border hover:bg-clip-padding"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:bg-clip-padding` to apply the `bg-clip-padding` utility at only medium screen sizes and above. ``` <div class="bg-clip-border md:bg-clip-padding"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Background Origin Quick reference --------------- | Class | Properties | | --- | --- | | bg-origin-border | background-origin: border-box; | | bg-origin-padding | background-origin: padding-box; | | bg-origin-content | background-origin: content-box; | Basic usage ----------- ### Setting the background origin Use `bg-origin-border`, `bg-origin-padding`, and `bg-origin-content` to control where an element’s background is rendered. ``` <div class="bg-origin-border p-4 border-4 border-dashed ..." style="background-image: url(...)"></div> <div class="bg-origin-padding p-4 border-4 border-dashed ..." style="background-image: url(...)"></div> <div class="bg-origin-content p-4 border-4 border-dashed ..." style="background-image: url(...)"></div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:bg-origin-padding` to only apply the `bg-origin-padding` utility on hover. ``` <div class="bg-origin-border hover:bg-origin-padding"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:bg-origin-padding` to apply the `bg-origin-padding` utility at only medium screen sizes and above. ``` <div class="bg-origin-border md:bg-origin-padding"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Z-Index Quick reference --------------- | Class | Properties | | --- | --- | | z-0 | z-index: 0; | | z-10 | z-index: 10; | | z-20 | z-index: 20; | | z-30 | z-index: 30; | | z-40 | z-index: 40; | | z-50 | z-index: 50; | | z-auto | z-index: auto; | Basic usage ----------- ### Setting the z-index Control the stack order (or three-dimensional positioning) of an element in Tailwind, regardless of order it has been displayed, using the `z-{index}` utilities. ``` <div class="z-40 ...">05</div> <div class="z-30 ...">04</div> <div class="z-20 ...">03</div> <div class="z-10 ...">02</div> <div class="z-0 ...">01</div> ``` ### Using negative values To use a negative z-index value, prefix the class name with a dash to convert it to a negative value. ``` <div class="-z-50"> <!-- ... --> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:z-50` to only apply the `z-50` utility on hover. ``` <div class="z-0 hover:z-50"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:z-50` to apply the `z-50` utility at only medium screen sizes and above. ``` <div class="z-0 md:z-50"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind provides six numeric `z-index` utilities and an `auto` utility. You can customize these values by editing `theme.zIndex` or `theme.extend.zIndex` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { zIndex: { '100': '100', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `z-index` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="z-[100]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Floats Quick reference --------------- | Class | Properties | | --- | --- | | float-right | float: right; | | float-left | float: left; | | float-none | float: none; | Basic usage ----------- ### Floating elements to the right Use `float-right` to float an element to the right of its container. ``` <img class="float-right ..." src="path/to/image.jpg"> <p>Maybe we can live without libraries, people like you and me. ...</p> ``` ### Floating elements to the left Use `float-left` to float an element to the left of its container. ``` <img class="float-left ..." src="path/to/image.jpg"> <p>Maybe we can live without libraries, people like you and me. ...</p> ``` ### Disabling a float Use `float-none` to reset any floats that are applied to an element. This is the default value for the float property. ``` <img class="float-none ..." src="path/to/image.jpg"> <p>Maybe we can live without libraries, people like you and me. ...</p> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:float-right` to only apply the `float-right` utility on hover. ``` <img class="float-right hover:float-left" src="path/to/image.jpg"> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:float-right` to apply the `float-right` utility at only medium screen sizes and above. ``` <img class="float-right md:float-left" src="path/to/image.jpg"> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Break After Quick reference --------------- | Class | Properties | | --- | --- | | break-after-auto | break-after: auto; | | break-after-avoid | break-after: avoid; | | break-after-all | break-after: all; | | break-after-avoid-page | break-after: avoid-page; | | break-after-page | break-after: page; | | break-after-left | break-after: left; | | break-after-right | break-after: right; | | break-after-column | break-after: column; | Basic usage ----------- ### Setting the break-after behavior Use the `break-after-{value}` utilities to control how a column or page break should behave after an element. For example, use the `break-after-column` utility to force a column break after an element. ``` <div class="columns-2"> <p>Well, let me tell you something, ...</p> <p class="break-after-column">Sure, go ahead, laugh...</p> <p>Maybe we can live without...</p> <p>Look. If you think this is...</p> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:break-after-column` to only apply the `break-after-column` utility on hover. ``` <div class="hover:break-after-column"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:break-after-column` to apply the `break-after-column` utility at only medium screen sizes and above. ``` <div class="md:break-after-column"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Max-Height Quick reference --------------- | Class | Properties | | --- | --- | | max-h-0 | max-height: 0px; | | max-h-px | max-height: 1px; | | max-h-0.5 | max-height: 0.125rem; /\* 2px \*/ | | max-h-1 | max-height: 0.25rem; /\* 4px \*/ | | max-h-1.5 | max-height: 0.375rem; /\* 6px \*/ | | max-h-2 | max-height: 0.5rem; /\* 8px \*/ | | max-h-2.5 | max-height: 0.625rem; /\* 10px \*/ | | max-h-3 | max-height: 0.75rem; /\* 12px \*/ | | max-h-3.5 | max-height: 0.875rem; /\* 14px \*/ | | max-h-4 | max-height: 1rem; /\* 16px \*/ | | max-h-5 | max-height: 1.25rem; /\* 20px \*/ | | max-h-6 | max-height: 1.5rem; /\* 24px \*/ | | max-h-7 | max-height: 1.75rem; /\* 28px \*/ | | max-h-8 | max-height: 2rem; /\* 32px \*/ | | max-h-9 | max-height: 2.25rem; /\* 36px \*/ | | max-h-10 | max-height: 2.5rem; /\* 40px \*/ | | max-h-11 | max-height: 2.75rem; /\* 44px \*/ | | max-h-12 | max-height: 3rem; /\* 48px \*/ | | max-h-14 | max-height: 3.5rem; /\* 56px \*/ | | max-h-16 | max-height: 4rem; /\* 64px \*/ | | max-h-20 | max-height: 5rem; /\* 80px \*/ | | max-h-24 | max-height: 6rem; /\* 96px \*/ | | max-h-28 | max-height: 7rem; /\* 112px \*/ | | max-h-32 | max-height: 8rem; /\* 128px \*/ | | max-h-36 | max-height: 9rem; /\* 144px \*/ | | max-h-40 | max-height: 10rem; /\* 160px \*/ | | max-h-44 | max-height: 11rem; /\* 176px \*/ | | max-h-48 | max-height: 12rem; /\* 192px \*/ | | max-h-52 | max-height: 13rem; /\* 208px \*/ | | max-h-56 | max-height: 14rem; /\* 224px \*/ | | max-h-60 | max-height: 15rem; /\* 240px \*/ | | max-h-64 | max-height: 16rem; /\* 256px \*/ | | max-h-72 | max-height: 18rem; /\* 288px \*/ | | max-h-80 | max-height: 20rem; /\* 320px \*/ | | max-h-96 | max-height: 24rem; /\* 384px \*/ | | max-h-full | max-height: 100%; | | max-h-screen | max-height: 100vh; | | max-h-min | max-height: min-content; | | max-h-max | max-height: max-content; | | max-h-fit | max-height: fit-content; | Basic usage ----------- ### Setting the maximum height Set the maximum height of an element using the `max-h-full` or `max-h-screen` utilities. ``` <div class="h-24 ..."> <div class="h-48 max-h-full ..."> <!-- ... --> </div> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:max-h-screen` to only apply the `max-h-screen` utility on hover. ``` <div class="h-48 max-h-full hover:max-h-screen"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:max-h-screen` to apply the `max-h-screen` utility at only medium screen sizes and above. ``` <div class="h-48 max-h-full md:max-h-screen"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind’s max-height scale uses a combination of the [default spacing scale](customizing-spacing) as well as some additional height related values. You can customize your spacing scale by editing `theme.spacing` or `theme.extend.spacing` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { spacing: { '128': '32rem', } } } } ``` Alternatively, you can customize just the max-height scale by editing `theme.maxHeight` or `theme.extend.maxHeight` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { maxHeight: { '128': '32rem', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `max-height` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="max-h-[32rem]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Customizing Colors Default color palette --------------------- Tailwind includes an expertly-crafted default color palette out-of-the-box that is a great starting point if you don’t have your own specific branding in mind. Slate 50 #F8FAFC 100 #F1F5F9 200 #E2E8F0 300 #CBD5E1 400 #94A3B8 500 #64748B 600 #475569 700 #334155 800 #1E293B 900 #0F172A Gray 50 #F9FAFB 100 #F3F4F6 200 #E5E7EB 300 #D1D5DB 400 #9CA3AF 500 #6B7280 600 #4B5563 700 #374151 800 #1F2937 900 #111827 Zinc 50 #FAFAFA 100 #F4F4F5 200 #E4E4E7 300 #D4D4D8 400 #A1A1AA 500 #71717A 600 #52525B 700 #3F3F46 800 #27272A 900 #18181B Neutral 50 #FAFAFA 100 #F5F5F5 200 #E5E5E5 300 #D4D4D4 400 #A3A3A3 500 #737373 600 #525252 700 #404040 800 #262626 900 #171717 Stone 50 #FAFAF9 100 #F5F5F4 200 #E7E5E4 300 #D6D3D1 400 #A8A29E 500 #78716C 600 #57534E 700 #44403C 800 #292524 900 #1C1917 Red 50 #FEF2F2 100 #FEE2E2 200 #FECACA 300 #FCA5A5 400 #F87171 500 #EF4444 600 #DC2626 700 #B91C1C 800 #991B1B 900 #7F1D1D Orange 50 #FFF7ED 100 #FFEDD5 200 #FED7AA 300 #FDBA74 400 #FB923C 500 #F97316 600 #EA580C 700 #C2410C 800 #9A3412 900 #7C2D12 Amber 50 #FFFBEB 100 #FEF3C7 200 #FDE68A 300 #FCD34D 400 #FBBF24 500 #F59E0B 600 #D97706 700 #B45309 800 #92400E 900 #78350F Yellow 50 #FEFCE8 100 #FEF9C3 200 #FEF08A 300 #FDE047 400 #FACC15 500 #EAB308 600 #CA8A04 700 #A16207 800 #854D0E 900 #713F12 Lime 50 #F7FEE7 100 #ECFCCB 200 #D9F99D 300 #BEF264 400 #A3E635 500 #84CC16 600 #65A30D 700 #4D7C0F 800 #3F6212 900 #365314 Green 50 #F0FDF4 100 #DCFCE7 200 #BBF7D0 300 #86EFAC 400 #4ADE80 500 #22C55E 600 #16A34A 700 #15803D 800 #166534 900 #14532D Emerald 50 #ECFDF5 100 #D1FAE5 200 #A7F3D0 300 #6EE7B7 400 #34D399 500 #10B981 600 #059669 700 #047857 800 #065F46 900 #064E3B Teal 50 #F0FDFA 100 #CCFBF1 200 #99F6E4 300 #5EEAD4 400 #2DD4BF 500 #14B8A6 600 #0D9488 700 #0F766E 800 #115E59 900 #134E4A Cyan 50 #ECFEFF 100 #CFFAFE 200 #A5F3FC 300 #67E8F9 400 #22D3EE 500 #06B6D4 600 #0891B2 700 #0E7490 800 #155E75 900 #164E63 Sky 50 #F0F9FF 100 #E0F2FE 200 #BAE6FD 300 #7DD3FC 400 #38BDF8 500 #0EA5E9 600 #0284C7 700 #0369A1 800 #075985 900 #0C4A6E Blue 50 #EFF6FF 100 #DBEAFE 200 #BFDBFE 300 #93C5FD 400 #60A5FA 500 #3B82F6 600 #2563EB 700 #1D4ED8 800 #1E40AF 900 #1E3A8A Indigo 50 #EEF2FF 100 #E0E7FF 200 #C7D2FE 300 #A5B4FC 400 #818CF8 500 #6366F1 600 #4F46E5 700 #4338CA 800 #3730A3 900 #312E81 Violet 50 #F5F3FF 100 #EDE9FE 200 #DDD6FE 300 #C4B5FD 400 #A78BFA 500 #8B5CF6 600 #7C3AED 700 #6D28D9 800 #5B21B6 900 #4C1D95 Purple 50 #FAF5FF 100 #F3E8FF 200 #E9D5FF 300 #D8B4FE 400 #C084FC 500 #A855F7 600 #9333EA 700 #7E22CE 800 #6B21A8 900 #581C87 Fuchsia 50 #FDF4FF 100 #FAE8FF 200 #F5D0FE 300 #F0ABFC 400 #E879F9 500 #D946EF 600 #C026D3 700 #A21CAF 800 #86198F 900 #701A75 Pink 50 #FDF2F8 100 #FCE7F3 200 #FBCFE8 300 #F9A8D4 400 #F472B6 500 #EC4899 600 #DB2777 700 #BE185D 800 #9D174D 900 #831843 Rose 50 #FFF1F2 100 #FFE4E6 200 #FECDD3 300 #FDA4AF 400 #FB7185 500 #F43F5E 600 #E11D48 700 #BE123C 800 #9F1239 900 #881337 But when you do need to customize your palette, you can configure your colors under the `colors` key in the `theme` section of your `tailwind.config.js` file: tailwind.config.js ``` module.exports = { theme: { colors: { // Configure your color palette here } } } ``` When it comes to building a custom color palette, you can either [configure your own custom colors](#using-custom-colors) from scratch if you know exactly what you want, or [curate your colors](#using-the-default-colors) from our extensive included color palette if you want a head start. Using custom colors ------------------- If you’d like to completely replace the default color palette with your own custom colors, add your colors directly under the `theme.colors` section of your configuration file: tailwind.config.js ``` module.exports = { theme: { colors: { transparent: 'transparent', current: 'currentColor', 'white': '#ffffff', 'purple': '#3f3cbb', 'midnight': '#121063', 'metal': '#565584', 'tahiti': '#3ab7bf', 'silver': '#ecebff', 'bubble-gum': '#ff77e9', 'bermuda': '#78dcca', }, }, } ``` By default, these colors will be made available everywhere in the framework where you use colors, like the [text color](text-color) utilities, [border color](border-color) utilities, [background color](background-color) utilities, and more. ``` <div class="bg-midnight text-tahiti"> <!-- ... --> </div> ``` Don’t forget to include values like `transparent` and `currentColor` if you want to use them in your project. ### Color object syntax When your palette includes multiple shades of the same color, it can be convenient to group them together using our nested color object syntax: tailwind.config.js ``` module.exports = { theme: { colors: { transparent: 'transparent', current: 'currentColor', 'white': '#ffffff', 'tahiti': { 100: '#cffafe', 200: '#a5f3fc', 300: '#67e8f9', 400: '#22d3ee', 500: '#06b6d4', 600: '#0891b2', 700: '#0e7490', 800: '#155e75', 900: '#164e63', }, // ... }, }, } ``` The nested keys will be combined with the parent key to form class names like `bg-tahiti-400`. Like many other places in Tailwind, the special `DEFAULT` key can be used when you want to define a value with no suffix: tailwind.config.js ``` module.exports = { theme: { colors: { // ... 'tahiti': { light: '#67e8f9', DEFAULT: '#06b6d4', dark: '#0e7490', }, // ... }, }, } ``` This will create classes like `bg-tahiti`, `bg-tahiti-light`, and `bg-tahiti-dark`. ### Arbitrary values If you need a one-off custom color in your project, consider using Tailwind’s arbitrary value notation to generate a class for that color on-demand instead of adding it to your theme: ``` <button class="bg-[#1da1f2] text-white ..."> <svg><!-- ... --></svg> Share on Twitter </button> ``` Learn more in the [using arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. ### Generating colors If you’re wondering how to automatically generate the 50–900 shades of your own custom colors, bad news — color is complicated and despite trying dozens of different tools, we’ve yet to find one that does a good job generating color palettes like this automatically. We picked all of Tailwind’s default colors by hand, meticulously balancing them by eye and testing them in real designs to make sure we were happy with them. Two useful tools we *can* recommend are [Palettte](https://palettte.app/) and [ColorBox](https://colorbox.io/) — they won’t do the work for you but their interfaces are well-designed for doing this sort of work. Using the default colors ------------------------ If you don’t have a set of completely custom colors in mind for your project, you can curate your colors from our default palette by importing `tailwindcss/colors` in your configuration file and choosing the colors you want to use: tailwind.config.js ``` const colors = require('tailwindcss/colors') module.exports = { theme: { colors: { transparent: 'transparent', current: 'currentColor', black: colors.black, white: colors.white, gray: colors.gray, emerald: colors.emerald, indigo: colors.indigo, yellow: colors.yellow, }, }, } ``` This can be helpful if you want to deliberately limit your color palette and reduce the number of class names suggested by [IntelliSense](https://tailwindcss.com/docs/editor-setup#intelli-sense-for-vs-code). ### Aliasing color names You can also alias the colors in our default palette to make the names simpler and easier to remember: tailwind.config.js ``` const colors = require('tailwindcss/colors') module.exports = { theme: { colors: { transparent: 'transparent', current: 'currentColor', black: colors.black, white: colors.white, gray: colors.slate, green: colors.emerald, purple: colors.violet, yellow: colors.amber, pink: colors.fuchsia, }, }, } ``` This is especially common for grays, as you usually only use one set in any given project and it’s nice to be able to type `bg-gray-300` instead of `bg-neutral-300` for example. ### Adding additional colors If you’d like to add a brand new color to the default palette, add it in the `theme.extend.colors` section of your configuration file: tailwind.config.js ``` module.exports = { theme: { extend: { colors: { brown: { 50: '#fdf8f6', 100: '#f2e8e5', 200: '#eaddd7', 300: '#e0cec7', 400: '#d2bab0', 500: '#bfa094', 600: '#a18072', 700: '#977669', 800: '#846358', 900: '#43302b', }, } }, }, } ``` You can also use `theme.extend.colors` to add additional shades to an existing color if it’s needed for your design: tailwind.config.js ``` module.exports = { theme: { extend: { colors: { blue: { 950: '#17275c', }, } }, }, } ``` ### Disabling a default color If you’d like to disable any of the default colors, the best approach is to override the default color palette and just include the colors you *do* want: tailwind.config.js ``` const colors = require('tailwindcss/colors') module.exports = { theme: { colors: { transparent: 'transparent', current: 'currentColor', black: colors.black, white: colors.white, gray: colors.gray, emerald: colors.emerald, indigo: colors.indigo, yellow: colors.yellow, }, }, } ``` Naming your colors ------------------ Tailwind uses literal color names *(like red, green, etc.)* and a numeric scale *(where 50 is light and 900 is dark)* by default. We think this is the best choice for most projects, and have found it easier to maintain than using abstract names like `primary` or `danger`. That said, you can name your colors in Tailwind whatever you like, and if you’re working on a project that needs to support multiple themes for example, it might make sense to use more abstract names: tailwind.config.js ``` module.exports = { theme: { colors: { primary: '#5c6ac4', secondary: '#ecc94b', // ... } } } ``` You can configure those colors explicitly like we have above, or you can pull in colors from our default color palette and alias them: tailwind.config.js ``` const colors = require('tailwindcss/colors') module.exports = { theme: { colors: { primary: colors.indigo, secondary: colors.yellow, neutral: colors.gray, } } } ``` Again, we recommend sticking to the default naming convention for most projects, and only using abstract names if you have a really good reason. Using CSS variables ------------------- If you’d like to define your colors as CSS variables, you’ll need to define those variables as just the color *channels* if you want them to work with the [opacity modifier syntax](text-color#changing-the-opacity): Define your CSS variables as channels with no color space function main.css ``` @tailwind base; @tailwind components; @tailwind utilities; @layer base { :root { --color-primary: 255 115 179; --color-secondary: 111 114 185; /* ... */ } } ``` Don't include the color space function or opacity modifiers won't work main.css ``` @tailwind base; @tailwind components; @tailwind utilities; @layer base { :root { --color-primary: rgb(255 115 179); --color-secondary: rgb(111 114 185); /* ... */ } } ``` Then define your colors in your configuration file, being sure to include the color space you’re using, and the special `<alpha-value>` placeholder that Tailwind will use to inject the alpha value when using an opacity modifier: tailwind.config.js ``` module.exports = { theme: { colors: { // Using modern `rgb` primary: 'rgb(var(--color-primary) / <alpha-value>)', secondary: 'rgb(var(--color-secondary) / <alpha-value>)', // Using modern `hsl` primary: 'hsl(var(--color-primary) / <alpha-value>)', secondary: 'hsl(var(--color-secondary) / <alpha-value>)', // Using legacy `rgba` primary: 'rgba(var(--color-primary), <alpha-value>)', secondary: 'rgba(var(--color-secondary), <alpha-value>)', } } } ``` When defining your colors this way, make sure that the format of your CSS variables is correct for the color function you are using. You’ll want to use spaces if using the modern [space-separated syntax](https://css-tricks.com/the-expanding-gamut-of-color-on-the-web/#aa-a-tale-of-new-syntaxes), and commas if using legacy functions like `rgba` or `hsla`: main.css ``` @tailwind base; @tailwind components; @tailwind utilities; @layer base { :root { /* For rgb(255 115 179 / <alpha-value>) */ --color-primary: 255 115 179; /* For hsl(198deg 93% 60% / <alpha-value>) */ --color-primary: 198deg 93% 60%; /* For rgba(255, 115, 179, <alpha-value>) */ --color-primary: 255, 115, 179; } } ```
programming_docs
tailwindcss Transition Duration Quick reference --------------- | Class | Properties | | --- | --- | | duration-75 | transition-duration: 75ms; | | duration-100 | transition-duration: 100ms; | | duration-150 | transition-duration: 150ms; | | duration-200 | transition-duration: 200ms; | | duration-300 | transition-duration: 300ms; | | duration-500 | transition-duration: 500ms; | | duration-700 | transition-duration: 700ms; | | duration-1000 | transition-duration: 1000ms; | Basic usage ----------- ### Changing transition duration Use the `duration-{amount}` utilities to control an element’s transition-duration. ``` <button class="transition duration-150 ease-in-out ...">Button A</button> <button class="transition duration-300 ease-in-out ...">Button B</button> <button class="transition duration-700 ease-in-out ...">Button C</button> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:duration-150` to only apply the `duration-150` utility on hover. ``` <div class="transition duration-0 hover:duration-150"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:duration-150` to apply the `duration-150` utility at only medium screen sizes and above. ``` <div class="transition duration-0 md:duration-150"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind provides eight general purpose transition-duration utilities. You can customize these values by editing `theme.transitionDuration` or `theme.extend.transitionDuration` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { transitionDuration: { '0': '0ms', '2000': '2000ms', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `transition-duration` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="duration-[2000ms]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Customizing Screens Configuring custom screens -------------------------- You define your project’s breakpoints in the `theme.screens` section of your `tailwind.config.js` file. The keys become your [responsive modifiers](responsive-design) (like `md:text-center`), and the values are the `min-width` where that breakpoint should start. The default breakpoints are inspired by common device resolutions: tailwind.config.js ``` module.exports = { theme: { screens: { 'sm': '640px', // => @media (min-width: 640px) { ... } 'md': '768px', // => @media (min-width: 768px) { ... } 'lg': '1024px', // => @media (min-width: 1024px) { ... } 'xl': '1280px', // => @media (min-width: 1280px) { ... } '2xl': '1536px', // => @media (min-width: 1536px) { ... } } } } ``` Feel free to have as few or as many screens as you want, naming them in whatever way you’d prefer for your project. ### Overriding the defaults To completely replace the default breakpoints, add your custom `screens` configuration directly under the `theme` key: tailwind.config.js ``` module.exports = { theme: { screens: { 'sm': '576px', // => @media (min-width: 576px) { ... } 'md': '960px', // => @media (min-width: 960px) { ... } 'lg': '1440px', // => @media (min-width: 1440px) { ... } }, } } ``` Any default screens you haven’t overridden (such as `xl` using the above example) will be removed and will not be available as screen modifiers. ### Overriding a single screen To override a single screen size (like `lg`), add your custom `screens` value under the `theme.extend` key: tailwind.config.js ``` module.exports = { theme: { extend: { screens: { 'lg': '992px', // => @media (min-width: 992px) { ... } }, }, }, } ``` This will replace the default `screens` value with the same name, without changing the order of your breakpoints. ### Adding larger breakpoints The easiest way to add an additional larger breakpoint is using the `extend` key: tailwind.config.js ``` module.exports = { theme: { extend: { screens: { '3xl': '1600px', }, }, }, variants: {}, plugins: [], } ``` This will add your custom screen to the end of the default breakpoint list. ### Adding smaller breakpoints If you want to add an additional small breakpoint, you can’t use `extend` because the small breakpoint would be added to the end of the breakpoint list, and breakpoints need to be sorted from smallest to largest in order to work as expected with a min-width breakpoint system. Instead, override the entire `screens` key, re-specifying the default breakpoints: tailwind.config.js ``` const defaultTheme = require('tailwindcss/defaultTheme') module.exports = { theme: { screens: { 'xs': '475px', ...defaultTheme.screens, }, }, variants: {}, plugins: [], } ``` We expose the default theme at `tailwindcss/defaultTheme` so you don’t have to maintain the list of default breakpoints yourself. ### Using custom screen names You can name your custom screens whatever you like, and are not limited to following the `sm`/`md`/`lg`/`xl`/`2xl` convention that Tailwind uses by default. tailwind.config.js ``` module.exports = { theme: { screens: { 'tablet': '640px', // => @media (min-width: 640px) { ... } 'laptop': '1024px', // => @media (min-width: 1024px) { ... } 'desktop': '1280px', // => @media (min-width: 1280px) { ... } }, } } ``` Your responsive modifiers will reflect these custom screen names, so using them in your HTML would now look like this: ``` <div class="grid grid-cols-1 tablet:grid-cols-2 laptop:grid-cols-3 desktop:grid-cols-4"> <!-- ... --> </div> ``` Advanced configuration ---------------------- By default, breakpoints are min-width to encourage a [mobile-first](responsive-design#mobile-first) workflow. If you need more control over your media queries, you can also define them using an object syntax that lets you specify explicit min-width and max-width values. ### Max-width breakpoints If you want to work with max-width breakpoints instead of min-width, you can specify your screens as objects with a `max` key: tailwind.config.js ``` module.exports = { theme: { screens: { '2xl': {'max': '1535px'}, // => @media (max-width: 1535px) { ... } 'xl': {'max': '1279px'}, // => @media (max-width: 1279px) { ... } 'lg': {'max': '1023px'}, // => @media (max-width: 1023px) { ... } 'md': {'max': '767px'}, // => @media (max-width: 767px) { ... } 'sm': {'max': '639px'}, // => @media (max-width: 639px) { ... } } } } ``` Make sure to list max-width breakpoints in descending order so that they override each other as expected. ### Fixed-range breakpoints If you want your breakpoints to specify both a `min-width` and a `max-width`, use the `min` and `max` keys together: tailwind.config.js ``` module.exports = { theme: { screens: { 'sm': {'min': '640px', 'max': '767px'}, // => @media (min-width: 640px and max-width: 767px) { ... } 'md': {'min': '768px', 'max': '1023px'}, // => @media (min-width: 768px and max-width: 1023px) { ... } 'lg': {'min': '1024px', 'max': '1279px'}, // => @media (min-width: 1024px and max-width: 1279px) { ... } 'xl': {'min': '1280px', 'max': '1535px'}, // => @media (min-width: 1280px and max-width: 1535px) { ... } '2xl': {'min': '1536px'}, // => @media (min-width: 1536px) { ... } }, } } ``` Unlike regular min-width or max-width breakpoints, breakpoints defined this way will only take effect when the viewport size is explicitly within the defined range. ``` <div class="md:text-center"> This text will be centered on medium screens, but revert back to the default (left-aligned) at all other screen sizes. </div> ``` ### Multi-range breakpoints Sometimes it can be useful to have a single breakpoint definition apply in multiple ranges. For example, say you have a sidebar and want your breakpoints to be based on the content-area width rather than the entire viewport. You can simulate this by having one of your breakpoints fall back to a smaller breakpoint when the sidebar becomes visible and shrinks the content area: tailwind.config.js ``` module.exports = { theme: { screens: { 'sm': '500px', 'md': [ // Sidebar appears at 768px, so revert to `sm:` styles between 768px // and 868px, after which the main content area is wide enough again to // apply the `md:` styles. {'min': '668px', 'max': '767px'}, {'min': '868px'} ], 'lg': '1100px', 'xl': '1400px', } } } ``` ### Custom media queries If you want full control over the generated media query, use the `raw` key: tailwind.config.js ``` module.exports = { theme: { extend: { screens: { 'tall': { 'raw': '(min-height: 800px)' }, // => @media (min-height: 800px) { ... } } } } } ``` Media queries defined using the `raw` key will be output as-is, and the `min` and `max` keys will be ignored. tailwindcss Grid Auto Rows Quick reference --------------- | Class | Properties | | --- | --- | | auto-rows-auto | grid-auto-rows: auto; | | auto-rows-min | grid-auto-rows: min-content; | | auto-rows-max | grid-auto-rows: max-content; | | auto-rows-fr | grid-auto-rows: minmax(0, 1fr); | Basic usage ----------- ### Sizing implicitly-created grid rows Use the `auto-rows-{size}` utilities to control the size implicitly-created grid rows. ``` <div class="grid grid-flow-row auto-rows-max"> <div>01</div> <div>02</div> <div>03</div> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:auto-rows-min` to only apply the `auto-rows-min` utility on hover. ``` <div class="grid grid-flow-row auto-rows-max hover:auto-rows-min"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:auto-rows-min` to apply the `auto-rows-min` utility at only medium screen sizes and above. ``` <div class="grid grid-flow-row auto-rows-max md:auto-rows-min"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind includes four general purpose `grid-auto-rows` utilities. You can customize these values by editing `theme.gridAutoRows` or `theme.extend.gridAutoRows` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { gridAutoRows: { '2fr': 'minmax(0, 2fr)', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `grid-auto-rows` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="grid grid-flow-row auto-rows-[minmax(0,_2fr)]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Container Quick reference --------------- | Class | Breakpoint | Properties | | --- | --- | --- | | container | None | width: 100%; | | sm (640px) | max-width: 640px; | | md (768px) | max-width: 768px; | | lg (1024px) | max-width: 1024px; | | xl (1280px) | max-width: 1280px; | | 2xl (1536px) | max-width: 1536px; | Basic usage ----------- ### Using the container The `container` class sets the `max-width` of an element to match the `min-width` of the current breakpoint. This is useful if you’d prefer to design for a fixed set of screen sizes instead of trying to accommodate a fully fluid viewport. Note that unlike containers you might have used in other frameworks, **Tailwind’s container does not center itself automatically and does not have any built-in horizontal padding.** To center a container, use the `mx-auto` utility: ``` <div class="container mx-auto"> <!-- ... --> </div> ``` To add horizontal padding, use the `px-{size}` utilities: ``` <div class="container mx-auto px-4"> <!-- ... --> </div> ``` If you’d like to center your containers by default or include default horizontal padding, see the [customization options](#customizing) below. Applying conditionally ---------------------- ### Responsive variants The `container` class also includes responsive variants like `md:container` by default that allow you to make something behave like a container at only a certain breakpoint and up: ``` <!-- Full-width fluid until the `md` breakpoint, then lock to container --> <div class="md:container md:mx-auto"> <!-- ... --> </div> ``` Customizing ----------- ### Centering by default To center containers by default, set the `center` option to `true` in the `theme.container` section of your config file: tailwind.config.js ``` module.exports = { theme: { container: { center: true, }, }, } ``` ### Adding horizontal padding To add horizontal padding by default, specify the amount of padding you’d like using the `padding` option in the `theme.container` section of your config file: tailwind.config.js ``` module.exports = { theme: { container: { padding: '2rem', }, }, } ``` If you want to specify a different padding amount for each breakpoint, use an object to provide a `default` value and any breakpoint-specific overrides: tailwind.config.js ``` module.exports = { theme: { container: { padding: { DEFAULT: '1rem', sm: '2rem', lg: '4rem', xl: '5rem', '2xl': '6rem', }, }, }, }; ``` tailwindcss Text Transform Quick reference --------------- | Class | Properties | | --- | --- | | uppercase | text-transform: uppercase; | | lowercase | text-transform: lowercase; | | capitalize | text-transform: capitalize; | | normal-case | text-transform: none; | Basic usage ----------- ### Transforming text The `uppercase` and `lowercase` will uppercase and lowercase text respectively, whereas `capitalize` utility will convert text to title-case. The `normal-case` utility can be used to preserve the original casing — typically to reset capitalization at different breakpoints. ``` <p class="normal-case ...">The quick brown fox ...</p> <p class="uppercase ...">The quick brown fox ...</p> <p class="lowercase ...">The quick brown fox ...</p> <p class="capitalize ...">The quick brown fox ...</p> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:uppercase` to only apply the `uppercase` utility on hover. ``` <p class="capitalize hover:uppercase"> <!-- ... --> </p> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:uppercase` to apply the `uppercase` utility at only medium screen sizes and above. ``` <p class="capitalize md:uppercase"> <!-- ... --> </p> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Transition Property Quick reference --------------- | Class | Properties | | --- | --- | | transition-none | transition-property: none; | | transition-all | transition-property: all; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; | | transition | transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; | | transition-colors | transition-property: color, background-color, border-color, text-decoration-color, fill, stroke; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; | | transition-opacity | transition-property: opacity; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; | | transition-shadow | transition-property: box-shadow; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; | | transition-transform | transition-property: transform; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; | Basic usage ----------- ### Controlling transitioned properties Use the `transition-{properties}` utilities to specify which properties should transition when they change. ``` <button class="transition ease-in-out delay-150 bg-blue-500 hover:-translate-y-1 hover:scale-110 hover:bg-indigo-500 duration-300 ..."> Save Changes </button> ``` ### Prefers-reduced-motion For situations where the user has specified that they prefer reduced motion, you can conditionally apply animations and transitions using the `motion-safe` and `motion-reduce` variants: ``` <button class="transition transform hover:-translate-y-1 motion-reduce:transition-none motion-reduce:hover:transform-none ..."> Hover me </button> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:transition-all` to only apply the `transition-all` utility on hover. ``` <div class="hover:transition-all"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:transition-all` to apply the `transition-all` utility at only medium screen sizes and above. ``` <div class="md:transition-all"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind provides transition-property utilities for seven common property combinations. You can customize these values by editing `theme.transitionProperty` or `theme.extend.transitionProperty` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { transitionProperty: { 'height': 'height', 'spacing': 'margin, padding', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `transition-property` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="transition-[height]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation.
programming_docs
tailwindcss Columns Quick reference --------------- | Class | Properties | | --- | --- | | columns-1 | columns: 1; | | columns-2 | columns: 2; | | columns-3 | columns: 3; | | columns-4 | columns: 4; | | columns-5 | columns: 5; | | columns-6 | columns: 6; | | columns-7 | columns: 7; | | columns-8 | columns: 8; | | columns-9 | columns: 9; | | columns-10 | columns: 10; | | columns-11 | columns: 11; | | columns-12 | columns: 12; | | columns-auto | columns: auto; | | columns-3xs | columns: 16rem; /\* 256px \*/ | | columns-2xs | columns: 18rem; /\* 288px \*/ | | columns-xs | columns: 20rem; /\* 320px \*/ | | columns-sm | columns: 24rem; /\* 384px \*/ | | columns-md | columns: 28rem; /\* 448px \*/ | | columns-lg | columns: 32rem; /\* 512px \*/ | | columns-xl | columns: 36rem; /\* 576px \*/ | | columns-2xl | columns: 42rem; /\* 672px \*/ | | columns-3xl | columns: 48rem; /\* 768px \*/ | | columns-4xl | columns: 56rem; /\* 896px \*/ | | columns-5xl | columns: 64rem; /\* 1024px \*/ | | columns-6xl | columns: 72rem; /\* 1152px \*/ | | columns-7xl | columns: 80rem; /\* 1280px \*/ | Basic usage ----------- ### Adding based on column count Use the `columns-{count}` utilities to set the number of columns that should be created for the content within an element. The column width will be automatically adjusted to accommodate that number. ``` <div class="columns-3 ..."> <img class="w-full aspect-video ..." src="..." /> <img class="w-full aspect-square ..." src="..." /> <!-- ... --> </div> ``` ### Adding based on column width Use the `columns-{width}` utilities to set the ideal column width for the content within an element, with the number of columns (the count) automatically adjusting to accommodate that value. This “t-shirt” scale is the same as the <max-width> scale, with the addition of `2xs` and `3xs`, since smaller columns may be desirable. ``` <div class="columns-3xs ..."> <img class="w-full aspect-video ..." src="..." /> <img class="w-full aspect-square ..." src="..." /> <!-- ... --> </div> ``` ### Setting the column gap To specify the width between columns, you can use the [gap-x](gap) utilities: ``` <div class="gap-8 columns-3 ..."> <img class="w-full aspect-video ..." src="..." /> <img class="w-full aspect-square ..." src="..." /> <!-- ... --> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:columns-3` to only apply the `columns-3` utility on hover. ``` <div class="columns-2 hover:columns-3"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:columns-3` to apply the `columns-3` utility at only medium screen sizes and above. ``` <div class="columns-2 md:columns-3"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind provides a column count scale from `1-12` as well as a column t-shirt scale from `3xs-7xl`. You can customize these values by editing `theme.columns` or `theme.extend.columns` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { columns: { '4xs': '14rem', } }, } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `columns` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="columns-[10rem]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Grid Auto Columns Quick reference --------------- | Class | Properties | | --- | --- | | auto-cols-auto | grid-auto-columns: auto; | | auto-cols-min | grid-auto-columns: min-content; | | auto-cols-max | grid-auto-columns: max-content; | | auto-cols-fr | grid-auto-columns: minmax(0, 1fr); | Basic usage ----------- ### Sizing implicitly-created grid columns Use the `auto-cols-{size}` utilities to control the size of implicitly-created grid columns. ``` <div class="grid grid-flow-col auto-cols-max"> <div>01</div> <div>02</div> <div>03</div> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:auto-cols-min` to only apply the `auto-cols-min` utility on hover. ``` <div class="grid grid-flow-col auto-cols-max hover:auto-cols-min"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:auto-cols-min` to apply the `auto-cols-min` utility at only medium screen sizes and above. ``` <div class="grid grid-flow-col auto-cols-max md:auto-cols-min"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind includes four general purpose `grid-auto-columns` utilities. You can customize these values by editing `theme.gridAutoColumns` or `theme.extend.gridAutoColumns` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { gridAutoColumns: { '2fr': 'minmax(0, 2fr)', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `grid-auto-columns` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="grid grid-flow-col auto-cols-[minmax(0,_2fr)]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Contrast Quick reference --------------- | Class | Properties | | --- | --- | | contrast-0 | filter: contrast(0); | | contrast-50 | filter: contrast(.5); | | contrast-75 | filter: contrast(.75); | | contrast-100 | filter: contrast(1); | | contrast-125 | filter: contrast(1.25); | | contrast-150 | filter: contrast(1.5); | | contrast-200 | filter: contrast(2); | Basic usage ----------- ### Changing element contrast Use the `contrast-{amount?}` utilities to control an element’s contrast. ``` <div class="contrast-50 ..."> <!-- ... --> </div> <div class="contrast-100 ..."> <!-- ... --> </div> <div class="contrast-125 ..."> <!-- ... --> </div> <div class="contrast-200 ..."> <!-- ... --> </div> ``` ### Removing filters To remove all of the filters on an element at once, use the `filter-none` utility: ``` <div class="blur-md invert contrast-125 md:filter-none"> <!-- ... --> </div> ``` This can be useful when you want to remove filters conditionally, such as on hover or at a particular breakpoint. Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:contrast-150` to only apply the `contrast-150` utility on hover. ``` <div class="contrast-125 hover:contrast-150"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:contrast-150` to apply the `contrast-150` utility at only medium screen sizes and above. ``` <div class="contrast-125 md:contrast-150"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind includes a handful of general purpose `contrast` utilities. You can customize these values by editing `theme.contrast` or `theme.extend.contrast` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { contrast: { 25: '.25', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `contrast` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="contrast-[.25]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Display Quick reference --------------- | Class | Properties | | --- | --- | | block | display: block; | | inline-block | display: inline-block; | | inline | display: inline; | | flex | display: flex; | | inline-flex | display: inline-flex; | | table | display: table; | | inline-table | display: inline-table; | | table-caption | display: table-caption; | | table-cell | display: table-cell; | | table-column | display: table-column; | | table-column-group | display: table-column-group; | | table-footer-group | display: table-footer-group; | | table-header-group | display: table-header-group; | | table-row-group | display: table-row-group; | | table-row | display: table-row; | | flow-root | display: flow-root; | | grid | display: grid; | | inline-grid | display: inline-grid; | | contents | display: contents; | | list-item | display: list-item; | | hidden | display: none; | Basic usage ----------- ### Block & Inline Use `inline`, `inline-block`, and `block` to control the flow of text and elements. ``` <div> When controlling the flow of text, using the CSS property <span class="inline">display: inline</span> will cause the text inside the element to wrap normally. While using the property <span class="inline-block">display: inline-block</span> will wrap the element to prevent the text inside from extending beyond its parent. Lastly, using the property <span class="block">display: block</span> will put the element on its own line and fill its parent. </div> ``` ### Flow Root Use `flow-root` to create a block-level element with its own [block formatting context](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context). ``` <div class="p-4"> <div class="flow-root ..."> <div class="my-4 ...">Well, let me tell you something, ...</div> </div> <div class="flow-root ..."> <div class="my-4 ...">Sure, go ahead, laugh if you want...</div> </div> </div> ``` ### Flex Use `flex` to create a block-level flex container. ``` <div class="flex items-center"> <img src="path/to/image.jpg"> <div> <strong>Andrew Alfred</strong> <span>Technical advisor</span> </div> </div> ``` ### Inline Flex Use `inline-flex` to create an inline flex container that flows with text. ``` <p> Today I spent most of the day researching ways to ... <span class="inline-flex items-baseline"> <img src="path/to/image.jpg" alt="" class="self-center w-5 h-5 rounded-full mx-1" /> <span>Kramer</span> </span> keeps telling me there is no way to make it work, that ... </p> ``` ### Grid Use `grid` to create a grid container. ``` <div class="grid gap-4 grid-cols-3 grid-rows-3"> <!-- ... --> </div> ``` ### Inline Grid Use `inline-grid` to create an inline grid container. ``` <span class="inline-grid grid-cols-3 gap-4"> <span>01</span> <span>02</span> <span>03</span> <span>04</span> <span>05</span> <span>06</span> </span> <span class="inline-grid grid-cols-3 gap-4"> <span>01</span> <span>02</span> <span>03</span> <span>04</span> <span>05</span> <span>06</span> </span> ``` ### Contents Use `contents` to create a “phantom” container whose children act like direct children of the parent. ``` <div class="flex ..."> <div class="flex-1 ...">01</div> <div class="contents"> <div class="flex-1 ...">02</div> <div class="flex-1 ...">03</div> </div> <div class="flex-1 ...">04</div> </div> ``` ### Table Use the `table`, `table-row`, `table-cell`, `table-caption`, `table-column`, `table-column-group`, `table-header-group`, `table-row-group`, and `table-footer-group` utilities to create elements that behave like their respective table elements. ``` <div class="table w-full ..."> <div class="table-header-group ..."> <div class="table-row"> <div class="table-cell text-left ...">Song</div> <div class="table-cell text-left ...">Artist</div> <div class="table-cell text-left ...">Year</div> </div> </div> <div class="table-row-group"> <div class="table-row"> <div class="table-cell ...">The Sliding Mr. Bones (Next Stop, Pottersville)</div> <div class="table-cell ...">Malcolm Lockyer</div> <div class="table-cell ...">1961</div> </div> <div class="table-row"> <div class="table-cell ...">Witchy Woman</div> <div class="table-cell ...">The Eagles</div> <div class="table-cell ...">1972</div> </div> <div class="table-row"> <div class="table-cell ...">Shining Star</div> <div class="table-cell ...">Earth, Wind, and Fire</div> <div class="table-cell ...">1975</div> </div> </div> </div> ``` ### Hidden Use `hidden` to set an element to `display: none` and remove it from the page layout (compare with `.invisible` from the [visibility](visibility#invisible) documentation). ``` <div class="flex ..."> <div class="hidden ...">01</div> <div>02</div> <div>03</div> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:inline-flex` to only apply the `inline-flex` utility on hover. ``` <div class="flex hover:inline-flex"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:inline-flex` to apply the `inline-flex` utility at only medium screen sizes and above. ``` <div class="flex md:inline-flex"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Grid Row Start / End Quick reference --------------- | Class | Properties | | --- | --- | | row-auto | grid-row: auto; | | row-span-1 | grid-row: span 1 / span 1; | | row-span-2 | grid-row: span 2 / span 2; | | row-span-3 | grid-row: span 3 / span 3; | | row-span-4 | grid-row: span 4 / span 4; | | row-span-5 | grid-row: span 5 / span 5; | | row-span-6 | grid-row: span 6 / span 6; | | row-span-full | grid-row: 1 / -1; | | row-start-1 | grid-row-start: 1; | | row-start-2 | grid-row-start: 2; | | row-start-3 | grid-row-start: 3; | | row-start-4 | grid-row-start: 4; | | row-start-5 | grid-row-start: 5; | | row-start-6 | grid-row-start: 6; | | row-start-7 | grid-row-start: 7; | | row-start-auto | grid-row-start: auto; | | row-end-1 | grid-row-end: 1; | | row-end-2 | grid-row-end: 2; | | row-end-3 | grid-row-end: 3; | | row-end-4 | grid-row-end: 4; | | row-end-5 | grid-row-end: 5; | | row-end-6 | grid-row-end: 6; | | row-end-7 | grid-row-end: 7; | | row-end-auto | grid-row-end: auto; | Basic usage ----------- ### Spanning rows Use the `row-span-{n}` utilities to make an element span *n* rows. ``` <div class="grid grid-rows-3 grid-flow-col gap-4"> <div class="row-span-3 ...">01</div> <div class="col-span-2 ...">02</div> <div class="row-span-2 col-span-2 ...">03</div> </div> ``` ### Starting and ending lines Use the `row-start-{n}` and `row-end-{n}` utilities to make an element start or end at the *nth* grid line. These can also be combined with the `row-span-{n}` utilities to span a specific number of rows. Note that CSS grid lines start at 1, not 0, so a full-height element in a 3-row grid would start at line 1 and end at line 4. ``` <div class="grid grid-rows-3 grid-flow-col gap-4"> <div class="row-start-2 row-span-2 ...">01</div> <div class="row-end-3 row-span-2 ...">02</div> <div class="row-start-1 row-end-4 ...">03</div> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:row-span-4` to only apply the `row-span-4` utility on hover. ``` <div class="row-span-3 hover:row-span-4"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:row-span-4` to apply the `row-span-4` utility at only medium screen sizes and above. ``` <div class="row-span-3 md:row-span-4"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind includes grid-row utilities for working with grids with up to 6 explicit rows. You can customize these values by editing `theme.gridRow`, `theme.extend.gridRow`, `theme.gridRowStart`, `theme.extend.gridRowStart`, `theme.gridRowEnd`, and `theme.extend.gridRowEnd` in your `tailwind.config.js` file. For creating more `row-{value}` utilities that control the `grid-row` shorthand property directly, customize the `gridRow` section of your Tailwind theme config: tailwind.config.js ``` module.exports = { theme: { extend: { gridRow: { 'span-16': 'span 16 / span 16', } } } } ``` We use this internally for our `row-span-{n}` utilities. Note that since this configures the `grid-row` shorthand property directly, we include the word `span` directly in the value name, it’s *not* baked into the class name automatically. That means you are free to add entries that do whatever you want here — they don’t just have to be `span` utilities. To add new `row-start-{n}` utilities, use the `gridRowStart` section of your Tailwind theme config: tailwind.config.js ``` module.exports = { theme: { extend: { gridRowStart: { '8': '8', '9': '9', '10': '10', '11': '11', '12': '12', '13': '13', } } } } ``` To add new `row-end-{n}` utilities, use the `gridRowEnd` section of your Tailwind theme config: tailwind.config.js ``` module.exports = { theme: { extend: { gridRowEnd: { '8': '8', '9': '9', '10': '10', '11': '11', '12': '12', '13': '13', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `grid-row/grid-row-start/grid-row-end` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="row-[span_16_/_span_16]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation.
programming_docs
tailwindcss Position Quick reference --------------- | Class | Properties | | --- | --- | | static | position: static; | | fixed | position: fixed; | | absolute | position: absolute; | | relative | position: relative; | | sticky | position: sticky; | Basic usage ----------- ### Statically positioning elements Use `static` to position an element according to the normal flow of the document. Any [offsets](top-right-bottom-left) will be ignored and the element will not act as a position reference for absolutely positioned children. ``` <div class="static ..."> <p>Static parent</p> <div class="absolute bottom-0 left-0 ..."> <p>Absolute child</p> </div> </div> ``` ### Relatively positioning elements Use `relative` to position an element according to the normal flow of the document. Any [offsets](top-right-bottom-left) are calculated relative to the element’s normal position and the element *will* act as a position reference for absolutely positioned children. ``` <div class="relative ..."> <p>Relative parent</p> <div class="absolute bottom-0 left-0 ..."> <p>Absolute child</p> </div> </div> ``` ### Absolutely positioning elements Use `absolute` to position an element *outside* of the normal flow of the document, causing neighboring elements to act as if the element doesn’t exist. Any [offsets](top-right-bottom-left) are calculated relative to the nearest parent that has a position other than `static`, and the element *will* act as a position reference for other absolutely positioned children. ``` <div class="static ..."> <!-- Static parent --> <div class="static ..."><p>Static child</p></div> <div class="inline-block ..."><p>Static sibling</p></div> <!-- Static parent --> <div class="absolute ..."><p>Absolute child</p></div> <div class="inline-block ..."><p>Static sibling</p></div> </div> ``` ### Fixed positioning elements Use `fixed` to position an element relative to the browser window. Any [offsets](top-right-bottom-left) are calculated relative to the viewport and the element *will* act as a position reference for absolutely positioned children. ``` <div class="relative"> <div class="fixed top-0 left-0 right-0">Contacts</div> <div> <div> <img src="..." /> <strong>Andrew Alfred</strong> </div> <div> <img src="..." /> <strong>Debra Houston</strong> </div> <!-- ... --> </div> </div> ``` ### Sticky positioning elements Use `sticky` to position an element as `relative` until it crosses a specified threshold, then treat it as fixed until its parent is off screen. Any [offsets](top-right-bottom-left) are calculated relative to the element’s normal position and the element *will* act as a position reference for absolutely positioned children. ``` <div> <div> <div class="sticky top-0 ...">A</div> <div> <div> <img src="..." /> <strong>Andrew Alfred</strong> </div> <div> <img src="..." /> <strong>Aisha Houston</strong> </div> <!-- ... --> </div> </div> <div> <div class="sticky top-0">B</div> <div> <div> <img src="..." /> <strong>Bob Alfred</strong> </div> <!-- ... --> </div> </div> <!-- ... --> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:absolute` to only apply the `absolute` utility on hover. ``` <div class="relative hover:absolute"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:absolute` to apply the `absolute` utility at only medium screen sizes and above. ``` <div class="relative md:absolute"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Animation Quick reference --------------- | Class | Properties | | --- | --- | | animate-none | animation: none; | | animate-spin | animation: spin 1s linear infinite; @keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } } | | animate-ping | animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite; @keyframes ping { 75%, 100% { transform: scale(2); opacity: 0; } } | | animate-pulse | animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } } | | animate-bounce | animation: bounce 1s infinite; @keyframes bounce { 0%, 100% { transform: translateY(-25%); animation-timing-function: cubic-bezier(0.8, 0, 1, 1); } 50% { transform: translateY(0); animation-timing-function: cubic-bezier(0, 0, 0.2, 1); } } | Basic usage ----------- ### Spin Add the `animate-spin` utility to add a linear spin animation to elements like loading indicators. ``` <button type="button" class="bg-indigo-500 ..." disabled> <svg class="animate-spin h-5 w-5 mr-3 ..." viewBox="0 0 24 24"> <!-- ... --> </svg> Processing... </button> ``` ### Ping Add the `animate-ping` utility to make an element scale and fade like a radar ping or ripple of water — useful for things like notification badges. ``` <span class="flex h-3 w-3"> <span class="animate-ping absolute inline-flex h-full w-full rounded-full bg-sky-400 opacity-75"></span> <span class="relative inline-flex rounded-full h-3 w-3 bg-sky-500"></span> </span> ``` ### Pulse Add the `animate-pulse` utility to make an element gently fade in and out — useful for things like skeleton loaders. ``` <div class="border border-blue-300 shadow rounded-md p-4 max-w-sm w-full mx-auto"> <div class="animate-pulse flex space-x-4"> <div class="rounded-full bg-slate-200 h-10 w-10"></div> <div class="flex-1 space-y-6 py-1"> <div class="h-2 bg-slate-200 rounded"></div> <div class="space-y-3"> <div class="grid grid-cols-3 gap-4"> <div class="h-2 bg-slate-200 rounded col-span-2"></div> <div class="h-2 bg-slate-200 rounded col-span-1"></div> </div> <div class="h-2 bg-slate-200 rounded"></div> </div> </div> </div> </div><div class="border border-blue-300 shadow rounded-md p-4 max-w-sm w-full mx-auto"> <div class="animate-pulse flex space-x-4"> <div class="rounded-full bg-slate-700 h-10 w-10"></div> <div class="flex-1 space-y-6 py-1"> <div class="h-2 bg-slate-700 rounded"></div> <div class="space-y-3"> <div class="grid grid-cols-3 gap-4"> <div class="h-2 bg-slate-700 rounded col-span-2"></div> <div class="h-2 bg-slate-700 rounded col-span-1"></div> </div> <div class="h-2 bg-slate-700 rounded"></div> </div> </div> </div> </div> ``` ### Bounce Add the `animate-bounce` utility to make an element bounce up and down — useful for things like “scroll down” indicators. ``` <svg class="animate-bounce w-6 h-6 ..."> <!-- ... --> </svg> ``` ### Prefers-reduced-motion For situations where the user has specified that they prefer reduced motion, you can conditionally apply animations and transitions using the `motion-safe` and `motion-reduce` variants: ``` <button type="button" class="bg-indigo-600 ..." disabled> <svg class="motion-safe:animate-spin h-5 w-5 mr-3 ..." viewBox="0 0 24 24"> <!-- ... --> </svg> Processing </button> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:animate-spin` to only apply the `animate-spin` utility on hover. ``` <div class="hover:animate-spin"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:animate-spin` to apply the `animate-spin` utility at only medium screen sizes and above. ``` <div class="md:animate-spin"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme Animations by their very nature tend to be highly project-specific. **The animations we include by default are best thought of as helpful examples**, and you’re encouraged to customize your animations to better suit your needs. By default, Tailwind provides utilities for four different example animations, as well as the `animate-none` utility. You can customize these values by editing `theme.animation` or `theme.extend.animation` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { animation: { 'spin-slow': 'spin 3s linear infinite', } } } } ``` To add new animation `@keyframes`, use the `keyframes` section of your theme configuration: tailwind.config.js ``` module.exports = { theme: { extend: { keyframes: { wiggle: { '0%, 100%': { transform: 'rotate(-3deg)' }, '50%': { transform: 'rotate(3deg)' }, } } } } } ``` You can then reference these keyframes by name in the `animation` section of your theme configuration: tailwind.config.js ``` module.exports = { theme: { extend: { animation: { wiggle: 'wiggle 1s ease-in-out infinite', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `animation` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="animate-[wiggle_1s_ease-in-out_infinite]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Will Change Quick reference --------------- | Class | Properties | | --- | --- | | will-change-auto | will-change: auto; | | will-change-scroll | will-change: scroll-position; | | will-change-contents | will-change: contents; | | will-change-transform | will-change: transform; | Basic usage ----------- ### Optimizing with will change Use `will-change-scroll`, `will-change-contents` and `will-change-transform` to optimize an element that’s expected to change in the near future by instructing the browser to prepare the necessary animation before it actually begins. ``` <div class="overflow-auto will-change-scroll"> <!-- ... --> </div> ``` It’s recommended that you apply these utilities just before an element changes, and then remove it shortly after it finishes using `will-change-auto`. The will-change property is intended to be used as a last resort when dealing with **known performance problems**. Avoid using these utilities too much, or simply in anticipation of performance issues, as it could actually cause the page to be less performant. Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:will-change-scroll` to only apply the `will-change-scroll` utility on hover. ``` <div class="will-change-auto hover:will-change-scroll"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:will-change-scroll` to apply the `will-change-scroll` utility at only medium screen sizes and above. ``` <div class="will-change-auto md:will-change-scroll"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind provides four `will-change` utilities. You can customize these values by editing `theme.willChange` or `theme.extend.willChange` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { willChange: { 'left-top': 'left, top', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `will-change` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="will-change-[top,left]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Font Family Quick reference --------------- | Class | Properties | | --- | --- | | font-sans | font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; | | font-serif | font-family: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif; | | font-mono | font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; | Basic usage ----------- ### Setting the font family You can control the typeface of text using the font family utilities. ``` <p class="font-sans ...">The quick brown fox ...</p> <p class="font-serif ...">The quick brown fox ...</p> <p class="font-mono ...">The quick brown fox ...</p> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:font-serif` to only apply the `font-serif` utility on hover. ``` <p class="font-sans hover:font-serif"> <!-- ... --> </p> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:font-serif` to apply the `font-serif` utility at only medium screen sizes and above. ``` <p class="font-sans md:font-serif"> <!-- ... --> </p> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind provides three font family utilities: a cross-browser sans-serif stack, a cross-browser serif stack, and a cross-browser monospaced stack. You can change, add, or remove these by editing the `theme.fontFamily` section of your Tailwind config. tailwind.config.js ``` module.exports = { theme: { fontFamily: { 'sans': ['ui-sans-serif', 'system-ui', ...], 'serif': ['ui-serif', 'Georgia', ...], 'mono': ['ui-monospace', 'SFMono-Regular', ...], 'display': ['Oswald', ...], 'body': ['"Open Sans"', ...], } } } ``` Font families can be specified as an array or as a simple comma-delimited string: ``` { // Array format: 'sans': ['Helvetica', 'Arial', 'sans-serif'], // Comma-delimited format: 'sans': 'Helvetica, Arial, sans-serif', } ``` Note that **Tailwind does not automatically escape font names** for you. If you’re using a font that contains an invalid identifier, wrap it in quotes or escape the invalid characters. ``` { // Won't work: 'sans': ['Exo 2', ...], // Add quotes: 'sans': ['"Exo 2"', ...], // ...or escape the space: 'sans': ['Exo\\ 2', ...], } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `font-family` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <p class="font-['Open_Sans']"> <!-- ... --> </p> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. ### Customizing the default font For convenience, [Preflight](preflight) sets the font family on the `html` element to match your configured `sans` font, so one way to change the default font for your project is to customize the `sans` key in your `fontFamily` configuration: tailwind.config.js ``` const defaultTheme = require('tailwindcss/defaultTheme') module.exports = { theme: { extend: { fontFamily: { 'sans': ['Proxima Nova', ...defaultTheme.fontFamily.sans], }, } } } ``` You can also customize the default font used in your project by [adding a custom base style](adding-custom-styles#adding-base-styles) that sets the `font-family` property explicitly: main.css ``` @tailwind base; @tailwind components; @tailwind utilities; @layer base { html { font-family: Proxima Nova, system-ui, sans-serif; } } ``` This is the best approach if you have customized your font family utilities to have different names and don’t want there to be `font-sans` utility available in your project. tailwindcss Place Content Quick reference --------------- | Class | Properties | | --- | --- | | place-content-center | place-content: center; | | place-content-start | place-content: start; | | place-content-end | place-content: end; | | place-content-between | place-content: space-between; | | place-content-around | place-content: space-around; | | place-content-evenly | place-content: space-evenly; | | place-content-stretch | place-content: stretch; | Basic usage ----------- ### Center Use `place-content-center` to pack items in the center of the block axis: ``` <div class="grid grid-cols-2 gap-4 place-content-center h-48 ..."> <div>01</div> <div>02</div> <div>03</div> <div>04</div> </div> ``` ### Start Use `place-content-start` to pack items against the start of the block axis: ``` <div class="grid grid-cols-2 gap-4 place-content-start h-48 ..."> <div>01</div> <div>02</div> <div>03</div> <div>04</div> </div> ``` ### End Use `place-content-end` to to pack items against the end of the block axis: ``` <div class="grid grid-cols-2 gap-4 place-content-end h-48 ..."> <div>01</div> <div>02</div> <div>03</div> <div>04</div> </div> ``` ### Space between Use `place-content-between` to distribute grid items along the block axis so that that there is an equal amount of space between each row on the block axis. ``` <div class="grid grid-cols-2 gap-4 place-content-between h-48 ..."> <div>01</div> <div>02</div> <div>03</div> <div>04</div> </div> ``` ### Space around Use `place-content-around` distribute grid items such that there is an equal amount of space around each row on the block axis: ``` <div class="grid grid-cols-2 gap-4 place-content-around h-48 ..."> <div>01</div> <div>02</div> <div>03</div> <div>04</div> </div> ``` ### Space evenly Use `place-content-evenly` to distribute grid items such that they are evenly spaced on the block axis: ``` <div class="grid grid-cols-2 gap-4 place-content-evenly h-48 ..."> <div>01</div> <div>02</div> <div>03</div> <div>04</div> </div> ``` ### Stretch Use `place-content-stretch` to stretch grid items along their grid areas on the block axis: ``` <div class="grid grid-cols-2 gap-4 place-content-stretch h-48 ..."> <div>01</div> <div>02</div> <div>03</div> <div>04</div> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:place-content-center` to only apply the `place-content-center` utility on hover. ``` <div class="grid place-content-start hover:place-content-center"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:place-content-center` to apply the `place-content-center` utility at only medium screen sizes and above. ``` <div class="grid place-content-start md:place-content-center"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries).
programming_docs
tailwindcss Stroke Quick reference --------------- | Class | Properties | | --- | --- | | stroke-inherit | stroke: inherit; | | stroke-current | stroke: currentColor; | | stroke-transparent | stroke: transparent; | | stroke-black | stroke: #000; | | stroke-white | stroke: #fff; | | stroke-slate-50 | stroke: #f8fafc; | | stroke-slate-100 | stroke: #f1f5f9; | | stroke-slate-200 | stroke: #e2e8f0; | | stroke-slate-300 | stroke: #cbd5e1; | | stroke-slate-400 | stroke: #94a3b8; | | stroke-slate-500 | stroke: #64748b; | | stroke-slate-600 | stroke: #475569; | | stroke-slate-700 | stroke: #334155; | | stroke-slate-800 | stroke: #1e293b; | | stroke-slate-900 | stroke: #0f172a; | | stroke-gray-50 | stroke: #f9fafb; | | stroke-gray-100 | stroke: #f3f4f6; | | stroke-gray-200 | stroke: #e5e7eb; | | stroke-gray-300 | stroke: #d1d5db; | | stroke-gray-400 | stroke: #9ca3af; | | stroke-gray-500 | stroke: #6b7280; | | stroke-gray-600 | stroke: #4b5563; | | stroke-gray-700 | stroke: #374151; | | stroke-gray-800 | stroke: #1f2937; | | stroke-gray-900 | stroke: #111827; | | stroke-zinc-50 | stroke: #fafafa; | | stroke-zinc-100 | stroke: #f4f4f5; | | stroke-zinc-200 | stroke: #e4e4e7; | | stroke-zinc-300 | stroke: #d4d4d8; | | stroke-zinc-400 | stroke: #a1a1aa; | | stroke-zinc-500 | stroke: #71717a; | | stroke-zinc-600 | stroke: #52525b; | | stroke-zinc-700 | stroke: #3f3f46; | | stroke-zinc-800 | stroke: #27272a; | | stroke-zinc-900 | stroke: #18181b; | | stroke-neutral-50 | stroke: #fafafa; | | stroke-neutral-100 | stroke: #f5f5f5; | | stroke-neutral-200 | stroke: #e5e5e5; | | stroke-neutral-300 | stroke: #d4d4d4; | | stroke-neutral-400 | stroke: #a3a3a3; | | stroke-neutral-500 | stroke: #737373; | | stroke-neutral-600 | stroke: #525252; | | stroke-neutral-700 | stroke: #404040; | | stroke-neutral-800 | stroke: #262626; | | stroke-neutral-900 | stroke: #171717; | | stroke-stone-50 | stroke: #fafaf9; | | stroke-stone-100 | stroke: #f5f5f4; | | stroke-stone-200 | stroke: #e7e5e4; | | stroke-stone-300 | stroke: #d6d3d1; | | stroke-stone-400 | stroke: #a8a29e; | | stroke-stone-500 | stroke: #78716c; | | stroke-stone-600 | stroke: #57534e; | | stroke-stone-700 | stroke: #44403c; | | stroke-stone-800 | stroke: #292524; | | stroke-stone-900 | stroke: #1c1917; | | stroke-red-50 | stroke: #fef2f2; | | stroke-red-100 | stroke: #fee2e2; | | stroke-red-200 | stroke: #fecaca; | | stroke-red-300 | stroke: #fca5a5; | | stroke-red-400 | stroke: #f87171; | | stroke-red-500 | stroke: #ef4444; | | stroke-red-600 | stroke: #dc2626; | | stroke-red-700 | stroke: #b91c1c; | | stroke-red-800 | stroke: #991b1b; | | stroke-red-900 | stroke: #7f1d1d; | | stroke-orange-50 | stroke: #fff7ed; | | stroke-orange-100 | stroke: #ffedd5; | | stroke-orange-200 | stroke: #fed7aa; | | stroke-orange-300 | stroke: #fdba74; | | stroke-orange-400 | stroke: #fb923c; | | stroke-orange-500 | stroke: #f97316; | | stroke-orange-600 | stroke: #ea580c; | | stroke-orange-700 | stroke: #c2410c; | | stroke-orange-800 | stroke: #9a3412; | | stroke-orange-900 | stroke: #7c2d12; | | stroke-amber-50 | stroke: #fffbeb; | | stroke-amber-100 | stroke: #fef3c7; | | stroke-amber-200 | stroke: #fde68a; | | stroke-amber-300 | stroke: #fcd34d; | | stroke-amber-400 | stroke: #fbbf24; | | stroke-amber-500 | stroke: #f59e0b; | | stroke-amber-600 | stroke: #d97706; | | stroke-amber-700 | stroke: #b45309; | | stroke-amber-800 | stroke: #92400e; | | stroke-amber-900 | stroke: #78350f; | | stroke-yellow-50 | stroke: #fefce8; | | stroke-yellow-100 | stroke: #fef9c3; | | stroke-yellow-200 | stroke: #fef08a; | | stroke-yellow-300 | stroke: #fde047; | | stroke-yellow-400 | stroke: #facc15; | | stroke-yellow-500 | stroke: #eab308; | | stroke-yellow-600 | stroke: #ca8a04; | | stroke-yellow-700 | stroke: #a16207; | | stroke-yellow-800 | stroke: #854d0e; | | stroke-yellow-900 | stroke: #713f12; | | stroke-lime-50 | stroke: #f7fee7; | | stroke-lime-100 | stroke: #ecfccb; | | stroke-lime-200 | stroke: #d9f99d; | | stroke-lime-300 | stroke: #bef264; | | stroke-lime-400 | stroke: #a3e635; | | stroke-lime-500 | stroke: #84cc16; | | stroke-lime-600 | stroke: #65a30d; | | stroke-lime-700 | stroke: #4d7c0f; | | stroke-lime-800 | stroke: #3f6212; | | stroke-lime-900 | stroke: #365314; | | stroke-green-50 | stroke: #f0fdf4; | | stroke-green-100 | stroke: #dcfce7; | | stroke-green-200 | stroke: #bbf7d0; | | stroke-green-300 | stroke: #86efac; | | stroke-green-400 | stroke: #4ade80; | | stroke-green-500 | stroke: #22c55e; | | stroke-green-600 | stroke: #16a34a; | | stroke-green-700 | stroke: #15803d; | | stroke-green-800 | stroke: #166534; | | stroke-green-900 | stroke: #14532d; | | stroke-emerald-50 | stroke: #ecfdf5; | | stroke-emerald-100 | stroke: #d1fae5; | | stroke-emerald-200 | stroke: #a7f3d0; | | stroke-emerald-300 | stroke: #6ee7b7; | | stroke-emerald-400 | stroke: #34d399; | | stroke-emerald-500 | stroke: #10b981; | | stroke-emerald-600 | stroke: #059669; | | stroke-emerald-700 | stroke: #047857; | | stroke-emerald-800 | stroke: #065f46; | | stroke-emerald-900 | stroke: #064e3b; | | stroke-teal-50 | stroke: #f0fdfa; | | stroke-teal-100 | stroke: #ccfbf1; | | stroke-teal-200 | stroke: #99f6e4; | | stroke-teal-300 | stroke: #5eead4; | | stroke-teal-400 | stroke: #2dd4bf; | | stroke-teal-500 | stroke: #14b8a6; | | stroke-teal-600 | stroke: #0d9488; | | stroke-teal-700 | stroke: #0f766e; | | stroke-teal-800 | stroke: #115e59; | | stroke-teal-900 | stroke: #134e4a; | | stroke-cyan-50 | stroke: #ecfeff; | | stroke-cyan-100 | stroke: #cffafe; | | stroke-cyan-200 | stroke: #a5f3fc; | | stroke-cyan-300 | stroke: #67e8f9; | | stroke-cyan-400 | stroke: #22d3ee; | | stroke-cyan-500 | stroke: #06b6d4; | | stroke-cyan-600 | stroke: #0891b2; | | stroke-cyan-700 | stroke: #0e7490; | | stroke-cyan-800 | stroke: #155e75; | | stroke-cyan-900 | stroke: #164e63; | | stroke-sky-50 | stroke: #f0f9ff; | | stroke-sky-100 | stroke: #e0f2fe; | | stroke-sky-200 | stroke: #bae6fd; | | stroke-sky-300 | stroke: #7dd3fc; | | stroke-sky-400 | stroke: #38bdf8; | | stroke-sky-500 | stroke: #0ea5e9; | | stroke-sky-600 | stroke: #0284c7; | | stroke-sky-700 | stroke: #0369a1; | | stroke-sky-800 | stroke: #075985; | | stroke-sky-900 | stroke: #0c4a6e; | | stroke-blue-50 | stroke: #eff6ff; | | stroke-blue-100 | stroke: #dbeafe; | | stroke-blue-200 | stroke: #bfdbfe; | | stroke-blue-300 | stroke: #93c5fd; | | stroke-blue-400 | stroke: #60a5fa; | | stroke-blue-500 | stroke: #3b82f6; | | stroke-blue-600 | stroke: #2563eb; | | stroke-blue-700 | stroke: #1d4ed8; | | stroke-blue-800 | stroke: #1e40af; | | stroke-blue-900 | stroke: #1e3a8a; | | stroke-indigo-50 | stroke: #eef2ff; | | stroke-indigo-100 | stroke: #e0e7ff; | | stroke-indigo-200 | stroke: #c7d2fe; | | stroke-indigo-300 | stroke: #a5b4fc; | | stroke-indigo-400 | stroke: #818cf8; | | stroke-indigo-500 | stroke: #6366f1; | | stroke-indigo-600 | stroke: #4f46e5; | | stroke-indigo-700 | stroke: #4338ca; | | stroke-indigo-800 | stroke: #3730a3; | | stroke-indigo-900 | stroke: #312e81; | | stroke-violet-50 | stroke: #f5f3ff; | | stroke-violet-100 | stroke: #ede9fe; | | stroke-violet-200 | stroke: #ddd6fe; | | stroke-violet-300 | stroke: #c4b5fd; | | stroke-violet-400 | stroke: #a78bfa; | | stroke-violet-500 | stroke: #8b5cf6; | | stroke-violet-600 | stroke: #7c3aed; | | stroke-violet-700 | stroke: #6d28d9; | | stroke-violet-800 | stroke: #5b21b6; | | stroke-violet-900 | stroke: #4c1d95; | | stroke-purple-50 | stroke: #faf5ff; | | stroke-purple-100 | stroke: #f3e8ff; | | stroke-purple-200 | stroke: #e9d5ff; | | stroke-purple-300 | stroke: #d8b4fe; | | stroke-purple-400 | stroke: #c084fc; | | stroke-purple-500 | stroke: #a855f7; | | stroke-purple-600 | stroke: #9333ea; | | stroke-purple-700 | stroke: #7e22ce; | | stroke-purple-800 | stroke: #6b21a8; | | stroke-purple-900 | stroke: #581c87; | | stroke-fuchsia-50 | stroke: #fdf4ff; | | stroke-fuchsia-100 | stroke: #fae8ff; | | stroke-fuchsia-200 | stroke: #f5d0fe; | | stroke-fuchsia-300 | stroke: #f0abfc; | | stroke-fuchsia-400 | stroke: #e879f9; | | stroke-fuchsia-500 | stroke: #d946ef; | | stroke-fuchsia-600 | stroke: #c026d3; | | stroke-fuchsia-700 | stroke: #a21caf; | | stroke-fuchsia-800 | stroke: #86198f; | | stroke-fuchsia-900 | stroke: #701a75; | | stroke-pink-50 | stroke: #fdf2f8; | | stroke-pink-100 | stroke: #fce7f3; | | stroke-pink-200 | stroke: #fbcfe8; | | stroke-pink-300 | stroke: #f9a8d4; | | stroke-pink-400 | stroke: #f472b6; | | stroke-pink-500 | stroke: #ec4899; | | stroke-pink-600 | stroke: #db2777; | | stroke-pink-700 | stroke: #be185d; | | stroke-pink-800 | stroke: #9d174d; | | stroke-pink-900 | stroke: #831843; | | stroke-rose-50 | stroke: #fff1f2; | | stroke-rose-100 | stroke: #ffe4e6; | | stroke-rose-200 | stroke: #fecdd3; | | stroke-rose-300 | stroke: #fda4af; | | stroke-rose-400 | stroke: #fb7185; | | stroke-rose-500 | stroke: #f43f5e; | | stroke-rose-600 | stroke: #e11d48; | | stroke-rose-700 | stroke: #be123c; | | stroke-rose-800 | stroke: #9f1239; | | stroke-rose-900 | stroke: #881337; | Basic usage ----------- ### Setting the stroke color Use the `stroke-{color}` utilities to change the stroke color of an SVG. ``` <svg class="stroke-cyan-500 ..."> <!-- ... --> </svg> ``` This can be useful for styling icon sets like [Heroicons](https://heroicons.com). Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:stroke-cyan-700` to only apply the `stroke-cyan-700` utility on hover. ``` <svg class="stroke-cyan-500 hover:stroke-cyan-700"> <!-- ... --> </svg> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:stroke-cyan-700` to apply the `stroke-cyan-700` utility at only medium screen sizes and above. ``` <svg class="stroke-cyan-500 md:stroke-cyan-700"> <!-- ... --> </svg> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind makes the entire [default color palette](customizing-colors#default-color-palette) available as stroke colors. You can [customize your color palette](/docs/customizing-colors#customizing) by editing `theme.colors` or `theme.extend.colors` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { colors: { 'regal-blue': '#243c5a', }, } } } ``` Alternatively, you can customize just your stroke colors by editing `theme.stroke` or `theme.extend.stroke` in your `tailwind.config.js` file. Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `stroke` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <svg class="stroke-[#243c5a]"> <!-- ... --> </svg> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Functions & Directives Directives ---------- Directives are custom Tailwind-specific [at-rules](https://developer.mozilla.org/en-US/docs/Web/CSS/At-rule) you can use in your CSS that offer special functionality for Tailwind CSS projects. ### @tailwind Use the `@tailwind` directive to insert Tailwind’s `base`, `components`, `utilities` and `variants` styles into your CSS. ``` /** * This injects Tailwind's base styles and any base styles registered by * plugins. */ @tailwind base; /** * This injects Tailwind's component classes and any component classes * registered by plugins. */ @tailwind components; /** * This injects Tailwind's utility classes and any utility classes registered * by plugins. */ @tailwind utilities; /** * Use this directive to control where Tailwind injects the hover, focus, * responsive, dark mode, and other variants of each class. * * If omitted, Tailwind will append these classes to the very end of * your stylesheet by default. */ @tailwind variants; ``` ### @layer Use the `@layer` directive to tell Tailwind which “bucket” a set of custom styles belong to. Valid layers are `base`, `components`, and `utilities`. ``` @tailwind base; @tailwind components; @tailwind utilities; @layer base { h1 { @apply text-2xl; } h2 { @apply text-xl; } } @layer components { .btn-blue { @apply bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded; } } @layer utilities { .filter-none { filter: none; } .filter-grayscale { filter: grayscale(100%); } } ``` Tailwind will automatically move any CSS within a `@layer` directive to the same place as the corresponding `@tailwind` rule, so you don’t have to worry about authoring your CSS in a specific order to avoid specificity issues. Any custom CSS added to a layer will only be included in the final build if that CSS is actually used in your HTML, just like all of the classes built in to Tailwind by default. Wrapping any custom CSS in a `@layer` directive also makes it possible to use modifiers with those rules, like `hover:` and `focus:` or responsive modifiers like `md:` and `lg:`. ### @apply Use `@apply` to inline any existing utility classes into your own custom CSS. This is useful when you need to write custom CSS (like to override the styles in a third-party library) but still want to work with your design tokens and use the same syntax you’re used to using in your HTML. ``` .select2-dropdown { @apply rounded-b-lg shadow-md; } .select2-search { @apply border border-gray-300 rounded; } .select2-results__group { @apply text-lg font-bold text-gray-900; } ``` Any rules inlined with `@apply` will have `!important` **removed** by default to avoid specificity issues: ``` /* Input */ .foo { color: blue !important; } .bar { @apply foo; } /* Output */ .foo { color: blue !important; } .bar { color: blue; } ``` If you’d like to `@apply` an existing class and make it `!important`, simply add `!important` to the end of the declaration: ``` /* Input */ .btn { @apply font-bold py-2 px-4 rounded !important; } /* Output */ .btn { font-weight: 700 !important; padding-top: .5rem !important; padding-bottom: .5rem !important; padding-right: 1rem !important; padding-left: 1rem !important; border-radius: .25rem !important; } ``` Note that if you’re using Sass/SCSS, you’ll need to use Sass’ interpolation feature to get this to work: ``` .btn { @apply font-bold py-2 px-4 rounded #{!important}; } ``` #### Using @apply with per-component CSS Component frameworks like Vue and Svelte support adding per-component styles within a `<style>` block that lives in each component file. If you try to `@apply` a custom class you’ve defined in your global CSS in one of these per-component `<style>` blocks, you’ll get an error about the class not existing: main.css ``` @tailwind base; @tailwind components; @tailwind utilities; @layer components { .card { background-color: theme(colors.white); border-radius: theme(borderRadius.lg); padding: theme(spacing.6); box-shadow: theme(boxShadow.xl); } } ``` Card.svelte ``` <div> <slot></slot> </div> <style> div { /* Won't work because this file and main.css are processed separately */ @apply card; } </style> ``` This is because under-the-hood, frameworks like Vue and Svelte are processing every single `<style>` block independently, and running your PostCSS plugin chain against each one in isolation. That means if you have 10 components that each have a `<style>` block, Tailwind is being run 10 separate times, and each run has zero knowledge about the other runs. Because of this, when you try to `@apply card` in `Card.svelte` it fails, because Tailwind has no idea that the `card` class exists since Svelte processed `Card.svelte` and `main.css` in total isolation from each other. The solution to this problem is to define any custom styles you want to `@apply` in your components using the [plugin system](plugins) instead: tailwind.config.js ``` const plugin = require('tailwindcss/plugin') module.exports = { // ... plugins: [ plugin(function ({ addComponents, theme }) { addComponents({ '.card': { backgroundColor: theme(colors.white), borderRadius: theme(borderRadius.lg), padding: theme(spacing.6), boxShadow: theme(boxShadow.xl), } }) }) ] } ``` This way any file processed by Tailwind that uses this config file will have access to those styles. Honestly though the best solution is to just not do weird stuff like this at all. Use Tailwind’s utilities directly in your markup the way they are intended to be used, and don’t abuse the `@apply` feature to do things like this and you will have a much better experience. Functions --------- Tailwind adds a few custom functions you can use in your CSS to access Tailwind-specific values. These functions are evaluated at build-time, and are replaced by static values in your final CSS. ### theme() Use the `theme()` function to access your Tailwind config values using dot notation. ``` .content-area { height: calc(100vh - theme(spacing.12)); } ``` If you need to access a value that contains a dot (like the `2.5` value in the spacing scale), you can use square bracket notation: ``` .content-area { height: calc(100vh - theme(spacing[2.5])); } ``` Since Tailwind uses a [nested object syntax](customizing-colors#color-object-syntax) to define its default color palette, make sure to use dot notation to access the nested colors. Don't use the dash syntax when accessing nested color values ``` .btn-blue { background-color: theme(colors.blue-500); } ``` Use dot notation to access nested color values ``` .btn-blue { background-color: theme(colors.blue.500); } ``` To adjust the opacity of a color retrieved with `theme`, use a slash followed by the opacity value you want to use: ``` .btn-blue { background-color: theme(colors.blue.500 / 75%); } ``` ### screen() The `screen` function allows you to create media queries that reference your breakpoints by name instead of duplicating their values in your own CSS. ``` @media screen(sm) { /* ... */ } ``` This will resolve to the underlying screen value at build-time, generating a regular media query that matches specified breakpoint: ``` @media (min-width: 640px) { /* ... */ } ``` tailwindcss Customizing Spacing Use the `spacing` key in the `theme` section of your `tailwind.config.js` file to customize Tailwind’s [default spacing/sizing scale](#default-spacing-scale). tailwind.config.js ``` module.exports = { theme: { spacing: { '1': '8px', '2': '12px', '3': '16px', '4': '24px', '5': '32px', '6': '48px', } } } ``` By default the spacing scale is inherited by the `padding`, `margin`, `width`, `height`, `maxHeight`, `gap`, `inset`, `space`, and `translate` core plugins. Extending the default spacing scale ----------------------------------- As described in the [theme documentation](theme#extending-the-default-theme), if you’d like to extend the default spacing scale, you can do so using the `theme.extend.spacing` section of your `tailwind.config.js` file: tailwind.config.js ``` module.exports = { theme: { extend: { spacing: { '13': '3.25rem', '15': '3.75rem', '128': '32rem', '144': '36rem', } } } } ``` This will generate classes like `p-13`, `m-15`, and `h-128` in addition to all of Tailwind’s default spacing/sizing utilities. Overriding the default spacing scale ------------------------------------ As described in the [theme documentation](theme#overriding-the-default-theme), if you’d like to override the default spacing scale, you can do so using the `theme.spacing` section of your `tailwind.config.js` file: tailwind.config.js ``` module.exports = { theme: { spacing: { sm: '8px', md: '12px', lg: '16px', xl: '24px', } } } ``` This will disable Tailwind’s default spacing scale and generate classes like `p-sm`, `m-md`, `w-lg`, and `h-xl` instead. Default spacing scale --------------------- By default, Tailwind includes a generous and comprehensive numeric spacing scale. The values are proportional, so `16` is twice as much spacing as `8` for example. One spacing unit is equal to `0.25rem`, which translates to `4px` by default in common browsers. | Name | Size | Pixels | Preview | | --- | --- | --- | --- | | 0 | 0px | 0px | | | px | 1px | 1px | | | 0.5 | 0.125rem | 2px | | | 1 | 0.25rem | 4px | | | 1.5 | 0.375rem | 6px | | | 2 | 0.5rem | 8px | | | 2.5 | 0.625rem | 10px | | | 3 | 0.75rem | 12px | | | 3.5 | 0.875rem | 14px | | | 4 | 1rem | 16px | | | 5 | 1.25rem | 20px | | | 6 | 1.5rem | 24px | | | 7 | 1.75rem | 28px | | | 8 | 2rem | 32px | | | 9 | 2.25rem | 36px | | | 10 | 2.5rem | 40px | | | 11 | 2.75rem | 44px | | | 12 | 3rem | 48px | | | 14 | 3.5rem | 56px | | | 16 | 4rem | 64px | | | 20 | 5rem | 80px | | | 24 | 6rem | 96px | | | 28 | 7rem | 112px | | | 32 | 8rem | 128px | | | 36 | 9rem | 144px | | | 40 | 10rem | 160px | | | 44 | 11rem | 176px | | | 48 | 12rem | 192px | | | 52 | 13rem | 208px | | | 56 | 14rem | 224px | | | 60 | 15rem | 240px | | | 64 | 16rem | 256px | | | 72 | 18rem | 288px | | | 80 | 20rem | 320px | | | 96 | 24rem | 384px | |
programming_docs
tailwindcss Adding Custom Styles Often the biggest challenge when working with a framework is figuring out what you’re supposed to do when there’s something you need that the framework doesn’t handle for you. Tailwind has been designed from the ground up to be extensible and customizable, so that no matter what you’re building you never feel like you’re fighting the framework. This guide covers topics like customizing your design tokens, how to break out of those constraints when necessary, adding your own custom CSS, and extending the framework with plugins. Customizing your theme ---------------------- If you want to change things like your color palette, spacing scale, typography scale, or breakpoints, add your customizations to the `theme` section of your `tailwind.config.js` file: tailwind.config.js ``` module.exports = { theme: { screens: { sm: '480px', md: '768px', lg: '976px', xl: '1440px', }, colors: { 'blue': '#1fb6ff', 'pink': '#ff49db', 'orange': '#ff7849', 'green': '#13ce66', 'gray-dark': '#273444', 'gray': '#8492a6', 'gray-light': '#d3dce6', }, fontFamily: { sans: ['Graphik', 'sans-serif'], serif: ['Merriweather', 'serif'], }, extend: { spacing: { '128': '32rem', '144': '36rem', }, borderRadius: { '4xl': '2rem', } } } } ``` Learn more about customizing your theme in the [Theme Configuration](theme) documentation. Using arbitrary values ---------------------- While you can usually build the bulk of a well-crafted design using a constrained set of design tokens, once in a while you need to break out of those constraints to get things pixel-perfect. When you find yourself really needing something like `top: 117px` to get a background image in just the right spot, use Tailwind’s square bracket notation to generate a class on the fly with any arbitrary value: ``` <div class="top-[117px]"> <!-- ... --> </div> ``` This is basically like inline styles, with the major benefit that you can combine it with interactive modifiers like `hover` and responsive modifiers like `lg`: ``` <div class="top-[117px] lg:top-[344px]"> <!-- ... --> </div> ``` This works for everything in the framework, including things like background colors, font sizes, pseudo-element content, and more: ``` <div class="bg-[#bada55] text-[22px] before:content-['Festivus']"> <!-- ... --> </div> ``` It’s even possible to use the [`theme` function](functions-and-directives#theme) to reference the design tokens in your `tailwind.config.js` file: ``` <div class="grid grid-cols-[fit-content(theme(spacing.32))]"> <!-- ... --> </div> ``` ### Arbitrary properties If you ever need to use a CSS property that Tailwind doesn’t include a utility for out of the box, you can also use square bracket notation to write completely arbitrary CSS: ``` <div class="[mask-type:luminance]"> <!-- ... --> </div> ``` This is *really* like inline styles, but again with the benefit that you can use modifiers: ``` <div class="[mask-type:luminance] hover:[mask-type:alpha]"> <!-- ... --> </div> ``` This can be useful for things like CSS variables as well, especially when they need to change under different conditions: ``` <div class="[--scroll-offset:56px] lg:[--scroll-offset:44px]"> <!-- ... --> </div> ``` ### Handling whitespace When an arbitrary value needs to contain a space, use an underscore (`_`) instead and Tailwind will automatically convert it to a space at build-time: ``` <div class="grid grid-cols-[1fr_500px_2fr]"> <!-- ... --> </div> ``` In situations where underscores are common but spaces are invalid, Tailwind will preserve the underscore instead of converting it to a space, for example in URLs: ``` <div class="bg-[url('/what_a_rush.png')]"> <!-- ... --> </div> ``` In the rare case that you actually need to use an underscore but it’s ambiguous because a space is valid as well, escape the underscore with a backslash and Tailwind won’t convert it to a space: ``` <div class="before:content-['hello\_world']"> <!-- ... --> </div> ``` If you’re using something like JSX where the backslash is stripped from the rendered HTML, use [String.raw()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/raw) so the backslash isn’t treated as a JavaScript escape character: ``` <div className={String.raw`before:content-['hello\_world']`}> <!-- ... --> </div> ``` ### Resolving ambiguities Many utilities in Tailwind share a common namespace but map to different CSS properties. For example `text-lg` and `text-black` both share the `text-` namespace, but one is for `font-size` and the other is for `color`. When using arbitrary values, Tailwind can generally handle this ambiguity automatically based on the value you pass in: ``` <!-- Will generate a font-size utility --> <div class="text-[22px]">...</div> <!-- Will generate a color utility --> <div class="text-[#bada55]">...</div> ``` Sometimes it really is ambiguous though, for example when using CSS variables: ``` <div class="text-[var(--my-var)]">...</div> ``` In these situations, you can “hint” the underlying type to Tailwind by adding a [CSS data type](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Types) before the value: ``` <!-- Will generate a font-size utility --> <div class="text-[length:var(--my-var)]">...</div> <!-- Will generate a color utility --> <div class="text-[color:var(--my-var)]">...</div> ``` Using CSS and @layer -------------------- When you need to add truly custom CSS rules to a Tailwind project, the easiest approach is to just add the custom CSS to your stylesheet: main.css ``` @tailwind base; @tailwind components; @tailwind utilities; .my-custom-style { /* ... */ } ``` For more power, you can also use the `@layer` directive to add styles to Tailwind’s `base`, `components`, and `utilities` layers: main.css ``` @tailwind base; @tailwind components; @tailwind utilities; @layer components { .my-custom-style { /* ... */ } } ``` Why does Tailwind group styles into "layers"?In CSS, the order of the rules in your stylesheet decides which declaration wins when two selectors have the same specificity: ``` .btn { background: blue; /* ... */ } .bg-black { background: black; } ``` Here, both buttons will be black since `.bg-black` comes after `.btn` in the CSS: ``` <button class="btn bg-black">...</button> <button class="bg-black btn">...</button> ``` To manage this, Tailwind organizes the styles it generates into three different “layers” — a concept popularized by [ITCSS](https://www.xfive.co/blog/itcss-scalable-maintainable-css-architecture/#what-is-itcss). * The `base` layer is for things like reset rules or default styles applied to plain HTML elements. * The `components` layer is for class-based styles that you want to be able to override with utilities. * The `utilities` layer is for small, single-purpose classes that should always take precedence over any other styles. Being explicit about this makes it easier to understand how your styles will interact with each other, and using the `@layer` directive lets you control the final declaration order while still organizing your actual code in whatever way you like. The `@layer` directive helps you control declaration order by automatically relocating your styles to the corresponding `@tailwind` directive, and also enables features like [modifiers](#using-modifiers-with-custom-css) and [tree-shaking](#removing-unused-custom-css) for your own custom CSS. ### Adding base styles If you just want to set some defaults for the page (like the text color, background color, or font family), the easiest option is just adding some classes to the `html` or `body` elements: ``` <!doctype html> <html lang="en" class="text-gray-900 bg-gray-100 font-serif"> <!-- ... --> </html> ``` This keeps your base styling decisions in your markup alongside all of your other styles, instead of hiding them in a separate file. If you want to add your own default base styles for specific HTML elements, use the `@layer` directive to add those styles to Tailwind’s `base` layer: main.css ``` @tailwind base; @tailwind components; @tailwind utilities; @layer base { h1 { @apply text-2xl; } h2 { @apply text-xl; } /* ... */ } ``` Use the [`theme`](functions-and-directives#theme) function or [`@apply`](functions-and-directives#apply) directive when adding custom base styles if you want to refer to any of the values defined in your <theme>. ### Adding component classes Use the `components` layer for any more complicated classes you want to add to your project that you’d still like to be able to override with utility classes. Traditionally these would be classes like `card`, `btn`, `badge` — that kind of thing. main.css ``` @tailwind base; @tailwind components; @tailwind utilities; @layer components { .card { background-color: theme('colors.white'); border-radius: theme('borderRadius.lg'); padding: theme('spacing.6'); box-shadow: theme('boxShadow.xl'); } /* ... */ } ``` By defining component classes in the `components` layer, you can still use utility classes to override them when necessary: ``` <!-- Will look like a card, but with square corners --> <div class="card rounded-none"> <!-- ... --> </div> ``` Using Tailwind you probably don’t need these types of classes as often as you think. Read our guide on [Reusing Styles](reusing-styles) for our recommendations. The `components` layer is also a good place to put custom styles for any third-party components you’re using: main.css ``` @tailwind base; @tailwind components; @tailwind utilities; @layer components { .select2-dropdown { @apply rounded-b-lg shadow-md; } .select2-search { @apply border border-gray-300 rounded; } .select2-results__group { @apply text-lg font-bold text-gray-900; } /* ... */ } ``` Use the [`theme`](functions-and-directives#theme) function or [`@apply`](functions-and-directives#apply) directive when adding custom component styles if you want to refer to any of the values defined in your <theme>. ### Adding custom utilities Add any of your own custom utility classes to Tailwind’s `utilities` layer: main.css ``` @tailwind base; @tailwind components; @tailwind utilities; @layer utilities { .content-auto { content-visibility: auto; } } ``` This can be useful when there’s a CSS feature you’d like to use in your project that Tailwind doesn’t include utilities for out of the box. ### Using modifiers with custom CSS Any custom styles you add to Tailwind with `@layer` will automatically support Tailwind’s modifier syntax for handling things like hover states, responsive breakpoints, dark mode, and more. CSS ``` @tailwind base; @tailwind components; @tailwind utilities; @layer utilities { .content-auto { content-visibility: auto; } } ``` HTML ``` <div class="lg:dark:content-auto"> <!-- ... --> </div> ``` Learn more about how these modifiers work in the [Hover, Focus, and Other States](hover-focus-and-other-states) documentation. ### Removing unused custom CSS Any custom styles you add to the `base`, `components`, or `utilities` layers will only be included in your compiled CSS if those styles are actually used in your HTML. main.css ``` @tailwind base; @tailwind components; @tailwind utilities; @layer components { /* This won't be included in your compiled CSS unless you actually use it */ .card { /* ... */ } } ``` If you want to add some custom CSS that should always be included, add it to your stylesheet without using the `@layer` directive: main.css ``` @tailwind base; @tailwind components; /* This will always be included in your compiled CSS */ .card { /* ... */ } @tailwind utilities; ``` Make sure to put your custom styles where they need to go to get the precedence behavior you want. In the example above, we’ve added the `.card` class before `@tailwind utilities` to make sure utilities can still override it. ### Using multiple CSS files If you are writing a lot of CSS and organizing it into multiple files, make sure those files are combined into a single stylesheet before processing them with Tailwind, or you’ll see errors about using `@layer` without the corresponding `@tailwind` directive. The easiest way to do this is using the [postcss-import](https://github.com/postcss/postcss-import) plugin: postcss.config.js ``` module.exports = { plugins: { 'postcss-import': {}, tailwindcss: {}, autoprefixer: {}, } } ``` Learn more in our [build-time imports](https://tailwindcss.com/docs/using-with-preprocessors#build-time-imports) documentation. ### Layers and per-component CSS Component frameworks like Vue and Svelte support adding per-component styles within a `<style>` block that lives in each component file. While you can use features like `@apply` and `theme` inside component styles like this, the `@layer` directive will not work and you’ll see an error about `@layer` being used without a matching `@tailwind` directive: Don't use `@layer` in component styles Card.svelte ``` <div> <slot></slot> </div> <style> /* Won't work because this file is processed in isolation */ @layer components { div { background-color: theme('colors.white'); border-radius: theme('borderRadius.lg'); padding: theme('spacing.6'); box-shadow: theme('boxShadow.xl'); } } </style> ``` This is because under-the-hood, frameworks like Vue and Svelte are processing every single `<style>` block independently, and running your PostCSS plugin chain against each one in isolation. That means if you have 10 components that each have a `<style>` block, Tailwind is being run 10 separate times, and each run has zero knowledge about the other runs. Because of this, Tailwind can’t take the styles you define in a `@layer` and move them to the corresponding `@tailwind` directive, because as far as Tailwind can tell there is no `@tailwind` directive to move it to. One solution to this is to simply *not* use `@layer` inside your component styles: Add your styles without using `@layer` Card.svelte ``` <div> <slot></slot> </div> <style> div { background-color: theme('colors.white'); border-radius: theme('borderRadius.lg'); padding: theme('spacing.6'); box-shadow: theme('boxShadow.xl'); } </style> ``` You lose the ability to control the precedence of your styles, but unfortunately that’s totally out of our control because of how these tools work. Our recommendation is that you just don’t use component styles like this at all and instead use Tailwind the way it’s intended to be used — as a single global stylesheet where you use the classes directly in your HTML: Use Tailwind's utilities instead of component styles Card.svelte ``` <div class="bg-white rounded-lg p-6 shadow-xl"> <slot></slot> </div> ``` Writing plugins --------------- You can also add custom styles to your project using Tailwind’s plugin system instead of using a CSS file: tailwind.config.js ``` const plugin = require('tailwindcss/plugin') module.exports = { // ... plugins: [ plugin(function ({ addBase, addComponents, addUtilities, theme }) { addBase({ 'h1': { fontSize: theme('fontSize.2xl'), }, 'h2': { fontSize: theme('fontSize.xl'), }, }) addComponents({ '.card': { backgroundColor: theme('colors.white'), borderRadius: theme('borderRadius.lg'), padding: theme('spacing.6'), boxShadow: theme('boxShadow.xl'), } }) addUtilities({ '.content-auto': { contentVisibility: 'auto', } }) }) ] } ``` Learn more about writing your own plugins in the [Plugins](plugins) documentation. tailwindcss Touch Action Quick reference --------------- | Class | Properties | | --- | --- | | touch-auto | touch-action: auto; | | touch-none | touch-action: none; | | touch-pan-x | touch-action: pan-x; | | touch-pan-left | touch-action: pan-left; | | touch-pan-right | touch-action: pan-right; | | touch-pan-y | touch-action: pan-y; | | touch-pan-up | touch-action: pan-up; | | touch-pan-down | touch-action: pan-down; | | touch-pinch-zoom | touch-action: pinch-zoom; | | touch-manipulation | touch-action: manipulation; | Basic usage ----------- ### Setting the touch action Use the `touch-{action}` utilities to control how an element can be scrolled (panned) and zoomed (pinched) on touchscreens. ``` <div class="w-full h-48 overflow-auto touch-auto ..."> <img class="w-[150%] max-w-none h-auto" src="..." /> </div> <div class="w-full h-48 overflow-auto touch-none ..."> <img class="w-[150%] max-w-none h-auto" src="..." /> </div> <div class="w-full h-48 overflow-auto touch-pan-x ..."> <img class="w-[150%] max-w-none h-auto" src="..." /> </div> <div class="w-full h-48 overflow-auto touch-pan-y ..."> <img class="w-[150%] max-w-none h-auto" src="..." /> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `focus:touch-pan-x` to only apply the `touch-pan-x` utility on focus. ``` <div class="focus:touch-pan-x"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:touch-pan-x` to apply the `touch-pan-x` utility at only medium screen sizes and above. ``` <div class="md:touch-pan-x"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Padding Quick reference --------------- | Class | Properties | | --- | --- | | p-0 | padding: 0px; | | px-0 | padding-left: 0px; padding-right: 0px; | | py-0 | padding-top: 0px; padding-bottom: 0px; | | pt-0 | padding-top: 0px; | | pr-0 | padding-right: 0px; | | pb-0 | padding-bottom: 0px; | | pl-0 | padding-left: 0px; | | p-px | padding: 1px; | | px-px | padding-left: 1px; padding-right: 1px; | | py-px | padding-top: 1px; padding-bottom: 1px; | | pt-px | padding-top: 1px; | | pr-px | padding-right: 1px; | | pb-px | padding-bottom: 1px; | | pl-px | padding-left: 1px; | | p-0.5 | padding: 0.125rem; /\* 2px \*/ | | px-0.5 | padding-left: 0.125rem; /\* 2px \*/ padding-right: 0.125rem; /\* 2px \*/ | | py-0.5 | padding-top: 0.125rem; /\* 2px \*/ padding-bottom: 0.125rem; /\* 2px \*/ | | pt-0.5 | padding-top: 0.125rem; /\* 2px \*/ | | pr-0.5 | padding-right: 0.125rem; /\* 2px \*/ | | pb-0.5 | padding-bottom: 0.125rem; /\* 2px \*/ | | pl-0.5 | padding-left: 0.125rem; /\* 2px \*/ | | p-1 | padding: 0.25rem; /\* 4px \*/ | | px-1 | padding-left: 0.25rem; /\* 4px \*/ padding-right: 0.25rem; /\* 4px \*/ | | py-1 | padding-top: 0.25rem; /\* 4px \*/ padding-bottom: 0.25rem; /\* 4px \*/ | | pt-1 | padding-top: 0.25rem; /\* 4px \*/ | | pr-1 | padding-right: 0.25rem; /\* 4px \*/ | | pb-1 | padding-bottom: 0.25rem; /\* 4px \*/ | | pl-1 | padding-left: 0.25rem; /\* 4px \*/ | | p-1.5 | padding: 0.375rem; /\* 6px \*/ | | px-1.5 | padding-left: 0.375rem; /\* 6px \*/ padding-right: 0.375rem; /\* 6px \*/ | | py-1.5 | padding-top: 0.375rem; /\* 6px \*/ padding-bottom: 0.375rem; /\* 6px \*/ | | pt-1.5 | padding-top: 0.375rem; /\* 6px \*/ | | pr-1.5 | padding-right: 0.375rem; /\* 6px \*/ | | pb-1.5 | padding-bottom: 0.375rem; /\* 6px \*/ | | pl-1.5 | padding-left: 0.375rem; /\* 6px \*/ | | p-2 | padding: 0.5rem; /\* 8px \*/ | | px-2 | padding-left: 0.5rem; /\* 8px \*/ padding-right: 0.5rem; /\* 8px \*/ | | py-2 | padding-top: 0.5rem; /\* 8px \*/ padding-bottom: 0.5rem; /\* 8px \*/ | | pt-2 | padding-top: 0.5rem; /\* 8px \*/ | | pr-2 | padding-right: 0.5rem; /\* 8px \*/ | | pb-2 | padding-bottom: 0.5rem; /\* 8px \*/ | | pl-2 | padding-left: 0.5rem; /\* 8px \*/ | | p-2.5 | padding: 0.625rem; /\* 10px \*/ | | px-2.5 | padding-left: 0.625rem; /\* 10px \*/ padding-right: 0.625rem; /\* 10px \*/ | | py-2.5 | padding-top: 0.625rem; /\* 10px \*/ padding-bottom: 0.625rem; /\* 10px \*/ | | pt-2.5 | padding-top: 0.625rem; /\* 10px \*/ | | pr-2.5 | padding-right: 0.625rem; /\* 10px \*/ | | pb-2.5 | padding-bottom: 0.625rem; /\* 10px \*/ | | pl-2.5 | padding-left: 0.625rem; /\* 10px \*/ | | p-3 | padding: 0.75rem; /\* 12px \*/ | | px-3 | padding-left: 0.75rem; /\* 12px \*/ padding-right: 0.75rem; /\* 12px \*/ | | py-3 | padding-top: 0.75rem; /\* 12px \*/ padding-bottom: 0.75rem; /\* 12px \*/ | | pt-3 | padding-top: 0.75rem; /\* 12px \*/ | | pr-3 | padding-right: 0.75rem; /\* 12px \*/ | | pb-3 | padding-bottom: 0.75rem; /\* 12px \*/ | | pl-3 | padding-left: 0.75rem; /\* 12px \*/ | | p-3.5 | padding: 0.875rem; /\* 14px \*/ | | px-3.5 | padding-left: 0.875rem; /\* 14px \*/ padding-right: 0.875rem; /\* 14px \*/ | | py-3.5 | padding-top: 0.875rem; /\* 14px \*/ padding-bottom: 0.875rem; /\* 14px \*/ | | pt-3.5 | padding-top: 0.875rem; /\* 14px \*/ | | pr-3.5 | padding-right: 0.875rem; /\* 14px \*/ | | pb-3.5 | padding-bottom: 0.875rem; /\* 14px \*/ | | pl-3.5 | padding-left: 0.875rem; /\* 14px \*/ | | p-4 | padding: 1rem; /\* 16px \*/ | | px-4 | padding-left: 1rem; /\* 16px \*/ padding-right: 1rem; /\* 16px \*/ | | py-4 | padding-top: 1rem; /\* 16px \*/ padding-bottom: 1rem; /\* 16px \*/ | | pt-4 | padding-top: 1rem; /\* 16px \*/ | | pr-4 | padding-right: 1rem; /\* 16px \*/ | | pb-4 | padding-bottom: 1rem; /\* 16px \*/ | | pl-4 | padding-left: 1rem; /\* 16px \*/ | | p-5 | padding: 1.25rem; /\* 20px \*/ | | px-5 | padding-left: 1.25rem; /\* 20px \*/ padding-right: 1.25rem; /\* 20px \*/ | | py-5 | padding-top: 1.25rem; /\* 20px \*/ padding-bottom: 1.25rem; /\* 20px \*/ | | pt-5 | padding-top: 1.25rem; /\* 20px \*/ | | pr-5 | padding-right: 1.25rem; /\* 20px \*/ | | pb-5 | padding-bottom: 1.25rem; /\* 20px \*/ | | pl-5 | padding-left: 1.25rem; /\* 20px \*/ | | p-6 | padding: 1.5rem; /\* 24px \*/ | | px-6 | padding-left: 1.5rem; /\* 24px \*/ padding-right: 1.5rem; /\* 24px \*/ | | py-6 | padding-top: 1.5rem; /\* 24px \*/ padding-bottom: 1.5rem; /\* 24px \*/ | | pt-6 | padding-top: 1.5rem; /\* 24px \*/ | | pr-6 | padding-right: 1.5rem; /\* 24px \*/ | | pb-6 | padding-bottom: 1.5rem; /\* 24px \*/ | | pl-6 | padding-left: 1.5rem; /\* 24px \*/ | | p-7 | padding: 1.75rem; /\* 28px \*/ | | px-7 | padding-left: 1.75rem; /\* 28px \*/ padding-right: 1.75rem; /\* 28px \*/ | | py-7 | padding-top: 1.75rem; /\* 28px \*/ padding-bottom: 1.75rem; /\* 28px \*/ | | pt-7 | padding-top: 1.75rem; /\* 28px \*/ | | pr-7 | padding-right: 1.75rem; /\* 28px \*/ | | pb-7 | padding-bottom: 1.75rem; /\* 28px \*/ | | pl-7 | padding-left: 1.75rem; /\* 28px \*/ | | p-8 | padding: 2rem; /\* 32px \*/ | | px-8 | padding-left: 2rem; /\* 32px \*/ padding-right: 2rem; /\* 32px \*/ | | py-8 | padding-top: 2rem; /\* 32px \*/ padding-bottom: 2rem; /\* 32px \*/ | | pt-8 | padding-top: 2rem; /\* 32px \*/ | | pr-8 | padding-right: 2rem; /\* 32px \*/ | | pb-8 | padding-bottom: 2rem; /\* 32px \*/ | | pl-8 | padding-left: 2rem; /\* 32px \*/ | | p-9 | padding: 2.25rem; /\* 36px \*/ | | px-9 | padding-left: 2.25rem; /\* 36px \*/ padding-right: 2.25rem; /\* 36px \*/ | | py-9 | padding-top: 2.25rem; /\* 36px \*/ padding-bottom: 2.25rem; /\* 36px \*/ | | pt-9 | padding-top: 2.25rem; /\* 36px \*/ | | pr-9 | padding-right: 2.25rem; /\* 36px \*/ | | pb-9 | padding-bottom: 2.25rem; /\* 36px \*/ | | pl-9 | padding-left: 2.25rem; /\* 36px \*/ | | p-10 | padding: 2.5rem; /\* 40px \*/ | | px-10 | padding-left: 2.5rem; /\* 40px \*/ padding-right: 2.5rem; /\* 40px \*/ | | py-10 | padding-top: 2.5rem; /\* 40px \*/ padding-bottom: 2.5rem; /\* 40px \*/ | | pt-10 | padding-top: 2.5rem; /\* 40px \*/ | | pr-10 | padding-right: 2.5rem; /\* 40px \*/ | | pb-10 | padding-bottom: 2.5rem; /\* 40px \*/ | | pl-10 | padding-left: 2.5rem; /\* 40px \*/ | | p-11 | padding: 2.75rem; /\* 44px \*/ | | px-11 | padding-left: 2.75rem; /\* 44px \*/ padding-right: 2.75rem; /\* 44px \*/ | | py-11 | padding-top: 2.75rem; /\* 44px \*/ padding-bottom: 2.75rem; /\* 44px \*/ | | pt-11 | padding-top: 2.75rem; /\* 44px \*/ | | pr-11 | padding-right: 2.75rem; /\* 44px \*/ | | pb-11 | padding-bottom: 2.75rem; /\* 44px \*/ | | pl-11 | padding-left: 2.75rem; /\* 44px \*/ | | p-12 | padding: 3rem; /\* 48px \*/ | | px-12 | padding-left: 3rem; /\* 48px \*/ padding-right: 3rem; /\* 48px \*/ | | py-12 | padding-top: 3rem; /\* 48px \*/ padding-bottom: 3rem; /\* 48px \*/ | | pt-12 | padding-top: 3rem; /\* 48px \*/ | | pr-12 | padding-right: 3rem; /\* 48px \*/ | | pb-12 | padding-bottom: 3rem; /\* 48px \*/ | | pl-12 | padding-left: 3rem; /\* 48px \*/ | | p-14 | padding: 3.5rem; /\* 56px \*/ | | px-14 | padding-left: 3.5rem; /\* 56px \*/ padding-right: 3.5rem; /\* 56px \*/ | | py-14 | padding-top: 3.5rem; /\* 56px \*/ padding-bottom: 3.5rem; /\* 56px \*/ | | pt-14 | padding-top: 3.5rem; /\* 56px \*/ | | pr-14 | padding-right: 3.5rem; /\* 56px \*/ | | pb-14 | padding-bottom: 3.5rem; /\* 56px \*/ | | pl-14 | padding-left: 3.5rem; /\* 56px \*/ | | p-16 | padding: 4rem; /\* 64px \*/ | | px-16 | padding-left: 4rem; /\* 64px \*/ padding-right: 4rem; /\* 64px \*/ | | py-16 | padding-top: 4rem; /\* 64px \*/ padding-bottom: 4rem; /\* 64px \*/ | | pt-16 | padding-top: 4rem; /\* 64px \*/ | | pr-16 | padding-right: 4rem; /\* 64px \*/ | | pb-16 | padding-bottom: 4rem; /\* 64px \*/ | | pl-16 | padding-left: 4rem; /\* 64px \*/ | | p-20 | padding: 5rem; /\* 80px \*/ | | px-20 | padding-left: 5rem; /\* 80px \*/ padding-right: 5rem; /\* 80px \*/ | | py-20 | padding-top: 5rem; /\* 80px \*/ padding-bottom: 5rem; /\* 80px \*/ | | pt-20 | padding-top: 5rem; /\* 80px \*/ | | pr-20 | padding-right: 5rem; /\* 80px \*/ | | pb-20 | padding-bottom: 5rem; /\* 80px \*/ | | pl-20 | padding-left: 5rem; /\* 80px \*/ | | p-24 | padding: 6rem; /\* 96px \*/ | | px-24 | padding-left: 6rem; /\* 96px \*/ padding-right: 6rem; /\* 96px \*/ | | py-24 | padding-top: 6rem; /\* 96px \*/ padding-bottom: 6rem; /\* 96px \*/ | | pt-24 | padding-top: 6rem; /\* 96px \*/ | | pr-24 | padding-right: 6rem; /\* 96px \*/ | | pb-24 | padding-bottom: 6rem; /\* 96px \*/ | | pl-24 | padding-left: 6rem; /\* 96px \*/ | | p-28 | padding: 7rem; /\* 112px \*/ | | px-28 | padding-left: 7rem; /\* 112px \*/ padding-right: 7rem; /\* 112px \*/ | | py-28 | padding-top: 7rem; /\* 112px \*/ padding-bottom: 7rem; /\* 112px \*/ | | pt-28 | padding-top: 7rem; /\* 112px \*/ | | pr-28 | padding-right: 7rem; /\* 112px \*/ | | pb-28 | padding-bottom: 7rem; /\* 112px \*/ | | pl-28 | padding-left: 7rem; /\* 112px \*/ | | p-32 | padding: 8rem; /\* 128px \*/ | | px-32 | padding-left: 8rem; /\* 128px \*/ padding-right: 8rem; /\* 128px \*/ | | py-32 | padding-top: 8rem; /\* 128px \*/ padding-bottom: 8rem; /\* 128px \*/ | | pt-32 | padding-top: 8rem; /\* 128px \*/ | | pr-32 | padding-right: 8rem; /\* 128px \*/ | | pb-32 | padding-bottom: 8rem; /\* 128px \*/ | | pl-32 | padding-left: 8rem; /\* 128px \*/ | | p-36 | padding: 9rem; /\* 144px \*/ | | px-36 | padding-left: 9rem; /\* 144px \*/ padding-right: 9rem; /\* 144px \*/ | | py-36 | padding-top: 9rem; /\* 144px \*/ padding-bottom: 9rem; /\* 144px \*/ | | pt-36 | padding-top: 9rem; /\* 144px \*/ | | pr-36 | padding-right: 9rem; /\* 144px \*/ | | pb-36 | padding-bottom: 9rem; /\* 144px \*/ | | pl-36 | padding-left: 9rem; /\* 144px \*/ | | p-40 | padding: 10rem; /\* 160px \*/ | | px-40 | padding-left: 10rem; /\* 160px \*/ padding-right: 10rem; /\* 160px \*/ | | py-40 | padding-top: 10rem; /\* 160px \*/ padding-bottom: 10rem; /\* 160px \*/ | | pt-40 | padding-top: 10rem; /\* 160px \*/ | | pr-40 | padding-right: 10rem; /\* 160px \*/ | | pb-40 | padding-bottom: 10rem; /\* 160px \*/ | | pl-40 | padding-left: 10rem; /\* 160px \*/ | | p-44 | padding: 11rem; /\* 176px \*/ | | px-44 | padding-left: 11rem; /\* 176px \*/ padding-right: 11rem; /\* 176px \*/ | | py-44 | padding-top: 11rem; /\* 176px \*/ padding-bottom: 11rem; /\* 176px \*/ | | pt-44 | padding-top: 11rem; /\* 176px \*/ | | pr-44 | padding-right: 11rem; /\* 176px \*/ | | pb-44 | padding-bottom: 11rem; /\* 176px \*/ | | pl-44 | padding-left: 11rem; /\* 176px \*/ | | p-48 | padding: 12rem; /\* 192px \*/ | | px-48 | padding-left: 12rem; /\* 192px \*/ padding-right: 12rem; /\* 192px \*/ | | py-48 | padding-top: 12rem; /\* 192px \*/ padding-bottom: 12rem; /\* 192px \*/ | | pt-48 | padding-top: 12rem; /\* 192px \*/ | | pr-48 | padding-right: 12rem; /\* 192px \*/ | | pb-48 | padding-bottom: 12rem; /\* 192px \*/ | | pl-48 | padding-left: 12rem; /\* 192px \*/ | | p-52 | padding: 13rem; /\* 208px \*/ | | px-52 | padding-left: 13rem; /\* 208px \*/ padding-right: 13rem; /\* 208px \*/ | | py-52 | padding-top: 13rem; /\* 208px \*/ padding-bottom: 13rem; /\* 208px \*/ | | pt-52 | padding-top: 13rem; /\* 208px \*/ | | pr-52 | padding-right: 13rem; /\* 208px \*/ | | pb-52 | padding-bottom: 13rem; /\* 208px \*/ | | pl-52 | padding-left: 13rem; /\* 208px \*/ | | p-56 | padding: 14rem; /\* 224px \*/ | | px-56 | padding-left: 14rem; /\* 224px \*/ padding-right: 14rem; /\* 224px \*/ | | py-56 | padding-top: 14rem; /\* 224px \*/ padding-bottom: 14rem; /\* 224px \*/ | | pt-56 | padding-top: 14rem; /\* 224px \*/ | | pr-56 | padding-right: 14rem; /\* 224px \*/ | | pb-56 | padding-bottom: 14rem; /\* 224px \*/ | | pl-56 | padding-left: 14rem; /\* 224px \*/ | | p-60 | padding: 15rem; /\* 240px \*/ | | px-60 | padding-left: 15rem; /\* 240px \*/ padding-right: 15rem; /\* 240px \*/ | | py-60 | padding-top: 15rem; /\* 240px \*/ padding-bottom: 15rem; /\* 240px \*/ | | pt-60 | padding-top: 15rem; /\* 240px \*/ | | pr-60 | padding-right: 15rem; /\* 240px \*/ | | pb-60 | padding-bottom: 15rem; /\* 240px \*/ | | pl-60 | padding-left: 15rem; /\* 240px \*/ | | p-64 | padding: 16rem; /\* 256px \*/ | | px-64 | padding-left: 16rem; /\* 256px \*/ padding-right: 16rem; /\* 256px \*/ | | py-64 | padding-top: 16rem; /\* 256px \*/ padding-bottom: 16rem; /\* 256px \*/ | | pt-64 | padding-top: 16rem; /\* 256px \*/ | | pr-64 | padding-right: 16rem; /\* 256px \*/ | | pb-64 | padding-bottom: 16rem; /\* 256px \*/ | | pl-64 | padding-left: 16rem; /\* 256px \*/ | | p-72 | padding: 18rem; /\* 288px \*/ | | px-72 | padding-left: 18rem; /\* 288px \*/ padding-right: 18rem; /\* 288px \*/ | | py-72 | padding-top: 18rem; /\* 288px \*/ padding-bottom: 18rem; /\* 288px \*/ | | pt-72 | padding-top: 18rem; /\* 288px \*/ | | pr-72 | padding-right: 18rem; /\* 288px \*/ | | pb-72 | padding-bottom: 18rem; /\* 288px \*/ | | pl-72 | padding-left: 18rem; /\* 288px \*/ | | p-80 | padding: 20rem; /\* 320px \*/ | | px-80 | padding-left: 20rem; /\* 320px \*/ padding-right: 20rem; /\* 320px \*/ | | py-80 | padding-top: 20rem; /\* 320px \*/ padding-bottom: 20rem; /\* 320px \*/ | | pt-80 | padding-top: 20rem; /\* 320px \*/ | | pr-80 | padding-right: 20rem; /\* 320px \*/ | | pb-80 | padding-bottom: 20rem; /\* 320px \*/ | | pl-80 | padding-left: 20rem; /\* 320px \*/ | | p-96 | padding: 24rem; /\* 384px \*/ | | px-96 | padding-left: 24rem; /\* 384px \*/ padding-right: 24rem; /\* 384px \*/ | | py-96 | padding-top: 24rem; /\* 384px \*/ padding-bottom: 24rem; /\* 384px \*/ | | pt-96 | padding-top: 24rem; /\* 384px \*/ | | pr-96 | padding-right: 24rem; /\* 384px \*/ | | pb-96 | padding-bottom: 24rem; /\* 384px \*/ | | pl-96 | padding-left: 24rem; /\* 384px \*/ | Basic usage ----------- ### Add padding to a single side Control the padding on one side of an element using the `p{t|r|b|l}-{size}` utilities. For example, `pt-6` would add `1.5rem` of padding to the top of an element, `pr-4` would add `1rem` of padding to the right of an element, `pb-8` would add `2rem` of padding to the bottom of an element, and `pl-2` would add `0.5rem` of padding to the left of an element. ``` <div class="pt-6 ...">pt-6</div> <div class="pr-4 ...">pr-4</div> <div class="pb-8 ...">pb-8</div> <div class="pl-2 ...">pl-2</div> ``` ### Add horizontal padding Control the horizontal padding of an element using the `px-{size}` utilities. ``` <div class="px-8 ...">px-8</div> ``` ### Add vertical padding Control the vertical padding of an element using the `py-{size}` utilities. ``` <div class="py-8 ...">py-8</div> ``` ### Add padding to all sides Control the padding on all sides of an element using the `p-{size}` utilities. ``` <div class="p-8 ...">p-8</div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:py-8` to only apply the `py-8` utility on hover. ``` <div class="py-4 hover:py-8"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:py-8` to apply the `py-8` utility at only medium screen sizes and above. ``` <div class="py-4 md:py-8"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind’s padding scale uses the [default spacing scale](customizing-spacing). You can customize your spacing scale by editing `theme.spacing` or `theme.extend.spacing` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { spacing: { '5px': '5px', } } } } ``` Alternatively, you can customize just the padding scale by editing `theme.padding` or `theme.extend.padding` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { padding: { '5px': '5px', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `padding` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="p-[5px]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation.
programming_docs
tailwindcss Ring Width Quick reference --------------- | Class | Properties | | --- | --- | | ring-0 | box-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color); | | ring-1 | box-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color); | | ring-2 | box-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color); | | ring | box-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color); | | ring-4 | box-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color); | | ring-8 | box-shadow: var(--tw-ring-inset) 0 0 0 calc(8px + var(--tw-ring-offset-width)) var(--tw-ring-color); | | ring-inset | --tw-ring-inset: inset; | Basic Usage ----------- ### Adding a ring Use the `ring-{width}` utilities to apply solid box-shadow of a specific thickness to an element. Rings are a semi-transparent blue color by default, similar to the default focus ring style in many systems. ``` <button class="... ring-offset-2 ring-2">Button A</button> <button class="... ring-offset-2 ring">Button B</button> <button class="... ring-offset-2 ring-4">Button C</button> ``` Ring utilities compose gracefully with regular `shadow-{size}` utilities and can be combined on the same element. You can also control the color, opacity, and offset of rings using the [ringColor](ring-color), [ringOpacity](/docs/ring-color#changing-the-opacity), and [ringOffsetWidth](ring-offset-width) utilities. ### Focus rings The ring width utilities make it easy to use custom focus rings by adding `focus:` to the beginning of any `ring-{width}` utility. ``` <button class="... focus:ring-2">Save Changes</button> ``` The `focus` variant is enabled by default for the [ringColor](ring-color), [ringOpacity](/docs/ring-color#changing-the-opacity), [ringOffsetWidth](ring-offset-width), and [ringOffsetColor](ring-offset-color) utilities as well. ### Inset rings Use the `ring-inset` utility to force a ring to render on the inside of an element instead of the outside. This can be useful for elements at the edge of the screen where part of the ring wouldn’t be visible. ``` <button class="... ring-2 ring-pink-300 ring-inset"> Save Changes </button><button class="... ring-2 ring-pink-500 ring-inset"> Save Changes </button> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:ring-4` to only apply the `ring-4` utility on hover. ``` <div class="ring-2 hover:ring-4"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:ring-4` to apply the `ring-4` utility at only medium screen sizes and above. ``` <div class="ring-2 md:ring-4"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind includes a handful of general purpose `ring-width` utilities. You can customize these values by editing `theme.ringWidth` or `theme.extend.ringWidth` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { ringWidth: { '10': '10px', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `ring` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="ring-[10px]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Background Position Quick reference --------------- | Class | Properties | | --- | --- | | bg-bottom | background-position: bottom; | | bg-center | background-position: center; | | bg-left | background-position: left; | | bg-left-bottom | background-position: left bottom; | | bg-left-top | background-position: left top; | | bg-right | background-position: right; | | bg-right-bottom | background-position: right bottom; | | bg-right-top | background-position: right top; | | bg-top | background-position: top; | Basic usage ----------- ### Setting the background position Use the `bg-{side}` utilities to control the position of an element’s background image. ``` <div class="bg-no-repeat bg-left-top ..." style="background-image: url(...);"></div> <div class="bg-no-repeat bg-top ..." style="background-image: url(...);"></div> <div class="bg-no-repeat bg-right-top ..." style="background-image: url(...);"></div> <div class="bg-no-repeat bg-left ..." style="background-image: url(...);"></div> <div class="bg-no-repeat bg-center ..." style="background-image: url(...);"></div> <div class="bg-no-repeat bg-right ..." style="background-image: url(...);"></div> <div class="bg-no-repeat bg-left-bottom ..." style="background-image: url(...);"></div> <div class="bg-no-repeat bg-bottom ..." style="background-image: url(...);"></div> <div class="bg-no-repeat bg-right-bottom ..." style="background-image: url(...);"></div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:bg-top` to only apply the `bg-top` utility on hover. ``` <div class="bg-center hover:bg-top ..." style="background-image: url(...)"></div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:bg-top` to apply the `bg-top` utility at only medium screen sizes and above. ``` <div class="bg-center md:bg-top ..." style="background-image: url(...)"></div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind provides nine `background-position` utilities. You change, add, or remove these by editing the `theme.backgroundPosition` section of your Tailwind config. tailwind.config.js ``` module.exports = { theme: { backgroundPosition: { bottom: 'bottom', 'bottom-4': 'center bottom 1rem', center: 'center', left: 'left', 'left-bottom': 'left bottom', 'left-top': 'left top', right: 'right', 'right-bottom': 'right bottom', 'right-top': 'right top', top: 'top', 'top-4': 'center top 1rem', } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `background-position` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="bg-[center_top_1rem]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Ring Color Quick reference --------------- | Class | Properties | | --- | --- | | ring-inherit | --tw-ring-color: inherit; | | ring-current | --tw-ring-color: currentColor; | | ring-transparent | --tw-ring-color: transparent; | | ring-black | --tw-ring-color: rgb(0 0 0); | | ring-white | --tw-ring-color: rgb(255 255 255); | | ring-slate-50 | --tw-ring-color: rgb(248 250 252); | | ring-slate-100 | --tw-ring-color: rgb(241 245 249); | | ring-slate-200 | --tw-ring-color: rgb(226 232 240); | | ring-slate-300 | --tw-ring-color: rgb(203 213 225); | | ring-slate-400 | --tw-ring-color: rgb(148 163 184); | | ring-slate-500 | --tw-ring-color: rgb(100 116 139); | | ring-slate-600 | --tw-ring-color: rgb(71 85 105); | | ring-slate-700 | --tw-ring-color: rgb(51 65 85); | | ring-slate-800 | --tw-ring-color: rgb(30 41 59); | | ring-slate-900 | --tw-ring-color: rgb(15 23 42); | | ring-gray-50 | --tw-ring-color: rgb(249 250 251); | | ring-gray-100 | --tw-ring-color: rgb(243 244 246); | | ring-gray-200 | --tw-ring-color: rgb(229 231 235); | | ring-gray-300 | --tw-ring-color: rgb(209 213 219); | | ring-gray-400 | --tw-ring-color: rgb(156 163 175); | | ring-gray-500 | --tw-ring-color: rgb(107 114 128); | | ring-gray-600 | --tw-ring-color: rgb(75 85 99); | | ring-gray-700 | --tw-ring-color: rgb(55 65 81); | | ring-gray-800 | --tw-ring-color: rgb(31 41 55); | | ring-gray-900 | --tw-ring-color: rgb(17 24 39); | | ring-zinc-50 | --tw-ring-color: rgb(250 250 250); | | ring-zinc-100 | --tw-ring-color: rgb(244 244 245); | | ring-zinc-200 | --tw-ring-color: rgb(228 228 231); | | ring-zinc-300 | --tw-ring-color: rgb(212 212 216); | | ring-zinc-400 | --tw-ring-color: rgb(161 161 170); | | ring-zinc-500 | --tw-ring-color: rgb(113 113 122); | | ring-zinc-600 | --tw-ring-color: rgb(82 82 91); | | ring-zinc-700 | --tw-ring-color: rgb(63 63 70); | | ring-zinc-800 | --tw-ring-color: rgb(39 39 42); | | ring-zinc-900 | --tw-ring-color: rgb(24 24 27); | | ring-neutral-50 | --tw-ring-color: rgb(250 250 250); | | ring-neutral-100 | --tw-ring-color: rgb(245 245 245); | | ring-neutral-200 | --tw-ring-color: rgb(229 229 229); | | ring-neutral-300 | --tw-ring-color: rgb(212 212 212); | | ring-neutral-400 | --tw-ring-color: rgb(163 163 163); | | ring-neutral-500 | --tw-ring-color: rgb(115 115 115); | | ring-neutral-600 | --tw-ring-color: rgb(82 82 82); | | ring-neutral-700 | --tw-ring-color: rgb(64 64 64); | | ring-neutral-800 | --tw-ring-color: rgb(38 38 38); | | ring-neutral-900 | --tw-ring-color: rgb(23 23 23); | | ring-stone-50 | --tw-ring-color: rgb(250 250 249); | | ring-stone-100 | --tw-ring-color: rgb(245 245 244); | | ring-stone-200 | --tw-ring-color: rgb(231 229 228); | | ring-stone-300 | --tw-ring-color: rgb(214 211 209); | | ring-stone-400 | --tw-ring-color: rgb(168 162 158); | | ring-stone-500 | --tw-ring-color: rgb(120 113 108); | | ring-stone-600 | --tw-ring-color: rgb(87 83 78); | | ring-stone-700 | --tw-ring-color: rgb(68 64 60); | | ring-stone-800 | --tw-ring-color: rgb(41 37 36); | | ring-stone-900 | --tw-ring-color: rgb(28 25 23); | | ring-red-50 | --tw-ring-color: rgb(254 242 242); | | ring-red-100 | --tw-ring-color: rgb(254 226 226); | | ring-red-200 | --tw-ring-color: rgb(254 202 202); | | ring-red-300 | --tw-ring-color: rgb(252 165 165); | | ring-red-400 | --tw-ring-color: rgb(248 113 113); | | ring-red-500 | --tw-ring-color: rgb(239 68 68); | | ring-red-600 | --tw-ring-color: rgb(220 38 38); | | ring-red-700 | --tw-ring-color: rgb(185 28 28); | | ring-red-800 | --tw-ring-color: rgb(153 27 27); | | ring-red-900 | --tw-ring-color: rgb(127 29 29); | | ring-orange-50 | --tw-ring-color: rgb(255 247 237); | | ring-orange-100 | --tw-ring-color: rgb(255 237 213); | | ring-orange-200 | --tw-ring-color: rgb(254 215 170); | | ring-orange-300 | --tw-ring-color: rgb(253 186 116); | | ring-orange-400 | --tw-ring-color: rgb(251 146 60); | | ring-orange-500 | --tw-ring-color: rgb(249 115 22); | | ring-orange-600 | --tw-ring-color: rgb(234 88 12); | | ring-orange-700 | --tw-ring-color: rgb(194 65 12); | | ring-orange-800 | --tw-ring-color: rgb(154 52 18); | | ring-orange-900 | --tw-ring-color: rgb(124 45 18); | | ring-amber-50 | --tw-ring-color: rgb(255 251 235); | | ring-amber-100 | --tw-ring-color: rgb(254 243 199); | | ring-amber-200 | --tw-ring-color: rgb(253 230 138); | | ring-amber-300 | --tw-ring-color: rgb(252 211 77); | | ring-amber-400 | --tw-ring-color: rgb(251 191 36); | | ring-amber-500 | --tw-ring-color: rgb(245 158 11); | | ring-amber-600 | --tw-ring-color: rgb(217 119 6); | | ring-amber-700 | --tw-ring-color: rgb(180 83 9); | | ring-amber-800 | --tw-ring-color: rgb(146 64 14); | | ring-amber-900 | --tw-ring-color: rgb(120 53 15); | | ring-yellow-50 | --tw-ring-color: rgb(254 252 232); | | ring-yellow-100 | --tw-ring-color: rgb(254 249 195); | | ring-yellow-200 | --tw-ring-color: rgb(254 240 138); | | ring-yellow-300 | --tw-ring-color: rgb(253 224 71); | | ring-yellow-400 | --tw-ring-color: rgb(250 204 21); | | ring-yellow-500 | --tw-ring-color: rgb(234 179 8); | | ring-yellow-600 | --tw-ring-color: rgb(202 138 4); | | ring-yellow-700 | --tw-ring-color: rgb(161 98 7); | | ring-yellow-800 | --tw-ring-color: rgb(133 77 14); | | ring-yellow-900 | --tw-ring-color: rgb(113 63 18); | | ring-lime-50 | --tw-ring-color: rgb(247 254 231); | | ring-lime-100 | --tw-ring-color: rgb(236 252 203); | | ring-lime-200 | --tw-ring-color: rgb(217 249 157); | | ring-lime-300 | --tw-ring-color: rgb(190 242 100); | | ring-lime-400 | --tw-ring-color: rgb(163 230 53); | | ring-lime-500 | --tw-ring-color: rgb(132 204 22); | | ring-lime-600 | --tw-ring-color: rgb(101 163 13); | | ring-lime-700 | --tw-ring-color: rgb(77 124 15); | | ring-lime-800 | --tw-ring-color: rgb(63 98 18); | | ring-lime-900 | --tw-ring-color: rgb(54 83 20); | | ring-green-50 | --tw-ring-color: rgb(240 253 244); | | ring-green-100 | --tw-ring-color: rgb(220 252 231); | | ring-green-200 | --tw-ring-color: rgb(187 247 208); | | ring-green-300 | --tw-ring-color: rgb(134 239 172); | | ring-green-400 | --tw-ring-color: rgb(74 222 128); | | ring-green-500 | --tw-ring-color: rgb(34 197 94); | | ring-green-600 | --tw-ring-color: rgb(22 163 74); | | ring-green-700 | --tw-ring-color: rgb(21 128 61); | | ring-green-800 | --tw-ring-color: rgb(22 101 52); | | ring-green-900 | --tw-ring-color: rgb(20 83 45); | | ring-emerald-50 | --tw-ring-color: rgb(236 253 245); | | ring-emerald-100 | --tw-ring-color: rgb(209 250 229); | | ring-emerald-200 | --tw-ring-color: rgb(167 243 208); | | ring-emerald-300 | --tw-ring-color: rgb(110 231 183); | | ring-emerald-400 | --tw-ring-color: rgb(52 211 153); | | ring-emerald-500 | --tw-ring-color: rgb(16 185 129); | | ring-emerald-600 | --tw-ring-color: rgb(5 150 105); | | ring-emerald-700 | --tw-ring-color: rgb(4 120 87); | | ring-emerald-800 | --tw-ring-color: rgb(6 95 70); | | ring-emerald-900 | --tw-ring-color: rgb(6 78 59); | | ring-teal-50 | --tw-ring-color: rgb(240 253 250); | | ring-teal-100 | --tw-ring-color: rgb(204 251 241); | | ring-teal-200 | --tw-ring-color: rgb(153 246 228); | | ring-teal-300 | --tw-ring-color: rgb(94 234 212); | | ring-teal-400 | --tw-ring-color: rgb(45 212 191); | | ring-teal-500 | --tw-ring-color: rgb(20 184 166); | | ring-teal-600 | --tw-ring-color: rgb(13 148 136); | | ring-teal-700 | --tw-ring-color: rgb(15 118 110); | | ring-teal-800 | --tw-ring-color: rgb(17 94 89); | | ring-teal-900 | --tw-ring-color: rgb(19 78 74); | | ring-cyan-50 | --tw-ring-color: rgb(236 254 255); | | ring-cyan-100 | --tw-ring-color: rgb(207 250 254); | | ring-cyan-200 | --tw-ring-color: rgb(165 243 252); | | ring-cyan-300 | --tw-ring-color: rgb(103 232 249); | | ring-cyan-400 | --tw-ring-color: rgb(34 211 238); | | ring-cyan-500 | --tw-ring-color: rgb(6 182 212); | | ring-cyan-600 | --tw-ring-color: rgb(8 145 178); | | ring-cyan-700 | --tw-ring-color: rgb(14 116 144); | | ring-cyan-800 | --tw-ring-color: rgb(21 94 117); | | ring-cyan-900 | --tw-ring-color: rgb(22 78 99); | | ring-sky-50 | --tw-ring-color: rgb(240 249 255); | | ring-sky-100 | --tw-ring-color: rgb(224 242 254); | | ring-sky-200 | --tw-ring-color: rgb(186 230 253); | | ring-sky-300 | --tw-ring-color: rgb(125 211 252); | | ring-sky-400 | --tw-ring-color: rgb(56 189 248); | | ring-sky-500 | --tw-ring-color: rgb(14 165 233); | | ring-sky-600 | --tw-ring-color: rgb(2 132 199); | | ring-sky-700 | --tw-ring-color: rgb(3 105 161); | | ring-sky-800 | --tw-ring-color: rgb(7 89 133); | | ring-sky-900 | --tw-ring-color: rgb(12 74 110); | | ring-blue-50 | --tw-ring-color: rgb(239 246 255); | | ring-blue-100 | --tw-ring-color: rgb(219 234 254); | | ring-blue-200 | --tw-ring-color: rgb(191 219 254); | | ring-blue-300 | --tw-ring-color: rgb(147 197 253); | | ring-blue-400 | --tw-ring-color: rgb(96 165 250); | | ring-blue-500 | --tw-ring-color: rgb(59 130 246); | | ring-blue-600 | --tw-ring-color: rgb(37 99 235); | | ring-blue-700 | --tw-ring-color: rgb(29 78 216); | | ring-blue-800 | --tw-ring-color: rgb(30 64 175); | | ring-blue-900 | --tw-ring-color: rgb(30 58 138); | | ring-indigo-50 | --tw-ring-color: rgb(238 242 255); | | ring-indigo-100 | --tw-ring-color: rgb(224 231 255); | | ring-indigo-200 | --tw-ring-color: rgb(199 210 254); | | ring-indigo-300 | --tw-ring-color: rgb(165 180 252); | | ring-indigo-400 | --tw-ring-color: rgb(129 140 248); | | ring-indigo-500 | --tw-ring-color: rgb(99 102 241); | | ring-indigo-600 | --tw-ring-color: rgb(79 70 229); | | ring-indigo-700 | --tw-ring-color: rgb(67 56 202); | | ring-indigo-800 | --tw-ring-color: rgb(55 48 163); | | ring-indigo-900 | --tw-ring-color: rgb(49 46 129); | | ring-violet-50 | --tw-ring-color: rgb(245 243 255); | | ring-violet-100 | --tw-ring-color: rgb(237 233 254); | | ring-violet-200 | --tw-ring-color: rgb(221 214 254); | | ring-violet-300 | --tw-ring-color: rgb(196 181 253); | | ring-violet-400 | --tw-ring-color: rgb(167 139 250); | | ring-violet-500 | --tw-ring-color: rgb(139 92 246); | | ring-violet-600 | --tw-ring-color: rgb(124 58 237); | | ring-violet-700 | --tw-ring-color: rgb(109 40 217); | | ring-violet-800 | --tw-ring-color: rgb(91 33 182); | | ring-violet-900 | --tw-ring-color: rgb(76 29 149); | | ring-purple-50 | --tw-ring-color: rgb(250 245 255); | | ring-purple-100 | --tw-ring-color: rgb(243 232 255); | | ring-purple-200 | --tw-ring-color: rgb(233 213 255); | | ring-purple-300 | --tw-ring-color: rgb(216 180 254); | | ring-purple-400 | --tw-ring-color: rgb(192 132 252); | | ring-purple-500 | --tw-ring-color: rgb(168 85 247); | | ring-purple-600 | --tw-ring-color: rgb(147 51 234); | | ring-purple-700 | --tw-ring-color: rgb(126 34 206); | | ring-purple-800 | --tw-ring-color: rgb(107 33 168); | | ring-purple-900 | --tw-ring-color: rgb(88 28 135); | | ring-fuchsia-50 | --tw-ring-color: rgb(253 244 255); | | ring-fuchsia-100 | --tw-ring-color: rgb(250 232 255); | | ring-fuchsia-200 | --tw-ring-color: rgb(245 208 254); | | ring-fuchsia-300 | --tw-ring-color: rgb(240 171 252); | | ring-fuchsia-400 | --tw-ring-color: rgb(232 121 249); | | ring-fuchsia-500 | --tw-ring-color: rgb(217 70 239); | | ring-fuchsia-600 | --tw-ring-color: rgb(192 38 211); | | ring-fuchsia-700 | --tw-ring-color: rgb(162 28 175); | | ring-fuchsia-800 | --tw-ring-color: rgb(134 25 143); | | ring-fuchsia-900 | --tw-ring-color: rgb(112 26 117); | | ring-pink-50 | --tw-ring-color: rgb(253 242 248); | | ring-pink-100 | --tw-ring-color: rgb(252 231 243); | | ring-pink-200 | --tw-ring-color: rgb(251 207 232); | | ring-pink-300 | --tw-ring-color: rgb(249 168 212); | | ring-pink-400 | --tw-ring-color: rgb(244 114 182); | | ring-pink-500 | --tw-ring-color: rgb(236 72 153); | | ring-pink-600 | --tw-ring-color: rgb(219 39 119); | | ring-pink-700 | --tw-ring-color: rgb(190 24 93); | | ring-pink-800 | --tw-ring-color: rgb(157 23 77); | | ring-pink-900 | --tw-ring-color: rgb(131 24 67); | | ring-rose-50 | --tw-ring-color: rgb(255 241 242); | | ring-rose-100 | --tw-ring-color: rgb(255 228 230); | | ring-rose-200 | --tw-ring-color: rgb(254 205 211); | | ring-rose-300 | --tw-ring-color: rgb(253 164 175); | | ring-rose-400 | --tw-ring-color: rgb(251 113 133); | | ring-rose-500 | --tw-ring-color: rgb(244 63 94); | | ring-rose-600 | --tw-ring-color: rgb(225 29 72); | | ring-rose-700 | --tw-ring-color: rgb(190 18 60); | | ring-rose-800 | --tw-ring-color: rgb(159 18 57); | | ring-rose-900 | --tw-ring-color: rgb(136 19 55); | Basic usage ----------- ### Setting the ring color Use the `ring-{color}` utilities to set the color of an [outline ring](ring-width). ``` <button class="... ring-2 ring-blue-500"> Create account </button> ``` ### Changing the opacity Control the opacity of an element’s background color using the color opacity modifier. ``` <button class="... ring-2 ring-blue-500/50">Subscribe</button> ``` You can use any value defined in your [opacity scale](opacity), or use arbitrary values if you need to deviate from your design tokens. ``` <button class="... ring-2 ring-blue-500/[.55]">Subscribe</button> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:ring-blue-500` to only apply the `ring-blue-500` utility on hover. ``` <div class="ring ring-blue-300 hover:ring-blue-500"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:ring-blue-500` to apply the `ring-blue-500` utility at only medium screen sizes and above. ``` <div class="ring ring-blue-300 md:ring-blue-500"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind makes the entire [default color palette](customizing-colors#default-color-palette) available as ring colors. You can [customize your color palette](/docs/customizing-colors#customizing) by editing `theme.colors` or `theme.extend.colors` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { colors: { 'regal-blue': '#243c5a', }, } } } ``` Alternatively, you can customize just your ring colors by editing `theme.ringColor` or `theme.extend.ringColor` in your `tailwind.config.js` file. Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `ring-{color}` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="ring-[#50d71e]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation.
programming_docs
tailwindcss Resize Quick reference --------------- | Class | Properties | | --- | --- | | resize-none | resize: none; | | resize-y | resize: vertical; | | resize-x | resize: horizontal; | | resize | resize: both; | Basic usage ----------- ### Resizing in all directions Use `resize` to make an element horizontally and vertically resizable. ``` <textarea class="resize rounded-md"></textarea> ``` ### Resizing vertically Use `resize-y` to make an element vertically resizable. ``` <textarea class="resize-y rounded-md"></textarea> ``` ### Resizing horizontally Use `resize-x` to make an element horizontally resizable. ``` <textarea class="resize-x rounded-md"></textarea> ``` ### Preventing resizing Use `resize-none` to prevent an element from being resizable. ``` <textarea class="resize-none rounded-md"></textarea> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:resize` to only apply the `resize` utility on hover. ``` <div class="resize-none hover:resize"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:resize` to apply the `resize` utility at only medium screen sizes and above. ``` <div class="resize-none md:resize"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Rotate Quick reference --------------- | Class | Properties | | --- | --- | | rotate-0 | transform: rotate(0deg); | | rotate-1 | transform: rotate(1deg); | | rotate-2 | transform: rotate(2deg); | | rotate-3 | transform: rotate(3deg); | | rotate-6 | transform: rotate(6deg); | | rotate-12 | transform: rotate(12deg); | | rotate-45 | transform: rotate(45deg); | | rotate-90 | transform: rotate(90deg); | | rotate-180 | transform: rotate(180deg); | Basic usage ----------- ### Rotating an element Use the `rotate-{angle}` utilities to rotate an element. ``` <img class="rotate-0 ..."> <img class="rotate-45 ..."> <img class="rotate-90 ..."> <img class="rotate-180 ..."> ``` ### Using negative values To use a negative rotate value, prefix the class name with a dash to convert it to a negative value. ``` <img class="-rotate-45 ..."> ``` ### Removing transforms To remove all of the transforms on an element at once, use the `transform-none` utility: ``` <div class="scale-75 translate-x-4 skew-y-3 md:transform-none"> <!-- ... --> </div> ``` This can be useful when you want to remove transforms conditionally, such as on hover or at a particular breakpoint. ### Hardware acceleration If your transition performs better when rendered by the GPU instead of the CPU, you can force hardware acceleration by adding the `transform-gpu` utility: ``` <div class="rotate-45 transform-gpu"> <!-- ... --> </div> ``` Use `transform-cpu` to force things back to the CPU if you need to undo this conditionally. Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:rotate-45` to only apply the `rotate-45` utility on hover. ``` <div class="hover:rotate-45"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:rotate-45` to apply the `rotate-45` utility at only medium screen sizes and above. ``` <div class="md:rotate-45"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind includes a handful of general purpose `rotate` utilities. You can customize these values by editing `theme.rotate` or `theme.extend.rotate` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { rotate: { '17': '17deg', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `rotate` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="rotate-[17deg]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Margin Quick reference --------------- | Class | Properties | | --- | --- | | m-0 | margin: 0px; | | mx-0 | margin-left: 0px; margin-right: 0px; | | my-0 | margin-top: 0px; margin-bottom: 0px; | | mt-0 | margin-top: 0px; | | mr-0 | margin-right: 0px; | | mb-0 | margin-bottom: 0px; | | ml-0 | margin-left: 0px; | | m-px | margin: 1px; | | mx-px | margin-left: 1px; margin-right: 1px; | | my-px | margin-top: 1px; margin-bottom: 1px; | | mt-px | margin-top: 1px; | | mr-px | margin-right: 1px; | | mb-px | margin-bottom: 1px; | | ml-px | margin-left: 1px; | | m-0.5 | margin: 0.125rem; /\* 2px \*/ | | mx-0.5 | margin-left: 0.125rem; /\* 2px \*/ margin-right: 0.125rem; /\* 2px \*/ | | my-0.5 | margin-top: 0.125rem; /\* 2px \*/ margin-bottom: 0.125rem; /\* 2px \*/ | | mt-0.5 | margin-top: 0.125rem; /\* 2px \*/ | | mr-0.5 | margin-right: 0.125rem; /\* 2px \*/ | | mb-0.5 | margin-bottom: 0.125rem; /\* 2px \*/ | | ml-0.5 | margin-left: 0.125rem; /\* 2px \*/ | | m-1 | margin: 0.25rem; /\* 4px \*/ | | mx-1 | margin-left: 0.25rem; /\* 4px \*/ margin-right: 0.25rem; /\* 4px \*/ | | my-1 | margin-top: 0.25rem; /\* 4px \*/ margin-bottom: 0.25rem; /\* 4px \*/ | | mt-1 | margin-top: 0.25rem; /\* 4px \*/ | | mr-1 | margin-right: 0.25rem; /\* 4px \*/ | | mb-1 | margin-bottom: 0.25rem; /\* 4px \*/ | | ml-1 | margin-left: 0.25rem; /\* 4px \*/ | | m-1.5 | margin: 0.375rem; /\* 6px \*/ | | mx-1.5 | margin-left: 0.375rem; /\* 6px \*/ margin-right: 0.375rem; /\* 6px \*/ | | my-1.5 | margin-top: 0.375rem; /\* 6px \*/ margin-bottom: 0.375rem; /\* 6px \*/ | | mt-1.5 | margin-top: 0.375rem; /\* 6px \*/ | | mr-1.5 | margin-right: 0.375rem; /\* 6px \*/ | | mb-1.5 | margin-bottom: 0.375rem; /\* 6px \*/ | | ml-1.5 | margin-left: 0.375rem; /\* 6px \*/ | | m-2 | margin: 0.5rem; /\* 8px \*/ | | mx-2 | margin-left: 0.5rem; /\* 8px \*/ margin-right: 0.5rem; /\* 8px \*/ | | my-2 | margin-top: 0.5rem; /\* 8px \*/ margin-bottom: 0.5rem; /\* 8px \*/ | | mt-2 | margin-top: 0.5rem; /\* 8px \*/ | | mr-2 | margin-right: 0.5rem; /\* 8px \*/ | | mb-2 | margin-bottom: 0.5rem; /\* 8px \*/ | | ml-2 | margin-left: 0.5rem; /\* 8px \*/ | | m-2.5 | margin: 0.625rem; /\* 10px \*/ | | mx-2.5 | margin-left: 0.625rem; /\* 10px \*/ margin-right: 0.625rem; /\* 10px \*/ | | my-2.5 | margin-top: 0.625rem; /\* 10px \*/ margin-bottom: 0.625rem; /\* 10px \*/ | | mt-2.5 | margin-top: 0.625rem; /\* 10px \*/ | | mr-2.5 | margin-right: 0.625rem; /\* 10px \*/ | | mb-2.5 | margin-bottom: 0.625rem; /\* 10px \*/ | | ml-2.5 | margin-left: 0.625rem; /\* 10px \*/ | | m-3 | margin: 0.75rem; /\* 12px \*/ | | mx-3 | margin-left: 0.75rem; /\* 12px \*/ margin-right: 0.75rem; /\* 12px \*/ | | my-3 | margin-top: 0.75rem; /\* 12px \*/ margin-bottom: 0.75rem; /\* 12px \*/ | | mt-3 | margin-top: 0.75rem; /\* 12px \*/ | | mr-3 | margin-right: 0.75rem; /\* 12px \*/ | | mb-3 | margin-bottom: 0.75rem; /\* 12px \*/ | | ml-3 | margin-left: 0.75rem; /\* 12px \*/ | | m-3.5 | margin: 0.875rem; /\* 14px \*/ | | mx-3.5 | margin-left: 0.875rem; /\* 14px \*/ margin-right: 0.875rem; /\* 14px \*/ | | my-3.5 | margin-top: 0.875rem; /\* 14px \*/ margin-bottom: 0.875rem; /\* 14px \*/ | | mt-3.5 | margin-top: 0.875rem; /\* 14px \*/ | | mr-3.5 | margin-right: 0.875rem; /\* 14px \*/ | | mb-3.5 | margin-bottom: 0.875rem; /\* 14px \*/ | | ml-3.5 | margin-left: 0.875rem; /\* 14px \*/ | | m-4 | margin: 1rem; /\* 16px \*/ | | mx-4 | margin-left: 1rem; /\* 16px \*/ margin-right: 1rem; /\* 16px \*/ | | my-4 | margin-top: 1rem; /\* 16px \*/ margin-bottom: 1rem; /\* 16px \*/ | | mt-4 | margin-top: 1rem; /\* 16px \*/ | | mr-4 | margin-right: 1rem; /\* 16px \*/ | | mb-4 | margin-bottom: 1rem; /\* 16px \*/ | | ml-4 | margin-left: 1rem; /\* 16px \*/ | | m-5 | margin: 1.25rem; /\* 20px \*/ | | mx-5 | margin-left: 1.25rem; /\* 20px \*/ margin-right: 1.25rem; /\* 20px \*/ | | my-5 | margin-top: 1.25rem; /\* 20px \*/ margin-bottom: 1.25rem; /\* 20px \*/ | | mt-5 | margin-top: 1.25rem; /\* 20px \*/ | | mr-5 | margin-right: 1.25rem; /\* 20px \*/ | | mb-5 | margin-bottom: 1.25rem; /\* 20px \*/ | | ml-5 | margin-left: 1.25rem; /\* 20px \*/ | | m-6 | margin: 1.5rem; /\* 24px \*/ | | mx-6 | margin-left: 1.5rem; /\* 24px \*/ margin-right: 1.5rem; /\* 24px \*/ | | my-6 | margin-top: 1.5rem; /\* 24px \*/ margin-bottom: 1.5rem; /\* 24px \*/ | | mt-6 | margin-top: 1.5rem; /\* 24px \*/ | | mr-6 | margin-right: 1.5rem; /\* 24px \*/ | | mb-6 | margin-bottom: 1.5rem; /\* 24px \*/ | | ml-6 | margin-left: 1.5rem; /\* 24px \*/ | | m-7 | margin: 1.75rem; /\* 28px \*/ | | mx-7 | margin-left: 1.75rem; /\* 28px \*/ margin-right: 1.75rem; /\* 28px \*/ | | my-7 | margin-top: 1.75rem; /\* 28px \*/ margin-bottom: 1.75rem; /\* 28px \*/ | | mt-7 | margin-top: 1.75rem; /\* 28px \*/ | | mr-7 | margin-right: 1.75rem; /\* 28px \*/ | | mb-7 | margin-bottom: 1.75rem; /\* 28px \*/ | | ml-7 | margin-left: 1.75rem; /\* 28px \*/ | | m-8 | margin: 2rem; /\* 32px \*/ | | mx-8 | margin-left: 2rem; /\* 32px \*/ margin-right: 2rem; /\* 32px \*/ | | my-8 | margin-top: 2rem; /\* 32px \*/ margin-bottom: 2rem; /\* 32px \*/ | | mt-8 | margin-top: 2rem; /\* 32px \*/ | | mr-8 | margin-right: 2rem; /\* 32px \*/ | | mb-8 | margin-bottom: 2rem; /\* 32px \*/ | | ml-8 | margin-left: 2rem; /\* 32px \*/ | | m-9 | margin: 2.25rem; /\* 36px \*/ | | mx-9 | margin-left: 2.25rem; /\* 36px \*/ margin-right: 2.25rem; /\* 36px \*/ | | my-9 | margin-top: 2.25rem; /\* 36px \*/ margin-bottom: 2.25rem; /\* 36px \*/ | | mt-9 | margin-top: 2.25rem; /\* 36px \*/ | | mr-9 | margin-right: 2.25rem; /\* 36px \*/ | | mb-9 | margin-bottom: 2.25rem; /\* 36px \*/ | | ml-9 | margin-left: 2.25rem; /\* 36px \*/ | | m-10 | margin: 2.5rem; /\* 40px \*/ | | mx-10 | margin-left: 2.5rem; /\* 40px \*/ margin-right: 2.5rem; /\* 40px \*/ | | my-10 | margin-top: 2.5rem; /\* 40px \*/ margin-bottom: 2.5rem; /\* 40px \*/ | | mt-10 | margin-top: 2.5rem; /\* 40px \*/ | | mr-10 | margin-right: 2.5rem; /\* 40px \*/ | | mb-10 | margin-bottom: 2.5rem; /\* 40px \*/ | | ml-10 | margin-left: 2.5rem; /\* 40px \*/ | | m-11 | margin: 2.75rem; /\* 44px \*/ | | mx-11 | margin-left: 2.75rem; /\* 44px \*/ margin-right: 2.75rem; /\* 44px \*/ | | my-11 | margin-top: 2.75rem; /\* 44px \*/ margin-bottom: 2.75rem; /\* 44px \*/ | | mt-11 | margin-top: 2.75rem; /\* 44px \*/ | | mr-11 | margin-right: 2.75rem; /\* 44px \*/ | | mb-11 | margin-bottom: 2.75rem; /\* 44px \*/ | | ml-11 | margin-left: 2.75rem; /\* 44px \*/ | | m-12 | margin: 3rem; /\* 48px \*/ | | mx-12 | margin-left: 3rem; /\* 48px \*/ margin-right: 3rem; /\* 48px \*/ | | my-12 | margin-top: 3rem; /\* 48px \*/ margin-bottom: 3rem; /\* 48px \*/ | | mt-12 | margin-top: 3rem; /\* 48px \*/ | | mr-12 | margin-right: 3rem; /\* 48px \*/ | | mb-12 | margin-bottom: 3rem; /\* 48px \*/ | | ml-12 | margin-left: 3rem; /\* 48px \*/ | | m-14 | margin: 3.5rem; /\* 56px \*/ | | mx-14 | margin-left: 3.5rem; /\* 56px \*/ margin-right: 3.5rem; /\* 56px \*/ | | my-14 | margin-top: 3.5rem; /\* 56px \*/ margin-bottom: 3.5rem; /\* 56px \*/ | | mt-14 | margin-top: 3.5rem; /\* 56px \*/ | | mr-14 | margin-right: 3.5rem; /\* 56px \*/ | | mb-14 | margin-bottom: 3.5rem; /\* 56px \*/ | | ml-14 | margin-left: 3.5rem; /\* 56px \*/ | | m-16 | margin: 4rem; /\* 64px \*/ | | mx-16 | margin-left: 4rem; /\* 64px \*/ margin-right: 4rem; /\* 64px \*/ | | my-16 | margin-top: 4rem; /\* 64px \*/ margin-bottom: 4rem; /\* 64px \*/ | | mt-16 | margin-top: 4rem; /\* 64px \*/ | | mr-16 | margin-right: 4rem; /\* 64px \*/ | | mb-16 | margin-bottom: 4rem; /\* 64px \*/ | | ml-16 | margin-left: 4rem; /\* 64px \*/ | | m-20 | margin: 5rem; /\* 80px \*/ | | mx-20 | margin-left: 5rem; /\* 80px \*/ margin-right: 5rem; /\* 80px \*/ | | my-20 | margin-top: 5rem; /\* 80px \*/ margin-bottom: 5rem; /\* 80px \*/ | | mt-20 | margin-top: 5rem; /\* 80px \*/ | | mr-20 | margin-right: 5rem; /\* 80px \*/ | | mb-20 | margin-bottom: 5rem; /\* 80px \*/ | | ml-20 | margin-left: 5rem; /\* 80px \*/ | | m-24 | margin: 6rem; /\* 96px \*/ | | mx-24 | margin-left: 6rem; /\* 96px \*/ margin-right: 6rem; /\* 96px \*/ | | my-24 | margin-top: 6rem; /\* 96px \*/ margin-bottom: 6rem; /\* 96px \*/ | | mt-24 | margin-top: 6rem; /\* 96px \*/ | | mr-24 | margin-right: 6rem; /\* 96px \*/ | | mb-24 | margin-bottom: 6rem; /\* 96px \*/ | | ml-24 | margin-left: 6rem; /\* 96px \*/ | | m-28 | margin: 7rem; /\* 112px \*/ | | mx-28 | margin-left: 7rem; /\* 112px \*/ margin-right: 7rem; /\* 112px \*/ | | my-28 | margin-top: 7rem; /\* 112px \*/ margin-bottom: 7rem; /\* 112px \*/ | | mt-28 | margin-top: 7rem; /\* 112px \*/ | | mr-28 | margin-right: 7rem; /\* 112px \*/ | | mb-28 | margin-bottom: 7rem; /\* 112px \*/ | | ml-28 | margin-left: 7rem; /\* 112px \*/ | | m-32 | margin: 8rem; /\* 128px \*/ | | mx-32 | margin-left: 8rem; /\* 128px \*/ margin-right: 8rem; /\* 128px \*/ | | my-32 | margin-top: 8rem; /\* 128px \*/ margin-bottom: 8rem; /\* 128px \*/ | | mt-32 | margin-top: 8rem; /\* 128px \*/ | | mr-32 | margin-right: 8rem; /\* 128px \*/ | | mb-32 | margin-bottom: 8rem; /\* 128px \*/ | | ml-32 | margin-left: 8rem; /\* 128px \*/ | | m-36 | margin: 9rem; /\* 144px \*/ | | mx-36 | margin-left: 9rem; /\* 144px \*/ margin-right: 9rem; /\* 144px \*/ | | my-36 | margin-top: 9rem; /\* 144px \*/ margin-bottom: 9rem; /\* 144px \*/ | | mt-36 | margin-top: 9rem; /\* 144px \*/ | | mr-36 | margin-right: 9rem; /\* 144px \*/ | | mb-36 | margin-bottom: 9rem; /\* 144px \*/ | | ml-36 | margin-left: 9rem; /\* 144px \*/ | | m-40 | margin: 10rem; /\* 160px \*/ | | mx-40 | margin-left: 10rem; /\* 160px \*/ margin-right: 10rem; /\* 160px \*/ | | my-40 | margin-top: 10rem; /\* 160px \*/ margin-bottom: 10rem; /\* 160px \*/ | | mt-40 | margin-top: 10rem; /\* 160px \*/ | | mr-40 | margin-right: 10rem; /\* 160px \*/ | | mb-40 | margin-bottom: 10rem; /\* 160px \*/ | | ml-40 | margin-left: 10rem; /\* 160px \*/ | | m-44 | margin: 11rem; /\* 176px \*/ | | mx-44 | margin-left: 11rem; /\* 176px \*/ margin-right: 11rem; /\* 176px \*/ | | my-44 | margin-top: 11rem; /\* 176px \*/ margin-bottom: 11rem; /\* 176px \*/ | | mt-44 | margin-top: 11rem; /\* 176px \*/ | | mr-44 | margin-right: 11rem; /\* 176px \*/ | | mb-44 | margin-bottom: 11rem; /\* 176px \*/ | | ml-44 | margin-left: 11rem; /\* 176px \*/ | | m-48 | margin: 12rem; /\* 192px \*/ | | mx-48 | margin-left: 12rem; /\* 192px \*/ margin-right: 12rem; /\* 192px \*/ | | my-48 | margin-top: 12rem; /\* 192px \*/ margin-bottom: 12rem; /\* 192px \*/ | | mt-48 | margin-top: 12rem; /\* 192px \*/ | | mr-48 | margin-right: 12rem; /\* 192px \*/ | | mb-48 | margin-bottom: 12rem; /\* 192px \*/ | | ml-48 | margin-left: 12rem; /\* 192px \*/ | | m-52 | margin: 13rem; /\* 208px \*/ | | mx-52 | margin-left: 13rem; /\* 208px \*/ margin-right: 13rem; /\* 208px \*/ | | my-52 | margin-top: 13rem; /\* 208px \*/ margin-bottom: 13rem; /\* 208px \*/ | | mt-52 | margin-top: 13rem; /\* 208px \*/ | | mr-52 | margin-right: 13rem; /\* 208px \*/ | | mb-52 | margin-bottom: 13rem; /\* 208px \*/ | | ml-52 | margin-left: 13rem; /\* 208px \*/ | | m-56 | margin: 14rem; /\* 224px \*/ | | mx-56 | margin-left: 14rem; /\* 224px \*/ margin-right: 14rem; /\* 224px \*/ | | my-56 | margin-top: 14rem; /\* 224px \*/ margin-bottom: 14rem; /\* 224px \*/ | | mt-56 | margin-top: 14rem; /\* 224px \*/ | | mr-56 | margin-right: 14rem; /\* 224px \*/ | | mb-56 | margin-bottom: 14rem; /\* 224px \*/ | | ml-56 | margin-left: 14rem; /\* 224px \*/ | | m-60 | margin: 15rem; /\* 240px \*/ | | mx-60 | margin-left: 15rem; /\* 240px \*/ margin-right: 15rem; /\* 240px \*/ | | my-60 | margin-top: 15rem; /\* 240px \*/ margin-bottom: 15rem; /\* 240px \*/ | | mt-60 | margin-top: 15rem; /\* 240px \*/ | | mr-60 | margin-right: 15rem; /\* 240px \*/ | | mb-60 | margin-bottom: 15rem; /\* 240px \*/ | | ml-60 | margin-left: 15rem; /\* 240px \*/ | | m-64 | margin: 16rem; /\* 256px \*/ | | mx-64 | margin-left: 16rem; /\* 256px \*/ margin-right: 16rem; /\* 256px \*/ | | my-64 | margin-top: 16rem; /\* 256px \*/ margin-bottom: 16rem; /\* 256px \*/ | | mt-64 | margin-top: 16rem; /\* 256px \*/ | | mr-64 | margin-right: 16rem; /\* 256px \*/ | | mb-64 | margin-bottom: 16rem; /\* 256px \*/ | | ml-64 | margin-left: 16rem; /\* 256px \*/ | | m-72 | margin: 18rem; /\* 288px \*/ | | mx-72 | margin-left: 18rem; /\* 288px \*/ margin-right: 18rem; /\* 288px \*/ | | my-72 | margin-top: 18rem; /\* 288px \*/ margin-bottom: 18rem; /\* 288px \*/ | | mt-72 | margin-top: 18rem; /\* 288px \*/ | | mr-72 | margin-right: 18rem; /\* 288px \*/ | | mb-72 | margin-bottom: 18rem; /\* 288px \*/ | | ml-72 | margin-left: 18rem; /\* 288px \*/ | | m-80 | margin: 20rem; /\* 320px \*/ | | mx-80 | margin-left: 20rem; /\* 320px \*/ margin-right: 20rem; /\* 320px \*/ | | my-80 | margin-top: 20rem; /\* 320px \*/ margin-bottom: 20rem; /\* 320px \*/ | | mt-80 | margin-top: 20rem; /\* 320px \*/ | | mr-80 | margin-right: 20rem; /\* 320px \*/ | | mb-80 | margin-bottom: 20rem; /\* 320px \*/ | | ml-80 | margin-left: 20rem; /\* 320px \*/ | | m-96 | margin: 24rem; /\* 384px \*/ | | mx-96 | margin-left: 24rem; /\* 384px \*/ margin-right: 24rem; /\* 384px \*/ | | my-96 | margin-top: 24rem; /\* 384px \*/ margin-bottom: 24rem; /\* 384px \*/ | | mt-96 | margin-top: 24rem; /\* 384px \*/ | | mr-96 | margin-right: 24rem; /\* 384px \*/ | | mb-96 | margin-bottom: 24rem; /\* 384px \*/ | | ml-96 | margin-left: 24rem; /\* 384px \*/ | | m-auto | margin: auto; | | mx-auto | margin-left: auto; margin-right: auto; | | my-auto | margin-top: auto; margin-bottom: auto; | | mt-auto | margin-top: auto; | | mr-auto | margin-right: auto; | | mb-auto | margin-bottom: auto; | | ml-auto | margin-left: auto; | Basic usage ----------- ### Add margin to a single side Control the margin on one side of an element using the `m{t|r|b|l}-{size}` utilities. For example, `mt-6` would add `1.5rem` of margin to the top of an element, `mr-4` would add `1rem` of margin to the right of an element, `mb-8` would add `2rem` of margin to the bottom of an element, and `ml-2` would add `0.5rem` of margin to the left of an element. ``` <div class="mt-6 ...">mt-6</div> <div class="mr-4 ...">mr-4</div> <div class="mb-8 ...">mb-8</div> <div class="ml-2 ...">ml-2</div> ``` ### Add horizontal margin Control the horizontal margin of an element using the `mx-{size}` utilities. ``` <div class="mx-8 ...">mx-8</div> ``` ### Add vertical margin Control the vertical margin of an element using the `my-{size}` utilities. ``` <div class="my-8 ...">my-8</div> ``` ### Add margin to all sides Control the margin on all sides of an element using the `m-{size}` utilities. ``` <div class="m-8 ...">m-8</div> ``` ### Using negative values To use a negative margin value, prefix the class name with a dash to convert it to a negative value. ``` <div class="w-36 h-16 bg-sky-400 opacity-20 ..."></div> <div class="-mt-8 bg-sky-300 ...">-mt-8</div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:mt-8` to only apply the `mt-8` utility on hover. ``` <div class="mt-4 hover:mt-8"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:mt-8` to apply the `mt-8` utility at only medium screen sizes and above. ``` <div class="mt-4 md:mt-8"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind’s margin scale uses the [default spacing scale](customizing-spacing). You can customize your spacing scale by editing `theme.spacing` or `theme.extend.spacing` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { spacing: { '5px': '5px', } } } } ``` Alternatively, you can customize just the margin scale by editing `theme.margin` or `theme.extend.margin` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { margin: { '5px': '5px', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `margin` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="m-[5px]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation.
programming_docs
tailwindcss Height Quick reference --------------- | Class | Properties | | --- | --- | | h-0 | height: 0px; | | h-px | height: 1px; | | h-0.5 | height: 0.125rem; /\* 2px \*/ | | h-1 | height: 0.25rem; /\* 4px \*/ | | h-1.5 | height: 0.375rem; /\* 6px \*/ | | h-2 | height: 0.5rem; /\* 8px \*/ | | h-2.5 | height: 0.625rem; /\* 10px \*/ | | h-3 | height: 0.75rem; /\* 12px \*/ | | h-3.5 | height: 0.875rem; /\* 14px \*/ | | h-4 | height: 1rem; /\* 16px \*/ | | h-5 | height: 1.25rem; /\* 20px \*/ | | h-6 | height: 1.5rem; /\* 24px \*/ | | h-7 | height: 1.75rem; /\* 28px \*/ | | h-8 | height: 2rem; /\* 32px \*/ | | h-9 | height: 2.25rem; /\* 36px \*/ | | h-10 | height: 2.5rem; /\* 40px \*/ | | h-11 | height: 2.75rem; /\* 44px \*/ | | h-12 | height: 3rem; /\* 48px \*/ | | h-14 | height: 3.5rem; /\* 56px \*/ | | h-16 | height: 4rem; /\* 64px \*/ | | h-20 | height: 5rem; /\* 80px \*/ | | h-24 | height: 6rem; /\* 96px \*/ | | h-28 | height: 7rem; /\* 112px \*/ | | h-32 | height: 8rem; /\* 128px \*/ | | h-36 | height: 9rem; /\* 144px \*/ | | h-40 | height: 10rem; /\* 160px \*/ | | h-44 | height: 11rem; /\* 176px \*/ | | h-48 | height: 12rem; /\* 192px \*/ | | h-52 | height: 13rem; /\* 208px \*/ | | h-56 | height: 14rem; /\* 224px \*/ | | h-60 | height: 15rem; /\* 240px \*/ | | h-64 | height: 16rem; /\* 256px \*/ | | h-72 | height: 18rem; /\* 288px \*/ | | h-80 | height: 20rem; /\* 320px \*/ | | h-96 | height: 24rem; /\* 384px \*/ | | h-auto | height: auto; | | h-1/2 | height: 50%; | | h-1/3 | height: 33.333333%; | | h-2/3 | height: 66.666667%; | | h-1/4 | height: 25%; | | h-2/4 | height: 50%; | | h-3/4 | height: 75%; | | h-1/5 | height: 20%; | | h-2/5 | height: 40%; | | h-3/5 | height: 60%; | | h-4/5 | height: 80%; | | h-1/6 | height: 16.666667%; | | h-2/6 | height: 33.333333%; | | h-3/6 | height: 50%; | | h-4/6 | height: 66.666667%; | | h-5/6 | height: 83.333333%; | | h-full | height: 100%; | | h-screen | height: 100vh; | | h-min | height: min-content; | | h-max | height: max-content; | | h-fit | height: fit-content; | Basic usage ----------- ### Fixed heights Use `h-{number}` or `h-px` to set an element to a fixed height. ``` <div class="h-96 ...">h-96</div> <div class="h-80 ...">h-80</div> <div class="h-64 ...">h-64</div> <div class="h-48 ...">h-48</div> <div class="h-40 ...">h-40</div> <div class="h-32 ...">h-32</div> <div class="h-24 ...">h-24</div> ``` ### Full height Use `h-full` to set an element’s height to 100% of its parent, as long as the parent has a defined height. ``` <div class="h-48"> <div class="h-full ..."> <!-- This element will have a height of `12rem` (h-48) --> </div> </div> ``` ### Viewport height Use `h-screen` to make an element span the entire height of the viewport. ``` <div class="h-screen"> <!-- ... --> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:h-full` to only apply the `h-full` utility on hover. ``` <div class="h-8 hover:h-full"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:h-full` to apply the `h-full` utility at only medium screen sizes and above. ``` <div class="h-8 md:h-full"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind’s height scale is a combination of the [default spacing scale](customizing-spacing#default-spacing-scale) as well as some additional values specific to heights. You can customize your spacing scale by editing `theme.spacing` or `theme.extend.spacing` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { spacing: { '128': '32rem', } } } } ``` To customize height separately, use the `theme.height` section of your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { height: { '128': '32rem', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `height` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="h-[32rem]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Scroll Padding Quick reference --------------- | Class | Properties | | --- | --- | | scroll-p-0 | scroll-padding: 0px; | | scroll-px-0 | scroll-padding-left: 0px; scroll-padding-right: 0px; | | scroll-py-0 | scroll-padding-top: 0px; scroll-padding-bottom: 0px; | | scroll-pt-0 | scroll-padding-top: 0px; | | scroll-pr-0 | scroll-padding-right: 0px; | | scroll-pb-0 | scroll-padding-bottom: 0px; | | scroll-pl-0 | scroll-padding-left: 0px; | | scroll-p-px | scroll-padding: 1px; | | scroll-px-px | scroll-padding-left: 1px; scroll-padding-right: 1px; | | scroll-py-px | scroll-padding-top: 1px; scroll-padding-bottom: 1px; | | scroll-pt-px | scroll-padding-top: 1px; | | scroll-pr-px | scroll-padding-right: 1px; | | scroll-pb-px | scroll-padding-bottom: 1px; | | scroll-pl-px | scroll-padding-left: 1px; | | scroll-p-0.5 | scroll-padding: 0.125rem; /\* 2px \*/ | | scroll-px-0.5 | scroll-padding-left: 0.125rem; /\* 2px \*/ scroll-padding-right: 0.125rem; /\* 2px \*/ | | scroll-py-0.5 | scroll-padding-top: 0.125rem; /\* 2px \*/ scroll-padding-bottom: 0.125rem; /\* 2px \*/ | | scroll-pt-0.5 | scroll-padding-top: 0.125rem; /\* 2px \*/ | | scroll-pr-0.5 | scroll-padding-right: 0.125rem; /\* 2px \*/ | | scroll-pb-0.5 | scroll-padding-bottom: 0.125rem; /\* 2px \*/ | | scroll-pl-0.5 | scroll-padding-left: 0.125rem; /\* 2px \*/ | | scroll-p-1 | scroll-padding: 0.25rem; /\* 4px \*/ | | scroll-px-1 | scroll-padding-left: 0.25rem; /\* 4px \*/ scroll-padding-right: 0.25rem; /\* 4px \*/ | | scroll-py-1 | scroll-padding-top: 0.25rem; /\* 4px \*/ scroll-padding-bottom: 0.25rem; /\* 4px \*/ | | scroll-pt-1 | scroll-padding-top: 0.25rem; /\* 4px \*/ | | scroll-pr-1 | scroll-padding-right: 0.25rem; /\* 4px \*/ | | scroll-pb-1 | scroll-padding-bottom: 0.25rem; /\* 4px \*/ | | scroll-pl-1 | scroll-padding-left: 0.25rem; /\* 4px \*/ | | scroll-p-1.5 | scroll-padding: 0.375rem; /\* 6px \*/ | | scroll-px-1.5 | scroll-padding-left: 0.375rem; /\* 6px \*/ scroll-padding-right: 0.375rem; /\* 6px \*/ | | scroll-py-1.5 | scroll-padding-top: 0.375rem; /\* 6px \*/ scroll-padding-bottom: 0.375rem; /\* 6px \*/ | | scroll-pt-1.5 | scroll-padding-top: 0.375rem; /\* 6px \*/ | | scroll-pr-1.5 | scroll-padding-right: 0.375rem; /\* 6px \*/ | | scroll-pb-1.5 | scroll-padding-bottom: 0.375rem; /\* 6px \*/ | | scroll-pl-1.5 | scroll-padding-left: 0.375rem; /\* 6px \*/ | | scroll-p-2 | scroll-padding: 0.5rem; /\* 8px \*/ | | scroll-px-2 | scroll-padding-left: 0.5rem; /\* 8px \*/ scroll-padding-right: 0.5rem; /\* 8px \*/ | | scroll-py-2 | scroll-padding-top: 0.5rem; /\* 8px \*/ scroll-padding-bottom: 0.5rem; /\* 8px \*/ | | scroll-pt-2 | scroll-padding-top: 0.5rem; /\* 8px \*/ | | scroll-pr-2 | scroll-padding-right: 0.5rem; /\* 8px \*/ | | scroll-pb-2 | scroll-padding-bottom: 0.5rem; /\* 8px \*/ | | scroll-pl-2 | scroll-padding-left: 0.5rem; /\* 8px \*/ | | scroll-p-2.5 | scroll-padding: 0.625rem; /\* 10px \*/ | | scroll-px-2.5 | scroll-padding-left: 0.625rem; /\* 10px \*/ scroll-padding-right: 0.625rem; /\* 10px \*/ | | scroll-py-2.5 | scroll-padding-top: 0.625rem; /\* 10px \*/ scroll-padding-bottom: 0.625rem; /\* 10px \*/ | | scroll-pt-2.5 | scroll-padding-top: 0.625rem; /\* 10px \*/ | | scroll-pr-2.5 | scroll-padding-right: 0.625rem; /\* 10px \*/ | | scroll-pb-2.5 | scroll-padding-bottom: 0.625rem; /\* 10px \*/ | | scroll-pl-2.5 | scroll-padding-left: 0.625rem; /\* 10px \*/ | | scroll-p-3 | scroll-padding: 0.75rem; /\* 12px \*/ | | scroll-px-3 | scroll-padding-left: 0.75rem; /\* 12px \*/ scroll-padding-right: 0.75rem; /\* 12px \*/ | | scroll-py-3 | scroll-padding-top: 0.75rem; /\* 12px \*/ scroll-padding-bottom: 0.75rem; /\* 12px \*/ | | scroll-pt-3 | scroll-padding-top: 0.75rem; /\* 12px \*/ | | scroll-pr-3 | scroll-padding-right: 0.75rem; /\* 12px \*/ | | scroll-pb-3 | scroll-padding-bottom: 0.75rem; /\* 12px \*/ | | scroll-pl-3 | scroll-padding-left: 0.75rem; /\* 12px \*/ | | scroll-p-3.5 | scroll-padding: 0.875rem; /\* 14px \*/ | | scroll-px-3.5 | scroll-padding-left: 0.875rem; /\* 14px \*/ scroll-padding-right: 0.875rem; /\* 14px \*/ | | scroll-py-3.5 | scroll-padding-top: 0.875rem; /\* 14px \*/ scroll-padding-bottom: 0.875rem; /\* 14px \*/ | | scroll-pt-3.5 | scroll-padding-top: 0.875rem; /\* 14px \*/ | | scroll-pr-3.5 | scroll-padding-right: 0.875rem; /\* 14px \*/ | | scroll-pb-3.5 | scroll-padding-bottom: 0.875rem; /\* 14px \*/ | | scroll-pl-3.5 | scroll-padding-left: 0.875rem; /\* 14px \*/ | | scroll-p-4 | scroll-padding: 1rem; /\* 16px \*/ | | scroll-px-4 | scroll-padding-left: 1rem; /\* 16px \*/ scroll-padding-right: 1rem; /\* 16px \*/ | | scroll-py-4 | scroll-padding-top: 1rem; /\* 16px \*/ scroll-padding-bottom: 1rem; /\* 16px \*/ | | scroll-pt-4 | scroll-padding-top: 1rem; /\* 16px \*/ | | scroll-pr-4 | scroll-padding-right: 1rem; /\* 16px \*/ | | scroll-pb-4 | scroll-padding-bottom: 1rem; /\* 16px \*/ | | scroll-pl-4 | scroll-padding-left: 1rem; /\* 16px \*/ | | scroll-p-5 | scroll-padding: 1.25rem; /\* 20px \*/ | | scroll-px-5 | scroll-padding-left: 1.25rem; /\* 20px \*/ scroll-padding-right: 1.25rem; /\* 20px \*/ | | scroll-py-5 | scroll-padding-top: 1.25rem; /\* 20px \*/ scroll-padding-bottom: 1.25rem; /\* 20px \*/ | | scroll-pt-5 | scroll-padding-top: 1.25rem; /\* 20px \*/ | | scroll-pr-5 | scroll-padding-right: 1.25rem; /\* 20px \*/ | | scroll-pb-5 | scroll-padding-bottom: 1.25rem; /\* 20px \*/ | | scroll-pl-5 | scroll-padding-left: 1.25rem; /\* 20px \*/ | | scroll-p-6 | scroll-padding: 1.5rem; /\* 24px \*/ | | scroll-px-6 | scroll-padding-left: 1.5rem; /\* 24px \*/ scroll-padding-right: 1.5rem; /\* 24px \*/ | | scroll-py-6 | scroll-padding-top: 1.5rem; /\* 24px \*/ scroll-padding-bottom: 1.5rem; /\* 24px \*/ | | scroll-pt-6 | scroll-padding-top: 1.5rem; /\* 24px \*/ | | scroll-pr-6 | scroll-padding-right: 1.5rem; /\* 24px \*/ | | scroll-pb-6 | scroll-padding-bottom: 1.5rem; /\* 24px \*/ | | scroll-pl-6 | scroll-padding-left: 1.5rem; /\* 24px \*/ | | scroll-p-7 | scroll-padding: 1.75rem; /\* 28px \*/ | | scroll-px-7 | scroll-padding-left: 1.75rem; /\* 28px \*/ scroll-padding-right: 1.75rem; /\* 28px \*/ | | scroll-py-7 | scroll-padding-top: 1.75rem; /\* 28px \*/ scroll-padding-bottom: 1.75rem; /\* 28px \*/ | | scroll-pt-7 | scroll-padding-top: 1.75rem; /\* 28px \*/ | | scroll-pr-7 | scroll-padding-right: 1.75rem; /\* 28px \*/ | | scroll-pb-7 | scroll-padding-bottom: 1.75rem; /\* 28px \*/ | | scroll-pl-7 | scroll-padding-left: 1.75rem; /\* 28px \*/ | | scroll-p-8 | scroll-padding: 2rem; /\* 32px \*/ | | scroll-px-8 | scroll-padding-left: 2rem; /\* 32px \*/ scroll-padding-right: 2rem; /\* 32px \*/ | | scroll-py-8 | scroll-padding-top: 2rem; /\* 32px \*/ scroll-padding-bottom: 2rem; /\* 32px \*/ | | scroll-pt-8 | scroll-padding-top: 2rem; /\* 32px \*/ | | scroll-pr-8 | scroll-padding-right: 2rem; /\* 32px \*/ | | scroll-pb-8 | scroll-padding-bottom: 2rem; /\* 32px \*/ | | scroll-pl-8 | scroll-padding-left: 2rem; /\* 32px \*/ | | scroll-p-9 | scroll-padding: 2.25rem; /\* 36px \*/ | | scroll-px-9 | scroll-padding-left: 2.25rem; /\* 36px \*/ scroll-padding-right: 2.25rem; /\* 36px \*/ | | scroll-py-9 | scroll-padding-top: 2.25rem; /\* 36px \*/ scroll-padding-bottom: 2.25rem; /\* 36px \*/ | | scroll-pt-9 | scroll-padding-top: 2.25rem; /\* 36px \*/ | | scroll-pr-9 | scroll-padding-right: 2.25rem; /\* 36px \*/ | | scroll-pb-9 | scroll-padding-bottom: 2.25rem; /\* 36px \*/ | | scroll-pl-9 | scroll-padding-left: 2.25rem; /\* 36px \*/ | | scroll-p-10 | scroll-padding: 2.5rem; /\* 40px \*/ | | scroll-px-10 | scroll-padding-left: 2.5rem; /\* 40px \*/ scroll-padding-right: 2.5rem; /\* 40px \*/ | | scroll-py-10 | scroll-padding-top: 2.5rem; /\* 40px \*/ scroll-padding-bottom: 2.5rem; /\* 40px \*/ | | scroll-pt-10 | scroll-padding-top: 2.5rem; /\* 40px \*/ | | scroll-pr-10 | scroll-padding-right: 2.5rem; /\* 40px \*/ | | scroll-pb-10 | scroll-padding-bottom: 2.5rem; /\* 40px \*/ | | scroll-pl-10 | scroll-padding-left: 2.5rem; /\* 40px \*/ | | scroll-p-11 | scroll-padding: 2.75rem; /\* 44px \*/ | | scroll-px-11 | scroll-padding-left: 2.75rem; /\* 44px \*/ scroll-padding-right: 2.75rem; /\* 44px \*/ | | scroll-py-11 | scroll-padding-top: 2.75rem; /\* 44px \*/ scroll-padding-bottom: 2.75rem; /\* 44px \*/ | | scroll-pt-11 | scroll-padding-top: 2.75rem; /\* 44px \*/ | | scroll-pr-11 | scroll-padding-right: 2.75rem; /\* 44px \*/ | | scroll-pb-11 | scroll-padding-bottom: 2.75rem; /\* 44px \*/ | | scroll-pl-11 | scroll-padding-left: 2.75rem; /\* 44px \*/ | | scroll-p-12 | scroll-padding: 3rem; /\* 48px \*/ | | scroll-px-12 | scroll-padding-left: 3rem; /\* 48px \*/ scroll-padding-right: 3rem; /\* 48px \*/ | | scroll-py-12 | scroll-padding-top: 3rem; /\* 48px \*/ scroll-padding-bottom: 3rem; /\* 48px \*/ | | scroll-pt-12 | scroll-padding-top: 3rem; /\* 48px \*/ | | scroll-pr-12 | scroll-padding-right: 3rem; /\* 48px \*/ | | scroll-pb-12 | scroll-padding-bottom: 3rem; /\* 48px \*/ | | scroll-pl-12 | scroll-padding-left: 3rem; /\* 48px \*/ | | scroll-p-14 | scroll-padding: 3.5rem; /\* 56px \*/ | | scroll-px-14 | scroll-padding-left: 3.5rem; /\* 56px \*/ scroll-padding-right: 3.5rem; /\* 56px \*/ | | scroll-py-14 | scroll-padding-top: 3.5rem; /\* 56px \*/ scroll-padding-bottom: 3.5rem; /\* 56px \*/ | | scroll-pt-14 | scroll-padding-top: 3.5rem; /\* 56px \*/ | | scroll-pr-14 | scroll-padding-right: 3.5rem; /\* 56px \*/ | | scroll-pb-14 | scroll-padding-bottom: 3.5rem; /\* 56px \*/ | | scroll-pl-14 | scroll-padding-left: 3.5rem; /\* 56px \*/ | | scroll-p-16 | scroll-padding: 4rem; /\* 64px \*/ | | scroll-px-16 | scroll-padding-left: 4rem; /\* 64px \*/ scroll-padding-right: 4rem; /\* 64px \*/ | | scroll-py-16 | scroll-padding-top: 4rem; /\* 64px \*/ scroll-padding-bottom: 4rem; /\* 64px \*/ | | scroll-pt-16 | scroll-padding-top: 4rem; /\* 64px \*/ | | scroll-pr-16 | scroll-padding-right: 4rem; /\* 64px \*/ | | scroll-pb-16 | scroll-padding-bottom: 4rem; /\* 64px \*/ | | scroll-pl-16 | scroll-padding-left: 4rem; /\* 64px \*/ | | scroll-p-20 | scroll-padding: 5rem; /\* 80px \*/ | | scroll-px-20 | scroll-padding-left: 5rem; /\* 80px \*/ scroll-padding-right: 5rem; /\* 80px \*/ | | scroll-py-20 | scroll-padding-top: 5rem; /\* 80px \*/ scroll-padding-bottom: 5rem; /\* 80px \*/ | | scroll-pt-20 | scroll-padding-top: 5rem; /\* 80px \*/ | | scroll-pr-20 | scroll-padding-right: 5rem; /\* 80px \*/ | | scroll-pb-20 | scroll-padding-bottom: 5rem; /\* 80px \*/ | | scroll-pl-20 | scroll-padding-left: 5rem; /\* 80px \*/ | | scroll-p-24 | scroll-padding: 6rem; /\* 96px \*/ | | scroll-px-24 | scroll-padding-left: 6rem; /\* 96px \*/ scroll-padding-right: 6rem; /\* 96px \*/ | | scroll-py-24 | scroll-padding-top: 6rem; /\* 96px \*/ scroll-padding-bottom: 6rem; /\* 96px \*/ | | scroll-pt-24 | scroll-padding-top: 6rem; /\* 96px \*/ | | scroll-pr-24 | scroll-padding-right: 6rem; /\* 96px \*/ | | scroll-pb-24 | scroll-padding-bottom: 6rem; /\* 96px \*/ | | scroll-pl-24 | scroll-padding-left: 6rem; /\* 96px \*/ | | scroll-p-28 | scroll-padding: 7rem; /\* 112px \*/ | | scroll-px-28 | scroll-padding-left: 7rem; /\* 112px \*/ scroll-padding-right: 7rem; /\* 112px \*/ | | scroll-py-28 | scroll-padding-top: 7rem; /\* 112px \*/ scroll-padding-bottom: 7rem; /\* 112px \*/ | | scroll-pt-28 | scroll-padding-top: 7rem; /\* 112px \*/ | | scroll-pr-28 | scroll-padding-right: 7rem; /\* 112px \*/ | | scroll-pb-28 | scroll-padding-bottom: 7rem; /\* 112px \*/ | | scroll-pl-28 | scroll-padding-left: 7rem; /\* 112px \*/ | | scroll-p-32 | scroll-padding: 8rem; /\* 128px \*/ | | scroll-px-32 | scroll-padding-left: 8rem; /\* 128px \*/ scroll-padding-right: 8rem; /\* 128px \*/ | | scroll-py-32 | scroll-padding-top: 8rem; /\* 128px \*/ scroll-padding-bottom: 8rem; /\* 128px \*/ | | scroll-pt-32 | scroll-padding-top: 8rem; /\* 128px \*/ | | scroll-pr-32 | scroll-padding-right: 8rem; /\* 128px \*/ | | scroll-pb-32 | scroll-padding-bottom: 8rem; /\* 128px \*/ | | scroll-pl-32 | scroll-padding-left: 8rem; /\* 128px \*/ | | scroll-p-36 | scroll-padding: 9rem; /\* 144px \*/ | | scroll-px-36 | scroll-padding-left: 9rem; /\* 144px \*/ scroll-padding-right: 9rem; /\* 144px \*/ | | scroll-py-36 | scroll-padding-top: 9rem; /\* 144px \*/ scroll-padding-bottom: 9rem; /\* 144px \*/ | | scroll-pt-36 | scroll-padding-top: 9rem; /\* 144px \*/ | | scroll-pr-36 | scroll-padding-right: 9rem; /\* 144px \*/ | | scroll-pb-36 | scroll-padding-bottom: 9rem; /\* 144px \*/ | | scroll-pl-36 | scroll-padding-left: 9rem; /\* 144px \*/ | | scroll-p-40 | scroll-padding: 10rem; /\* 160px \*/ | | scroll-px-40 | scroll-padding-left: 10rem; /\* 160px \*/ scroll-padding-right: 10rem; /\* 160px \*/ | | scroll-py-40 | scroll-padding-top: 10rem; /\* 160px \*/ scroll-padding-bottom: 10rem; /\* 160px \*/ | | scroll-pt-40 | scroll-padding-top: 10rem; /\* 160px \*/ | | scroll-pr-40 | scroll-padding-right: 10rem; /\* 160px \*/ | | scroll-pb-40 | scroll-padding-bottom: 10rem; /\* 160px \*/ | | scroll-pl-40 | scroll-padding-left: 10rem; /\* 160px \*/ | | scroll-p-44 | scroll-padding: 11rem; /\* 176px \*/ | | scroll-px-44 | scroll-padding-left: 11rem; /\* 176px \*/ scroll-padding-right: 11rem; /\* 176px \*/ | | scroll-py-44 | scroll-padding-top: 11rem; /\* 176px \*/ scroll-padding-bottom: 11rem; /\* 176px \*/ | | scroll-pt-44 | scroll-padding-top: 11rem; /\* 176px \*/ | | scroll-pr-44 | scroll-padding-right: 11rem; /\* 176px \*/ | | scroll-pb-44 | scroll-padding-bottom: 11rem; /\* 176px \*/ | | scroll-pl-44 | scroll-padding-left: 11rem; /\* 176px \*/ | | scroll-p-48 | scroll-padding: 12rem; /\* 192px \*/ | | scroll-px-48 | scroll-padding-left: 12rem; /\* 192px \*/ scroll-padding-right: 12rem; /\* 192px \*/ | | scroll-py-48 | scroll-padding-top: 12rem; /\* 192px \*/ scroll-padding-bottom: 12rem; /\* 192px \*/ | | scroll-pt-48 | scroll-padding-top: 12rem; /\* 192px \*/ | | scroll-pr-48 | scroll-padding-right: 12rem; /\* 192px \*/ | | scroll-pb-48 | scroll-padding-bottom: 12rem; /\* 192px \*/ | | scroll-pl-48 | scroll-padding-left: 12rem; /\* 192px \*/ | | scroll-p-52 | scroll-padding: 13rem; /\* 208px \*/ | | scroll-px-52 | scroll-padding-left: 13rem; /\* 208px \*/ scroll-padding-right: 13rem; /\* 208px \*/ | | scroll-py-52 | scroll-padding-top: 13rem; /\* 208px \*/ scroll-padding-bottom: 13rem; /\* 208px \*/ | | scroll-pt-52 | scroll-padding-top: 13rem; /\* 208px \*/ | | scroll-pr-52 | scroll-padding-right: 13rem; /\* 208px \*/ | | scroll-pb-52 | scroll-padding-bottom: 13rem; /\* 208px \*/ | | scroll-pl-52 | scroll-padding-left: 13rem; /\* 208px \*/ | | scroll-p-56 | scroll-padding: 14rem; /\* 224px \*/ | | scroll-px-56 | scroll-padding-left: 14rem; /\* 224px \*/ scroll-padding-right: 14rem; /\* 224px \*/ | | scroll-py-56 | scroll-padding-top: 14rem; /\* 224px \*/ scroll-padding-bottom: 14rem; /\* 224px \*/ | | scroll-pt-56 | scroll-padding-top: 14rem; /\* 224px \*/ | | scroll-pr-56 | scroll-padding-right: 14rem; /\* 224px \*/ | | scroll-pb-56 | scroll-padding-bottom: 14rem; /\* 224px \*/ | | scroll-pl-56 | scroll-padding-left: 14rem; /\* 224px \*/ | | scroll-p-60 | scroll-padding: 15rem; /\* 240px \*/ | | scroll-px-60 | scroll-padding-left: 15rem; /\* 240px \*/ scroll-padding-right: 15rem; /\* 240px \*/ | | scroll-py-60 | scroll-padding-top: 15rem; /\* 240px \*/ scroll-padding-bottom: 15rem; /\* 240px \*/ | | scroll-pt-60 | scroll-padding-top: 15rem; /\* 240px \*/ | | scroll-pr-60 | scroll-padding-right: 15rem; /\* 240px \*/ | | scroll-pb-60 | scroll-padding-bottom: 15rem; /\* 240px \*/ | | scroll-pl-60 | scroll-padding-left: 15rem; /\* 240px \*/ | | scroll-p-64 | scroll-padding: 16rem; /\* 256px \*/ | | scroll-px-64 | scroll-padding-left: 16rem; /\* 256px \*/ scroll-padding-right: 16rem; /\* 256px \*/ | | scroll-py-64 | scroll-padding-top: 16rem; /\* 256px \*/ scroll-padding-bottom: 16rem; /\* 256px \*/ | | scroll-pt-64 | scroll-padding-top: 16rem; /\* 256px \*/ | | scroll-pr-64 | scroll-padding-right: 16rem; /\* 256px \*/ | | scroll-pb-64 | scroll-padding-bottom: 16rem; /\* 256px \*/ | | scroll-pl-64 | scroll-padding-left: 16rem; /\* 256px \*/ | | scroll-p-72 | scroll-padding: 18rem; /\* 288px \*/ | | scroll-px-72 | scroll-padding-left: 18rem; /\* 288px \*/ scroll-padding-right: 18rem; /\* 288px \*/ | | scroll-py-72 | scroll-padding-top: 18rem; /\* 288px \*/ scroll-padding-bottom: 18rem; /\* 288px \*/ | | scroll-pt-72 | scroll-padding-top: 18rem; /\* 288px \*/ | | scroll-pr-72 | scroll-padding-right: 18rem; /\* 288px \*/ | | scroll-pb-72 | scroll-padding-bottom: 18rem; /\* 288px \*/ | | scroll-pl-72 | scroll-padding-left: 18rem; /\* 288px \*/ | | scroll-p-80 | scroll-padding: 20rem; /\* 320px \*/ | | scroll-px-80 | scroll-padding-left: 20rem; /\* 320px \*/ scroll-padding-right: 20rem; /\* 320px \*/ | | scroll-py-80 | scroll-padding-top: 20rem; /\* 320px \*/ scroll-padding-bottom: 20rem; /\* 320px \*/ | | scroll-pt-80 | scroll-padding-top: 20rem; /\* 320px \*/ | | scroll-pr-80 | scroll-padding-right: 20rem; /\* 320px \*/ | | scroll-pb-80 | scroll-padding-bottom: 20rem; /\* 320px \*/ | | scroll-pl-80 | scroll-padding-left: 20rem; /\* 320px \*/ | | scroll-p-96 | scroll-padding: 24rem; /\* 384px \*/ | | scroll-px-96 | scroll-padding-left: 24rem; /\* 384px \*/ scroll-padding-right: 24rem; /\* 384px \*/ | | scroll-py-96 | scroll-padding-top: 24rem; /\* 384px \*/ scroll-padding-bottom: 24rem; /\* 384px \*/ | | scroll-pt-96 | scroll-padding-top: 24rem; /\* 384px \*/ | | scroll-pr-96 | scroll-padding-right: 24rem; /\* 384px \*/ | | scroll-pb-96 | scroll-padding-bottom: 24rem; /\* 384px \*/ | | scroll-pl-96 | scroll-padding-left: 24rem; /\* 384px \*/ | Basic usage ----------- ### Setting the scroll padding Use the `scroll-p{side}-{size}` utilities to set the scroll offset of an element within a snap container. ``` <div class="scroll-pl-6 snap-x ..."> <div class="snap-start ..."> <img src="https://images.unsplash.com/photo-1604999565976-8913ad2ddb7c?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-start ..."> <img src="https://images.unsplash.com/photo-1540206351-d6465b3ac5c1?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-start ..."> <img src="https://images.unsplash.com/photo-1622890806166-111d7f6c7c97?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-start ..."> <img src="https://images.unsplash.com/photo-1590523277543-a94d2e4eb00b?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-start ..."> <img src="https://images.unsplash.com/photo-1575424909138-46b05e5919ec?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:scroll-p-0` to only apply the `scroll-p-0` utility on hover. ``` <div class="scroll-p-8 hover:scroll-p-0"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:scroll-p-0` to apply the `scroll-p-0` utility at only medium screen sizes and above. ``` <div class="scroll-p-8 md:scroll-p-0"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind’s scroll padding scale uses the [default spacing scale](customizing-spacing). You can customize your spacing scale by editing `theme.spacing` or `theme.extend.spacing` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { spacing: { '96': '24rem', } } } } ``` Alternatively, you can customize just the scroll padding scale by editing `theme.scrollPadding` or `theme.extend.scrollPadding` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { scrollPadding: { '96': '24rem', }, } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `scroll-padding` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="scroll-p-[24rem]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation.
programming_docs
tailwindcss Backdrop Contrast Quick reference --------------- | Class | Properties | | --- | --- | | backdrop-contrast-0 | backdrop-filter: contrast(0); | | backdrop-contrast-50 | backdrop-filter: contrast(.5); | | backdrop-contrast-75 | backdrop-filter: contrast(.75); | | backdrop-contrast-100 | backdrop-filter: contrast(1); | | backdrop-contrast-125 | backdrop-filter: contrast(1.25); | | backdrop-contrast-150 | backdrop-filter: contrast(1.5); | | backdrop-contrast-200 | backdrop-filter: contrast(2); | Basic usage ----------- ### Controlling backdrop contrast Use the `backdrop-contrast-{amount?}` utilities to control an element’s backdrop contrast. ``` <div class="backdrop-contrast-50 bg-white/30 ..."> <!-- ... --> </div> <div class="backdrop-contrast-125 bg-white/30 ..."> <!-- ... --> </div> <div class="backdrop-contrast-200 bg-white/30 ..."> <!-- ... --> </div> ``` ### Removing backdrop filters To remove all of the backdrop filters on an element at once, use the `backdrop-filter-none` utility: ``` <div class="backdrop-blur-md backdrop-contrast-125 md:backdrop-filter-none"> <!-- ... --> </div> ``` This can be useful when you want to remove backdrop filters conditionally, such as on hover or at a particular breakpoint. Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:backdrop-contrast-150` to only apply the `backdrop-contrast-150` utility on hover. ``` <div class="backdrop-contrast-125 hover:backdrop-contrast-150"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:backdrop-contrast-150` to apply the `backdrop-contrast-150` utility at only medium screen sizes and above. ``` <div class="backdrop-contrast-125 md:backdrop-contrast-150"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind includes a handful of general purpose `backdrop-contrast` utilities. You can customize these values by editing `theme.backdropContrast` or `theme.extend.backdropContrast` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { backdropContrast: { 25: '.25', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `backdrop-contrast` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="backdrop-contrast-[.25]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Min-Width Quick reference --------------- | Class | Properties | | --- | --- | | min-w-0 | min-width: 0px; | | min-w-full | min-width: 100%; | | min-w-min | min-width: min-content; | | min-w-max | min-width: max-content; | | min-w-fit | min-width: fit-content; | Basic usage ----------- ### Setting the minimum width Set the minimum width of an element using the `min-w-{width}` utilities. ``` <span class="min-w-full ..."> <!-- ... --> </span> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:min-w-0` to only apply the `min-w-0` utility on hover. ``` <div class="w-24 min-w-full hover:min-w-0"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:min-w-0` to apply the `min-w-0` utility at only medium screen sizes and above. ``` <div class="w-24 min-w-full md:min-w-0"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme You can customize your `min-width` scale by editing `theme.minWidth` or `theme.extend.minWidth` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { minWidth: { '1/2': '50%', } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `min-width` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="min-w-[50%]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Scroll Snap Stop Quick reference --------------- | Class | Properties | | --- | --- | | snap-normal | scroll-snap-stop: normal; | | snap-always | scroll-snap-stop: always; | Basic usage ----------- ### Forcing snap position stops Use the `snap-always` utility together with the `snap-mandatory` utility to force a snap container to always stop on an element before the user can continue scrolling to the next item. ``` <div class="snap-x snap-mandatory ..."> <div class="snap-always snap-center ..."> <img src="https://images.unsplash.com/photo-1604999565976-8913ad2ddb7c?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-always snap-center ..."> <img src="https://images.unsplash.com/photo-1540206351-d6465b3ac5c1?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-always snap-center ..."> <img src="https://images.unsplash.com/photo-1622890806166-111d7f6c7c97?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-always snap-center ..."> <img src="https://images.unsplash.com/photo-1590523277543-a94d2e4eb00b?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-always snap-center ..."> <img src="https://images.unsplash.com/photo-1575424909138-46b05e5919ec?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-always snap-center ..."> <img src="https://images.unsplash.com/photo-1559333086-b0a56225a93c?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> </div> ``` ### Skipping snap position stops Use the `snap-normal` utility to allow a snap container to skip past possible scroll snap positions. ``` <div class="snap-x ..."> <div class="snap-normal snap-center ..."> <img src="https://images.unsplash.com/photo-1604999565976-8913ad2ddb7c?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-normal snap-center ..."> <img src="https://images.unsplash.com/photo-1540206351-d6465b3ac5c1?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-normal snap-center ..."> <img src="https://images.unsplash.com/photo-1622890806166-111d7f6c7c97?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-normal snap-center ..."> <img src="https://images.unsplash.com/photo-1590523277543-a94d2e4eb00b?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-normal snap-center ..."> <img src="https://images.unsplash.com/photo-1575424909138-46b05e5919ec?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-normal snap-center ..."> <img src="https://images.unsplash.com/photo-1559333086-b0a56225a93c?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:snap-normal` to only apply the `snap-normal` utility on hover. ``` <div class="snap-always hover:snap-normal"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:snap-normal` to apply the `snap-normal` utility at only medium screen sizes and above. ``` <div class="snap-always md:snap-normal"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Backdrop Opacity Quick reference --------------- | Class | Properties | | --- | --- | | backdrop-opacity-0 | backdrop-filter: opacity(0); | | backdrop-opacity-5 | backdrop-filter: opacity(0.05); | | backdrop-opacity-10 | backdrop-filter: opacity(0.1); | | backdrop-opacity-20 | backdrop-filter: opacity(0.2); | | backdrop-opacity-25 | backdrop-filter: opacity(0.25); | | backdrop-opacity-30 | backdrop-filter: opacity(0.3); | | backdrop-opacity-40 | backdrop-filter: opacity(0.4); | | backdrop-opacity-50 | backdrop-filter: opacity(0.5); | | backdrop-opacity-60 | backdrop-filter: opacity(0.6); | | backdrop-opacity-70 | backdrop-filter: opacity(0.7); | | backdrop-opacity-75 | backdrop-filter: opacity(0.75); | | backdrop-opacity-80 | backdrop-filter: opacity(0.8); | | backdrop-opacity-90 | backdrop-filter: opacity(0.9); | | backdrop-opacity-95 | backdrop-filter: opacity(0.95); | | backdrop-opacity-100 | backdrop-filter: opacity(1); | Basic usage ----------- ### Controlling opacity of backdrop filters Use the `backdrop-opacity-{amount}` utilities to control the opacity of other backdrop filters applied to an element. ``` <div class="backdrop-opacity-10 backdrop-invert bg-white/30 ..."> <!-- ... --> </div> <div class="backdrop-opacity-60 backdrop-invert bg-white/30 ..."> <!-- ... --> </div> <div class="backdrop-opacity-95 backdrop-invert bg-white/30 ..."> <!-- ... --> </div> ``` ### Removing backdrop filters To remove all of the backdrop filters on an element at once, use the `backdrop-filter-none` utility: ``` <div class="backdrop-blur-md backdrop-opacity-60 md:backdrop-filter-none"> <!-- ... --> </div> ``` This can be useful when you want to remove backdrop filters conditionally, such as on hover or at a particular breakpoint. Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:backdrop-opacity-60` to only apply the `backdrop-opacity-60` utility on hover. ``` <div class="backdrop-opacity-100 hover:backdrop-opacity-60"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:backdrop-opacity-60` to apply the `backdrop-opacity-60` utility at only medium screen sizes and above. ``` <div class="backdrop-opacity-100 md:backdrop-opacity-60"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind includes a handful of general purpose `backdrop-opacity` utilities. You can customize these values by editing `theme.backdropOpacity` or `theme.extend.backdropOpacity` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { backdropOpacity: { 15: '.15', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `backdrop-opacity` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="backdrop-opacity-[.15]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Transition Timing Function Quick reference --------------- | Class | Properties | | --- | --- | | ease-linear | transition-timing-function: linear; | | ease-in | transition-timing-function: cubic-bezier(0.4, 0, 1, 1); | | ease-out | transition-timing-function: cubic-bezier(0, 0, 0.2, 1); | | ease-in-out | transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); | Basic usage ----------- ### Controlling the easing curve Use the `ease-{timing}` utilities to control an element’s easing curve. ``` <button class="ease-in duration-300 ...">Button A</button> <button class="ease-out duration-300 ...">Button B</button> <button class="ease-in-out duration-300 ...">Button C</button> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:ease-in` to only apply the `ease-in` utility on hover. ``` <div class="transition duration-150 ease-out hover:ease-in"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:ease-in` to apply the `ease-in` utility at only medium screen sizes and above. ``` <div class="transition duration-150 ease-out md:ease-in"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind provides four general purpose transition-timing-function utilities. You can customize these values by editing `theme.transitionTimingFunction` or `theme.extend.transitionTimingFunction` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { transitionTimingFunction: { 'in-expo': 'cubic-bezier(0.95, 0.05, 0.795, 0.035)', 'out-expo': 'cubic-bezier(0.19, 1, 0.22, 1)', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `transition-timing-function` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="ease-[cubic-bezier(0.95,0.05,0.795,0.035)]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Align Content Quick reference --------------- | Class | Properties | | --- | --- | | content-center | align-content: center; | | content-start | align-content: flex-start; | | content-end | align-content: flex-end; | | content-between | align-content: space-between; | | content-around | align-content: space-around; | | content-evenly | align-content: space-evenly; | Basic usage ----------- ### Start Use `content-start` to pack rows in a container against the start of the cross axis: ``` <div class="h-56 grid grid-cols-3 gap-4 content-start ..."> <div>01</div> <div>02</div> <div>03</div> <div>04</div> <div>05</div> </div> ``` ### Center Use `content-center` to pack rows in a container in the center of the cross axis: ``` <div class="h-56 grid grid-cols-3 gap-4 content-center ..."> <div>01</div> <div>02</div> <div>03</div> <div>04</div> <div>05</div> </div> ``` ### End Use `content-end` to pack rows in a container against the end of the cross axis: ``` <div class="h-56 grid grid-cols-3 gap-4 content-end ..."> <div>01</div> <div>02</div> <div>03</div> <div>04</div> <div>05</div> </div> ``` ### Space between Use `content-between` to distribute rows in a container such that there is an equal amount of space between each line: ``` <div class="h-56 grid grid-cols-3 gap-4 content-between ..."> <div>01</div> <div>02</div> <div>03</div> <div>04</div> <div>05</div> </div> ``` ### Space around Use `content-around` to distribute rows in a container such that there is an equal amount of space around each line: ``` <div class="h-56 grid grid-cols-3 gap-4 content-around ..."> <div>01</div> <div>02</div> <div>03</div> <div>04</div> <div>05</div> </div> ``` ### Space evenly Use `content-evenly` to distribute rows in a container such that there is an equal amount of space around each item, but also accounting for the doubling of space you would normally see between each item when using `content-around`: ``` <div class="h-56 grid grid-cols-3 gap-4 content-evenly ..."> <div>01</div> <div>02</div> <div>03</div> <div>04</div> <div>05</div> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:content-around` to only apply the `content-around` utility on hover. ``` <div class="grid content-start hover:content-around"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:content-around` to apply the `content-around` utility at only medium screen sizes and above. ``` <div class="grid content-start md:content-around"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries).
programming_docs
tailwindcss Drop Shadow Quick reference --------------- | Class | Properties | | --- | --- | | drop-shadow-sm | filter: drop-shadow(0 1px 1px rgb(0 0 0 / 0.05)); | | drop-shadow | filter: drop-shadow(0 1px 2px rgb(0 0 0 / 0.1)) drop-shadow(0 1px 1px rgb(0 0 0 / 0.06)); | | drop-shadow-md | filter: drop-shadow(0 4px 3px rgb(0 0 0 / 0.07)) drop-shadow(0 2px 2px rgb(0 0 0 / 0.06)); | | drop-shadow-lg | filter: drop-shadow(0 10px 8px rgb(0 0 0 / 0.04)) drop-shadow(0 4px 3px rgb(0 0 0 / 0.1)); | | drop-shadow-xl | filter: drop-shadow(0 20px 13px rgb(0 0 0 / 0.03)) drop-shadow(0 8px 5px rgb(0 0 0 / 0.08)); | | drop-shadow-2xl | filter: drop-shadow(0 25px 25px rgb(0 0 0 / 0.15)); | | drop-shadow-none | filter: drop-shadow(0 0 #0000); | Basic usage ----------- ### Adding a drop shadow Use the `drop-shadow-{amount}` utilities to add a drop shadow to an element. ``` <div class="drop-shadow-md ..."> <!-- ... --> </div> <div class="drop-shadow-lg ..."> <!-- ... --> </div> <div class="drop-shadow-xl ..."> <!-- ... --> </div> <div class="drop-shadow-2xl ..."> <!-- ... --> </div> ``` ### Removing filters To remove all of the filters on an element at once, use the `filter-none` utility: ``` <div class="blur-md invert drop-shadow-xl md:filter-none"> <!-- ... --> </div> ``` This can be useful when you want to remove filters conditionally, such as on hover or at a particular breakpoint. Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:drop-shadow-xl` to only apply the `drop-shadow-xl` utility on hover. ``` <div class="drop-shadow-md hover:drop-shadow-xl"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:drop-shadow-xl` to apply the `drop-shadow-xl` utility at only medium screen sizes and above. ``` <div class="drop-shadow-md md:drop-shadow-xl"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind includes a handful of general purpose `dropShadow` utilities. You can customize these values by editing `theme.dropShadow` or `theme.extend.dropShadow` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { dropShadow: { '3xl': '0 35px 35px rgba(0, 0, 0, 0.25)', '4xl': [ '0 35px 35px rgba(0, 0, 0, 0.25)', '0 45px 65px rgba(0, 0, 0, 0.15)' ] } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `drop-shadow` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="drop-shadow-[0_35px_35px_rgba(0,0,0,0.25)]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Background Size Quick reference --------------- | Class | Properties | | --- | --- | | bg-auto | background-size: auto; | | bg-cover | background-size: cover; | | bg-contain | background-size: contain; | Basic usage ----------- ### Auto Use `bg-auto` to display the background image at its default size. ``` <div class="bg-auto bg-no-repeat bg-center ..." style="background-image: url(...)"></div> ``` ### Cover Use `bg-cover` to scale the background image until it fills the background layer. ``` <div class="bg-cover bg-center ..." style="background-image: url(...)"></div> ``` ### Contain Use `bg-contain` to scale the background image to the outer edges without cropping or stretching. ``` <div class="bg-contain bg-center ..." style="background-image: url(...)"></div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:bg-contain` to only apply the `bg-contain` utility on hover. ``` <div class="bg-auto hover:bg-contain"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:bg-contain` to apply the `bg-contain` utility at only medium screen sizes and above. ``` <div class="bg-auto md:bg-contain"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind provides utilities for `auto`, `cover`, and `contain` background sizes. You can change, add, or remove these by editing the `theme.backgroundSize` section of your config. tailwind.config.js ``` module.exports = { theme: { backgroundSize: { 'auto': 'auto', 'cover': 'cover', 'contain': 'contain', '50%': '50%', '16': '4rem', } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `background-size` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="bg-[length:200px_100px]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Overflow Quick reference --------------- | Class | Properties | | --- | --- | | overflow-auto | overflow: auto; | | overflow-hidden | overflow: hidden; | | overflow-clip | overflow: clip; | | overflow-visible | overflow: visible; | | overflow-scroll | overflow: scroll; | | overflow-x-auto | overflow-x: auto; | | overflow-y-auto | overflow-y: auto; | | overflow-x-hidden | overflow-x: hidden; | | overflow-y-hidden | overflow-y: hidden; | | overflow-x-clip | overflow-x: clip; | | overflow-y-clip | overflow-y: clip; | | overflow-x-visible | overflow-x: visible; | | overflow-y-visible | overflow-y: visible; | | overflow-x-scroll | overflow-x: scroll; | | overflow-y-scroll | overflow-y: scroll; | Basic usage ----------- ### Showing content that overflows Use `overflow-visible` to prevent content within an element from being clipped. Note that any content that overflows the bounds of the element will then be visible. ``` <div class="overflow-visible ..."></div> ``` ### Hiding content that overflows Use `overflow-hidden` to clip any content within an element that overflows the bounds of that element. ``` <div class="overflow-hidden ..."></div> ``` ### Scrolling if needed Use `overflow-auto` to add scrollbars to an element in the event that its content overflows the bounds of that element. Unlike `overflow-scroll`, which always shows scrollbars, this utility will only show them if scrolling is necessary. ``` <div class="overflow-auto ..."></div> ``` ### Scrolling horizontally if needed Use `overflow-x-auto` to allow horizontal scrolling if needed. ``` <div class="overflow-x-auto ..."></div> ``` ### Scrolling vertically if needed Use `overflow-y-auto` to allow vertical scrolling if needed. ``` <div class="overflow-y-auto h-32 ..."></div> ``` ### Scrolling horizontally always Use `overflow-x-scroll` to allow horizontal scrolling and always show scrollbars unless always-visible scrollbars are disabled by the operating system. ``` <div class="overflow-x-scroll ..."></div> ``` ### Scrolling vertically always Use `overflow-y-scroll` to allow vertical scrolling and always show scrollbars unless always-visible scrollbars are disabled by the operating system. ``` <div class="overflow-y-scroll ..."></div> ``` ### Scrolling in all directions Use `overflow-scroll` to add scrollbars to an element. Unlike `overflow-auto`, which only shows scrollbars if they are necessary, this utility always shows them. Note that some operating systems (like macOS) hide unnecessary scrollbars regardless of this setting. ``` <div class="overflow-scroll ..."></div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:overflow-scroll` to only apply the `overflow-scroll` utility on hover. ``` <div class="overflow-auto hover:overflow-scroll"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:overflow-scroll` to apply the `overflow-scroll` utility at only medium screen sizes and above. ``` <div class="overflow-auto md:overflow-scroll"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Flex Direction Quick reference --------------- | Class | Properties | | --- | --- | | flex-row | flex-direction: row; | | flex-row-reverse | flex-direction: row-reverse; | | flex-col | flex-direction: column; | | flex-col-reverse | flex-direction: column-reverse; | Basic usage ----------- ### Row Use `flex-row` to position flex items horizontally in the same direction as text: ``` <div class="flex flex-row ..."> <div>01</div> <div>02</div> <div>03</div> </div> ``` ### Row reversed Use `flex-row-reverse` to position flex items horizontally in the opposite direction: ``` <div class="flex flex-row-reverse ..."> <div>01</div> <div>02</div> <div>03</div> </div> ``` ### Column Use `flex-col` to position flex items vertically: ``` <div class="flex flex-col ..."> <div>01</div> <div>02</div> <div>03</div> </div> ``` ### Column reversed Use `flex-col-reverse` to position flex items vertically in the opposite direction: ``` <div class="flex flex-col-reverse ..."> <div>01</div> <div>02</div> <div>03</div> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:flex-row` to only apply the `flex-row` utility on hover. ``` <div class="flex flex-col hover:flex-row"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:flex-row` to apply the `flex-row` utility at only medium screen sizes and above. ``` <div class="flex flex-col md:flex-row"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Font Variant Numeric Quick reference --------------- | Class | Properties | | --- | --- | | normal-nums | font-variant-numeric: normal; | | ordinal | font-variant-numeric: ordinal; | | slashed-zero | font-variant-numeric: slashed-zero; | | lining-nums | font-variant-numeric: lining-nums; | | oldstyle-nums | font-variant-numeric: oldstyle-nums; | | proportional-nums | font-variant-numeric: proportional-nums; | | tabular-nums | font-variant-numeric: tabular-nums; | | diagonal-fractions | font-variant-numeric: diagonal-fractions; | | stacked-fractions | font-variant-numeric: stacked-fractions; | Basic usage ----------- ### Applying numeric variants Use the `font-variant-numeric` utilities to enable additional glyphs for numbers, fractions, and ordinal markers *(in fonts that support them)*. These utilities are composable so you can enable multiple `font-variant-numeric` features by combining multiple classes in your HTML: ``` <p class="ordinal slashed-zero tabular-nums ..."> 1234567890 </p> ``` Note that many fonts don’t support these features *(stacked fractions support for example is especially rare)*, so some of these utilities may have no effect depending on the font family you are using. ### Ordinal Use the `ordinal` utility to enable special glyphs for the ordinal markers. ``` <p class="ordinal ...">1st</p> ``` ### Slashed Zero Use the `slashed-zero` utility to force a 0 with a slash; this is useful when a clear distinction between O and 0 is needed. ``` <p class="slashed-zero ...">0</p> ``` ### Lining figures Use the `lining-nums` utility to use the numeric glyphs that are all aligned by their baseline. This corresponds to the `lnum` OpenType feature. This is the default for most fonts. ``` <p class="lining-nums ..."> 1234567890 </p> ``` ### Oldstyle figures Use the `oldstyle-nums` utility to use numeric glyphs where some numbers have descenders. This corresponds to the `onum` OpenType feature. ``` <p class="oldstyle-nums ..."> 1234567890 </p> ``` ### Proportional figures Use the `proportional-nums` utility to use numeric glyphs that have proportional widths (rather than uniform/tabular). This corresponds to the `pnum` OpenType feature. ``` <p class="proportional-nums ..."> 12121 </p> <p class="proportional-nums ..."> 90909 </p> ``` ### Tabular figures Use the `tabular-nums` utility to use numeric glyphs that have uniform/tabular widths (rather than proportional). This corresponds to the `tnum` OpenType feature. ``` <p class="tabular-nums ..."> 12121 </p> <p class="tabular-nums ..."> 90909 </p> ``` ### Diagonal fractions Use the `diagonal-fractions` utility to replace numbers separated by a slash with common diagonal fractions. This corresponds to the `frac` OpenType feature. ``` <p class="diagonal-fractions ..."> 1/2 3/4 5/6 </p> ``` ### Stacked fractions Use the `stacked-fractions` utility to replace numbers separated by a slash with common stacked fractions. This corresponds to the `afrc` OpenType feature. Very few fonts seem to support this feature — we’ve used Ubuntu Mono here. ``` <p class="stacked-fractions ..."> 1/2 3/4 5/6 </p> ``` ### Resetting numeric font variants Use the `normal-nums` propery to reset numeric font variants. This is usually useful for resetting a font feature at a particular breakpoint: ``` <p class="slashed-zero tabular-nums md:normal-nums ..."> 12345 </p> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:tabular-nums` to only apply the `tabular-nums` utility on hover. ``` <p class="proportional-nums hover:tabular-nums"> <!-- ... --> </p> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:tabular-nums` to apply the `tabular-nums` utility at only medium screen sizes and above. ``` <p class="proportional-nums md:tabular-nums"> <!-- ... --> </p> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Text Decoration Thickness Quick reference --------------- | Class | Properties | | --- | --- | | decoration-auto | text-decoration-thickness: auto; | | decoration-from-font | text-decoration-thickness: from-font; | | decoration-0 | text-decoration-thickness: 0px; | | decoration-1 | text-decoration-thickness: 1px; | | decoration-2 | text-decoration-thickness: 2px; | | decoration-4 | text-decoration-thickness: 4px; | | decoration-8 | text-decoration-thickness: 8px; | Basic usage ----------- ### Setting the text decoration thickness Use the `decoration-{width}` utilities to change the thickness of an element’s [text decoration](text-decoration). ``` <p class="underline decoration-1 ...">The quick brown fox...</p> <p class="underline decoration-2 ...">The quick brown fox...</p> <p class="underline decoration-4 ...">The quick brown fox...</p> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:decoration-4` to only apply the `decoration-4` utility on hover. ``` <p class="underline hover:decoration-4"> <!-- ... --> </p> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:decoration-4` to apply the `decoration-4` utility at only medium screen sizes and above. ``` <p class="underline md:decoration-4"> <!-- ... --> </p> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme You can customize the `decoration-{width}` utilities by editing `theme.textDecorationThickness` or `theme.extend.textDecorationThickness` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { textDecorationThickness: { 3: '3px', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `text-decoration-thickness` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <p class="decoration-[3px]"> <!-- ... --> </p> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Scroll Snap Type Quick reference --------------- | Class | Properties | | --- | --- | | snap-none | scroll-snap-type: none; | | snap-x | scroll-snap-type: x var(--tw-scroll-snap-strictness); | | snap-y | scroll-snap-type: y var(--tw-scroll-snap-strictness); | | snap-both | scroll-snap-type: both var(--tw-scroll-snap-strictness); | | snap-mandatory | --tw-scroll-snap-strictness: mandatory; | | snap-proximity | --tw-scroll-snap-strictness: proximity; | Basic usage ----------- ### Horizontal scroll snapping Use the `snap-x` utility to enable horizontal scroll snapping within an element. For scroll snapping to work, you need to also set the [scroll snap alignment](scroll-snap-align) on the children within the element. ``` <div class="snap-x ..."> <div class="snap-center ..."> <img src="https://images.unsplash.com/photo-1604999565976-8913ad2ddb7c?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-center ..."> <img src="https://images.unsplash.com/photo-1540206351-d6465b3ac5c1?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-center ..."> <img src="https://images.unsplash.com/photo-1622890806166-111d7f6c7c97?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-center ..."> <img src="https://images.unsplash.com/photo-1590523277543-a94d2e4eb00b?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-center ..."> <img src="https://images.unsplash.com/photo-1575424909138-46b05e5919ec?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-center ..."> <img src="https://images.unsplash.com/photo-1559333086-b0a56225a93c?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> </div> ``` ### Mandatory scroll snapping Use the `snap-mandatory` utility to force a snap container to always come to rest on a snap point. ``` <div class="snap-mandatory snap-x ..."> <div class="snap-center ..."> <img src="https://images.unsplash.com/photo-1604999565976-8913ad2ddb7c?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-center ..."> <img src="https://images.unsplash.com/photo-1540206351-d6465b3ac5c1?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-center ..."> <img src="https://images.unsplash.com/photo-1622890806166-111d7f6c7c97?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-center ..."> <img src="https://images.unsplash.com/photo-1590523277543-a94d2e4eb00b?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-center ..."> <img src="https://images.unsplash.com/photo-1575424909138-46b05e5919ec?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-center ..."> <img src="https://images.unsplash.com/photo-1559333086-b0a56225a93c?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> </div> ``` ### Proximity scroll snapping Use the `snap-proximity` utility to make a snap container come to rest on snap points that are close in proximity. This is the browser default. ``` <div class="snap-proximity snap-x ..."> <div class="snap-center ..."> <img src="https://images.unsplash.com/photo-1604999565976-8913ad2ddb7c?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-center ..."> <img src="https://images.unsplash.com/photo-1540206351-d6465b3ac5c1?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-center ..."> <img src="https://images.unsplash.com/photo-1622890806166-111d7f6c7c97?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-center ..."> <img src="https://images.unsplash.com/photo-1590523277543-a94d2e4eb00b?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-center ..."> <img src="https://images.unsplash.com/photo-1575424909138-46b05e5919ec?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:snap-x` to only apply the `snap-x` utility on hover. ``` <div class="hover:snap-x"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:snap-x` to apply the `snap-x` utility at only medium screen sizes and above. ``` <div class="md:snap-x"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries).
programming_docs
tailwindcss Scroll Snap Align Quick reference --------------- | Class | Properties | | --- | --- | | snap-start | scroll-snap-align: start; | | snap-end | scroll-snap-align: end; | | snap-center | scroll-snap-align: center; | | snap-align-none | scroll-snap-align: none; | Basic usage ----------- ### Snapping to the center Use the `snap-center` utility to snap an element to its center when being scrolled inside a snap container. ``` <div class="snap-x ..."> <div class="snap-center ..."> <img src="https://images.unsplash.com/photo-1604999565976-8913ad2ddb7c?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-center ..."> <img src="https://images.unsplash.com/photo-1540206351-d6465b3ac5c1?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-center ..."> <img src="https://images.unsplash.com/photo-1622890806166-111d7f6c7c97?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-center ..."> <img src="https://images.unsplash.com/photo-1590523277543-a94d2e4eb00b?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-center ..."> <img src="https://images.unsplash.com/photo-1575424909138-46b05e5919ec?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-center ..."> <img src="https://images.unsplash.com/photo-1559333086-b0a56225a93c?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> </div> ``` ### Snapping to the start Use the `snap-start` utility to snap an element to its start when being scrolled inside a snap container. ``` <div class="snap-x ..."> <div class="snap-start ..."> <img src="https://images.unsplash.com/photo-1604999565976-8913ad2ddb7c?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-start ..."> <img src="https://images.unsplash.com/photo-1540206351-d6465b3ac5c1?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-start ..."> <img src="https://images.unsplash.com/photo-1622890806166-111d7f6c7c97?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-start ..."> <img src="https://images.unsplash.com/photo-1590523277543-a94d2e4eb00b?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-start ..."> <img src="https://images.unsplash.com/photo-1575424909138-46b05e5919ec?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-start ..."> <img src="https://images.unsplash.com/photo-1559333086-b0a56225a93c?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> </div> ``` ### Snapping to the end Use the `snap-end` utility to snap an element to its end when being scrolled inside a snap container. ``` <div class="snap-x ..."> <div class="snap-end ..."> <img src="https://images.unsplash.com/photo-1604999565976-8913ad2ddb7c?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-end ..."> <img src="https://images.unsplash.com/photo-1540206351-d6465b3ac5c1?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-end ..."> <img src="https://images.unsplash.com/photo-1622890806166-111d7f6c7c97?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-end ..."> <img src="https://images.unsplash.com/photo-1590523277543-a94d2e4eb00b?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-end ..."> <img src="https://images.unsplash.com/photo-1575424909138-46b05e5919ec?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> <div class="snap-end ..."> <img src="https://images.unsplash.com/photo-1559333086-b0a56225a93c?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=320&h=160&q=80" /> </div> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:snap-start` to only apply the `snap-start` utility on hover. ``` <div class="snap-center hover:snap-start"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:snap-start` to apply the `snap-start` utility at only medium screen sizes and above. ``` <div class="snap-center md:snap-start"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Presets By default, any configuration you add in your own `tailwind.config.js` file is intelligently merged with the [default configuration](https://unpkg.com/browse/tailwindcss@%5E2/stubs/defaultConfig.stub.js), with your own configuration acting as a set of overrides and extensions. The `presets` option lets you specify a *different* configuration to use as your base, making it easy to package up a set of customizations that you’d like to reuse across projects. tailwind.config.js ``` module.exports = { presets: [ require('@acmecorp/tailwind-base') ], // ... } ``` This can be very useful for teams that manage multiple Tailwind projects for the same brand where they want a single source of truth for colors, fonts, and other common customizations. Creating a preset ----------------- Presets are just regular Tailwind configuration objects, taking the exact same shape as the configuration you would add in your `tailwind.config.js` file. my-preset.js ``` // Example preset module.exports = { theme: { colors: { blue: { light: '#85d7ff', DEFAULT: '#1fb6ff', dark: '#009eeb', }, pink: { light: '#ff7ce5', DEFAULT: '#ff49db', dark: '#ff16d1', }, gray: { darkest: '#1f2d3d', dark: '#3c4858', DEFAULT: '#c0ccda', light: '#e0e6ed', lightest: '#f9fafc', } }, fontFamily: { sans: ['Graphik', 'sans-serif'], }, extend: { flexGrow: { 2: '2', 3: '3', }, zIndex: { 60: '60', 70: '70', 80: '80', 90: '90', 100: '100', }, } }, plugins: [ require('@tailwindcss/typography'), require('@tailwindcss/aspect-ratio'), ], } ``` As you can see, presets can contain all of the configuration options you’re used to, including theme overrides and extensions, adding plugins, configuring a prefix, and so on. Read about [how configurations are merged](#merging-logic-in-depth) for more details. Assuming this preset was saved at `./my-preset.js`, you would use it by adding it to the `tailwind.config.js` file in your actual project under the `presets` key: tailwind.config.js ``` module.exports = { presets: [ require('./my-preset.js') ], // Customizations specific to this project would go here theme: { extend: { minHeight: { 48: '12rem', } } }, variants: { extend: { backgroundColor: ['active'] }, }, } ``` By default, presets themselves extend Tailwind’s [default configuration](https://unpkg.com/browse/tailwindcss@%5E3/stubs/defaultConfig.stub.js) just like your own configuration would. If you’d like to create a preset that completely replaces the default configuration, include an empty `presets` key in the preset itself: ``` // Example preset module.exports = { presets: [], theme: { // ... }, plugins: [ // ... ], } ``` For more information, read about [disabling the default configuration](#disabling-the-default-configuration). Merging logic in-depth ---------------------- Project-specific configurations (those found in your `tailwind.config.js` file) are merged against presets the same way they are merged against the default configuration. The following options in `tailwind.config.js` simply **replace** the same option if present in a preset: * `content` * `darkMode` * `prefix` * `important` * `variantOrder` * `separator` * `safelist` The remaining options are each carefully merged in the way that makes the most sense for that option, explained in more detail below. ### Theme The `theme` object is merged shallowly, with top-level keys in `tailwind.config.js` replacing the same top-level keys in any presets. The exception to this is the `extend` key, which is collected across all configurations and applied on top of the rest of the theme configuration. Learn more about how the `theme` option works in the [theme configuration documentation](theme). ### Presets The `presets` array is merged across configurations, allowing presets to include their own presets, which can also include their own presets. ### Plugins The `plugins` array is merged across configurations to make it possible for a preset to register plugins while also allowing you to add additional plugins at the project-level. This means it’s not possible to disable a plugin that has been added by a preset. If you find yourself wanting to disable a plugin in a preset, it’s a sign that you should probably remove that plugin from the preset and include it on a project-by-project basis instead, or [split your preset into two presets](#extending-multiple-presets). ### Core plugins The `corePlugins` option behaves differently depending on whether you configure it as an object or as an array. If you configure `corePlugins` as an object, it is merged across configurations. my-preset.js ``` module.exports = { // ... corePlugins: { float: false, }, } ``` tailwind.config.js ``` module.exports = { presets: [ require('./my-preset.js'), ], // This configuration will be merged corePlugins: { cursor: false } } ``` If you configure `corePlugins` as an array, it replaces any `corePlugins` configuration provided by your configured preset(s). my-preset.js ``` module.exports = { // ... corePlugins: { float: false, }, } ``` tailwind.config.js ``` module.exports = { presets: [ require('./example-preset.js'), ], // This will replace the configuration in the preset corePlugins: ['float', 'padding', 'margin'] } ``` Extending multiple presets -------------------------- The `presets` option is an array and can accept multiple presets. This is useful if you want to split your reusable customizations up into composable chunks that can be imported independently. tailwind.config.js ``` module.exports = { presets: [ require('@acmecorp/tailwind-colors'), require('@acmecorp/tailwind-fonts'), require('@acmecorp/tailwind-spacing'), ] } ``` When adding multiple presets, it’s important to note that if they overlap in any way, they are resolved the same way your own customizations are resolved against a preset, and the last configuration wins. For example, if both of these configurations provided a custom color palette (and were not using `extend`), the color palette from `configuration-b` would be used: tailwind.config.js ``` module.exports = { presets: [ require('@acmecorp/configuration-a'), require('@acmecorp/configuration-b'), ] } ``` Disabling the default configuration ----------------------------------- If you’d like to completely disable the default configuration and start with no base configuration at all, set `presets` to an empty array: tailwind.config.js ``` module.exports = { presets: [], // ... } ``` This will completely disable all of Tailwind’s defaults, so no colors, font families, font sizes, spacing values, etc. will be generated at all. You can also do this from within a preset if you’d like your preset to provide a complete design system on its own that doesn’t extend Tailwind’s defaults: my-preset.js ``` module.exports = { presets: [], // ... } ``` tailwind.config.js ``` module.exports = { presets: [ require('./example-preset.js') ], // ... } ``` tailwindcss Box Decoration Break Quick reference --------------- | Class | Properties | | --- | --- | | box-decoration-clone | box-decoration-break: clone; | | box-decoration-slice | box-decoration-break: slice; | Basic usage ----------- ### Setting the box decoration break Use the `box-decoration-slice` and `box-decoration-clone` utilities to control whether properties like background, border, border-image, box-shadow, clip-page, margin, and padding should be rendered as if the element were one continuous fragment, or distinct blocks. ``` <span class="box-decoration-slice bg-gradient-to-r from-indigo-600 to-pink-500 text-white px-2 ..."> Hello<br> World </span> <span class="box-decoration-clone bg-gradient-to-r from-indigo-600 to-pink-500 text-white px-2 ..."> Hello<br> World </span> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:box-decoration-slice` to only apply the `box-decoration-slice` utility on hover. ``` <div class="box-decoration-clone hover:box-decoration-slice"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:box-decoration-slice` to apply the `box-decoration-slice` utility at only medium screen sizes and above. ``` <div class="box-decoration-clone md:box-decoration-slice"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Text Decoration Style Quick reference --------------- | Class | Properties | | --- | --- | | decoration-solid | text-decoration-style: solid; | | decoration-double | text-decoration-style: double; | | decoration-dotted | text-decoration-style: dotted; | | decoration-dashed | text-decoration-style: dashed; | | decoration-wavy | text-decoration-style: wavy; | Basic usage ----------- ### Setting the text decoration style Use the `decoration-{style}` utilities to change the style of an element’s [text decoration](text-decoration). ``` <p class="underline decoration-solid ...">The quick brown fox...</p> <p class="underline decoration-double ...">The quick brown fox...</p> <p class="underline decoration-dotted ...">The quick brown fox...</p> <p class="underline decoration-dashed ...">The quick brown fox...</p> <p class="underline decoration-wavy ...">The quick brown fox...</p> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:decoration-dashed` to only apply the `decoration-dashed` utility on hover. ``` <p class="underline hover:decoration-dashed"> <!-- ... --> </p> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:decoration-dashed` to apply the `decoration-dashed` utility at only medium screen sizes and above. ``` <p class="underline md:decoration-dashed"> <!-- ... --> </p> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Clear Quick reference --------------- | Class | Properties | | --- | --- | | clear-left | clear: left; | | clear-right | clear: right; | | clear-both | clear: both; | | clear-none | clear: none; | Basic usage ----------- ### Clearing left-floated elements Use `clear-left` to position an element below any preceding left-floated elements. ``` <img class="float-left ..." src="path/to/image.jpg"> <img class="float-right ..." src="path/to/image.jpg"> <p class="clear-left ...">Maybe we can live without libraries...</p> ``` ### Clearing right-floated elements Use `clear-right` to position an element below any preceding right-floated elements. ``` <img class="float-left ..." src="path/to/image.jpg"> <img class="float-right ..." src="path/to/image.jpg"> <p class="clear-right ...">Maybe we can live without libraries...</p> ``` ### Clearing all floated elements Use `clear-both` to position an element below all preceding floated elements. ``` <img class="float-left ..." src="path/to/image.jpg"> <img class="float-right ..." src="path/to/image.jpg"> <p class="clear-both ...">Maybe we can live without libraries...</p> ``` ### Disabling applied clears Use `clear-none` to reset any clears that are applied to an element. This is the default value for the clear property. ``` <img class="float-left ..." src="path/to/image.jpg"> <img class="float-right ..." src="path/to/image.jpg"> <p class="clear-none ...">Maybe we can live without libraries...</p> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:clear-none` to only apply the `clear-none` utility on hover. ``` <p class="clear-left hover:clear-none"> <!-- ... --> </p> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:clear-none` to apply the `clear-none` utility at only medium screen sizes and above. ``` <p class="clear-left md:clear-none"> <!-- ... --> </p> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Grid Column Start / End Quick reference --------------- | Class | Properties | | --- | --- | | col-auto | grid-column: auto; | | col-span-1 | grid-column: span 1 / span 1; | | col-span-2 | grid-column: span 2 / span 2; | | col-span-3 | grid-column: span 3 / span 3; | | col-span-4 | grid-column: span 4 / span 4; | | col-span-5 | grid-column: span 5 / span 5; | | col-span-6 | grid-column: span 6 / span 6; | | col-span-7 | grid-column: span 7 / span 7; | | col-span-8 | grid-column: span 8 / span 8; | | col-span-9 | grid-column: span 9 / span 9; | | col-span-10 | grid-column: span 10 / span 10; | | col-span-11 | grid-column: span 11 / span 11; | | col-span-12 | grid-column: span 12 / span 12; | | col-span-full | grid-column: 1 / -1; | | col-start-1 | grid-column-start: 1; | | col-start-2 | grid-column-start: 2; | | col-start-3 | grid-column-start: 3; | | col-start-4 | grid-column-start: 4; | | col-start-5 | grid-column-start: 5; | | col-start-6 | grid-column-start: 6; | | col-start-7 | grid-column-start: 7; | | col-start-8 | grid-column-start: 8; | | col-start-9 | grid-column-start: 9; | | col-start-10 | grid-column-start: 10; | | col-start-11 | grid-column-start: 11; | | col-start-12 | grid-column-start: 12; | | col-start-13 | grid-column-start: 13; | | col-start-auto | grid-column-start: auto; | | col-end-1 | grid-column-end: 1; | | col-end-2 | grid-column-end: 2; | | col-end-3 | grid-column-end: 3; | | col-end-4 | grid-column-end: 4; | | col-end-5 | grid-column-end: 5; | | col-end-6 | grid-column-end: 6; | | col-end-7 | grid-column-end: 7; | | col-end-8 | grid-column-end: 8; | | col-end-9 | grid-column-end: 9; | | col-end-10 | grid-column-end: 10; | | col-end-11 | grid-column-end: 11; | | col-end-12 | grid-column-end: 12; | | col-end-13 | grid-column-end: 13; | | col-end-auto | grid-column-end: auto; | Basic usage ----------- ### Spanning columns Use the `col-span-{n}` utilities to make an element span *n* columns. ``` <div class="grid grid-cols-3 gap-4"> <div class="...">01</div> <div class="...">02</div> <div class="...">03</div> <div class="col-span-2 ...">04</div> <div class="...">05</div> <div class="...">06</div> <div class="col-span-2 ...">07</div> </div> ``` ### Starting and ending lines Use the `col-start-{n}` and `col-end-{n}` utilities to make an element start or end at the *nth* grid line. These can also be combined with the `col-span-{n}` utilities to span a specific number of columns. Note that CSS grid lines start at 1, not 0, so a full-width element in a 6-column grid would start at line 1 and end at line 7. ``` <div class="grid grid-cols-6 gap-4"> <div class="col-start-2 col-span-4 ...">01</div> <div class="col-start-1 col-end-3 ...">02</div> <div class="col-end-7 col-span-2 ...">03</div> <div class="col-start-1 col-end-7 ...">04</div> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:col-span-6` to only apply the `col-span-6` utility on hover. ``` <div class="col-span-2 hover:col-span-6"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:col-span-6` to apply the `col-span-6` utility at only medium screen sizes and above. ``` <div class="col-span-2 md:col-span-6"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind includes grid-column utilities for working with grids with up to 12 columns. You change, add, or remove these by customizing the `gridColumn`, `gridColumnStart`, and `gridColumnEnd` sections of your Tailwind theme config. For creating more `col-{value}` utilities that control the `grid-column` shorthand property directly, customize the `gridColumn` section of your Tailwind theme config: tailwind.config.js ``` module.exports = { theme: { extend: { gridColumn: { 'span-16': 'span 16 / span 16', } } } } ``` We use this internally for our `col-span-{n}` utilities. Note that since this configures the `grid-column` shorthand property directly, we include the word `span` directly in the value name, it’s *not* baked into the class name automatically. That means you are free to add entries that do whatever you want here — they don’t just have to be `span` utilities. To add new `col-start-{n}` utilities, use the `gridColumnStart` section of your Tailwind theme config: tailwind.config.js ``` module.exports = { theme: { extend: { gridColumnStart: { '13': '13', '14': '14', '15': '15', '16': '16', '17': '17', } } } } ``` To add new `col-end-{n}` utilities, use the `gridColumnEnd` section of your Tailwind theme config: tailwind.config.js ``` module.exports = { theme: { extend: { gridColumnEnd: { '13': '13', '14': '14', '15': '15', '16': '16', '17': '17', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `grid-column/grid-column-start/grid-column-end` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="col-[16_/_span_16]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation.
programming_docs
tailwindcss Text Decoration Quick reference --------------- | Class | Properties | | --- | --- | | underline | text-decoration-line: underline; | | overline | text-decoration-line: overline; | | line-through | text-decoration-line: line-through; | | no-underline | text-decoration-line: none; | Basic usage ----------- ### Setting the text decoration Control how text is decorated with the `underline`, `no-underline`, and `line-through` utilities. ``` <p class="underline ...">The quick brown fox ...</p> <p class="overline ...">The quick brown fox ...</p> <p class="line-through ...">The quick brown fox ...</p> <p class="no-underline ...">The quick brown fox ...</p> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:text-center` to only apply the `text-center` utility on hover. ``` <a href="#" class="no-underline hover:underline ...">Link</a> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:underline` to apply the `underline` utility at only medium screen sizes and above. ``` <p class="no-underline md:underline"> <!-- ... --> </p> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Flex Grow Quick reference --------------- | Class | Properties | | --- | --- | | grow | flex-grow: 1; | | grow-0 | flex-grow: 0; | Basic usage ----------- ### Grow Use `grow` to allow a flex item to grow to fill any available space: ``` <div class="flex ..."> <div class="flex-none w-14 h-14 ..."> 01 </div> <div class="grow h-14 ..."> 02 </div> <div class="flex-none w-14 h-14 ..."> 03 </div> </div> ``` ### Don't grow Use `grow-0` to prevent a flex item from growing: ``` <div class="flex ..."> <div class="grow h-14 ..."> 01 </div> <div class="grow-0 h-14 ..."> 02 </div> <div class="grow h-14 ..."> 03 </div> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:grow-0` to only apply the `grow-0` utility on hover. ``` <div class="grow hover:grow-0"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:grow-0` to apply the `grow-0` utility at only medium screen sizes and above. ``` <div class="grow md:grow-0"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind provides two `grow` utilities. You can customize these values by editing `theme.flexGrow` or `theme.extend.flexGrow` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { flexGrow: { '2': 2 } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `flex-grow` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="grow-[2]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Ring Offset Color Quick reference --------------- | Class | Properties | | --- | --- | | ring-offset-inherit | --tw-ring-offset-color: inherit; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-current | --tw-ring-offset-color: currentColor; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-transparent | --tw-ring-offset-color: transparent; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-black | --tw-ring-offset-color: #000; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-white | --tw-ring-offset-color: #fff; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-slate-50 | --tw-ring-offset-color: #f8fafc; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-slate-100 | --tw-ring-offset-color: #f1f5f9; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-slate-200 | --tw-ring-offset-color: #e2e8f0; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-slate-300 | --tw-ring-offset-color: #cbd5e1; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-slate-400 | --tw-ring-offset-color: #94a3b8; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-slate-500 | --tw-ring-offset-color: #64748b; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-slate-600 | --tw-ring-offset-color: #475569; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-slate-700 | --tw-ring-offset-color: #334155; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-slate-800 | --tw-ring-offset-color: #1e293b; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-slate-900 | --tw-ring-offset-color: #0f172a; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-gray-50 | --tw-ring-offset-color: #f9fafb; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-gray-100 | --tw-ring-offset-color: #f3f4f6; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-gray-200 | --tw-ring-offset-color: #e5e7eb; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-gray-300 | --tw-ring-offset-color: #d1d5db; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-gray-400 | --tw-ring-offset-color: #9ca3af; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-gray-500 | --tw-ring-offset-color: #6b7280; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-gray-600 | --tw-ring-offset-color: #4b5563; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-gray-700 | --tw-ring-offset-color: #374151; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-gray-800 | --tw-ring-offset-color: #1f2937; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-gray-900 | --tw-ring-offset-color: #111827; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-zinc-50 | --tw-ring-offset-color: #fafafa; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-zinc-100 | --tw-ring-offset-color: #f4f4f5; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-zinc-200 | --tw-ring-offset-color: #e4e4e7; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-zinc-300 | --tw-ring-offset-color: #d4d4d8; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-zinc-400 | --tw-ring-offset-color: #a1a1aa; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-zinc-500 | --tw-ring-offset-color: #71717a; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-zinc-600 | --tw-ring-offset-color: #52525b; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-zinc-700 | --tw-ring-offset-color: #3f3f46; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-zinc-800 | --tw-ring-offset-color: #27272a; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-zinc-900 | --tw-ring-offset-color: #18181b; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-neutral-50 | --tw-ring-offset-color: #fafafa; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-neutral-100 | --tw-ring-offset-color: #f5f5f5; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-neutral-200 | --tw-ring-offset-color: #e5e5e5; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-neutral-300 | --tw-ring-offset-color: #d4d4d4; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-neutral-400 | --tw-ring-offset-color: #a3a3a3; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-neutral-500 | --tw-ring-offset-color: #737373; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-neutral-600 | --tw-ring-offset-color: #525252; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-neutral-700 | --tw-ring-offset-color: #404040; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-neutral-800 | --tw-ring-offset-color: #262626; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-neutral-900 | --tw-ring-offset-color: #171717; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-stone-50 | --tw-ring-offset-color: #fafaf9; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-stone-100 | --tw-ring-offset-color: #f5f5f4; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-stone-200 | --tw-ring-offset-color: #e7e5e4; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-stone-300 | --tw-ring-offset-color: #d6d3d1; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-stone-400 | --tw-ring-offset-color: #a8a29e; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-stone-500 | --tw-ring-offset-color: #78716c; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-stone-600 | --tw-ring-offset-color: #57534e; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-stone-700 | --tw-ring-offset-color: #44403c; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-stone-800 | --tw-ring-offset-color: #292524; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-stone-900 | --tw-ring-offset-color: #1c1917; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-red-50 | --tw-ring-offset-color: #fef2f2; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-red-100 | --tw-ring-offset-color: #fee2e2; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-red-200 | --tw-ring-offset-color: #fecaca; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-red-300 | --tw-ring-offset-color: #fca5a5; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-red-400 | --tw-ring-offset-color: #f87171; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-red-500 | --tw-ring-offset-color: #ef4444; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-red-600 | --tw-ring-offset-color: #dc2626; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-red-700 | --tw-ring-offset-color: #b91c1c; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-red-800 | --tw-ring-offset-color: #991b1b; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-red-900 | --tw-ring-offset-color: #7f1d1d; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-orange-50 | --tw-ring-offset-color: #fff7ed; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-orange-100 | --tw-ring-offset-color: #ffedd5; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-orange-200 | --tw-ring-offset-color: #fed7aa; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-orange-300 | --tw-ring-offset-color: #fdba74; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-orange-400 | --tw-ring-offset-color: #fb923c; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-orange-500 | --tw-ring-offset-color: #f97316; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-orange-600 | --tw-ring-offset-color: #ea580c; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-orange-700 | --tw-ring-offset-color: #c2410c; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-orange-800 | --tw-ring-offset-color: #9a3412; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-orange-900 | --tw-ring-offset-color: #7c2d12; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-amber-50 | --tw-ring-offset-color: #fffbeb; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-amber-100 | --tw-ring-offset-color: #fef3c7; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-amber-200 | --tw-ring-offset-color: #fde68a; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-amber-300 | --tw-ring-offset-color: #fcd34d; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-amber-400 | --tw-ring-offset-color: #fbbf24; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-amber-500 | --tw-ring-offset-color: #f59e0b; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-amber-600 | --tw-ring-offset-color: #d97706; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-amber-700 | --tw-ring-offset-color: #b45309; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-amber-800 | --tw-ring-offset-color: #92400e; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-amber-900 | --tw-ring-offset-color: #78350f; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-yellow-50 | --tw-ring-offset-color: #fefce8; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-yellow-100 | --tw-ring-offset-color: #fef9c3; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-yellow-200 | --tw-ring-offset-color: #fef08a; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-yellow-300 | --tw-ring-offset-color: #fde047; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-yellow-400 | --tw-ring-offset-color: #facc15; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-yellow-500 | --tw-ring-offset-color: #eab308; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-yellow-600 | --tw-ring-offset-color: #ca8a04; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-yellow-700 | --tw-ring-offset-color: #a16207; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-yellow-800 | --tw-ring-offset-color: #854d0e; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-yellow-900 | --tw-ring-offset-color: #713f12; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-lime-50 | --tw-ring-offset-color: #f7fee7; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-lime-100 | --tw-ring-offset-color: #ecfccb; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-lime-200 | --tw-ring-offset-color: #d9f99d; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-lime-300 | --tw-ring-offset-color: #bef264; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-lime-400 | --tw-ring-offset-color: #a3e635; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-lime-500 | --tw-ring-offset-color: #84cc16; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-lime-600 | --tw-ring-offset-color: #65a30d; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-lime-700 | --tw-ring-offset-color: #4d7c0f; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-lime-800 | --tw-ring-offset-color: #3f6212; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-lime-900 | --tw-ring-offset-color: #365314; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-green-50 | --tw-ring-offset-color: #f0fdf4; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-green-100 | --tw-ring-offset-color: #dcfce7; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-green-200 | --tw-ring-offset-color: #bbf7d0; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-green-300 | --tw-ring-offset-color: #86efac; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-green-400 | --tw-ring-offset-color: #4ade80; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-green-500 | --tw-ring-offset-color: #22c55e; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-green-600 | --tw-ring-offset-color: #16a34a; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-green-700 | --tw-ring-offset-color: #15803d; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-green-800 | --tw-ring-offset-color: #166534; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-green-900 | --tw-ring-offset-color: #14532d; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-emerald-50 | --tw-ring-offset-color: #ecfdf5; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-emerald-100 | --tw-ring-offset-color: #d1fae5; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-emerald-200 | --tw-ring-offset-color: #a7f3d0; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-emerald-300 | --tw-ring-offset-color: #6ee7b7; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-emerald-400 | --tw-ring-offset-color: #34d399; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-emerald-500 | --tw-ring-offset-color: #10b981; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-emerald-600 | --tw-ring-offset-color: #059669; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-emerald-700 | --tw-ring-offset-color: #047857; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-emerald-800 | --tw-ring-offset-color: #065f46; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-emerald-900 | --tw-ring-offset-color: #064e3b; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-teal-50 | --tw-ring-offset-color: #f0fdfa; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-teal-100 | --tw-ring-offset-color: #ccfbf1; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-teal-200 | --tw-ring-offset-color: #99f6e4; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-teal-300 | --tw-ring-offset-color: #5eead4; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-teal-400 | --tw-ring-offset-color: #2dd4bf; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-teal-500 | --tw-ring-offset-color: #14b8a6; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-teal-600 | --tw-ring-offset-color: #0d9488; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-teal-700 | --tw-ring-offset-color: #0f766e; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-teal-800 | --tw-ring-offset-color: #115e59; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-teal-900 | --tw-ring-offset-color: #134e4a; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-cyan-50 | --tw-ring-offset-color: #ecfeff; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-cyan-100 | --tw-ring-offset-color: #cffafe; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-cyan-200 | --tw-ring-offset-color: #a5f3fc; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-cyan-300 | --tw-ring-offset-color: #67e8f9; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-cyan-400 | --tw-ring-offset-color: #22d3ee; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-cyan-500 | --tw-ring-offset-color: #06b6d4; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-cyan-600 | --tw-ring-offset-color: #0891b2; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-cyan-700 | --tw-ring-offset-color: #0e7490; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-cyan-800 | --tw-ring-offset-color: #155e75; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-cyan-900 | --tw-ring-offset-color: #164e63; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-sky-50 | --tw-ring-offset-color: #f0f9ff; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-sky-100 | --tw-ring-offset-color: #e0f2fe; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-sky-200 | --tw-ring-offset-color: #bae6fd; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-sky-300 | --tw-ring-offset-color: #7dd3fc; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-sky-400 | --tw-ring-offset-color: #38bdf8; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-sky-500 | --tw-ring-offset-color: #0ea5e9; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-sky-600 | --tw-ring-offset-color: #0284c7; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-sky-700 | --tw-ring-offset-color: #0369a1; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-sky-800 | --tw-ring-offset-color: #075985; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-sky-900 | --tw-ring-offset-color: #0c4a6e; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-blue-50 | --tw-ring-offset-color: #eff6ff; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-blue-100 | --tw-ring-offset-color: #dbeafe; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-blue-200 | --tw-ring-offset-color: #bfdbfe; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-blue-300 | --tw-ring-offset-color: #93c5fd; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-blue-400 | --tw-ring-offset-color: #60a5fa; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-blue-500 | --tw-ring-offset-color: #3b82f6; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-blue-600 | --tw-ring-offset-color: #2563eb; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-blue-700 | --tw-ring-offset-color: #1d4ed8; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-blue-800 | --tw-ring-offset-color: #1e40af; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-blue-900 | --tw-ring-offset-color: #1e3a8a; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-indigo-50 | --tw-ring-offset-color: #eef2ff; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-indigo-100 | --tw-ring-offset-color: #e0e7ff; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-indigo-200 | --tw-ring-offset-color: #c7d2fe; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-indigo-300 | --tw-ring-offset-color: #a5b4fc; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-indigo-400 | --tw-ring-offset-color: #818cf8; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-indigo-500 | --tw-ring-offset-color: #6366f1; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-indigo-600 | --tw-ring-offset-color: #4f46e5; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-indigo-700 | --tw-ring-offset-color: #4338ca; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-indigo-800 | --tw-ring-offset-color: #3730a3; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-indigo-900 | --tw-ring-offset-color: #312e81; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-violet-50 | --tw-ring-offset-color: #f5f3ff; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-violet-100 | --tw-ring-offset-color: #ede9fe; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-violet-200 | --tw-ring-offset-color: #ddd6fe; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-violet-300 | --tw-ring-offset-color: #c4b5fd; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-violet-400 | --tw-ring-offset-color: #a78bfa; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-violet-500 | --tw-ring-offset-color: #8b5cf6; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-violet-600 | --tw-ring-offset-color: #7c3aed; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-violet-700 | --tw-ring-offset-color: #6d28d9; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-violet-800 | --tw-ring-offset-color: #5b21b6; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-violet-900 | --tw-ring-offset-color: #4c1d95; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-purple-50 | --tw-ring-offset-color: #faf5ff; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-purple-100 | --tw-ring-offset-color: #f3e8ff; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-purple-200 | --tw-ring-offset-color: #e9d5ff; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-purple-300 | --tw-ring-offset-color: #d8b4fe; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-purple-400 | --tw-ring-offset-color: #c084fc; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-purple-500 | --tw-ring-offset-color: #a855f7; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-purple-600 | --tw-ring-offset-color: #9333ea; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-purple-700 | --tw-ring-offset-color: #7e22ce; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-purple-800 | --tw-ring-offset-color: #6b21a8; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-purple-900 | --tw-ring-offset-color: #581c87; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-fuchsia-50 | --tw-ring-offset-color: #fdf4ff; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-fuchsia-100 | --tw-ring-offset-color: #fae8ff; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-fuchsia-200 | --tw-ring-offset-color: #f5d0fe; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-fuchsia-300 | --tw-ring-offset-color: #f0abfc; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-fuchsia-400 | --tw-ring-offset-color: #e879f9; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-fuchsia-500 | --tw-ring-offset-color: #d946ef; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-fuchsia-600 | --tw-ring-offset-color: #c026d3; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-fuchsia-700 | --tw-ring-offset-color: #a21caf; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-fuchsia-800 | --tw-ring-offset-color: #86198f; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-fuchsia-900 | --tw-ring-offset-color: #701a75; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-pink-50 | --tw-ring-offset-color: #fdf2f8; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-pink-100 | --tw-ring-offset-color: #fce7f3; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-pink-200 | --tw-ring-offset-color: #fbcfe8; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-pink-300 | --tw-ring-offset-color: #f9a8d4; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-pink-400 | --tw-ring-offset-color: #f472b6; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-pink-500 | --tw-ring-offset-color: #ec4899; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-pink-600 | --tw-ring-offset-color: #db2777; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-pink-700 | --tw-ring-offset-color: #be185d; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-pink-800 | --tw-ring-offset-color: #9d174d; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-pink-900 | --tw-ring-offset-color: #831843; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-rose-50 | --tw-ring-offset-color: #fff1f2; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-rose-100 | --tw-ring-offset-color: #ffe4e6; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-rose-200 | --tw-ring-offset-color: #fecdd3; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-rose-300 | --tw-ring-offset-color: #fda4af; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-rose-400 | --tw-ring-offset-color: #fb7185; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-rose-500 | --tw-ring-offset-color: #f43f5e; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-rose-600 | --tw-ring-offset-color: #e11d48; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-rose-700 | --tw-ring-offset-color: #be123c; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-rose-800 | --tw-ring-offset-color: #9f1239; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-rose-900 | --tw-ring-offset-color: #881337; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | Basic usage ----------- ### Setting the ring offset color Use the `ring-offset-{color}` utilities to change the color of a ring offset. Usually this is done to try and match the offset to the parent background color, since true box-shadow offsets aren’t actually possible in CSS. ``` <button class="ring-2 ring-purple-500 ring-offset-4 ring-offset-purple-100 ..."> Save Changes </button> ``` ### Changing the opacity Control the opacity of an element’s ring offset color using the color opacity modifier. ``` <button class="ring-2 ring-purple-500 ring-offset-4 ring-offset-purple-100/50"></button> ``` You can use any value defined in your [opacity scale](opacity), or use arbitrary values if you need to deviate from your design tokens. ``` <button class="ring-2 ring-purple-500 ring-offset-4 ring-offset-purple-100/[.55]"></button> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:ring-offset-blue-500` to only apply the `ring-offset-blue-500` utility on hover. ``` <div class="ring-2 ring-offset-2 ring-offset-blue-300 hover:ring-offset-blue-500"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:ring-offset-blue-500` to apply the `ring-offset-blue-500` utility at only medium screen sizes and above. ``` <div class="ring-2 ring-offset-2 ring-offset-blue-300 md:ring-offset-blue-500"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind makes the entire [default color palette](customizing-colors#default-color-palette) available as ring offset color colors. You can [customize your color palette](/docs/customizing-colors#customizing) by editing `theme.colors` or `theme.extend.colors` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { colors: { 'regal-blue': '#243c5a', }, } } } ``` Alternatively, you can customize just your ring offset color colors by editing `theme.ringOffsetColor` or `theme.extend.ringOffsetColor` in your `tailwind.config.js` file. Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `ring-offset-{color}` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="ring-offset-[#50d71e]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation.
programming_docs
tailwindcss Align Items Quick reference --------------- | Class | Properties | | --- | --- | | items-start | align-items: flex-start; | | items-end | align-items: flex-end; | | items-center | align-items: center; | | items-baseline | align-items: baseline; | | items-stretch | align-items: stretch; | Basic usage ----------- ### Stretch Use `items-stretch` to stretch items to fill the container’s cross axis: ``` <div class="flex items-stretch ..."> <div class="py-4">01</div> <div class="py-12">02</div> <div class="py-8">03</div> </div> ``` ### Start Use `items-start` to align items to the start of the container’s cross axis: ``` <div class="flex items-start ..."> <div class="py-4">01</div> <div class="py-12">02</div> <div class="py-8">03</div> </div> ``` ### Center Use `items-center` to align items along the center of the container’s cross axis: ``` <div class="flex items-center ..."> <div class="py-4">01</div> <div class="py-12">02</div> <div class="py-8">03</div> </div> ``` ### End Use `items-end` to align items to the end of the container’s cross axis: ``` <div class="flex items-end ..."> <div class="py-4">01</div> <div class="py-12">02</div> <div class="py-8">03</div> </div> ``` ### Baseline Use `items-baseline` to align items along the container’s cross axis such that all of their baselines align: ``` <div class="flex items-baseline ..."> <div class="pt-2 pb-6">01</div> <div class="pt-8 pb-12">02</div> <div class="pt-12 pb-4">03</div> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:items-center` to only apply the `items-center` utility on hover. ``` <div class="flex items-stretch hover:items-center"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:items-center` to apply the `items-center` utility at only medium screen sizes and above. ``` <div class="flex items-stretch md:items-center"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Flex Basis Quick reference --------------- | Class | Properties | | --- | --- | | basis-0 | flex-basis: 0px; | | basis-1 | flex-basis: 0.25rem; /\* 4px \*/ | | basis-2 | flex-basis: 0.5rem; /\* 8px \*/ | | basis-3 | flex-basis: 0.75rem; /\* 12px \*/ | | basis-4 | flex-basis: 1rem; /\* 16px \*/ | | basis-5 | flex-basis: 1.25rem; /\* 20px \*/ | | basis-6 | flex-basis: 1.5rem; /\* 24px \*/ | | basis-7 | flex-basis: 1.75rem; /\* 28px \*/ | | basis-8 | flex-basis: 2rem; /\* 32px \*/ | | basis-9 | flex-basis: 2.25rem; /\* 36px \*/ | | basis-10 | flex-basis: 2.5rem; /\* 40px \*/ | | basis-11 | flex-basis: 2.75rem; /\* 44px \*/ | | basis-12 | flex-basis: 3rem; /\* 48px \*/ | | basis-14 | flex-basis: 3.5rem; /\* 56px \*/ | | basis-16 | flex-basis: 4rem; /\* 64px \*/ | | basis-20 | flex-basis: 5rem; /\* 80px \*/ | | basis-24 | flex-basis: 6rem; /\* 96px \*/ | | basis-28 | flex-basis: 7rem; /\* 112px \*/ | | basis-32 | flex-basis: 8rem; /\* 128px \*/ | | basis-36 | flex-basis: 9rem; /\* 144px \*/ | | basis-40 | flex-basis: 10rem; /\* 160px \*/ | | basis-44 | flex-basis: 11rem; /\* 176px \*/ | | basis-48 | flex-basis: 12rem; /\* 192px \*/ | | basis-52 | flex-basis: 13rem; /\* 208px \*/ | | basis-56 | flex-basis: 14rem; /\* 224px \*/ | | basis-60 | flex-basis: 15rem; /\* 240px \*/ | | basis-64 | flex-basis: 16rem; /\* 256px \*/ | | basis-72 | flex-basis: 18rem; /\* 288px \*/ | | basis-80 | flex-basis: 20rem; /\* 320px \*/ | | basis-96 | flex-basis: 24rem; /\* 384px \*/ | | basis-auto | flex-basis: auto; | | basis-px | flex-basis: 1px; | | basis-0.5 | flex-basis: 0.125rem; /\* 2px \*/ | | basis-1.5 | flex-basis: 0.375rem; /\* 6px \*/ | | basis-2.5 | flex-basis: 0.625rem; /\* 10px \*/ | | basis-3.5 | flex-basis: 0.875rem; /\* 14px \*/ | | basis-1/2 | flex-basis: 50%; | | basis-1/3 | flex-basis: 33.333333%; | | basis-2/3 | flex-basis: 66.666667%; | | basis-1/4 | flex-basis: 25%; | | basis-2/4 | flex-basis: 50%; | | basis-3/4 | flex-basis: 75%; | | basis-1/5 | flex-basis: 20%; | | basis-2/5 | flex-basis: 40%; | | basis-3/5 | flex-basis: 60%; | | basis-4/5 | flex-basis: 80%; | | basis-1/6 | flex-basis: 16.666667%; | | basis-2/6 | flex-basis: 33.333333%; | | basis-3/6 | flex-basis: 50%; | | basis-4/6 | flex-basis: 66.666667%; | | basis-5/6 | flex-basis: 83.333333%; | | basis-1/12 | flex-basis: 8.333333%; | | basis-2/12 | flex-basis: 16.666667%; | | basis-3/12 | flex-basis: 25%; | | basis-4/12 | flex-basis: 33.333333%; | | basis-5/12 | flex-basis: 41.666667%; | | basis-6/12 | flex-basis: 50%; | | basis-7/12 | flex-basis: 58.333333%; | | basis-8/12 | flex-basis: 66.666667%; | | basis-9/12 | flex-basis: 75%; | | basis-10/12 | flex-basis: 83.333333%; | | basis-11/12 | flex-basis: 91.666667%; | | basis-full | flex-basis: 100%; | Basic usage ----------- ### Setting the flex basis Use the `basis-{size}` utilities to set the initial size of flex items. ``` <div class="flex flex-row"> <div class="basis-1/4">01</div> <div class="basis-1/4">02</div> <div class="basis-1/2">03</div> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:basis-1/2` to only apply the `basis-1/2` utility on hover. ``` <div class="basis-1/3 hover:basis-1/2"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:basis-1/3` to apply the `basis-1/3` utility at only medium screen sizes and above. ``` <div class="flex flex-row"> <div class="basis-1/4 md:basis-1/3">01</div> <div class="basis-1/4 md:basis-1/3">02</div> <div class="basis-1/2 md:basis-1/3">03</div> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme The default flex basis scale is a combination of the [default spacing scale](customizing-spacing#default-spacing-scale) as well as a set of percentage based values. You can customize your spacing scale by editing `theme.spacing` or `theme.extend.spacing` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { spacing: { '112': '28rem', '128': '32rem', } } } } ``` Alternatively, you can customize just the flex basis scale by editing `theme.flexBasis` or `theme.extend.flexBasis` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { flexBasis: { '1/7': '14.2857143%', '2/7': '28.5714286%', '3/7': '42.8571429%', '4/7': '57.1428571%', '5/7': '71.4285714%', '6/7': '85.7142857%', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `flex-basis` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="basis-[14.2857143%]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Ring Offset Width Quick reference --------------- | Class | Properties | | --- | --- | | ring-offset-0 | --tw-ring-offset-width: 0px; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-1 | --tw-ring-offset-width: 1px; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-2 | --tw-ring-offset-width: 2px; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-4 | --tw-ring-offset-width: 4px; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | | ring-offset-8 | --tw-ring-offset-width: 8px; box-shadow: 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color), var(--tw-ring-shadow); | Basic usage ----------- ### Setting the ring offset width Use the `ring-offset-{width}` utilities to simulate an offset by adding solid white box-shadow and increasing the thickness of the accompanying outline ring to accommodate the offset. ``` <button class="... ring ring-pink-500 ring-offset-0">Button A</button> <button class="... ring ring-pink-500 ring-offset-2">Button B</button> <button class="... ring ring-pink-500 ring-offset-4">Button C</button> ``` ### Changing the offset color You can’t actually offset a box-shadow in CSS, so we have to fake it using a solid color shadow that matches the parent background color. We use white by default, but if you are adding a ring offset over a different background color, you should use the `ring-offset-{color}` utilities to match the parent background color: ``` <button class="... ring ring-pink-500 ring-offset-2 ring-offset-pink-100"> Save Changes </button> ``` For more information, see the [ring offset color](ring-offset-color) documentation. Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:ring-offset-4` to only apply the `ring-offset-4` utility on hover. ``` <button class="ring-2 ring-offset-2 hover:ring-offset-4"> <!-- ... --> </button> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:ring-offset-4` to apply the `ring-offset-4` utility at only medium screen sizes and above. ``` <button class="ring-2 ring-offset-2 md:ring-offset-4"> <!-- ... --> </button> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme To customize which ring offset width utilities are generated, add your custom values under `ringOffsetWidth` key in the `theme` section of your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { ringOffsetWidth: { '3': '3px', '6': '6px', '10': '10px', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `ring-offset` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="ring-offset-[3px]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Break Before Quick reference --------------- | Class | Properties | | --- | --- | | break-before-auto | break-before: auto; | | break-before-avoid | break-before: avoid; | | break-before-all | break-before: all; | | break-before-avoid-page | break-before: avoid-page; | | break-before-page | break-before: page; | | break-before-left | break-before: left; | | break-before-right | break-before: right; | | break-before-column | break-before: column; | Basic usage ----------- ### Setting the break-before behavior Use the `break-before-{value}` utilities to control how a column or page break should behave before an element. For example, use the `break-before-column` utility to force a column break before an element. ``` <div class="columns-2"> <p>Well, let me tell you something, ...</p> <p class="break-before-column">Sure, go ahead, laugh...</p> <p>Maybe we can live without...</p> <p>Look. If you think this is...</p> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:break-before-column` to only apply the `break-before-column` utility on hover. ``` <div class="hover:break-before-column"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:break-before-column` to apply the `break-before-column` utility at only medium screen sizes and above. ``` <div class="md:break-before-column"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Grayscale Quick reference --------------- | Class | Properties | | --- | --- | | grayscale-0 | filter: grayscale(0); | | grayscale | filter: grayscale(100%); | Basic usage ----------- ### Making an element grayscale Use the `grayscale` and `grayscale-0` utilities to control whether an element should be rendered as grayscale or in full color. ``` <div class="grayscale-0 ..."> <!-- ... --> </div> <div class="grayscale ..."> <!-- ... --> </div> ``` ### Removing filters To remove all of the filters on an element at once, use the `filter-none` utility: ``` <div class="blur-md invert grayscale md:filter-none"> <!-- ... --> </div> ``` This can be useful when you want to remove filters conditionally, such as on hover or at a particular breakpoint. Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:grayscale-0` to only apply the `grayscale-0` utility on hover. ``` <div class="grayscale hover:grayscale-0"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:grayscale-0` to apply the `grayscale-0` utility at only medium screen sizes and above. ``` <div class="grayscale md:grayscale-0"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind includes a handful of general purpose `grayscale` utilities. You can customize these values by editing `theme.grayscale` or `theme.extend.grayscale` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { grayscale: { 50: '50%', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `grayscale` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="grayscale-[50%]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Accent Color Quick reference --------------- | Class | Properties | | --- | --- | | accent-inherit | accent-color: inherit; | | accent-current | accent-color: currentColor; | | accent-transparent | accent-color: transparent; | | accent-black | accent-color: #000; | | accent-white | accent-color: #fff; | | accent-slate-50 | accent-color: #f8fafc; | | accent-slate-100 | accent-color: #f1f5f9; | | accent-slate-200 | accent-color: #e2e8f0; | | accent-slate-300 | accent-color: #cbd5e1; | | accent-slate-400 | accent-color: #94a3b8; | | accent-slate-500 | accent-color: #64748b; | | accent-slate-600 | accent-color: #475569; | | accent-slate-700 | accent-color: #334155; | | accent-slate-800 | accent-color: #1e293b; | | accent-slate-900 | accent-color: #0f172a; | | accent-gray-50 | accent-color: #f9fafb; | | accent-gray-100 | accent-color: #f3f4f6; | | accent-gray-200 | accent-color: #e5e7eb; | | accent-gray-300 | accent-color: #d1d5db; | | accent-gray-400 | accent-color: #9ca3af; | | accent-gray-500 | accent-color: #6b7280; | | accent-gray-600 | accent-color: #4b5563; | | accent-gray-700 | accent-color: #374151; | | accent-gray-800 | accent-color: #1f2937; | | accent-gray-900 | accent-color: #111827; | | accent-zinc-50 | accent-color: #fafafa; | | accent-zinc-100 | accent-color: #f4f4f5; | | accent-zinc-200 | accent-color: #e4e4e7; | | accent-zinc-300 | accent-color: #d4d4d8; | | accent-zinc-400 | accent-color: #a1a1aa; | | accent-zinc-500 | accent-color: #71717a; | | accent-zinc-600 | accent-color: #52525b; | | accent-zinc-700 | accent-color: #3f3f46; | | accent-zinc-800 | accent-color: #27272a; | | accent-zinc-900 | accent-color: #18181b; | | accent-neutral-50 | accent-color: #fafafa; | | accent-neutral-100 | accent-color: #f5f5f5; | | accent-neutral-200 | accent-color: #e5e5e5; | | accent-neutral-300 | accent-color: #d4d4d4; | | accent-neutral-400 | accent-color: #a3a3a3; | | accent-neutral-500 | accent-color: #737373; | | accent-neutral-600 | accent-color: #525252; | | accent-neutral-700 | accent-color: #404040; | | accent-neutral-800 | accent-color: #262626; | | accent-neutral-900 | accent-color: #171717; | | accent-stone-50 | accent-color: #fafaf9; | | accent-stone-100 | accent-color: #f5f5f4; | | accent-stone-200 | accent-color: #e7e5e4; | | accent-stone-300 | accent-color: #d6d3d1; | | accent-stone-400 | accent-color: #a8a29e; | | accent-stone-500 | accent-color: #78716c; | | accent-stone-600 | accent-color: #57534e; | | accent-stone-700 | accent-color: #44403c; | | accent-stone-800 | accent-color: #292524; | | accent-stone-900 | accent-color: #1c1917; | | accent-red-50 | accent-color: #fef2f2; | | accent-red-100 | accent-color: #fee2e2; | | accent-red-200 | accent-color: #fecaca; | | accent-red-300 | accent-color: #fca5a5; | | accent-red-400 | accent-color: #f87171; | | accent-red-500 | accent-color: #ef4444; | | accent-red-600 | accent-color: #dc2626; | | accent-red-700 | accent-color: #b91c1c; | | accent-red-800 | accent-color: #991b1b; | | accent-red-900 | accent-color: #7f1d1d; | | accent-orange-50 | accent-color: #fff7ed; | | accent-orange-100 | accent-color: #ffedd5; | | accent-orange-200 | accent-color: #fed7aa; | | accent-orange-300 | accent-color: #fdba74; | | accent-orange-400 | accent-color: #fb923c; | | accent-orange-500 | accent-color: #f97316; | | accent-orange-600 | accent-color: #ea580c; | | accent-orange-700 | accent-color: #c2410c; | | accent-orange-800 | accent-color: #9a3412; | | accent-orange-900 | accent-color: #7c2d12; | | accent-amber-50 | accent-color: #fffbeb; | | accent-amber-100 | accent-color: #fef3c7; | | accent-amber-200 | accent-color: #fde68a; | | accent-amber-300 | accent-color: #fcd34d; | | accent-amber-400 | accent-color: #fbbf24; | | accent-amber-500 | accent-color: #f59e0b; | | accent-amber-600 | accent-color: #d97706; | | accent-amber-700 | accent-color: #b45309; | | accent-amber-800 | accent-color: #92400e; | | accent-amber-900 | accent-color: #78350f; | | accent-yellow-50 | accent-color: #fefce8; | | accent-yellow-100 | accent-color: #fef9c3; | | accent-yellow-200 | accent-color: #fef08a; | | accent-yellow-300 | accent-color: #fde047; | | accent-yellow-400 | accent-color: #facc15; | | accent-yellow-500 | accent-color: #eab308; | | accent-yellow-600 | accent-color: #ca8a04; | | accent-yellow-700 | accent-color: #a16207; | | accent-yellow-800 | accent-color: #854d0e; | | accent-yellow-900 | accent-color: #713f12; | | accent-lime-50 | accent-color: #f7fee7; | | accent-lime-100 | accent-color: #ecfccb; | | accent-lime-200 | accent-color: #d9f99d; | | accent-lime-300 | accent-color: #bef264; | | accent-lime-400 | accent-color: #a3e635; | | accent-lime-500 | accent-color: #84cc16; | | accent-lime-600 | accent-color: #65a30d; | | accent-lime-700 | accent-color: #4d7c0f; | | accent-lime-800 | accent-color: #3f6212; | | accent-lime-900 | accent-color: #365314; | | accent-green-50 | accent-color: #f0fdf4; | | accent-green-100 | accent-color: #dcfce7; | | accent-green-200 | accent-color: #bbf7d0; | | accent-green-300 | accent-color: #86efac; | | accent-green-400 | accent-color: #4ade80; | | accent-green-500 | accent-color: #22c55e; | | accent-green-600 | accent-color: #16a34a; | | accent-green-700 | accent-color: #15803d; | | accent-green-800 | accent-color: #166534; | | accent-green-900 | accent-color: #14532d; | | accent-emerald-50 | accent-color: #ecfdf5; | | accent-emerald-100 | accent-color: #d1fae5; | | accent-emerald-200 | accent-color: #a7f3d0; | | accent-emerald-300 | accent-color: #6ee7b7; | | accent-emerald-400 | accent-color: #34d399; | | accent-emerald-500 | accent-color: #10b981; | | accent-emerald-600 | accent-color: #059669; | | accent-emerald-700 | accent-color: #047857; | | accent-emerald-800 | accent-color: #065f46; | | accent-emerald-900 | accent-color: #064e3b; | | accent-teal-50 | accent-color: #f0fdfa; | | accent-teal-100 | accent-color: #ccfbf1; | | accent-teal-200 | accent-color: #99f6e4; | | accent-teal-300 | accent-color: #5eead4; | | accent-teal-400 | accent-color: #2dd4bf; | | accent-teal-500 | accent-color: #14b8a6; | | accent-teal-600 | accent-color: #0d9488; | | accent-teal-700 | accent-color: #0f766e; | | accent-teal-800 | accent-color: #115e59; | | accent-teal-900 | accent-color: #134e4a; | | accent-cyan-50 | accent-color: #ecfeff; | | accent-cyan-100 | accent-color: #cffafe; | | accent-cyan-200 | accent-color: #a5f3fc; | | accent-cyan-300 | accent-color: #67e8f9; | | accent-cyan-400 | accent-color: #22d3ee; | | accent-cyan-500 | accent-color: #06b6d4; | | accent-cyan-600 | accent-color: #0891b2; | | accent-cyan-700 | accent-color: #0e7490; | | accent-cyan-800 | accent-color: #155e75; | | accent-cyan-900 | accent-color: #164e63; | | accent-sky-50 | accent-color: #f0f9ff; | | accent-sky-100 | accent-color: #e0f2fe; | | accent-sky-200 | accent-color: #bae6fd; | | accent-sky-300 | accent-color: #7dd3fc; | | accent-sky-400 | accent-color: #38bdf8; | | accent-sky-500 | accent-color: #0ea5e9; | | accent-sky-600 | accent-color: #0284c7; | | accent-sky-700 | accent-color: #0369a1; | | accent-sky-800 | accent-color: #075985; | | accent-sky-900 | accent-color: #0c4a6e; | | accent-blue-50 | accent-color: #eff6ff; | | accent-blue-100 | accent-color: #dbeafe; | | accent-blue-200 | accent-color: #bfdbfe; | | accent-blue-300 | accent-color: #93c5fd; | | accent-blue-400 | accent-color: #60a5fa; | | accent-blue-500 | accent-color: #3b82f6; | | accent-blue-600 | accent-color: #2563eb; | | accent-blue-700 | accent-color: #1d4ed8; | | accent-blue-800 | accent-color: #1e40af; | | accent-blue-900 | accent-color: #1e3a8a; | | accent-indigo-50 | accent-color: #eef2ff; | | accent-indigo-100 | accent-color: #e0e7ff; | | accent-indigo-200 | accent-color: #c7d2fe; | | accent-indigo-300 | accent-color: #a5b4fc; | | accent-indigo-400 | accent-color: #818cf8; | | accent-indigo-500 | accent-color: #6366f1; | | accent-indigo-600 | accent-color: #4f46e5; | | accent-indigo-700 | accent-color: #4338ca; | | accent-indigo-800 | accent-color: #3730a3; | | accent-indigo-900 | accent-color: #312e81; | | accent-violet-50 | accent-color: #f5f3ff; | | accent-violet-100 | accent-color: #ede9fe; | | accent-violet-200 | accent-color: #ddd6fe; | | accent-violet-300 | accent-color: #c4b5fd; | | accent-violet-400 | accent-color: #a78bfa; | | accent-violet-500 | accent-color: #8b5cf6; | | accent-violet-600 | accent-color: #7c3aed; | | accent-violet-700 | accent-color: #6d28d9; | | accent-violet-800 | accent-color: #5b21b6; | | accent-violet-900 | accent-color: #4c1d95; | | accent-purple-50 | accent-color: #faf5ff; | | accent-purple-100 | accent-color: #f3e8ff; | | accent-purple-200 | accent-color: #e9d5ff; | | accent-purple-300 | accent-color: #d8b4fe; | | accent-purple-400 | accent-color: #c084fc; | | accent-purple-500 | accent-color: #a855f7; | | accent-purple-600 | accent-color: #9333ea; | | accent-purple-700 | accent-color: #7e22ce; | | accent-purple-800 | accent-color: #6b21a8; | | accent-purple-900 | accent-color: #581c87; | | accent-fuchsia-50 | accent-color: #fdf4ff; | | accent-fuchsia-100 | accent-color: #fae8ff; | | accent-fuchsia-200 | accent-color: #f5d0fe; | | accent-fuchsia-300 | accent-color: #f0abfc; | | accent-fuchsia-400 | accent-color: #e879f9; | | accent-fuchsia-500 | accent-color: #d946ef; | | accent-fuchsia-600 | accent-color: #c026d3; | | accent-fuchsia-700 | accent-color: #a21caf; | | accent-fuchsia-800 | accent-color: #86198f; | | accent-fuchsia-900 | accent-color: #701a75; | | accent-pink-50 | accent-color: #fdf2f8; | | accent-pink-100 | accent-color: #fce7f3; | | accent-pink-200 | accent-color: #fbcfe8; | | accent-pink-300 | accent-color: #f9a8d4; | | accent-pink-400 | accent-color: #f472b6; | | accent-pink-500 | accent-color: #ec4899; | | accent-pink-600 | accent-color: #db2777; | | accent-pink-700 | accent-color: #be185d; | | accent-pink-800 | accent-color: #9d174d; | | accent-pink-900 | accent-color: #831843; | | accent-rose-50 | accent-color: #fff1f2; | | accent-rose-100 | accent-color: #ffe4e6; | | accent-rose-200 | accent-color: #fecdd3; | | accent-rose-300 | accent-color: #fda4af; | | accent-rose-400 | accent-color: #fb7185; | | accent-rose-500 | accent-color: #f43f5e; | | accent-rose-600 | accent-color: #e11d48; | | accent-rose-700 | accent-color: #be123c; | | accent-rose-800 | accent-color: #9f1239; | | accent-rose-900 | accent-color: #881337; | | accent-auto | accent-color: auto; | Basic usage ----------- ### Setting the accent color Use the `accent-{color}` utilities to change the accent color of an element. This is helpful for styling elements like checkboxes and radio groups by overriding the browser’s default color. ``` <label> <input type="checkbox" checked> Browser default </label> <label> <input type="checkbox" class="accent-pink-500" checked> Customized </label> ``` ### Changing the opacity While it’s possible to control the opacity of the accent color using the color opacity modifier, the `rgba()` alpha value is only supported in Firefox at this time *(last tested November 2021)*. ``` <input type="checkbox" class="accent-emerald-500/25" checked> Emerald ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:accent-pink-500` to only apply the `accent-pink-500` utility on hover. ``` <input type="checkbox" class="accent-pink-300 focus:accent-pink-500" checked> ``` Note, while it’s possible to set an accent color using the `hover` and `active` modifiers, the resulting color will be slightly different than what you set, as browsers automatically adjust the brightness of the accent color for these two states. For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:accent-pink-500` to apply the `accent-pink-500` utility at only medium screen sizes and above. ``` <input type="checkbox" class="accent-pink-300 md:accent-pink-500" checked> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind makes the entire [default color palette](customizing-colors#default-color-palette) available as accent colors. You can [customize your color palette](/docs/customizing-colors#customizing) by editing `theme.colors` or `theme.extend.colors` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { colors: { 'regal-blue': '#243c5a', }, } } } ``` Alternatively, you can customize just your accent colors by editing `theme.accentColor` or `theme.extend.accentColor` in your `tailwind.config.js` file. Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `accent-color` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <input type="checkbox" class="accent-[#50d71e]" checked> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation.
programming_docs
tailwindcss Pointer Events Quick reference --------------- | Class | Properties | | --- | --- | | pointer-events-none | pointer-events: none; | | pointer-events-auto | pointer-events: auto; | Basic usage ----------- ### Controlling pointer event behavior Use `pointer-events-auto` to revert to the default browser behavior for pointer events (like `:hover` and `click`). Use `pointer-events-none` to make an element ignore pointer events. The pointer events will still trigger on child elements and pass-through to elements that are “beneath” the target. ``` <div class="relative ..."> <div class="absolute pointer-events-auto ..."> <svg class="absolute text-slate-400 h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path fill-rule="evenodd" d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z" clip-rule="evenodd" /> </svg> </div> <input type="text" placeholder="Search" class="..."> </div> <div class="relative ..."> <div class="absolute pointer-events-none ..."> <svg class="absolute text-slate-400 h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path fill-rule="evenodd" d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z" clip-rule="evenodd" /> </svg> </div> <input type="text" placeholder="Search" class="..."> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `focus:pointer-events-auto` to only apply the `pointer-events-auto` utility on focus. ``` <div class="pointer-events-none focus:pointer-events-auto"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:pointer-events-auto` to apply the `pointer-events-auto` utility at only medium screen sizes and above. ``` <div class="pointer-events-none md:pointer-events-auto"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Text Decoration Color Quick reference --------------- | Class | Properties | | --- | --- | | decoration-inherit | text-decoration-color: inherit; | | decoration-current | text-decoration-color: currentColor; | | decoration-transparent | text-decoration-color: transparent; | | decoration-black | text-decoration-color: #000; | | decoration-white | text-decoration-color: #fff; | | decoration-slate-50 | text-decoration-color: #f8fafc; | | decoration-slate-100 | text-decoration-color: #f1f5f9; | | decoration-slate-200 | text-decoration-color: #e2e8f0; | | decoration-slate-300 | text-decoration-color: #cbd5e1; | | decoration-slate-400 | text-decoration-color: #94a3b8; | | decoration-slate-500 | text-decoration-color: #64748b; | | decoration-slate-600 | text-decoration-color: #475569; | | decoration-slate-700 | text-decoration-color: #334155; | | decoration-slate-800 | text-decoration-color: #1e293b; | | decoration-slate-900 | text-decoration-color: #0f172a; | | decoration-gray-50 | text-decoration-color: #f9fafb; | | decoration-gray-100 | text-decoration-color: #f3f4f6; | | decoration-gray-200 | text-decoration-color: #e5e7eb; | | decoration-gray-300 | text-decoration-color: #d1d5db; | | decoration-gray-400 | text-decoration-color: #9ca3af; | | decoration-gray-500 | text-decoration-color: #6b7280; | | decoration-gray-600 | text-decoration-color: #4b5563; | | decoration-gray-700 | text-decoration-color: #374151; | | decoration-gray-800 | text-decoration-color: #1f2937; | | decoration-gray-900 | text-decoration-color: #111827; | | decoration-zinc-50 | text-decoration-color: #fafafa; | | decoration-zinc-100 | text-decoration-color: #f4f4f5; | | decoration-zinc-200 | text-decoration-color: #e4e4e7; | | decoration-zinc-300 | text-decoration-color: #d4d4d8; | | decoration-zinc-400 | text-decoration-color: #a1a1aa; | | decoration-zinc-500 | text-decoration-color: #71717a; | | decoration-zinc-600 | text-decoration-color: #52525b; | | decoration-zinc-700 | text-decoration-color: #3f3f46; | | decoration-zinc-800 | text-decoration-color: #27272a; | | decoration-zinc-900 | text-decoration-color: #18181b; | | decoration-neutral-50 | text-decoration-color: #fafafa; | | decoration-neutral-100 | text-decoration-color: #f5f5f5; | | decoration-neutral-200 | text-decoration-color: #e5e5e5; | | decoration-neutral-300 | text-decoration-color: #d4d4d4; | | decoration-neutral-400 | text-decoration-color: #a3a3a3; | | decoration-neutral-500 | text-decoration-color: #737373; | | decoration-neutral-600 | text-decoration-color: #525252; | | decoration-neutral-700 | text-decoration-color: #404040; | | decoration-neutral-800 | text-decoration-color: #262626; | | decoration-neutral-900 | text-decoration-color: #171717; | | decoration-stone-50 | text-decoration-color: #fafaf9; | | decoration-stone-100 | text-decoration-color: #f5f5f4; | | decoration-stone-200 | text-decoration-color: #e7e5e4; | | decoration-stone-300 | text-decoration-color: #d6d3d1; | | decoration-stone-400 | text-decoration-color: #a8a29e; | | decoration-stone-500 | text-decoration-color: #78716c; | | decoration-stone-600 | text-decoration-color: #57534e; | | decoration-stone-700 | text-decoration-color: #44403c; | | decoration-stone-800 | text-decoration-color: #292524; | | decoration-stone-900 | text-decoration-color: #1c1917; | | decoration-red-50 | text-decoration-color: #fef2f2; | | decoration-red-100 | text-decoration-color: #fee2e2; | | decoration-red-200 | text-decoration-color: #fecaca; | | decoration-red-300 | text-decoration-color: #fca5a5; | | decoration-red-400 | text-decoration-color: #f87171; | | decoration-red-500 | text-decoration-color: #ef4444; | | decoration-red-600 | text-decoration-color: #dc2626; | | decoration-red-700 | text-decoration-color: #b91c1c; | | decoration-red-800 | text-decoration-color: #991b1b; | | decoration-red-900 | text-decoration-color: #7f1d1d; | | decoration-orange-50 | text-decoration-color: #fff7ed; | | decoration-orange-100 | text-decoration-color: #ffedd5; | | decoration-orange-200 | text-decoration-color: #fed7aa; | | decoration-orange-300 | text-decoration-color: #fdba74; | | decoration-orange-400 | text-decoration-color: #fb923c; | | decoration-orange-500 | text-decoration-color: #f97316; | | decoration-orange-600 | text-decoration-color: #ea580c; | | decoration-orange-700 | text-decoration-color: #c2410c; | | decoration-orange-800 | text-decoration-color: #9a3412; | | decoration-orange-900 | text-decoration-color: #7c2d12; | | decoration-amber-50 | text-decoration-color: #fffbeb; | | decoration-amber-100 | text-decoration-color: #fef3c7; | | decoration-amber-200 | text-decoration-color: #fde68a; | | decoration-amber-300 | text-decoration-color: #fcd34d; | | decoration-amber-400 | text-decoration-color: #fbbf24; | | decoration-amber-500 | text-decoration-color: #f59e0b; | | decoration-amber-600 | text-decoration-color: #d97706; | | decoration-amber-700 | text-decoration-color: #b45309; | | decoration-amber-800 | text-decoration-color: #92400e; | | decoration-amber-900 | text-decoration-color: #78350f; | | decoration-yellow-50 | text-decoration-color: #fefce8; | | decoration-yellow-100 | text-decoration-color: #fef9c3; | | decoration-yellow-200 | text-decoration-color: #fef08a; | | decoration-yellow-300 | text-decoration-color: #fde047; | | decoration-yellow-400 | text-decoration-color: #facc15; | | decoration-yellow-500 | text-decoration-color: #eab308; | | decoration-yellow-600 | text-decoration-color: #ca8a04; | | decoration-yellow-700 | text-decoration-color: #a16207; | | decoration-yellow-800 | text-decoration-color: #854d0e; | | decoration-yellow-900 | text-decoration-color: #713f12; | | decoration-lime-50 | text-decoration-color: #f7fee7; | | decoration-lime-100 | text-decoration-color: #ecfccb; | | decoration-lime-200 | text-decoration-color: #d9f99d; | | decoration-lime-300 | text-decoration-color: #bef264; | | decoration-lime-400 | text-decoration-color: #a3e635; | | decoration-lime-500 | text-decoration-color: #84cc16; | | decoration-lime-600 | text-decoration-color: #65a30d; | | decoration-lime-700 | text-decoration-color: #4d7c0f; | | decoration-lime-800 | text-decoration-color: #3f6212; | | decoration-lime-900 | text-decoration-color: #365314; | | decoration-green-50 | text-decoration-color: #f0fdf4; | | decoration-green-100 | text-decoration-color: #dcfce7; | | decoration-green-200 | text-decoration-color: #bbf7d0; | | decoration-green-300 | text-decoration-color: #86efac; | | decoration-green-400 | text-decoration-color: #4ade80; | | decoration-green-500 | text-decoration-color: #22c55e; | | decoration-green-600 | text-decoration-color: #16a34a; | | decoration-green-700 | text-decoration-color: #15803d; | | decoration-green-800 | text-decoration-color: #166534; | | decoration-green-900 | text-decoration-color: #14532d; | | decoration-emerald-50 | text-decoration-color: #ecfdf5; | | decoration-emerald-100 | text-decoration-color: #d1fae5; | | decoration-emerald-200 | text-decoration-color: #a7f3d0; | | decoration-emerald-300 | text-decoration-color: #6ee7b7; | | decoration-emerald-400 | text-decoration-color: #34d399; | | decoration-emerald-500 | text-decoration-color: #10b981; | | decoration-emerald-600 | text-decoration-color: #059669; | | decoration-emerald-700 | text-decoration-color: #047857; | | decoration-emerald-800 | text-decoration-color: #065f46; | | decoration-emerald-900 | text-decoration-color: #064e3b; | | decoration-teal-50 | text-decoration-color: #f0fdfa; | | decoration-teal-100 | text-decoration-color: #ccfbf1; | | decoration-teal-200 | text-decoration-color: #99f6e4; | | decoration-teal-300 | text-decoration-color: #5eead4; | | decoration-teal-400 | text-decoration-color: #2dd4bf; | | decoration-teal-500 | text-decoration-color: #14b8a6; | | decoration-teal-600 | text-decoration-color: #0d9488; | | decoration-teal-700 | text-decoration-color: #0f766e; | | decoration-teal-800 | text-decoration-color: #115e59; | | decoration-teal-900 | text-decoration-color: #134e4a; | | decoration-cyan-50 | text-decoration-color: #ecfeff; | | decoration-cyan-100 | text-decoration-color: #cffafe; | | decoration-cyan-200 | text-decoration-color: #a5f3fc; | | decoration-cyan-300 | text-decoration-color: #67e8f9; | | decoration-cyan-400 | text-decoration-color: #22d3ee; | | decoration-cyan-500 | text-decoration-color: #06b6d4; | | decoration-cyan-600 | text-decoration-color: #0891b2; | | decoration-cyan-700 | text-decoration-color: #0e7490; | | decoration-cyan-800 | text-decoration-color: #155e75; | | decoration-cyan-900 | text-decoration-color: #164e63; | | decoration-sky-50 | text-decoration-color: #f0f9ff; | | decoration-sky-100 | text-decoration-color: #e0f2fe; | | decoration-sky-200 | text-decoration-color: #bae6fd; | | decoration-sky-300 | text-decoration-color: #7dd3fc; | | decoration-sky-400 | text-decoration-color: #38bdf8; | | decoration-sky-500 | text-decoration-color: #0ea5e9; | | decoration-sky-600 | text-decoration-color: #0284c7; | | decoration-sky-700 | text-decoration-color: #0369a1; | | decoration-sky-800 | text-decoration-color: #075985; | | decoration-sky-900 | text-decoration-color: #0c4a6e; | | decoration-blue-50 | text-decoration-color: #eff6ff; | | decoration-blue-100 | text-decoration-color: #dbeafe; | | decoration-blue-200 | text-decoration-color: #bfdbfe; | | decoration-blue-300 | text-decoration-color: #93c5fd; | | decoration-blue-400 | text-decoration-color: #60a5fa; | | decoration-blue-500 | text-decoration-color: #3b82f6; | | decoration-blue-600 | text-decoration-color: #2563eb; | | decoration-blue-700 | text-decoration-color: #1d4ed8; | | decoration-blue-800 | text-decoration-color: #1e40af; | | decoration-blue-900 | text-decoration-color: #1e3a8a; | | decoration-indigo-50 | text-decoration-color: #eef2ff; | | decoration-indigo-100 | text-decoration-color: #e0e7ff; | | decoration-indigo-200 | text-decoration-color: #c7d2fe; | | decoration-indigo-300 | text-decoration-color: #a5b4fc; | | decoration-indigo-400 | text-decoration-color: #818cf8; | | decoration-indigo-500 | text-decoration-color: #6366f1; | | decoration-indigo-600 | text-decoration-color: #4f46e5; | | decoration-indigo-700 | text-decoration-color: #4338ca; | | decoration-indigo-800 | text-decoration-color: #3730a3; | | decoration-indigo-900 | text-decoration-color: #312e81; | | decoration-violet-50 | text-decoration-color: #f5f3ff; | | decoration-violet-100 | text-decoration-color: #ede9fe; | | decoration-violet-200 | text-decoration-color: #ddd6fe; | | decoration-violet-300 | text-decoration-color: #c4b5fd; | | decoration-violet-400 | text-decoration-color: #a78bfa; | | decoration-violet-500 | text-decoration-color: #8b5cf6; | | decoration-violet-600 | text-decoration-color: #7c3aed; | | decoration-violet-700 | text-decoration-color: #6d28d9; | | decoration-violet-800 | text-decoration-color: #5b21b6; | | decoration-violet-900 | text-decoration-color: #4c1d95; | | decoration-purple-50 | text-decoration-color: #faf5ff; | | decoration-purple-100 | text-decoration-color: #f3e8ff; | | decoration-purple-200 | text-decoration-color: #e9d5ff; | | decoration-purple-300 | text-decoration-color: #d8b4fe; | | decoration-purple-400 | text-decoration-color: #c084fc; | | decoration-purple-500 | text-decoration-color: #a855f7; | | decoration-purple-600 | text-decoration-color: #9333ea; | | decoration-purple-700 | text-decoration-color: #7e22ce; | | decoration-purple-800 | text-decoration-color: #6b21a8; | | decoration-purple-900 | text-decoration-color: #581c87; | | decoration-fuchsia-50 | text-decoration-color: #fdf4ff; | | decoration-fuchsia-100 | text-decoration-color: #fae8ff; | | decoration-fuchsia-200 | text-decoration-color: #f5d0fe; | | decoration-fuchsia-300 | text-decoration-color: #f0abfc; | | decoration-fuchsia-400 | text-decoration-color: #e879f9; | | decoration-fuchsia-500 | text-decoration-color: #d946ef; | | decoration-fuchsia-600 | text-decoration-color: #c026d3; | | decoration-fuchsia-700 | text-decoration-color: #a21caf; | | decoration-fuchsia-800 | text-decoration-color: #86198f; | | decoration-fuchsia-900 | text-decoration-color: #701a75; | | decoration-pink-50 | text-decoration-color: #fdf2f8; | | decoration-pink-100 | text-decoration-color: #fce7f3; | | decoration-pink-200 | text-decoration-color: #fbcfe8; | | decoration-pink-300 | text-decoration-color: #f9a8d4; | | decoration-pink-400 | text-decoration-color: #f472b6; | | decoration-pink-500 | text-decoration-color: #ec4899; | | decoration-pink-600 | text-decoration-color: #db2777; | | decoration-pink-700 | text-decoration-color: #be185d; | | decoration-pink-800 | text-decoration-color: #9d174d; | | decoration-pink-900 | text-decoration-color: #831843; | | decoration-rose-50 | text-decoration-color: #fff1f2; | | decoration-rose-100 | text-decoration-color: #ffe4e6; | | decoration-rose-200 | text-decoration-color: #fecdd3; | | decoration-rose-300 | text-decoration-color: #fda4af; | | decoration-rose-400 | text-decoration-color: #fb7185; | | decoration-rose-500 | text-decoration-color: #f43f5e; | | decoration-rose-600 | text-decoration-color: #e11d48; | | decoration-rose-700 | text-decoration-color: #be123c; | | decoration-rose-800 | text-decoration-color: #9f1239; | | decoration-rose-900 | text-decoration-color: #881337; | Basic usage ----------- ### Setting the text decoration color Use the `decoration-{color}` utilities to change the color of an element’s [text decoration](text-decoration). ``` <div> <p> I’m Derek, an astro-engineer based in Tattooine. I like to build X-Wings at <a class="underline decoration-sky-500">My Company, Inc</a>. Outside of work, I like to <a class="underline decoration-pink-500">watch pod-racing</a> and have <a class="underline decoration-indigo-500">light-saber</a> fights. </p> </div> ``` ### Changing the opacity Control the opacity of an element’s text decoration color using the color opacity modifier. ``` <div> <p> I’m Derek, an astro-engineer based in Tattooine. I like to build X-Wings at <a class="underline decoration-sky-500/30">My Company, Inc</a>. Outside of work, I like to <a class="underline decoration-pink-500/30">watch pod-racing</a> and have <a class="underline decoration-indigo-500/30">light-saber</a> fights. </p> </div> ``` You can use any value defined in your [opacity scale](opacity), or use arbitrary values if you need to deviate from your design tokens. ``` <strong class="underline decoration-sky-500/[.33]"></strong> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:decoration-blue-400` to only apply the `decoration-blue-400` utility on hover. ``` <p class="underline decoration-sky-600 hover:decoration-blue-400"> <!-- ... --> </p> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:decoration-blue-400` to apply the `decoration-blue-400` utility at only medium screen sizes and above. ``` <p class="underline decoration-sky-600 md:decoration-blue-400"> <!-- ... --> </p> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind makes the entire [default color palette](customizing-colors#default-color-palette) available as text decoration colors. You can [customize your color palette](/docs/customizing-colors#customizing) by editing `theme.colors` or `theme.extend.colors` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { colors: { 'regal-blue': '#243c5a', }, } } } ``` Alternatively, you can customize just your text decoration colors by editing `theme.textDecorationColor` or `theme.extend.textDecorationColor` in your `tailwind.config.js` file. Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `text-decoration-color` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <p class="decoration-[#50d71e]"> <!-- ... --> </p> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Flex Wrap Quick reference --------------- | Class | Properties | | --- | --- | | flex-wrap | flex-wrap: wrap; | | flex-wrap-reverse | flex-wrap: wrap-reverse; | | flex-nowrap | flex-wrap: nowrap; | Basic usage ----------- ### Don't wrap Use `flex-nowrap` to prevent flex items from wrapping, causing inflexible items to overflow the container if necessary: ``` <div class="flex flex-nowrap"> <div>01</div> <div>02</div> <div>03</div> </div> ``` ### Wrap normally Use `flex-wrap` to allow flex items to wrap: ``` <div class="flex flex-wrap"> <div>01</div> <div>02</div> <div>03</div> </div> ``` ### Wrap reversed Use `flex-wrap-reverse` to wrap flex items in the reverse direction: ``` <div class="flex flex-wrap-reverse"> <div>01</div> <div>02</div> <div>03</div> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:flex-wrap-reverse` to only apply the `flex-wrap-reverse` utility on hover. ``` <div class="flex flex-wrap hover:flex-wrap-reverse"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:flex-wrap-reverse` to apply the `flex-wrap-reverse` utility at only medium screen sizes and above. ``` <div class="flex flex-wrap md:flex-wrap-reverse"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries).
programming_docs
tailwindcss Justify Content Quick reference --------------- | Class | Properties | | --- | --- | | justify-start | justify-content: flex-start; | | justify-end | justify-content: flex-end; | | justify-center | justify-content: center; | | justify-between | justify-content: space-between; | | justify-around | justify-content: space-around; | | justify-evenly | justify-content: space-evenly; | Basic usage ----------- ### Start Use `justify-start` to justify items against the start of the container’s main axis: ``` <div class="flex justify-start ..."> <div>01</div> <div>02</div> <div>03</div> </div> ``` ### Center Use `justify-center` to justify items along the center of the container’s main axis: ``` <div class="flex justify-center ..."> <div>01</div> <div>02</div> <div>03</div> </div> ``` ### End Use `justify-end` to justify items against the end of the container’s main axis: ``` <div class="flex justify-end ..."> <div>01</div> <div>02</div> <div>03</div> </div> ``` ### Space between Use `justify-between` to justify items along the container’s main axis such that there is an equal amount of space between each item: ``` <div class="flex justify-between ..."> <div>01</div> <div>02</div> <div>03</div> </div> ``` ### Space around Use `justify-around` to justify items along the container’s main axis such that there is an equal amount of space on each side of each item: ``` <div class="flex justify-around ..."> <div>01</div> <div>02</div> <div>03</div> </div> ``` ### Space evenly Use `justify-evenly` to justify items along the container’s main axis such that there is an equal amount of space around each item, but also accounting for the doubling of space you would normally see between each item when using `justify-around`: ``` <div class="flex justify-evenly ..."> <div>01</div> <div>02</div> <div>03</div> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:justify-between` to only apply the `justify-between` utility on hover. ``` <div class="flex justify-start hover:justify-between"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:justify-between` to apply the `justify-between` utility at only medium screen sizes and above. ``` <div class="flex justify-start md:justify-between"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Justify Items Quick reference --------------- | Class | Properties | | --- | --- | | justify-items-start | justify-items: start; | | justify-items-end | justify-items: end; | | justify-items-center | justify-items: center; | | justify-items-stretch | justify-items: stretch; | Basic usage ----------- ### Start Use `justify-items-start` to justify grid items against the start of their inline axis: ``` <div class="grid justify-items-start ..."> <div>01</div> <div>02</div> <div>03</div> <div>04</div> <div>05</div> <div>06</div> </div> ``` ### End Use `justify-items-end` to justify grid items against the end of their inline axis: ``` <div class="grid justify-items-end ..."> <div>01</div> <div>02</div> <div>03</div> <div>04</div> <div>05</div> <div>06</div> </div> ``` ### Center Use `justify-items-center` to justify grid items along their inline axis: ``` <div class="grid justify-items-center ..."> <div>01</div> <div>02</div> <div>03</div> <div>04</div> <div>05</div> <div>06</div> </div> ``` ### Stretch Use `justify-items-stretch` to stretch items along their inline axis: ``` <div class="grid justify-items-stretch ..."> <div>01</div> <div>02</div> <div>03</div> <div>04</div> <div>05</div> <div>06</div> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:justify-items-center` to only apply the `justify-items-center` utility on hover. ``` <div class="grid justify-items-start hover:justify-items-center"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:justify-items-center` to apply the `justify-items-center` utility at only medium screen sizes and above. ``` <div class="grid justify-items-start md:justify-items-center"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Letter Spacing Quick reference --------------- | Class | Properties | | --- | --- | | tracking-tighter | letter-spacing: -0.05em; | | tracking-tight | letter-spacing: -0.025em; | | tracking-normal | letter-spacing: 0em; | | tracking-wide | letter-spacing: 0.025em; | | tracking-wider | letter-spacing: 0.05em; | | tracking-widest | letter-spacing: 0.1em; | Basic usage ----------- ### Setting the letter spacing Control the letter spacing of an element using the `tracking-{size}` utilities. ``` <p class="tracking-tight ...">The quick brown fox ...</p> <p class="tracking-normal ...">The quick brown fox ...</p> <p class="tracking-wide ...">The quick brown fox ...</p> ``` ### Using negative values To use a negative letter-spacing value, prefix the class name with a dash to convert it to a negative value. Using negative values doesn’t make a ton of sense with the letter-spacing scale Tailwind includes out of the box, but if you’ve opted to customize your letter-spacing scale to use numbers instead of descriptive words like “wide” the negative value modifier can be useful. Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:tracking-wide` to only apply the `tracking-wide` utility on hover. ``` <p class="tracking-tight hover:tracking-wide"> <!-- ... --> </p> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:tracking-wide` to apply the `tracking-wide` utility at only medium screen sizes and above. ``` <p class="tracking-tight md:tracking-wide"> <!-- ... --> </p> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind provides six tracking utilities. You can change, add, or remove these by editing the `theme.letterSpacing` section of your Tailwind config. tailwind.config.js ``` module.exports = { theme: { letterSpacing: { tightest: '-.075em', tighter: '-.05em', tight: '-.025em', normal: '0', wide: '.025em', wider: '.05em', widest: '.1em', widest: '.25em', } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `letter-spacing` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <p class="tracking-[.25em]"> <!-- ... --> </p> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss List Style Type Quick reference --------------- | Class | Properties | | --- | --- | | list-none | list-style-type: none; | | list-disc | list-style-type: disc; | | list-decimal | list-style-type: decimal; | Basic usage ----------- ### Setting the list style type To create bulleted or numeric lists, use the `list-disc` and `list-decimal` utilities. ``` <ul class="list-disc"> <li>Now this is a story all about how, my life got flipped-turned upside down</li> <!-- ... --> </ul> <ol class="list-decimal"> <li>Now this is a story all about how, my life got flipped-turned upside down</li> <!-- ... --> </ol> <ul class="list-none"> <li>Now this is a story all about how, my life got flipped-turned upside down</li> <!-- ... --> </ul> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:list-disc` to only apply the `list-disc` utility on hover. ``` <ul class="list-none hover:list-disc"> <!-- ... --> </ul> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:list-disc` to apply the `list-disc` utility at only medium screen sizes and above. ``` <ul class="list-none md:list-disc"> <!-- ... --> </ul> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind provides three utilities for the most common list style types. You change, add, or remove these by editing the `theme.listStyleType` section of your Tailwind config. tailwind.config.js ``` module.exports = { theme: { listStyleType: { none: 'none', disc: 'disc', decimal: 'decimal', square: 'square', roman: 'upper-roman', } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `list-style-type` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <ul class="list-[upper-roman]"> <!-- ... --> </ul> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Content Configuration The `content` section of your `tailwind.config.js` file is where you configure the paths to all of your HTML templates, JavaScript components, and any other source files that contain Tailwind class names. tailwind.config.js ``` module.exports = { content: [ './pages/**/*.{html,js}', './components/**/*.{html,js}', ], // ... } ``` This guide covers everything you need to know to make sure Tailwind generates all of the CSS needed for your project. Configuring source paths ------------------------ Tailwind CSS works by scanning all of your HTML, JavaScript components, and any other template files for class names, then generating all of the corresponding CSS for those styles. In order for Tailwind to generate all of the CSS you need, it needs to know about every single file in your project that contains any Tailwind class names. Configure the paths to all of your content files in the `content` section of your configuration file: tailwind.config.js ``` module.exports = { content: [ './pages/**/*.{html,js}', './components/**/*.{html,js}' ], // ... } ``` Paths are configured as [glob patterns](https://en.wikipedia.org/wiki/Glob_(programming)), making it easy to match all of the content files in your project without a ton of configuration: * Use `*` to match anything except slashes and hidden files * Use `**` to match zero or more directories * Use comma separate values between `{}` to match against a list of options Tailwind uses the [fast-glob](https://github.com/mrmlnc/fast-glob) library under-the-hood — check out their documentation for other supported pattern features. Paths are relative to your project root, *not* your `tailwind.config.js` file, so if your `tailwind.config.js` file is in a custom location, you should still write your paths relative to the root of your project. ### Pattern recommendations For the best performance and to avoid false positives, be as specific as possible with your content configuration. If you use a really broad pattern like this one, Tailwind will even scan `node_modules` for content which is probably not what you want: Don't use extremely broad patterns tailwind.config.js ``` module.exports = { content: [ './**/*.{html,js}', ], // ... } ``` If you have any files you need to scan that are at the root of your project (often an `index.html` file), list that file independently so your other patterns can be more specific: Be specific with your content patterns tailwind.config.js ``` module.exports = { content: [ './components/**/*.{html,js}', './pages/**/*.{html,js}', './index.html', ], // ... } ``` Some frameworks hide their main HTML entry point in a different place than the rest of your templates (often `public/index.html`), so if you are adding Tailwind classes to that file make sure it’s included in your configuration as well: Don't forget your HTML entry point if applicable tailwind.config.js ``` module.exports = { content: [ './public/index.html', './src/**/*.{html,js}', ], // ... } ``` If you have any JavaScript files that manipulate your HTML to add classes, make sure you include those as well: tailwind.config.js ``` module.exports = { content: [ // ... './src/**/*.js', ], // ... } ``` src/spaghetti.js ``` // ... menuButton.addEventListener('click', function () { let classList = document.getElementById('nav').classList classList.toggle('hidden') classList.toggle('block') }) // ... ``` It’s also important that you don’t scan any CSS files — configure Tailwind to scan your *templates* where your class names are being used, never the CSS file that Tailwind is generating. Never include CSS files in your content configuration tailwind.config.js ``` module.exports = { content: [ './src/**/*.css', ], // ... } ``` ### Class detection in-depth The way Tailwind scans your source code for classes is intentionally very simple — we don’t actually parse or execute any of your code in the language it’s written in, we just use regular expressions to extract every string that could possibly be a class name. For example, here’s some HTML with every potential class name string individually highlighted: ``` <div class="md:flex"> <div class="md:flex-shrink-0"> <img class="rounded-lg md:w-56" src="/img/shopping.jpg" alt="Woman paying for a purchase"> </div> <div class="mt-4 md:mt-0 md:ml-6"> <div class="uppercase tracking-wide text-sm text-indigo-600 font-bold"> Marketing </div> <a href="/get-started" class="block mt-1 text-lg leading-tight font-semibold text-gray-900 hover:underline"> Finding customers for your new business </a> <p class="mt-2 text-gray-600"> Getting a new business off the ground is a lot of hard work. Here are five ideas you can use to find your first customers. </p> </div> </div> ``` We don’t just limit our search to `class="..."` attributes because you could be using classes anywhere, like in some JavaScript for toggling a menu: spaghetti.js ``` <script> menuButton.addEventListener('click', function () { let classList = document.getElementById('nav').classList classList.toggle('hidden') classList.toggle('block') }) </script> ``` By using this very simple approach, Tailwind works extremely reliably with any programming language, like JSX for example: Button.jsx ``` const sizes = { md: 'px-4 py-2 rounded-md text-base', lg: 'px-5 py-3 rounded-lg text-lg', } const colors = { indigo: 'bg-indigo-500 hover:bg-indigo-600 text-white', cyan: 'bg-cyan-600 hover:bg-cyan-700 text-white', } export default function Button({ color, size, children }) { let colorClasses = colors[color] let sizeClasses = sizes[size] return ( <button type="button" className={`font-bold ${sizeClasses} ${colorClasses}`}> {children} </button> ) } ``` ### Dynamic class names The most important implication of how Tailwind extracts class names is that it will only find classes that exist *as complete unbroken strings* in your source files. If you use string interpolation or concatenate partial class names together, Tailwind will not find them and therefore will not generate the corresponding CSS: Don't construct class names dynamically ``` <div class="text-{{ error ? 'red' : 'green' }}-600"></div> ``` In the example above, the strings `text-red-600` and `text-green-600` do not exist, so Tailwind will not generate those classes. Instead, make sure any class names you’re using exist in full: Always use complete class names ``` <div class="{{ error ? 'text-red-600' : 'text-green-600' }}"></div> ``` As long as you always use complete class names in your code, Tailwind will generate all of your CSS perfectly every time. ### Working with third-party libraries If you’re working with any third-party libraries (for example [Select2](https://select2.org/)) and styling that library with your own custom CSS, we recommend writing those styles *without* using Tailwind’s `@layer` feature: main.css ``` @tailwind base; @tailwind components; .select2-dropdown { @apply rounded-b-lg shadow-md; } .select2-search { @apply border border-gray-300 rounded; } .select2-results__group { @apply text-lg font-bold text-gray-900; } /* ... */ @tailwind utilities; ``` This will ensure that Tailwind *always* includes those styles in your CSS, which is a lot easier than configuring Tailwind to scan the source code of a third-party library. If you’ve created your own reusable set of components that are styled with Tailwind and are importing them in multiple projects, make sure to configure Tailwind to scan those components for class names: tailwind.config.js ``` module.exports = { content: [ './components/**/*.{html,js}', './pages/**/*.{html,js}', './node_modules/@my-company/tailwind-components/**/*.js', ], // ... } ``` This will make sure Tailwind generates all of the CSS needed for those components as well. If you’re working in a monorepo with workspaces, you may need to use `require.resolve` to make sure Tailwind can see your content files: tailwind.config.js ``` const path = require('path'); module.exports = { content: [ './components/**/*.{html,js}', './pages/**/*.{html,js}', path.join(require.resolve('@my-company/tailwind-components'), '**/*.js'), ], // ... } ``` ### Configuring raw content If for whatever reason you need to configure Tailwind to scan some raw content rather than the contents of a file, use an object with a `raw` key instead of a path: tailwind.config.js ``` module.exports = { content: [ './pages/**/*.{html,js}' './components/**/*.{html,js}', { raw: '<div class="font-bold">', extension: 'html' }, ], // ... } ``` There aren’t many valid use-cases for this — [safelisting](#safelisting-classes) is usually what you really want instead. Safelisting classes ------------------- For the smallest file size and best development experience, we highly recommend relying on your `content` configuration to tell Tailwind which classes to generate as much as possible. Safelisting is a last-resort, and should only be used in situations where it’s impossible to scan certain content for class names. These situations are rare, and you should almost never need this feature. If you need to make sure Tailwind generates certain class names that don’t exist in your content files, use the `safelist` option: tailwind.config.js ``` module.exports = { content: [ './pages/**/*.{html,js}' './components/**/*.{html,js}', ], safelist: [ 'bg-red-500', 'text-3xl', 'lg:text-4xl', ] // ... } ``` One example of where this can be useful is if your site displays user-generated content and you want users to be able to use a constrained set of Tailwind classes in their content that might not exist in your own site’s source files. ### Using regular expressions Tailwind supports pattern-based safelisting for situations where you need to safelist a lot of classes: tailwind.config.js ``` module.exports = { content: [ './pages/**/*.{html,js}', './components/**/*.{html,js}', ], safelist: [ 'text-2xl', 'text-3xl', { pattern: /bg-(red|green|blue)-(100|200|300)/, }, ], // ... } ``` Patterns can only match against base utility names like `/bg-red-.+/`, and won’t match if the pattern includes a variant modifier like `/hover:bg-red-.+/`. If you want to force Tailwind to generate variants for any matched classes, include them using the `variants` option: tailwind.config.js ``` module.exports = { content: [ './pages/**/*.{html,js}', './components/**/*.{html,js}', ], safelist: [ 'text-2xl', 'text-3xl', { pattern: /bg-(red|green|blue)-(100|200|300)/, variants: ['lg', 'hover', 'focus', 'lg:hover'], }, ], // ... } ``` Transforming source files ------------------------- If you’re authoring content in a format that *compiles* to HTML (like Markdown), it often makes sense to compile that content to HTML *before* scanning it for class names. Use the `content.transform` option to transform any content matching a specific file extension before extracting classes: tailwind.config.js ``` const remark = require('remark') module.exports = { content: { files: ['./src/**/*.{html,md}'], transform: { md: (content) => { return remark().process(content) } } }, // ... } ``` When using `content.transform`, you’ll need to provide your source paths using `content.files` instead of as a top-level array under `content`. Customizing extraction logic ---------------------------- Use the `extract` option to override the logic Tailwind uses to detect class names for specific file extensions: tailwind.config.js ``` module.exports = { content: { files: ['./src/**/*.{html,wtf}'], extract: { wtf: (content) => { return content.match(/[^<>"'`\s]*/) } } }, // ... } ``` This is an advanced feature and most users won’t need it — the default extraction logic in Tailwind works extremely well for almost all projects. As with transforming, when using `content.extract`, you’ll need to provide your source paths using `content.files` instead of as a top-level array under `content`. Troubleshooting --------------- ### Classes aren't generated If Tailwind isn’t generating classes, make sure your `content` configuration is correct and matches all of the right source files. A common mistake is missing a file extension, for example if you’re using `jsx` instead of `js` for your React components: tailwind.config.js ``` module.exports = { content: [ './src/**/*.{html,js}', './src/**/*.{html,js,jsx}' ], // ... } ``` Or creating a new folder mid-project that wasn’t covered originally and forgetting to add it to your configuration: tailwind.config.js ``` module.exports = { content: [ './pages/**/*.{html,js}', './components/**/*.{html,js}', './util/**/*.{html,js}' ], // ... } ``` It could also be that you are trying to use dynamic class names, which won’t work because Tailwind doesn’t actually evaluate your source code and can only detect static unbroken class strings. Don't construct class names dynamically ``` <div class="text-{{ error ? 'red' : 'green' }}-600"></div> ``` Make sure you always use complete class names in your code: Always use complete class names ``` <div class="{{ error ? 'text-red-600' : 'text-green-600' }}"></div> ``` Read our documentation on [dynamic class names](#dynamic-class-names) for more details. ### Styles rebuild in an infinite loop If your CSS seems to be rebuilding in an infinite loop, there’s a good chance it’s because your build tool doesn’t support the `glob` option when [registering PostCSS dependencies](https://github.com/postcss/postcss/blob/main/docs/guidelines/runner.md#31-rebuild-when-dependencies-change). Many build tools (such as webpack) don’t support this option, and as a result we can only tell them to watch specific files or *entire directories*. We can’t tell webpack to *only* watch `*.html` files in a directory for example. That means that if building your CSS causes *any* files in those directories to change, a rebuild will be triggered, even if the changed file doesn’t match the extension in your glob. tailwind.config.js ``` module.exports = { content: [ // With some build tools, your CSS will rebuild // any time *any* file in `src` changes. './src/**/*.{html,js}', ], // ... } ``` So if you are watching `src/**/*.html` for changes, but you are writing your CSS output file to `src/css/styles.css`, you will get an infinite rebuild loop using some tools. Ideally we could warn you about this in the console, but many tools support it perfectly fine (including our own CLI tool), and we have no reliable way to detect what build tool you are using. To solve this problem, use more specific paths in your `content` config, making sure to only include directories that won’t change when your CSS builds: tailwind.config.js ``` module.exports = { content: [ './src/**/*.{html,js}', './src/pages/**/*.{html,js}', './src/components/**/*.{html,js}', './src/layouts/**/*.{html,js}', './src/index.html', ], // ... } ``` If necessary, adjust your actual project directory structure to make sure you can target your template files without accidentally catching your CSS file or other build artifacts like manifest files. If you absolutely can’t change your content config or directory structure, your best bet is to compile your CSS separately with a tool that has complete glob support. We recommend using [Tailwind CLI](https://tailwindcss.com/docs/installation), which is a fast, simple, purpose-built tool for compiling your CSS with Tailwind. ### It just isn't working properly If you are experiencing weird, hard to describe issues with the output, or things just don’t seem like they are working at all, there’s a good chance it’s due to your build tool not supporting PostCSS dependency messages properly *(or at all)*. One known example of this currently is [Stencil](https://github.com/ionic-team/stencil-postcss/issues/38). When you are having these sorts of issues, we recommend using [Tailwind CLI](https://tailwindcss.com/docs/installation) to compile your CSS separately instead of trying to integrate Tailwind into your existing tooling. You can use packages like `npm-run-all` or `concurrently` to compile your CSS alongside your usual development command by adding some scripts to your project like this: ``` // package.json { // ... "scripts": { "start": "concurrently \"npm run start:css\" \"react-scripts start\"", "start:css": "tailwindcss -o src/tailwind.css --watch", "build": "npm run build:css && react-scripts build", "build:css": "NODE_ENV=production tailwindcss -o src/tailwind.css -m", }, } ``` Either way, please be sure to [check for an existing issue](https://github.com/tailwindlabs/tailwindcss/issues) or [open a new one](https://github.com/tailwindlabs/tailwindcss/issues/new/choose) so we can figure out the problem and try to improve compatibility with whatever tool you are using.
programming_docs
tailwindcss Theme Configuration The `theme` section of your `tailwind.config.js` file is where you define your project’s color palette, type scale, fonts, breakpoints, border radius values, and more. tailwind.config.js ``` module.exports = { theme: { screens: { sm: '480px', md: '768px', lg: '976px', xl: '1440px', }, colors: { 'blue': '#1fb6ff', 'purple': '#7e5bef', 'pink': '#ff49db', 'orange': '#ff7849', 'green': '#13ce66', 'yellow': '#ffc82c', 'gray-dark': '#273444', 'gray': '#8492a6', 'gray-light': '#d3dce6', }, fontFamily: { sans: ['Graphik', 'sans-serif'], serif: ['Merriweather', 'serif'], }, extend: { spacing: { '128': '32rem', '144': '36rem', }, borderRadius: { '4xl': '2rem', } } } } ``` We provide a sensible [default theme](https://github.com/tailwindlabs/tailwindcss/blob/master/stubs/defaultConfig.stub.js) with a very generous set of values to get you started, but don’t be afraid to change it or extend it; you’re encouraged to customize it as much as you need to fit the goals of your design. Theme structure --------------- The `theme` object contains keys for `screens`, `colors`, and `spacing`, as well as a key for each customizable [core plugin](configuration#core-plugins). See the [theme configuration reference](#configuration-reference) or the [default theme](https://github.com/tailwindlabs/tailwindcss/blob/master/stubs/defaultConfig.stub.js#L7) for a complete list of theme options. ### Screens The `screens` key allows you to customize the responsive breakpoints in your project. tailwind.config.js ``` module.exports = { theme: { screens: { 'sm': '640px', 'md': '768px', 'lg': '1024px', 'xl': '1280px', '2xl': '1536px', } } } ``` To learn more, see the [breakpoint customization documentation](/docs/screens). ### Colors The `colors` key allows you to customize the global color palette for your project. tailwind.config.js ``` module.exports = { theme: { colors: { transparent: 'transparent', black: '#000', white: '#fff', gray: { 100: '#f7fafc', // ... 900: '#1a202c', }, // ... } } } ``` By default, these colors are inherited by all color-related core plugins, like `backgroundColor`, `borderColor`, `textColor`, and others. To learn more, see the [color customization documentation](/docs/customizing-colors). ### Spacing The `spacing` key allows you to customize the global spacing and sizing scale for your project. tailwind.config.js ``` module.exports = { theme: { spacing: { px: '1px', 0: '0', 0.5: '0.125rem', 1: '0.25rem', 1.5: '0.375rem', 2: '0.5rem', 2.5: '0.625rem', 3: '0.75rem', 3.5: '0.875rem', 4: '1rem', 5: '1.25rem', 6: '1.5rem', 7: '1.75rem', 8: '2rem', 9: '2.25rem', 10: '2.5rem', 11: '2.75rem', 12: '3rem', 14: '3.5rem', 16: '4rem', 20: '5rem', 24: '6rem', 28: '7rem', 32: '8rem', 36: '9rem', 40: '10rem', 44: '11rem', 48: '12rem', 52: '13rem', 56: '14rem', 60: '15rem', 64: '16rem', 72: '18rem', 80: '20rem', 96: '24rem', }, } } ``` By default, these values are inherited by the `padding`, `margin`, `width`, `height`, `maxHeight`, `flex-basis`, `gap`, `inset`, `space`, `translate`, `scrollMargin`, `scrollPadding`, and `textIndent` core plugins. To learn more, see the [spacing customization documentation](customizing-spacing). ### Core plugins The rest of the `theme` section is used to configure which values are available for each individual core plugin. For example, the `borderRadius` key lets you customize which border radius utilities will be generated: ``` module.exports = { theme: { borderRadius: { 'none': '0', 'sm': '.125rem', DEFAULT: '.25rem', 'lg': '.5rem', 'full': '9999px', }, } } ``` The keys determine the suffix for the generated classes, and the values determine the value of the actual CSS declaration. The example `borderRadius` configuration above would generate the following CSS classes: ``` .rounded-none { border-radius: 0 } .rounded-sm { border-radius: .125rem } .rounded { border-radius: .25rem } .rounded-lg { border-radius: .5rem } .rounded-full { border-radius: 9999px } ``` You’ll notice that using a key of `DEFAULT` in the theme configuration created the class `rounded` with no suffix. This is a common convention in Tailwind and is supported by all core plugins. To learn more about customizing a specific core plugin, visit the documentation for that plugin. For a complete reference of available theme properties and their default values, [see the default theme configuration](https://github.com/tailwindlabs/tailwindcss/blob/master/stubs/defaultConfig.stub.js). Customizing the default theme ----------------------------- Out of the box, your project will automatically inherit the values from [the default theme configuration](https://github.com/tailwindlabs/tailwindcss/blob/master/stubs/defaultConfig.stub.js). If you would like to customize the default theme, you have a few different options depending on your goals. ### Extending the default theme If you’d like to preserve the default values for a theme option but also add new values, add your extensions under the `extend` key in the `theme` section of your configuration file. For example, if you wanted to add an extra breakpoint but preserve the existing ones, you could extend the `screens` property: tailwind.config.js ``` module.exports = { theme: { extend: { // Adds a new breakpoint in addition to the default breakpoints screens: { '3xl': '1600px', } } } } ``` ### Overriding the default theme To override an option in the default theme, add your overrides directly under the `theme` section of your `tailwind.config.js`: tailwind.config.js ``` module.exports = { theme: { // Replaces all of the default `opacity` values opacity: { '0': '0', '20': '0.2', '40': '0.4', '60': '0.6', '80': '0.8', '100': '1', } } } ``` This will completely replace Tailwind’s default configuration for that key, so in the example above none of the default opacity utilities would be generated. Any keys you **do not** provide will be inherited from the default theme, so in the above example, the default theme configuration for things like colors, spacing, border-radius, background-position, etc. would be preserved. You can of course both override some parts of the default theme and extend other parts of the default theme within the same configuration: tailwind.config.js ``` module.exports = { theme: { opacity: { '0': '0', '20': '0.2', '40': '0.4', '60': '0.6', '80': '0.8', '100': '1', }, extend: { screens: { '3xl': '1600px', } } } } ``` ### Referencing other values If you need to reference another value in your theme, you can do so by providing a closure instead of a static value. The closure will receive an object that includes a `theme()` function that you can use to look up other values in your theme using dot notation. For example, you could generate `background-size` utilities for every value in your spacing scale by referencing `theme('spacing')` in your `backgroundSize` configuration: tailwind.config.js ``` module.exports = { theme: { spacing: { // ... }, backgroundSize: ({ theme }) => ({ auto: 'auto', cover: 'cover', contain: 'contain', ...theme('spacing') }) } } ``` The `theme()` function attempts to find the value you are looking for from the fully merged theme object, so it can reference your own customizations as well as the default theme values. It also works recursively, so as long as there is a static value at the end of the chain it will be able to resolve the value you are looking for. Note that you can only use this kind of closure with top-level theme keys, not the keys inside of each section. You can't use functions for individual values tailwind.config.js ``` module.exports = { theme: { fill: { gray: ({ theme }) => theme('colors.gray') } } } ``` Use functions for top-level theme keys tailwind.config.js ``` module.exports = { theme: { fill: ({ theme }) => ({ gray: theme('colors.gray') }) } } ``` ### Referencing the default theme If you’d like to reference a value in the default theme for any reason, you can import it from `tailwindcss/defaultTheme`. One example of where this is useful is if you’d like to add a font family to one of Tailwind’s default font stacks: tailwind.config.js ``` const defaultTheme = require('tailwindcss/defaultTheme') module.exports = { theme: { extend: { fontFamily: { sans: [ 'Lato', ...defaultTheme.fontFamily.sans, ] } } } } ``` ### Disabling an entire core plugin If you don’t want to generate any classes for a certain core plugin, it’s better to set that plugin to false in your `corePlugins` configuration than to provide an empty object for that key in your `theme` configuration. Don't assign an empty object in your theme configuration tailwind.config.js ``` module.exports = { theme: { opacity: {}, } } ``` Do disable the plugin in your corePlugins configuration tailwind.config.js ``` module.exports = { corePlugins: { opacity: false, } } ``` The end result is the same, but since many core plugins expose no configuration they can only be disabled using `corePlugins` anyways, so it’s better to be consistent. Configuration reference ----------------------- Except for `screens`, `colors`, and `spacing`, all of the keys in the `theme` object map to one of Tailwind’s [core plugins](configuration#core-plugins). Since many plugins are responsible for CSS properties that only accept a static set of values (like `float` for example), note that not every plugin has a corresponding key in the `theme` object. All of these keys are also available under the `theme.extend` key to enable [extending the default theme](#extending-the-default-theme). | Key | Description | | --- | --- | | `screens` | Your project's responsive breakpoints | | `colors` | Your project's color palette | | `columns` | Values for the `columns` property | | `spacing` | Your project's spacing scale | | `animation` | Values for the `animation` property | | `aspectRatio` | Values for the `aspect-ratio` property | | `backdropBlur` | Values for the `backdropBlur` plugin | | `backdropBrightness` | Values for the `backdropBrightness` plugin | | `backdropContrast` | Values for the `backdropContrast` plugin | | `backdropGrayscale` | Values for the `backdropGrayscale` plugin | | `backdropHueRotate` | Values for the `backdropHueRotate` plugin | | `backdropInvert` | Values for the `backdropInvert` plugin | | `backdropOpacity` | Values for the `backdropOpacity` plugin | | `backdropSaturate` | Values for the `backdropSaturate` plugin | | `backdropSepia` | Values for the `backdropSepia` plugin | | `backgroundColor` | Values for the `background-color` property | | `backgroundImage` | Values for the `background-image` property | | `backgroundOpacity` | Values for the `background-opacity` property | | `backgroundPosition` | Values for the `background-position` property | | `backgroundSize` | Values for the `background-size` property | | `blur` | Values for the `blur` plugin | | `brightness` | Values for the `brightness` plugin | | `borderColor` | Values for the `border-color` property | | `borderOpacity` | Values for the `borderOpacity` plugin | | `borderRadius` | Values for the `border-radius` property | | `borderSpacing` | Values for the `border-spacing` property | | `borderWidth` | Values for the `borderWidth` plugin | | `boxShadow` | Values for the `box-shadow` property | | `boxShadowColor` | Values for the `boxShadowColor` plugin | | `caretColor` | Values for the `caret-color` property | | `accentColor` | Values for the `accent-color` property | | `contrast` | Values for the `contrast` plugin | | `container` | Configuration for the `container` plugin | | `content` | Values for the `content` property | | `cursor` | Values for the `cursor` property | | `divideColor` | Values for the `divideColor` plugin | | `divideOpacity` | Values for the `divideOpacity` plugin | | `divideWidth` | Values for the `divideWidth` plugin | | `dropShadow` | Values for the `dropShadow` plugin | | `fill` | Values for the `fill` plugin | | `grayscale` | Values for the `grayscale` plugin | | `hueRotate` | Values for the `hueRotate` plugin | | `invert` | Values for the `invert` plugin | | `flex` | Values for the `flex` property | | `flexBasis` | Values for the `flex-basis` property | | `flexGrow` | Values for the `flex-grow` property | | `flexShrink` | Values for the `flex-shrink` property | | `fontFamily` | Values for the `font-family` property | | `fontSize` | Values for the `font-size` property | | `fontWeight` | Values for the `font-weight` property | | `gap` | Values for the `gap` property | | `gradientColorStops` | Values for the `gradientColorStops` plugin | | `gridAutoColumns` | Values for the `grid-auto-columns` property | | `gridAutoRows` | Values for the `grid-auto-rows` property | | `gridColumn` | Values for the `grid-column` property | | `gridColumnEnd` | Values for the `grid-column-end` property | | `gridColumnStart` | Values for the `grid-column-start` property | | `gridRow` | Values for the `grid-row` property | | `gridRowStart` | Values for the `grid-row-start` property | | `gridRowEnd` | Values for the `grid-row-end` property | | `gridTemplateColumns` | Values for the `grid-template-columns` property | | `gridTemplateRows` | Values for the `grid-template-rows` property | | `height` | Values for the `height` property | | `inset` | Values for the `top`, `right`, `bottom`, and `left` properties | | `keyframes` | Keyframe values used in the `animation` plugin | | `letterSpacing` | Values for the `letter-spacing` property | | `lineHeight` | Values for the `line-height` property | | `listStyleType` | Values for the `list-style-type` property | | `margin` | Values for the `margin` property | | `maxHeight` | Values for the `max-height` property | | `maxWidth` | Values for the `max-width` property | | `minHeight` | Values for the `min-height` property | | `minWidth` | Values for the `min-width` property | | `objectPosition` | Values for the `object-position` property | | `opacity` | Values for the `opacity` property | | `order` | Values for the `order` property | | `padding` | Values for the `padding` property | | `placeholderColor` | Values for the `placeholderColor` plugin | | `placeholderOpacity` | Values for the `placeholderOpacity` plugin | | `outlineColor` | Values for the `outline-color` property | | `outlineOffset` | Values for the `outline-offset` property | | `outlineWidth` | Values for the `outline-width` property | | `ringColor` | Values for the `ringColor` plugin | | `ringOffsetColor` | Values for the `ringOffsetColor` plugin | | `ringOffsetWidth` | Values for the `ringOffsetWidth` plugin | | `ringOpacity` | Values for the `ringOpacity` plugin | | `ringWidth` | Values for the `ringWidth` plugin | | `rotate` | Values for the `rotate` plugin | | `saturate` | Values for the `saturate` plugin | | `scale` | Values for the `scale` plugin | | `scrollMargin` | Values for the `scroll-margin` property | | `scrollPadding` | Values for the `scroll-padding` property | | `sepia` | Values for the `sepia` plugin | | `skew` | Values for the `skew` plugin | | `space` | Values for the `space` plugin | | `stroke` | Values for the `stroke` property | | `strokeWidth` | Values for the `stroke-width` property | | `textColor` | Values for the `text-color` property | | `textDecorationColor` | Values for the `text-decoration-color` property | | `textDecorationThickness` | Values for the `text-decoration-thickness` property | | `textUnderlineOffset` | Values for the `text-underline-offset` property | | `textIndent` | Values for the `text-indent` property | | `textOpacity` | Values for the `textOpacity` plugin | | `transformOrigin` | Values for the `transform-origin` property | | `transitionDelay` | Values for the `transition-delay` property | | `transitionDuration` | Values for the `transition-duration` property | | `transitionProperty` | Values for the `transition-property` property | | `transitionTimingFunction` | Values for the `transition-timing-function` property | | `translate` | Values for the `translate` plugin | | `width` | Values for the `width` property | | `willChange` | Values for the `will-change` property | | `zIndex` | Values for the `z-index` property | tailwindcss Border Spacing Quick reference --------------- | Class | Properties | | --- | --- | | border-spacing-0 | border-spacing: 0px 0px; | | border-spacing-x-0 | border-spacing: 0px var(--tw-border-spacing-y); | | border-spacing-y-0 | border-spacing: var(--tw-border-spacing-x) 0px; | | border-spacing-px | border-spacing: 1px 1px; | | border-spacing-x-px | border-spacing: 1px var(--tw-border-spacing-y); | | border-spacing-y-px | border-spacing: var(--tw-border-spacing-x) 1px; | | border-spacing-0.5 | border-spacing: 0.125rem 0.125rem; | | border-spacing-x-0.5 | border-spacing: 0.125rem var(--tw-border-spacing-y); | | border-spacing-y-0.5 | border-spacing: var(--tw-border-spacing-x) 0.125rem; | | border-spacing-1 | border-spacing: 0.25rem 0.25rem; | | border-spacing-x-1 | border-spacing: 0.25rem var(--tw-border-spacing-y); | | border-spacing-y-1 | border-spacing: var(--tw-border-spacing-x) 0.25rem; | | border-spacing-1.5 | border-spacing: 0.375rem 0.375rem; | | border-spacing-x-1.5 | border-spacing: 0.375rem var(--tw-border-spacing-y); | | border-spacing-y-1.5 | border-spacing: var(--tw-border-spacing-x) 0.375rem; | | border-spacing-2 | border-spacing: 0.5rem 0.5rem; | | border-spacing-x-2 | border-spacing: 0.5rem var(--tw-border-spacing-y); | | border-spacing-y-2 | border-spacing: var(--tw-border-spacing-x) 0.5rem; | | border-spacing-2.5 | border-spacing: 0.625rem 0.625rem; | | border-spacing-x-2.5 | border-spacing: 0.625rem var(--tw-border-spacing-y); | | border-spacing-y-2.5 | border-spacing: var(--tw-border-spacing-x) 0.625rem; | | border-spacing-3 | border-spacing: 0.75rem 0.75rem; | | border-spacing-x-3 | border-spacing: 0.75rem var(--tw-border-spacing-y); | | border-spacing-y-3 | border-spacing: var(--tw-border-spacing-x) 0.75rem; | | border-spacing-3.5 | border-spacing: 0.875rem 0.875rem; | | border-spacing-x-3.5 | border-spacing: 0.875rem var(--tw-border-spacing-y); | | border-spacing-y-3.5 | border-spacing: var(--tw-border-spacing-x) 0.875rem; | | border-spacing-4 | border-spacing: 1rem 1rem; | | border-spacing-x-4 | border-spacing: 1rem var(--tw-border-spacing-y); | | border-spacing-y-4 | border-spacing: var(--tw-border-spacing-x) 1rem; | | border-spacing-5 | border-spacing: 1.25rem 1.25rem; | | border-spacing-x-5 | border-spacing: 1.25rem var(--tw-border-spacing-y); | | border-spacing-y-5 | border-spacing: var(--tw-border-spacing-x) 1.25rem; | | border-spacing-6 | border-spacing: 1.5rem 1.5rem; | | border-spacing-x-6 | border-spacing: 1.5rem var(--tw-border-spacing-y); | | border-spacing-y-6 | border-spacing: var(--tw-border-spacing-x) 1.5rem; | | border-spacing-7 | border-spacing: 1.75rem 1.75rem; | | border-spacing-x-7 | border-spacing: 1.75rem var(--tw-border-spacing-y); | | border-spacing-y-7 | border-spacing: var(--tw-border-spacing-x) 1.75rem; | | border-spacing-8 | border-spacing: 2rem 2rem; | | border-spacing-x-8 | border-spacing: 2rem var(--tw-border-spacing-y); | | border-spacing-y-8 | border-spacing: var(--tw-border-spacing-x) 2rem; | | border-spacing-9 | border-spacing: 2.25rem 2.25rem; | | border-spacing-x-9 | border-spacing: 2.25rem var(--tw-border-spacing-y); | | border-spacing-y-9 | border-spacing: var(--tw-border-spacing-x) 2.25rem; | | border-spacing-10 | border-spacing: 2.5rem 2.5rem; | | border-spacing-x-10 | border-spacing: 2.5rem var(--tw-border-spacing-y); | | border-spacing-y-10 | border-spacing: var(--tw-border-spacing-x) 2.5rem; | | border-spacing-11 | border-spacing: 2.75rem 2.75rem; | | border-spacing-x-11 | border-spacing: 2.75rem var(--tw-border-spacing-y); | | border-spacing-y-11 | border-spacing: var(--tw-border-spacing-x) 2.75rem; | | border-spacing-12 | border-spacing: 3rem 3rem; | | border-spacing-x-12 | border-spacing: 3rem var(--tw-border-spacing-y); | | border-spacing-y-12 | border-spacing: var(--tw-border-spacing-x) 3rem; | | border-spacing-14 | border-spacing: 3.5rem 3.5rem; | | border-spacing-x-14 | border-spacing: 3.5rem var(--tw-border-spacing-y); | | border-spacing-y-14 | border-spacing: var(--tw-border-spacing-x) 3.5rem; | | border-spacing-16 | border-spacing: 4rem 4rem; | | border-spacing-x-16 | border-spacing: 4rem var(--tw-border-spacing-y); | | border-spacing-y-16 | border-spacing: var(--tw-border-spacing-x) 4rem; | | border-spacing-20 | border-spacing: 5rem 5rem; | | border-spacing-x-20 | border-spacing: 5rem var(--tw-border-spacing-y); | | border-spacing-y-20 | border-spacing: var(--tw-border-spacing-x) 5rem; | | border-spacing-24 | border-spacing: 6rem 6rem; | | border-spacing-x-24 | border-spacing: 6rem var(--tw-border-spacing-y); | | border-spacing-y-24 | border-spacing: var(--tw-border-spacing-x) 6rem; | | border-spacing-28 | border-spacing: 7rem 7rem; | | border-spacing-x-28 | border-spacing: 7rem var(--tw-border-spacing-y); | | border-spacing-y-28 | border-spacing: var(--tw-border-spacing-x) 7rem; | | border-spacing-32 | border-spacing: 8rem 8rem; | | border-spacing-x-32 | border-spacing: 8rem var(--tw-border-spacing-y); | | border-spacing-y-32 | border-spacing: var(--tw-border-spacing-x) 8rem; | | border-spacing-36 | border-spacing: 9rem 9rem; | | border-spacing-x-36 | border-spacing: 9rem var(--tw-border-spacing-y); | | border-spacing-y-36 | border-spacing: var(--tw-border-spacing-x) 9rem; | | border-spacing-40 | border-spacing: 10rem 10rem; | | border-spacing-x-40 | border-spacing: 10rem var(--tw-border-spacing-y); | | border-spacing-y-40 | border-spacing: var(--tw-border-spacing-x) 10rem; | | border-spacing-44 | border-spacing: 11rem 11rem; | | border-spacing-x-44 | border-spacing: 11rem var(--tw-border-spacing-y); | | border-spacing-y-44 | border-spacing: var(--tw-border-spacing-x) 11rem; | | border-spacing-48 | border-spacing: 12rem 12rem; | | border-spacing-x-48 | border-spacing: 12rem var(--tw-border-spacing-y); | | border-spacing-y-48 | border-spacing: var(--tw-border-spacing-x) 12rem; | | border-spacing-52 | border-spacing: 13rem 13rem; | | border-spacing-x-52 | border-spacing: 13rem var(--tw-border-spacing-y); | | border-spacing-y-52 | border-spacing: var(--tw-border-spacing-x) 13rem; | | border-spacing-56 | border-spacing: 14rem 14rem; | | border-spacing-x-56 | border-spacing: 14rem var(--tw-border-spacing-y); | | border-spacing-y-56 | border-spacing: var(--tw-border-spacing-x) 14rem; | | border-spacing-60 | border-spacing: 15rem 15rem; | | border-spacing-x-60 | border-spacing: 15rem var(--tw-border-spacing-y); | | border-spacing-y-60 | border-spacing: var(--tw-border-spacing-x) 15rem; | | border-spacing-64 | border-spacing: 16rem 16rem; | | border-spacing-x-64 | border-spacing: 16rem var(--tw-border-spacing-y); | | border-spacing-y-64 | border-spacing: var(--tw-border-spacing-x) 16rem; | | border-spacing-72 | border-spacing: 18rem 18rem; | | border-spacing-x-72 | border-spacing: 18rem var(--tw-border-spacing-y); | | border-spacing-y-72 | border-spacing: var(--tw-border-spacing-x) 18rem; | | border-spacing-80 | border-spacing: 20rem 20rem; | | border-spacing-x-80 | border-spacing: 20rem var(--tw-border-spacing-y); | | border-spacing-y-80 | border-spacing: var(--tw-border-spacing-x) 20rem; | | border-spacing-96 | border-spacing: 24rem 24rem; | | border-spacing-x-96 | border-spacing: 24rem var(--tw-border-spacing-y); | | border-spacing-y-96 | border-spacing: var(--tw-border-spacing-x) 24rem; | Basic usage ----------- ### Setting the border spacing Use `border-spacing` to control the space between the borders of table cells with [separate borders](border-collapse#separate). ``` <table class="border-separate border-spacing-2 border border-slate-400 ..."> <thead> <tr> <th class="border border-slate-300 ...">State</th> <th class="border border-slate-300 ...">City</th> </tr> </thead> <tbody> <tr> <td class="border border-slate-300 ...">Indiana</td> <td class="border border-slate-300 ...">Indianapolis</td> </tr> <tr> <td class="border border-slate-300 ...">Ohio</td> <td class="border border-slate-300 ...">Columbus</td> </tr> <tr> <td class="border border-slate-300 ...">Michigan</td> <td class="border border-slate-300 ...">Detroit</td> </tr> </tbody> </table><table class="border-separate border-spacing-2 border border-slate-500 ..."> <thead> <tr> <th class="border border-slate-600 ...">State</th> <th class="border border-slate-600 ...">City</th> </tr> </thead> <tbody> <tr> <td class="border border-slate-700 ...">Indiana</td> <td class="border border-slate-700 ...">Indianapolis</td> </tr> <tr> <td class="border border-slate-700 ...">Ohio</td> <td class="border border-slate-700 ...">Columbus</td> </tr> <tr> <td class="border border-slate-700 ...">Michigan</td> <td class="border border-slate-700 ...">Detroit</td> </tr> </tbody> </table> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:border-spacing-2` to only apply the `border-spacing-2` utility on hover. ``` <table class="hover:border-spacing-2"> <!-- ... --> </table> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:border-spacing-4` to apply the `border-spacing-4` utility at only medium screen sizes and above. ``` <table class="md:border-spacing-4"> <!-- ... --> </table> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind’s border spacing utilities use the [default spacing scale](customizing-spacing). You can customize your spacing scale by editing `theme.spacing` or `theme.extend.spacing` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { spacing: { '13': '3.25rem', } } } } ``` Alternatively, you can customize just the border spacing scale by editing `theme.borderSpacing` or `theme.extend.borderSpacing` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { borderSpacing: { '13': '3.25rem', }, } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `border-spacing` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="border-spacing-[7px]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation.
programming_docs
tailwindcss Box Shadow Color Quick reference --------------- | Class | Properties | | --- | --- | | shadow-inherit | --tw-shadow-color: inherit; | | shadow-current | --tw-shadow-color: currentColor; | | shadow-transparent | --tw-shadow-color: transparent; | | shadow-black | --tw-shadow-color: #000; | | shadow-white | --tw-shadow-color: #fff; | | shadow-slate-50 | --tw-shadow-color: #f8fafc; | | shadow-slate-100 | --tw-shadow-color: #f1f5f9; | | shadow-slate-200 | --tw-shadow-color: #e2e8f0; | | shadow-slate-300 | --tw-shadow-color: #cbd5e1; | | shadow-slate-400 | --tw-shadow-color: #94a3b8; | | shadow-slate-500 | --tw-shadow-color: #64748b; | | shadow-slate-600 | --tw-shadow-color: #475569; | | shadow-slate-700 | --tw-shadow-color: #334155; | | shadow-slate-800 | --tw-shadow-color: #1e293b; | | shadow-slate-900 | --tw-shadow-color: #0f172a; | | shadow-gray-50 | --tw-shadow-color: #f9fafb; | | shadow-gray-100 | --tw-shadow-color: #f3f4f6; | | shadow-gray-200 | --tw-shadow-color: #e5e7eb; | | shadow-gray-300 | --tw-shadow-color: #d1d5db; | | shadow-gray-400 | --tw-shadow-color: #9ca3af; | | shadow-gray-500 | --tw-shadow-color: #6b7280; | | shadow-gray-600 | --tw-shadow-color: #4b5563; | | shadow-gray-700 | --tw-shadow-color: #374151; | | shadow-gray-800 | --tw-shadow-color: #1f2937; | | shadow-gray-900 | --tw-shadow-color: #111827; | | shadow-zinc-50 | --tw-shadow-color: #fafafa; | | shadow-zinc-100 | --tw-shadow-color: #f4f4f5; | | shadow-zinc-200 | --tw-shadow-color: #e4e4e7; | | shadow-zinc-300 | --tw-shadow-color: #d4d4d8; | | shadow-zinc-400 | --tw-shadow-color: #a1a1aa; | | shadow-zinc-500 | --tw-shadow-color: #71717a; | | shadow-zinc-600 | --tw-shadow-color: #52525b; | | shadow-zinc-700 | --tw-shadow-color: #3f3f46; | | shadow-zinc-800 | --tw-shadow-color: #27272a; | | shadow-zinc-900 | --tw-shadow-color: #18181b; | | shadow-neutral-50 | --tw-shadow-color: #fafafa; | | shadow-neutral-100 | --tw-shadow-color: #f5f5f5; | | shadow-neutral-200 | --tw-shadow-color: #e5e5e5; | | shadow-neutral-300 | --tw-shadow-color: #d4d4d4; | | shadow-neutral-400 | --tw-shadow-color: #a3a3a3; | | shadow-neutral-500 | --tw-shadow-color: #737373; | | shadow-neutral-600 | --tw-shadow-color: #525252; | | shadow-neutral-700 | --tw-shadow-color: #404040; | | shadow-neutral-800 | --tw-shadow-color: #262626; | | shadow-neutral-900 | --tw-shadow-color: #171717; | | shadow-stone-50 | --tw-shadow-color: #fafaf9; | | shadow-stone-100 | --tw-shadow-color: #f5f5f4; | | shadow-stone-200 | --tw-shadow-color: #e7e5e4; | | shadow-stone-300 | --tw-shadow-color: #d6d3d1; | | shadow-stone-400 | --tw-shadow-color: #a8a29e; | | shadow-stone-500 | --tw-shadow-color: #78716c; | | shadow-stone-600 | --tw-shadow-color: #57534e; | | shadow-stone-700 | --tw-shadow-color: #44403c; | | shadow-stone-800 | --tw-shadow-color: #292524; | | shadow-stone-900 | --tw-shadow-color: #1c1917; | | shadow-red-50 | --tw-shadow-color: #fef2f2; | | shadow-red-100 | --tw-shadow-color: #fee2e2; | | shadow-red-200 | --tw-shadow-color: #fecaca; | | shadow-red-300 | --tw-shadow-color: #fca5a5; | | shadow-red-400 | --tw-shadow-color: #f87171; | | shadow-red-500 | --tw-shadow-color: #ef4444; | | shadow-red-600 | --tw-shadow-color: #dc2626; | | shadow-red-700 | --tw-shadow-color: #b91c1c; | | shadow-red-800 | --tw-shadow-color: #991b1b; | | shadow-red-900 | --tw-shadow-color: #7f1d1d; | | shadow-orange-50 | --tw-shadow-color: #fff7ed; | | shadow-orange-100 | --tw-shadow-color: #ffedd5; | | shadow-orange-200 | --tw-shadow-color: #fed7aa; | | shadow-orange-300 | --tw-shadow-color: #fdba74; | | shadow-orange-400 | --tw-shadow-color: #fb923c; | | shadow-orange-500 | --tw-shadow-color: #f97316; | | shadow-orange-600 | --tw-shadow-color: #ea580c; | | shadow-orange-700 | --tw-shadow-color: #c2410c; | | shadow-orange-800 | --tw-shadow-color: #9a3412; | | shadow-orange-900 | --tw-shadow-color: #7c2d12; | | shadow-amber-50 | --tw-shadow-color: #fffbeb; | | shadow-amber-100 | --tw-shadow-color: #fef3c7; | | shadow-amber-200 | --tw-shadow-color: #fde68a; | | shadow-amber-300 | --tw-shadow-color: #fcd34d; | | shadow-amber-400 | --tw-shadow-color: #fbbf24; | | shadow-amber-500 | --tw-shadow-color: #f59e0b; | | shadow-amber-600 | --tw-shadow-color: #d97706; | | shadow-amber-700 | --tw-shadow-color: #b45309; | | shadow-amber-800 | --tw-shadow-color: #92400e; | | shadow-amber-900 | --tw-shadow-color: #78350f; | | shadow-yellow-50 | --tw-shadow-color: #fefce8; | | shadow-yellow-100 | --tw-shadow-color: #fef9c3; | | shadow-yellow-200 | --tw-shadow-color: #fef08a; | | shadow-yellow-300 | --tw-shadow-color: #fde047; | | shadow-yellow-400 | --tw-shadow-color: #facc15; | | shadow-yellow-500 | --tw-shadow-color: #eab308; | | shadow-yellow-600 | --tw-shadow-color: #ca8a04; | | shadow-yellow-700 | --tw-shadow-color: #a16207; | | shadow-yellow-800 | --tw-shadow-color: #854d0e; | | shadow-yellow-900 | --tw-shadow-color: #713f12; | | shadow-lime-50 | --tw-shadow-color: #f7fee7; | | shadow-lime-100 | --tw-shadow-color: #ecfccb; | | shadow-lime-200 | --tw-shadow-color: #d9f99d; | | shadow-lime-300 | --tw-shadow-color: #bef264; | | shadow-lime-400 | --tw-shadow-color: #a3e635; | | shadow-lime-500 | --tw-shadow-color: #84cc16; | | shadow-lime-600 | --tw-shadow-color: #65a30d; | | shadow-lime-700 | --tw-shadow-color: #4d7c0f; | | shadow-lime-800 | --tw-shadow-color: #3f6212; | | shadow-lime-900 | --tw-shadow-color: #365314; | | shadow-green-50 | --tw-shadow-color: #f0fdf4; | | shadow-green-100 | --tw-shadow-color: #dcfce7; | | shadow-green-200 | --tw-shadow-color: #bbf7d0; | | shadow-green-300 | --tw-shadow-color: #86efac; | | shadow-green-400 | --tw-shadow-color: #4ade80; | | shadow-green-500 | --tw-shadow-color: #22c55e; | | shadow-green-600 | --tw-shadow-color: #16a34a; | | shadow-green-700 | --tw-shadow-color: #15803d; | | shadow-green-800 | --tw-shadow-color: #166534; | | shadow-green-900 | --tw-shadow-color: #14532d; | | shadow-emerald-50 | --tw-shadow-color: #ecfdf5; | | shadow-emerald-100 | --tw-shadow-color: #d1fae5; | | shadow-emerald-200 | --tw-shadow-color: #a7f3d0; | | shadow-emerald-300 | --tw-shadow-color: #6ee7b7; | | shadow-emerald-400 | --tw-shadow-color: #34d399; | | shadow-emerald-500 | --tw-shadow-color: #10b981; | | shadow-emerald-600 | --tw-shadow-color: #059669; | | shadow-emerald-700 | --tw-shadow-color: #047857; | | shadow-emerald-800 | --tw-shadow-color: #065f46; | | shadow-emerald-900 | --tw-shadow-color: #064e3b; | | shadow-teal-50 | --tw-shadow-color: #f0fdfa; | | shadow-teal-100 | --tw-shadow-color: #ccfbf1; | | shadow-teal-200 | --tw-shadow-color: #99f6e4; | | shadow-teal-300 | --tw-shadow-color: #5eead4; | | shadow-teal-400 | --tw-shadow-color: #2dd4bf; | | shadow-teal-500 | --tw-shadow-color: #14b8a6; | | shadow-teal-600 | --tw-shadow-color: #0d9488; | | shadow-teal-700 | --tw-shadow-color: #0f766e; | | shadow-teal-800 | --tw-shadow-color: #115e59; | | shadow-teal-900 | --tw-shadow-color: #134e4a; | | shadow-cyan-50 | --tw-shadow-color: #ecfeff; | | shadow-cyan-100 | --tw-shadow-color: #cffafe; | | shadow-cyan-200 | --tw-shadow-color: #a5f3fc; | | shadow-cyan-300 | --tw-shadow-color: #67e8f9; | | shadow-cyan-400 | --tw-shadow-color: #22d3ee; | | shadow-cyan-500 | --tw-shadow-color: #06b6d4; | | shadow-cyan-600 | --tw-shadow-color: #0891b2; | | shadow-cyan-700 | --tw-shadow-color: #0e7490; | | shadow-cyan-800 | --tw-shadow-color: #155e75; | | shadow-cyan-900 | --tw-shadow-color: #164e63; | | shadow-sky-50 | --tw-shadow-color: #f0f9ff; | | shadow-sky-100 | --tw-shadow-color: #e0f2fe; | | shadow-sky-200 | --tw-shadow-color: #bae6fd; | | shadow-sky-300 | --tw-shadow-color: #7dd3fc; | | shadow-sky-400 | --tw-shadow-color: #38bdf8; | | shadow-sky-500 | --tw-shadow-color: #0ea5e9; | | shadow-sky-600 | --tw-shadow-color: #0284c7; | | shadow-sky-700 | --tw-shadow-color: #0369a1; | | shadow-sky-800 | --tw-shadow-color: #075985; | | shadow-sky-900 | --tw-shadow-color: #0c4a6e; | | shadow-blue-50 | --tw-shadow-color: #eff6ff; | | shadow-blue-100 | --tw-shadow-color: #dbeafe; | | shadow-blue-200 | --tw-shadow-color: #bfdbfe; | | shadow-blue-300 | --tw-shadow-color: #93c5fd; | | shadow-blue-400 | --tw-shadow-color: #60a5fa; | | shadow-blue-500 | --tw-shadow-color: #3b82f6; | | shadow-blue-600 | --tw-shadow-color: #2563eb; | | shadow-blue-700 | --tw-shadow-color: #1d4ed8; | | shadow-blue-800 | --tw-shadow-color: #1e40af; | | shadow-blue-900 | --tw-shadow-color: #1e3a8a; | | shadow-indigo-50 | --tw-shadow-color: #eef2ff; | | shadow-indigo-100 | --tw-shadow-color: #e0e7ff; | | shadow-indigo-200 | --tw-shadow-color: #c7d2fe; | | shadow-indigo-300 | --tw-shadow-color: #a5b4fc; | | shadow-indigo-400 | --tw-shadow-color: #818cf8; | | shadow-indigo-500 | --tw-shadow-color: #6366f1; | | shadow-indigo-600 | --tw-shadow-color: #4f46e5; | | shadow-indigo-700 | --tw-shadow-color: #4338ca; | | shadow-indigo-800 | --tw-shadow-color: #3730a3; | | shadow-indigo-900 | --tw-shadow-color: #312e81; | | shadow-violet-50 | --tw-shadow-color: #f5f3ff; | | shadow-violet-100 | --tw-shadow-color: #ede9fe; | | shadow-violet-200 | --tw-shadow-color: #ddd6fe; | | shadow-violet-300 | --tw-shadow-color: #c4b5fd; | | shadow-violet-400 | --tw-shadow-color: #a78bfa; | | shadow-violet-500 | --tw-shadow-color: #8b5cf6; | | shadow-violet-600 | --tw-shadow-color: #7c3aed; | | shadow-violet-700 | --tw-shadow-color: #6d28d9; | | shadow-violet-800 | --tw-shadow-color: #5b21b6; | | shadow-violet-900 | --tw-shadow-color: #4c1d95; | | shadow-purple-50 | --tw-shadow-color: #faf5ff; | | shadow-purple-100 | --tw-shadow-color: #f3e8ff; | | shadow-purple-200 | --tw-shadow-color: #e9d5ff; | | shadow-purple-300 | --tw-shadow-color: #d8b4fe; | | shadow-purple-400 | --tw-shadow-color: #c084fc; | | shadow-purple-500 | --tw-shadow-color: #a855f7; | | shadow-purple-600 | --tw-shadow-color: #9333ea; | | shadow-purple-700 | --tw-shadow-color: #7e22ce; | | shadow-purple-800 | --tw-shadow-color: #6b21a8; | | shadow-purple-900 | --tw-shadow-color: #581c87; | | shadow-fuchsia-50 | --tw-shadow-color: #fdf4ff; | | shadow-fuchsia-100 | --tw-shadow-color: #fae8ff; | | shadow-fuchsia-200 | --tw-shadow-color: #f5d0fe; | | shadow-fuchsia-300 | --tw-shadow-color: #f0abfc; | | shadow-fuchsia-400 | --tw-shadow-color: #e879f9; | | shadow-fuchsia-500 | --tw-shadow-color: #d946ef; | | shadow-fuchsia-600 | --tw-shadow-color: #c026d3; | | shadow-fuchsia-700 | --tw-shadow-color: #a21caf; | | shadow-fuchsia-800 | --tw-shadow-color: #86198f; | | shadow-fuchsia-900 | --tw-shadow-color: #701a75; | | shadow-pink-50 | --tw-shadow-color: #fdf2f8; | | shadow-pink-100 | --tw-shadow-color: #fce7f3; | | shadow-pink-200 | --tw-shadow-color: #fbcfe8; | | shadow-pink-300 | --tw-shadow-color: #f9a8d4; | | shadow-pink-400 | --tw-shadow-color: #f472b6; | | shadow-pink-500 | --tw-shadow-color: #ec4899; | | shadow-pink-600 | --tw-shadow-color: #db2777; | | shadow-pink-700 | --tw-shadow-color: #be185d; | | shadow-pink-800 | --tw-shadow-color: #9d174d; | | shadow-pink-900 | --tw-shadow-color: #831843; | | shadow-rose-50 | --tw-shadow-color: #fff1f2; | | shadow-rose-100 | --tw-shadow-color: #ffe4e6; | | shadow-rose-200 | --tw-shadow-color: #fecdd3; | | shadow-rose-300 | --tw-shadow-color: #fda4af; | | shadow-rose-400 | --tw-shadow-color: #fb7185; | | shadow-rose-500 | --tw-shadow-color: #f43f5e; | | shadow-rose-600 | --tw-shadow-color: #e11d48; | | shadow-rose-700 | --tw-shadow-color: #be123c; | | shadow-rose-800 | --tw-shadow-color: #9f1239; | | shadow-rose-900 | --tw-shadow-color: #881337; | Basic usage ----------- ### Setting the box shadow color Use the `shadow-{color}` utilities to change the color of an existing box shadow. By default colored shadows have an opacity of 100%, but you can adjust this using the opacity modifier. ``` <button class="bg-cyan-500 shadow-lg shadow-cyan-500/50 ...">Subscribe</button> <button class="bg-blue-500 shadow-lg shadow-blue-500/50 ...">Subscribe</button> <button class="bg-indigo-500 shadow-lg shadow-indigo-500/50 ...">Subscribe</button> ``` ### Using shadows on colored backgrounds When using shadows on a colored background, colored shadows can often look more natural than the default black-based shadows, which tend to appear gray and washed-out. ``` <!-- Default shadow--> <button class="shadow-lg">Subscribe</button> <!-- Colored shadow--> <button class="shadow-lg shadow-indigo-500/40 ...">Subscribe</button> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:shadow-indigo-500/40` to only apply the `shadow-indigo-500/40` utility on hover. ``` <button class="shadow shadow-blue-500/40 hover:shadow-indigo-500/40"> <!-- ... --> </button> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:shadow-indigo-500/40` to apply the `shadow-indigo-500/40` utility at only medium screen sizes and above. ``` <button class="shadow shadow-blue-500/40 md:shadow-indigo-500/40"> <!-- ... --> </button> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). ### Preserving shadow color when changing the shadow size Note that if you change the [box shadow](box-shadow) size at a different breakpoint, or on another state like hover, it will override any existing shadow colors. ``` <!-- This shadow will NOT be red at medium screens and above --> <div class="shadow-lg shadow-red-500 md:shadow-xl"></div> ``` To preserve the shadow color in these states, it needs to be respecified: ``` <!-- This shadow WILL be red at medium screens and above --> <div class="shadow-lg shadow-red-500 md:shadow-xl md:shadow-red-500"></div> ``` It’s necessary for Tailwind to work this way, as otherwise there would be no way to switch back to the default shadow. Using custom values ------------------- ### Customizing your theme By default, Tailwind makes the entire [default color palette](customizing-colors#default-color-palette) available as box shadow colors. You can [customize your color palette](/docs/customizing-colors#customizing) by editing `theme.colors` or `theme.extend.colors` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { colors: { 'regal-blue': '#243c5a', }, } } } ``` Alternatively, you can customize just your box shadow colors by editing `theme.boxShadowColor` or `theme.extend.boxShadowColor` in your `tailwind.config.js` file. Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `box-shadow` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <button class="shadow-[#50d71e]"> <!-- ... --> </button> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Background Attachment Quick reference --------------- | Class | Properties | | --- | --- | | bg-fixed | background-attachment: fixed; | | bg-local | background-attachment: local; | | bg-scroll | background-attachment: scroll; | Basic usage ----------- ### Fixed Use `bg-fixed` to fix the background image relative to the viewport. ``` <div class="bg-fixed ..." style="background-image: url(...)"></div> ``` ### Local Use `bg-local` to scroll the background image with the container and the viewport. ``` <div class="bg-local ..." style="background-image: url(...)"></div> ``` ### Scroll Use `bg-scroll` to scroll the background image with the viewport, but not with the container. ``` <div class="bg-scroll ..." style="background-image: url(...)"></div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:bg-fixed` to only apply the `bg-fixed` utility on hover. ``` <div class="bg-local hover:bg-fixed"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:bg-fixed` to apply the `bg-fixed` utility at only medium screen sizes and above. ``` <div class="bg-local md:bg-fixed"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Handling Hover, Focus, and Other States Every utility class in Tailwind can be applied *conditionally* by adding a modifier to the beginning of the class name that describes the condition you want to target. For example, to apply the `bg-sky-700` class on hover, use the `hover:bg-sky-700` class: ``` <button class="bg-sky-500 hover:bg-sky-700 ..."> Save changes </button> ``` How does this compare to traditional CSS?When writing CSS the traditional way, a single class name would do different things based on the current state. Traditionally the same class name applies different styles on hover ``` .btn-primary { background-color: #0ea5e9; } .btn-primary:hover { background-color: #0369a1; } ``` In Tailwind, rather than adding the styles for a hover state to an existing class, you add another class to the element that *only* does something on hover. In Tailwind, separate classes are used for the default state and the hover state ``` .bg-sky-500 { background-color: #0ea5e9; } .hover\:bg-sky-700:hover { background-color: #0369a1; } ``` Notice how `hover:bg-sky-700` *only* defines styles for the `:hover` state? It does nothing by default, but as soon as you hover over an element with that class, the background color will change to `sky-700`. This is what we mean when we say a utility class can be applied *conditionally* — by using modifiers you can control exactly how your design behaves in different states, without ever leaving your HTML. Tailwind includes modifiers for just about everything you’ll ever need, including: * [Pseudo-classes](#pseudo-classes), like `:hover`, `:focus`, `:first-child`, and `:required` * [Pseudo-elements](#pseudo-elements), like `::before`, `::after`, `::placeholder`, and `::selection` * [Media queries](#media-queries), like responsive breakpoints, dark mode, and `prefers-reduced-motion` * [Attribute selectors](#attribute-selectors), like `[dir="rtl"]` and `[open]` These modifiers can even be [stacked](#ordering-stacked-modifiers) to target more specific situations, for example changing the background color in dark mode, at the medium breakpoint, on hover: ``` <button class="dark:md:hover:bg-fuchsia-600 ..."> Save changes </button> ``` In this guide you’ll learn about every modifier available in the framework, how to use them with your own custom classes, and even how to create your own. Pseudo-classes -------------- ### Hover, focus, and active Style elements on hover, focus, and active using the `hover`, `focus`, and `active` modifiers: ``` <button class="bg-violet-500 hover:bg-violet-600 active:bg-violet-700 focus:outline-none focus:ring focus:ring-violet-300 ..."> Save changes </button> ``` Tailwind also includes modifiers for other interactive states like `:visited`, `:focus-within`, `:focus-visible`, and more. See the [pseudo-class reference](#pseudo-class-reference) for a complete list of available pseudo-class modifiers. ### First, last, odd, and even Style an element when it is the first-child or last-child using the `first` and `last` modifiers: ``` <ul role="list" class="p-6 divide-y divide-slate-200"> {#each people as person} <!-- Remove top/bottom padding when first/last child --> <li class="flex py-4 first:pt-0 last:pb-0"> <img class="h-10 w-10 rounded-full" src="{person.imageUrl}" alt="" /> <div class="ml-3 overflow-hidden"> <p class="text-sm font-medium text-slate-900">{person.name}</p> <p class="text-sm text-slate-500 truncate">{person.email}</p> </div> </li> {/each} </ul> ``` You can also style an element when it’s an odd or even child using the `odd` and `even` modifiers: ``` <table> <!-- ... --> <tbody> {#each people as person} <!-- Use a white background for odd rows, and slate-50 for even rows --> <tr class="odd:bg-white even:bg-slate-50"> <td>{person.name}</td> <td>{person.title}</td> <td>{person.email}</td> </tr> {/each} </tbody> </table> ``` Tailwind also includes modifiers for other structural pseudo-classes like `:only-child`, `:first-of-type`, `:empty`, and more. See the [pseudo-class reference](#pseudo-class-reference) for a complete list of available pseudo-class modifiers. ### Form states Style form elements in different states using modifiers like `required`, `invalid`, and `disabled`: ``` <form> <label class="block"> <span class="block text-sm font-medium text-slate-700">Username</span> <!-- Using form state modifers, the classes can be identical for every input --> <input type="text" value="tbone" disabled class="mt-1 block w-full px-3 py-2 bg-white border border-slate-300 rounded-md text-sm shadow-sm placeholder-slate-400 focus:outline-none focus:border-sky-500 focus:ring-1 focus:ring-sky-500 disabled:bg-slate-50 disabled:text-slate-500 disabled:border-slate-200 disabled:shadow-none invalid:border-pink-500 invalid:text-pink-600 focus:invalid:border-pink-500 focus:invalid:ring-pink-500 "/> </label> <!-- ... --> </form> ``` Using modifiers for this sort of thing can reduce the amount of conditional logic in your templates, letting you use the same set of classes regardless of what state an input is in and letting the browser apply the right styles for you. Tailwind also includes modifiers for other form states like `:read-only`, `:indeterminate`, `:checked`, and more. See the [pseudo-class reference](#disabled) for a complete list of available pseudo-class modifiers. ### Styling based on parent state (group-{modifier}) When you need to style an element based on the state of some *parent* element, mark the parent with the `group` class, and use `group-*` modifiers like `group-hover` to style the target element: ``` <a href="#" class="group block max-w-xs mx-auto rounded-lg p-6 bg-white ring-1 ring-slate-900/5 shadow-lg space-y-3 hover:bg-sky-500 hover:ring-sky-500"> <div class="flex items-center space-x-3"> <svg class="h-6 w-6 stroke-sky-500 group-hover:stroke-white" fill="none" viewBox="0 0 24 24"><!-- ... --></svg> <h3 class="text-slate-900 group-hover:text-white text-sm font-semibold">New project</h3> </div> <p class="text-slate-500 group-hover:text-white text-sm">Create a new project from a variety of starting templates.</p> </a> ``` This pattern works with every pseudo-class modifier, for example `group-focus`, `group-active`, or even `group-odd`. ### Styling based on sibling state (peer-{modifier}) When you need to style an element based on the state of a *sibling* element, mark the sibling with the `peer` class, and use `peer-*` modifiers like `peer-invalid` to style the target element: ``` <form> <label class="block"> <span class="block text-sm font-medium text-slate-700">Email</span> <input type="email" class="peer ..."/> <p class="mt-2 invisible peer-invalid:visible text-pink-600 text-sm"> Please provide a valid email address. </p> </label> </form> ``` This makes it possible to do all sorts of neat tricks, like [floating labels](https://www.youtube.com/watch?v=nJzKi6oIvBA) for example without any JS. This pattern works with every pseudo-class modifier, for example `peer-focus`, `peer-required`, and `peer-disabled`. It’s important to note that the `peer` marker can only be used on *previous* siblings because of how the [general sibling combinator](https://developer.mozilla.org/en-US/docs/Web/CSS/General_sibling_combinator) works in CSS. Won't work, only previous siblings can be marked as peers ``` <label> <span class="peer-invalid:text-red-500 ...">Email</span> <input type="email" class="peer ..."/> </label> ``` Pseudo-elements --------------- ### Before and after Style the `::before` and `::after` pseudo-elements using the `before` and `after` modifiers: ``` <label class="block"> <span class="after:content-['*'] after:ml-0.5 after:text-red-500 block text-sm font-medium text-slate-700"> Email </span> <input type="email" name="email" class="mt-1 px-3 py-2 bg-white border shadow-sm border-slate-300 placeholder-slate-400 focus:outline-none focus:border-sky-500 focus:ring-sky-500 block w-full rounded-md sm:text-sm focus:ring-1" placeholder="[email protected]" /> </label> ``` When using these modifiers, Tailwind will automatically add `content: ''` by default so you don’t have to specify it unless you want a different value: ``` <blockquote class="text-2xl font-semibold italic text-center text-slate-900"> When you look <span class="before:block before:absolute before:-inset-1 before:-skew-y-3 before:bg-pink-500 relative inline-block"> <span class="relative text-white">annoyed</span> </span> all the time, people think that you're busy. </blockquote> ``` It’s worth noting that you don’t really need `::before` and `::after` pseudo-elements for most things in Tailwind projects — it’s usually simpler to just use a real HTML element. For example, here’s the same design from above but using a `<span>` instead of the `::before` pseudo-element, which is a little easier to read and is actually less code: ``` <blockquote class="text-2xl font-semibold italic text-center text-slate-900"> When you look <span class="relative"> <span class="block absolute -inset-1 -skew-y-3 bg-pink-500" aria-hidden="true"></span> <span class="relative text-white">annoyed</span> </span> all the time, people think that you're busy. </blockquote> ``` Save `before` and `after` for situations where it’s important that the content of the pseudo-element is not actually in the DOM and can’t be selected by the user. Note that if you’ve disabled our [preflight base styles](preflight), the content property will not be set to an empty string by default, and you will need to include `content-['']` any time you use the `before` and `after` modifiers. ``` <div class="before:content-[''] before:block ..."> <!-- ... --> </div> ``` ### Placeholder text Style the placeholder text of any input or textarea using the `placeholder` modifier: ``` <label class="relative block"> <span class="sr-only">Search</span> <span class="absolute inset-y-0 left-0 flex items-center pl-2"> <svg class="h-5 w-5 fill-slate-300" viewBox="0 0 20 20"><!-- ... --></svg> </span> <input class="placeholder:italic placeholder:text-slate-400 block bg-white w-full border border-slate-300 rounded-md py-2 pl-9 pr-3 shadow-sm focus:outline-none focus:border-sky-500 focus:ring-sky-500 focus:ring-1 sm:text-sm" placeholder="Search for anything..." type="text" name="search"/> </label> ``` ### File input buttons Style the button in file inputs using the `file` modifier: ``` <form class="flex items-center space-x-6"> <div class="shrink-0"> <img class="h-16 w-16 object-cover rounded-full" src="https://images.unsplash.com/photo-1580489944761-15a19d654956?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1361&q=80" alt="Current profile photo" /> </div> <label class="block"> <span class="sr-only">Choose profile photo</span> <input type="file" class="block w-full text-sm text-slate-500 file:mr-4 file:py-2 file:px-4 file:rounded-full file:border-0 file:text-sm file:font-semibold file:bg-violet-50 file:text-violet-700 hover:file:bg-violet-100 "/> </label> </form> ``` Note that Tailwind’s [border reset](preflight#border-styles-are-reset-globally) is not applied to file input buttons. This means that to add a border to a file input button, you need to explicitly set the <border-style> using a class like `file:border-solid` alongside any <border-width> utility: ``` <input type="file" class="file:border file:border-solid ..." /> ``` ### List markers Style the counters or bullets in lists using the `marker` modifier: ``` <ul role="list" class="marker:text-sky-400 list-disc pl-5 space-y-3 text-slate-500"> <li>5 cups chopped Porcini mushrooms</li> <li>1/2 cup of olive oil</li> <li>3lb of celery</li> </ul><ul role="list" class="marker:text-sky-400 list-disc pl-5 space-y-3 text-slate-400"> <li>5 cups chopped Porcini mushrooms</li> <li>1/2 cup of olive oil</li> <li>3lb of celery</li> </ul> ``` We’ve designed the `marker` modifier to be inheritable, so although you can use it directly on an `<li>` element, you can also use it on a parent to avoid repeating yourself. ### Highlighted text Style the active text selection using the `selection` modifier: ``` <div class="selection:bg-fuchsia-300 selection:text-fuchsia-900"> <p> So I started to walk into the water. I won't lie to you boys, I was terrified. But I pressed on, and as I made my way past the breakers a strange calm came over me. I don't know if it was divine intervention or the kinship of all living things but I tell you Jerry at that moment, I <em>was</em> a marine biologist. </p> </div> ``` We’ve designed the `selection` modifier to be inheritable, so you can add it anywhere in the tree and it will be applied to all descendant elements. This makes it easy to set the selection color to match your brand across your entire site: ``` <html> <head> <!-- ... --> </head> <body class="selection:bg-pink-300"> <!-- ... --> </body> </html> ``` ### First-line and first-letter Style the first line in a block of content using the `first-line` modifier, and the first letter using the `first-letter` modifier: ``` <p class="first-line:uppercase first-line:tracking-widest first-letter:text-7xl first-letter:font-bold first-letter:text-slate-900 first-letter:mr-3 first-letter:float-left "> Well, let me tell you something, funny boy. Y'know that little stamp, the one that says "New York Public Library"? Well that may not mean anything to you, but that means a lot to me. One whole hell of a lot. </p><p class="first-line:uppercase first-line:tracking-widest first-letter:text-7xl first-letter:font-bold first-letter:text-white first-letter:mr-3 first-letter:float-left "> Well, let me tell you something, funny boy. Y'know that little stamp, the one that says "New York Public Library"? Well that may not mean anything to you, but that means a lot to me. One whole hell of a lot. </p> ``` ### Dialog backdrops Style the backdrop of a [native `<dialog>` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog) using the `backdrop` modifier: ``` <dialog class="backdrop:bg-gray-50"> <form method="dialog"> <!-- ... --> </form> </dialog> ``` If you’re using native `<dialog>` elements in your project, you may also want to read about [styling open/closed states](hover-focus-and-other-states#open-closed-state) using the `open` modifier. Media queries ------------- ### Responsive breakpoints To style an element at a specific breakpoint, use responsive modifiers like `md` and `lg`. For example, this will render a 3-column grid on mobile, a 4-column grid on medium-width screens, and a 6-column grid on large-width screens: ``` <div class="grid grid-cols-3 md:grid-cols-4 lg:grid-cols-6"> <!-- ... --> </div> ``` Check out the [Responsive Design](responsive-design) documentation for an in-depth look at how these features work. ### Prefers color scheme The `prefers-color-scheme` media query tells you whether the user prefers a light theme or dark theme, and is usually configured at the operating system level. Use utilities with no modifier to target light mode, and use the `dark` modifier to provide overrides for dark mode: ``` <div class="bg-white dark:bg-slate-900 rounded-lg px-6 py-8 ring-1 ring-slate-900/5 shadow-xl"> <div> <span class="inline-flex items-center justify-center p-2 bg-indigo-500 rounded-md shadow-lg"> <svg class="h-6 w-6 text-white" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true"><!-- ... --></svg> </span> </div> <h3 class="text-slate-900 dark:text-white mt-5 text-base font-medium tracking-tight">Writes Upside-Down</h3> <p class="text-slate-500 dark:text-slate-400 mt-2 text-sm"> The Zero Gravity Pen can be used to write in any orientation, including upside-down. It even works in outer space. </p> </div> ``` Check out the [Dark Mode](dark-mode) documentation for an in-depth look at how this feature works. ### Prefers reduced motion The `prefers-reduced-motion` media query tells you if the user has requested that you minimize non-essential motion. Use the `motion-reduce` modifier to conditionally add styles when the user has requested reduced motion: ``` <button type="button" class="bg-indigo-500 ..." disabled> <svg class="motion-reduce:hidden animate-spin ..." viewBox="0 0 24 24"><!-- ... --></svg> Processing... </button> ``` Tailwind also includes a `motion-safe` modifier that only adds styles when the user has *not* requested reduced motion. This can be useful when using the `motion-reduce` helper would mean having to “undo” a lot of styles: ``` <!-- Using `motion-reduce` can mean lots of "undoing" styles --> <button class="hover:-translate-y-0.5 transition motion-reduce:hover:translate-y-0 motion-reduce:transition-none ..."> Save changes </button> <!-- Using `motion-safe` is less code in these situations --> <button class="motion-safe:hover:-translate-x-0.5 motion-safe:transition ..."> Save changes </button> ``` ### Prefers contrast The `prefers-contrast` media query tells you if the user has requested more or less contrast. Use the `contrast-more` modifier to conditionally add styles when the user has requested more contrast: ``` <form> <label class="block"> <span class="block text-sm font-medium text-slate-700">Social Security Number</span> <input class="border-slate-200 placeholder-slate-400 contrast-more:border-slate-400 contrast-more:placeholder-slate-500"/> <p class="mt-2 opacity-10 contrast-more:opacity-100 text-slate-600 text-sm"> We need this to steal your identity. </p> </label> </form> ``` Tailwind also includes a `contrast-less` modifier you can use to conditionally add styles when the user has requested less contrast. ### Viewport orientation Use the `portrait` and `landscape` modifiers to conditionally add styles when the viewport is in a specific orientation: ``` <div> <div class="portrait:hidden"> <!-- ... --> </div> <div class="landscape:hidden"> <p> This experience is designed to be viewed in landscape. Please rotate your device to view the site. </p> </div> </div> ``` ### Print styles Use the `print` modifier to conditionally add styles that only apply when the document is being printed: ``` <div> <article class="print:hidden"> <h1>My Secret Pizza Recipe</h1> <p>This recipe is a secret, and must not be shared with anyone</p> <!-- ... --> </article> <div class="hidden print:block"> Are you seriously trying to print this? It's secret! </div> </div> ``` Attribute selectors ------------------- ### RTL support *Right-to-left support is experimental and the details of how it works may change. Share your feedback in the [community](https://github.com/tailwindlabs/tailwindcss/discussions) to help us get it ready for prime time.* Use the `rtl` and `ltr` modifiers conditionally add styles in right-to-left and left-to-right modes respectively when building multi-directional layouts: ``` <div class="group flex items-center"> <img class="shrink-0 h-12 w-12 rounded-full" src="..." alt="" /> <div class="ltr:ml-3 rtl:mr-3"> <p class="text-sm font-medium text-slate-700 group-hover:text-slate-900">...</p> <p class="text-sm font-medium text-slate-500 group-hover:text-slate-700">...</p> </div> </div> <div class="group flex items-center"> <img class="shrink-0 h-12 w-12 rounded-full" src="..." alt="" /> <div class="ltr:ml-3 rtl:mr-3"> <p class="text-sm font-medium text-slate-300 group-hover:text-white">...</p> <p class="text-sm font-medium text-slate-500 group-hover:text-slate-300">...</p> </div> </div> ``` Note that the `ltr` modifier will not take effect unless the `dir` attribute is explicitly set to `ltr`, so if you are building a multi-directional site make sure to always set a direction, not just in `rtl` mode. ``` <html dir="ltr"> <!-- ... --> </html> ``` Remember, these modifiers are only useful if you are building a site that needs to support *both* left-to-right and right-to-left layouts. If you’re building a site that only needs to support a single direction, you don’t need these modifiers — just apply the styles that make sense for your content. ### Open/closed state Use the `open` modifier to conditionally add styles when a `<details>` or `<dialog>` element is in an open state: ``` <div class="max-w-lg mx-auto p-8"> <details class="open:bg-white dark:open:bg-slate-900 open:ring-1 open:ring-black/5 dark:open:ring-white/10 open:shadow-lg p-6 rounded-lg" open> <summary class="text-sm leading-6 text-slate-900 dark:text-white font-semibold select-none"> Why do they call it Ovaltine? </summary> <div class="mt-3 text-sm leading-6 text-slate-600 dark:text-slate-400"> <p>The mug is round. The jar is round. They should call it Roundtine.</p> </div> </details> </div> ``` Custom modifiers ---------------- ### Using arbitrary variants Just like [arbitrary values](adding-custom-styles#using-arbitrary-values) let you use custom values with your utility classes, arbitrary variants let you write custom selector modifiers directly in your HTML. Arbitrary variants are just format strings that represent the selector, wrapped in square brackets. For example, this arbitrary modifier selects an element only when it is the third child: The format string is the same as what you’d use with the [`addVariant` plugin API](plugins#adding-variants), with the `&` representing the selector being modified. Arbitrary variants can be stacked with built-in modifiers or with each other, just like the rest of the modifiers in Tailwind: If you need spaces in your selector, you can use an underscore. For example, this arbitrary modifier selects all `p` elements within the element where you’ve added the class: You can also use at-rules like `@media` or `@supports` in arbitrary variants: With at-rule custom modifiers the `&` placeholder isn’t necessary, just like when nesting with a preprocessor. You can even combine at-rules and regular selector modifiers by including the selector modifier within curly braces after the at-rule: ### Creating a plugin If you find yourself using the same arbitrary modifier multiple times in your project, it might be worth extracting it to a plugin using the `addVariant` API: tailwind.config.js ``` let plugin = require('tailwindcss/plugin') module.exports = { // ... plugins: [ plugin(function ({ addVariant }) { // Add a `third` variant, ie. `third:pb-0` addVariant('third', '&:nth-child(3)') }) ] } ``` Learn more in the [adding variant plugins](plugins#adding-variants) documentation. Advanced topics --------------- ### Using with your own classes All of Tailwind’s modifiers are available to use with your own custom classes as long as you’ve defined them in one of Tailwind’s [layers](adding-custom-styles#using-css-and-layer) or added them using a [plugin](adding-custom-styles#writing-plugins): main.css ``` @tailwind base; @tailwind components; @tailwind utilities; @layer utilities { .content-auto { content-visibility: auto; } } ``` HTML ``` <div class="lg:content-auto"> <!-- ... --> </div> ``` ### Ordering stacked modifiers When stacking modifiers, they are applied from the inside-out, like nested function calls: ``` // These modifiers: 'dark:group-hover:focus:opacity-100' // ...are applied like this: dark(groupHover(focus('opacity-100'))) ``` For the most part this doesn’t actually matter, but there are a few situations where the order you use actually generates meaningfully different CSS. For example, if you have `darkMode` configured to `class`, combining the `dark` and `group-hover` modifiers generates a different result depending on the order you use: ``` /* dark:group-hover:opacity-100 */ .dark .group:hover .dark\:group-hover\:opacity-100 { opacity: 1; } /* group-hover:dark:opacity-100 */ .group:hover .dark .group-hover\:dark\:opacity-100 { opacity: 1; } ``` In the first example, the `dark` element needs to be a parent of the `group` element, but in the second example it’s reversed. Another place this is important is when using modifiers like `prose-headings` that are included with the official typography plugin: ``` /* prose-headings:hover:underline */ .prose-headings\:hover\:underline:hover :is(:where(h1, h2, h3, h4, th)) { text-decoration: underline; } /* hover:prose-headings:underline */ .hover\:prose-headings\:underline :is(:where(h1, h2, h3, h4, th)):hover { text-decoration: underline; } ``` In the first example, every single heading is underlined when you hover over the article itself, whereas in the second example each heading is only underlined when you hover over that heading. Appendix -------- ### Quick reference A quick reference table of every single modifier included in Tailwind by default. | Modifier | CSS | | --- | --- | | [hover](#hover) | `&:hover` | | [focus](#focus) | `&:focus` | | [focus-within](#focus-within) | `&:focus-within` | | [focus-visible](#focus-visible) | `&:focus-visible` | | [active](#active) | `&:active` | | [visited](#visited) | `&:visited` | | [target](#target) | `&:target` | | [first](#first) | `&:first-child` | | [last](#last) | `&:last-child` | | [only](#only) | `&:only-child` | | [odd](#odd) | `&:nth-child(odd)` | | [even](#even) | `&:nth-child(even)` | | [first-of-type](#first-of-type) | `&:first-of-type` | | [last-of-type](#last-of-type) | `&:last-of-type` | | [only-of-type](#only-of-type) | `&:only-of-type` | | [empty](#empty) | `&:empty` | | [disabled](#disabled) | `&:disabled` | | [enabled](#enabled) | `&:enabled` | | [checked](#checked) | `&:checked` | | [indeterminate](#indeterminate) | `&:indeterminate` | | [default](#default) | `&:default` | | [required](#required) | `&:required` | | [valid](#valid) | `&:valid` | | [invalid](#invalid) | `&:invalid` | | [in-range](#in-range) | `&:in-range` | | [out-of-range](#out-of-range) | `&:out-of-range` | | [placeholder-shown](#placeholder-shown) | `&:placeholder-shown` | | [autofill](#autofill) | `&:autofill` | | [read-only](#read-only) | `&:read-only` | | [open](#open-closed-state) | `&[open]` | | [before](#before-and-after) | `&::before` | | [after](#before-and-after) | `&::after` | | [first-letter](#first-line-and-first-letter) | `&::first-letter` | | [first-line](#first-line-and-first-letter) | `&::first-line` | | [marker](#highlighted-text) | `&::marker` | | [selection](#selection) | `&::selection` | | [file](#file-input-buttons) | `&::file-selector-button` | | [backdrop](#dialog-backdrops) | `&::backdrop` | | [placeholder](#placeholder) | `&::placeholder` | | [sm](#responsive-breakpoints) | `@media (min-width: 640px)` | | [md](#responsive-breakpoints) | `@media (min-width: 768px)` | | [lg](#responsive-breakpoints) | `@media (min-width: 1024px)` | | [xl](#responsive-breakpoints) | `@media (min-width: 1280px)` | | [2xl](#responsive-breakpoints) | `@media (min-width: 1536px)` | | [dark](#prefers-color-scheme) | `@media (prefers-color-scheme: dark)` | | [portrait](#viewport-orientation) | `@media (orientation: portrait)` | | [landscape](#viewport-orientation) | `@media (orientation: landscape)` | | [motion-safe](#prefers-reduced-motion) | `@media (prefers-reduced-motion: no-preference)` | | [motion-reduce](#prefers-reduced-motion) | `@media (prefers-reduced-motion: reduce)` | | [contrast-more](#prefers-contrast) | `@media (prefers-contrast: more)` | | [contrast-less](#prefers-contrast) | `@media (prefers-contrast: less)` | | [print](#print-styles) | `@media print` | | [rtl](#rtl-support) | `[dir=“rtl”] &` | | [ltr](#rtl-support) | `[dir=“ltr”] &` | ### Pseudo-class reference This is a comprehensive list of examples for all the pseudo-class modifiers included in Tailwind to complement the [pseudo-classes documentation](hover-focus-and-other-states#pseudo-classes) at the beginning of this guide. #### hover (:hover) Style an element when the user hovers over it with the mouse cursor using the `hover` modifier: ``` <div class="bg-black hover:bg-white ..."> <!-- ... --> </div> ``` #### focus (:focus) Style an element when it has focus the `focus` modifier: ``` <input class="border-gray-300 focus:border-blue-400 ..." /> ``` #### focus-within (:focus-within) Style an element when it or one of its descendants has focus using the `focus-within` modifier: ``` <div class="focus-within:shadow-lg ..."> <input type="text" /> </div> ``` #### focus-visible (:focus-visible) Style an element when it has been focused using the keyboard using the `focus-visible` modifier: ``` <button class="focus:outline-none focus-visible:ring ..."> Submit </button> ``` #### active (:active) Style an element when it is being pressed using the `active` modifier: ``` <button class="bg-blue-500 active:bg-blue-600 ..."> Submit </button> ``` #### visited (:visited) Style a link when it has already been visited using the `visited` modifier: ``` <a href="https://seinfeldquotes.com" class="text-blue-600 visited:text-purple-600 ..."> Inspiration </a> ``` #### target (:target) Style an element if its ID matches the current URL fragment using the `target` modifier: ``` <div id="about" class="target:shadow-lg ..."> <!-- ... --> </div> ``` #### first (:first-child) Style an element if it’s the first child using the `first` modifier: ``` <ul> {#each people as person} <li class="py-4 first:pt-0 ..."> <!-- ... --> </li> {/each} </ul> ``` #### last (:last-child) Style an element if it’s the last child using the `last` modifier: ``` <ul> {#each people as person} <li class="py-4 last:pb-0 ..."> <!-- ... --> </li> {/each} </ul> ``` #### only (:only-child) Style an element if it’s the only child using the `only` modifier: ``` <ul> {#each people as person} <li class="py-4 only:py-0 ..."> <!-- ... --> </li> {/each} </ul> ``` #### odd (:nth-child(odd)) Style an element if it’s an oddly numbered child using the `odd` modifier: ``` <table> {#each people as person} <tr class="bg-white odd:bg-gray-100 ..."> <!-- ... --> </tr> {/each} </table> ``` #### even (:nth-child(even)) Style an element if it’s an evenly numbered child using the `even` modifier: ``` <table> {#each people as person} <tr class="bg-white even:bg-gray-100 ..."> <!-- ... --> </tr> {/each} </table> ``` #### first-of-type (:first-of-type) Style an element if it’s the first child of its type using the `first-of-type` modifier: ``` <nav> <img src="/logo.svg" alt="Vandelay Industries" /> {#each links as link} <a href="#" class="ml-2 first-of-type:ml-6 ..."> <!-- ... --> </a> {/each} </table> ``` #### last-of-type (:last-of-type) Style an element if it’s the last child of its type using the `last-of-type` modifier: ``` <nav> <img src="/logo.svg" alt="Vandelay Industries" /> {#each links as link} <a href="#" class="mr-2 last-of-type:mr-6 ..."> <!-- ... --> </a> {/each} <button>More</button> </table> ``` #### only-of-type (:only-of-type) Style an element if it’s the only child of its type using the `only-of-type` modifier: ``` <nav> <img src="/logo.svg" alt="Vandelay Industries" /> {#each links as link} <a href="#" class="mx-2 only-of-type:mx-6 ..."> <!-- ... --> </a> {/each} <button>More</button> </table> ``` #### empty (:empty) Style an element if it has no content using the `empty` modifier: ``` <ul> {#each people as person} <li class="empty:hidden ...">{person.hobby}</li> {/each} </ul> ``` #### disabled (:disabled) Style an input when it’s disabled using the `disabled` modifier: ``` <input class="disabled:opacity-75 ..." /> ``` #### enabled (:enabled) Style an input when it’s enabled using the `enabled` modifier, most helpful when you only want to apply another style when an element is not disabled: ``` <input class="enabled:hover:border-gray-400 disabled:opacity-75 ..." /> ``` #### checked (:checked) Style a checkbox or radio button when it’s checked using the `checked` modifier: ``` <input type="checkbox" class="appearance-none checked:bg-blue-500 ..." /> ``` #### indeterminate (:indeterminate) Style a checkbox or radio button in an indeterminate state using the `indeterminate` modifier: ``` <input type="checkbox" class="appearance-none indeterminate:bg-gray-300 ..." /> ``` #### default (:default) Style an option, checkbox or radio button that was the default value when the page initially loaded using the `default` modifier: ``` <input type="checkbox" class="default:ring-2 ..." /> ``` #### required (:required) Style an input when it’s required using the `required` modifier: ``` <input class="required:border-red-500 ..." /> ``` #### valid (:valid) Style an input when it’s valid using the `valid` modifier: ``` <input class="valid:border-green-500 ..." /> ``` #### invalid (:invalid) Style an input when it’s invalid using the `invalid` modifier: ``` <input class="invalid:border-red-500 ..." /> ``` #### in-range (:in-range) Style an input when it’s value is within a specified range limit using the `in-range` modifier: ``` <input min="1" max="5" class="in-range:border-green-500 ..." /> ``` #### out-of-range (:out-of-range) Style an input when it’s value is outside of a specified range limit using the `out-of-range` modifier: ``` <input min="1" max="5" class="out-of-range:border-red-500 ..." /> ``` #### placeholder-shown (:placeholder-shown) Style an input when the placeholder is shown using the `placeholder-shown` modifier: ``` <input class="placeholder-shown:border-gray-500 ..." placeholder="[email protected]" /> ``` #### autofill (:autofill) Style an input when it has been autofilled by the browser using the `autofill` modifier: ``` <input class="autofill:bg-yellow-200 ..." /> ``` #### read-only (:read-only) Style an input when it is read-only using the `read-only` modifier: ``` <input class="read-only:bg-gray-100 ..." /> ```
programming_docs
tailwindcss Aspect Ratio Quick reference --------------- | Class | Properties | | --- | --- | | aspect-auto | aspect-ratio: auto; | | aspect-square | aspect-ratio: 1 / 1; | | aspect-video | aspect-ratio: 16 / 9; | Basic usage ----------- ### Setting the aspect ratio Use the `aspect-{ratio}` utilities to set the desired aspect ratio of an element. ``` <iframe class="w-full aspect-video ..." src="https://www.youtube.com/..."></iframe> ``` Tailwind doesn’t include a large set of aspect ratio values out of the box since it’s easier to just use arbitrary values. See the [arbitrary values](#arbitrary-values) section for more information. ### Browser support The `aspect-{ratio}` utilities use the native `aspect-ratio` CSS property, which was not supported in Safari until version 15. Until Safari 15 is popularized, Tailwind’s [aspect-ratio](https://github.com/tailwindlabs/tailwindcss-aspect-ratio) plugin is a good alternative. Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:aspect-square` to only apply the `aspect-square` utility on hover. ``` <iframe class="w-full aspect-video hover:aspect-square" src="https://www.youtube.com/..."></iframe> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:aspect-square` to apply the `aspect-square` utility at only medium screen sizes and above. ``` <iframe class="w-full aspect-video md:aspect-square" src="https://www.youtube.com/..."></iframe> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind provides a minimal set of `aspect-ratio` utilities. You can customize these values by editing `theme.aspectRatio` or `theme.extend.aspectRatio` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { aspectRatio: { '4/3': '4 / 3', }, } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `aspect-ratio` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <iframe class="w-full aspect-[4/3]" src="https://www.youtube.com/..."></iframe> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Opacity Quick reference --------------- | Class | Properties | | --- | --- | | opacity-0 | opacity: 0; | | opacity-5 | opacity: 0.05; | | opacity-10 | opacity: 0.1; | | opacity-20 | opacity: 0.2; | | opacity-25 | opacity: 0.25; | | opacity-30 | opacity: 0.3; | | opacity-40 | opacity: 0.4; | | opacity-50 | opacity: 0.5; | | opacity-60 | opacity: 0.6; | | opacity-70 | opacity: 0.7; | | opacity-75 | opacity: 0.75; | | opacity-80 | opacity: 0.8; | | opacity-90 | opacity: 0.9; | | opacity-95 | opacity: 0.95; | | opacity-100 | opacity: 1; | Basic usage ----------- ### Changing an element's opacity Control the opacity of an element using the `opacity-{amount}` utilities. ``` <button class="bg-indigo-500 opacity-100 ..."></button> <button class="bg-indigo-500 opacity-75 ..."></button> <button class="bg-indigo-500 opacity-50 ..."></button> <button class="bg-indigo-500 opacity-25 ..."></button> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:opacity-100` to only apply the `opacity-100` utility on hover. ``` <div class="opacity-50 hover:opacity-100"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:opacity-100` to apply the `opacity-100` utility at only medium screen sizes and above. ``` <div class="opacity-50 md:opacity-100"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind provides several opacity utilities for general purpose use. You can customize these values by editing `theme.opacity` or `theme.extend.opacity` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { opacity: { '67': '.67', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `opacity` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="opacity-[.67]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Background Image Quick reference --------------- | Class | Properties | | --- | --- | | bg-none | background-image: none; | | bg-gradient-to-t | background-image: linear-gradient(to top, var(--tw-gradient-stops)); | | bg-gradient-to-tr | background-image: linear-gradient(to top right, var(--tw-gradient-stops)); | | bg-gradient-to-r | background-image: linear-gradient(to right, var(--tw-gradient-stops)); | | bg-gradient-to-br | background-image: linear-gradient(to bottom right, var(--tw-gradient-stops)); | | bg-gradient-to-b | background-image: linear-gradient(to bottom, var(--tw-gradient-stops)); | | bg-gradient-to-bl | background-image: linear-gradient(to bottom left, var(--tw-gradient-stops)); | | bg-gradient-to-l | background-image: linear-gradient(to left, var(--tw-gradient-stops)); | | bg-gradient-to-tl | background-image: linear-gradient(to top left, var(--tw-gradient-stops)); | Basic usage ----------- ### Linear gradients To give an element a linear gradient background, use one of the `bg-gradient-{direction}` utilities, in combination with the [gradient color stop](gradient-color-stops) utilities. ``` <div class="h-14 bg-gradient-to-r from-cyan-500 to-blue-500"></div> <div class="h-14 bg-gradient-to-r from-sky-500 to-indigo-500"></div> <div class="h-14 bg-gradient-to-r from-violet-500 to-fuchsia-500"></div> <div class="h-14 bg-gradient-to-r from-purple-500 to-pink-500"></div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:bg-gradient-to-r` to only apply the `bg-gradient-to-r` utility on hover. ``` <div class="bg-gradient-to-l hover:bg-gradient-to-r"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:bg-gradient-to-r` to apply the `bg-gradient-to-r` utility at only medium screen sizes and above. ``` <div class="bg-gradient-to-l md:bg-gradient-to-r"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind includes background image utilities for creating linear gradient backgrounds in eight directions. You can add your own background images by editing the `theme.backgroundImage` section of your `tailwind.config.js` file: tailwind.config.js ``` module.exports = { theme: { extend: { backgroundImage: { 'hero-pattern': "url('/img/hero-pattern.svg')", 'footer-texture': "url('/img/footer-texture.png')", } } } } ``` These don’t just have to be gradients — they can be any background images you need. Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `background-image` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="bg-[url('/img/hero-pattern.svg')]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Overscroll Behavior Quick reference --------------- | Class | Properties | | --- | --- | | overscroll-auto | overscroll-behavior: auto; | | overscroll-contain | overscroll-behavior: contain; | | overscroll-none | overscroll-behavior: none; | | overscroll-y-auto | overscroll-behavior-y: auto; | | overscroll-y-contain | overscroll-behavior-y: contain; | | overscroll-y-none | overscroll-behavior-y: none; | | overscroll-x-auto | overscroll-behavior-x: auto; | | overscroll-x-contain | overscroll-behavior-x: contain; | | overscroll-x-none | overscroll-behavior-x: none; | Basic usage ----------- ### Preventing parent overscrolling Use `overscroll-contain` to prevent scrolling in the target area from triggering scrolling in the parent element, but preserve “bounce” effects when scrolling past the end of the container in operating systems that support it. ``` <div class="overscroll-contain ...">Well, let me tell you something, ...</div> ``` ### Preventing overscroll bouncing Use `overscroll-none` to prevent scrolling in the target area from triggering scrolling in the parent element, and also prevent “bounce” effects when scrolling past the end of the container. ``` <div class="overscroll-none ...">Well, let me tell you something, ...</div> ``` ### Using the default overscroll behavior Use `overscroll-auto` to make it possible for the user to continue scrolling a parent scroll area when they reach the boundary of the primary scroll area. ``` <div class="overscroll-auto ...">Well, let me tell you something, ...</div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:overscroll-contain` to only apply the `overscroll-contain` utility on hover. ``` <div class="overscroll-auto hover:overscroll-contain"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:overscroll-contain` to apply the `overscroll-contain` utility at only medium screen sizes and above. ``` <div class="overscroll-auto md:overscroll-contain"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Invert Quick reference --------------- | Class | Properties | | --- | --- | | invert-0 | filter: invert(0); | | invert | filter: invert(100%); | Basic usage ----------- ### Inverting an element's color Use the `invert` and `invert-0` utilities to control whether an element should be rendered with inverted colors or normally. ``` <div class="invert-0 ..."> <!-- ... --> </div> <div class="invert ..."> <!-- ... --> </div> ``` ### Removing filters To remove all of the filters on an element at once, use the `filter-none` utility: ``` <div class="blur-md invert brightness-150 md:filter-none"> <!-- ... --> </div> ``` This can be useful when you want to remove filters conditionally, such as on hover or at a particular breakpoint. Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:invert-0` to only apply the `invert-0` utility on hover. ``` <div class="invert hover:invert-0"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:invert-0` to apply the `invert-0` utility at only medium screen sizes and above. ``` <div class="invert md:invert-0"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind includes a handful of general purpose `invert` utilities. You can customize these values by editing `theme.invert` or `theme.extend.invert` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { invert: { 25: '.25', 50: '.5', 75: '.75', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `invert` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="invert-[.25]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Space Between Quick reference --------------- | Class | Properties | | --- | --- | | space-x-0 > \* + \* | margin-left: 0px; | | space-y-0 > \* + \* | margin-top: 0px; | | space-x-0.5 > \* + \* | margin-left: 0.125rem; /\* 2px \*/ | | space-y-0.5 > \* + \* | margin-top: 0.125rem; /\* 2px \*/ | | space-x-1 > \* + \* | margin-left: 0.25rem; /\* 4px \*/ | | space-y-1 > \* + \* | margin-top: 0.25rem; /\* 4px \*/ | | space-x-1.5 > \* + \* | margin-left: 0.375rem; /\* 6px \*/ | | space-y-1.5 > \* + \* | margin-top: 0.375rem; /\* 6px \*/ | | space-x-2 > \* + \* | margin-left: 0.5rem; /\* 8px \*/ | | space-y-2 > \* + \* | margin-top: 0.5rem; /\* 8px \*/ | | space-x-2.5 > \* + \* | margin-left: 0.625rem; /\* 10px \*/ | | space-y-2.5 > \* + \* | margin-top: 0.625rem; /\* 10px \*/ | | space-x-3 > \* + \* | margin-left: 0.75rem; /\* 12px \*/ | | space-y-3 > \* + \* | margin-top: 0.75rem; /\* 12px \*/ | | space-x-3.5 > \* + \* | margin-left: 0.875rem; /\* 14px \*/ | | space-y-3.5 > \* + \* | margin-top: 0.875rem; /\* 14px \*/ | | space-x-4 > \* + \* | margin-left: 1rem; /\* 16px \*/ | | space-y-4 > \* + \* | margin-top: 1rem; /\* 16px \*/ | | space-x-5 > \* + \* | margin-left: 1.25rem; /\* 20px \*/ | | space-y-5 > \* + \* | margin-top: 1.25rem; /\* 20px \*/ | | space-x-6 > \* + \* | margin-left: 1.5rem; /\* 24px \*/ | | space-y-6 > \* + \* | margin-top: 1.5rem; /\* 24px \*/ | | space-x-7 > \* + \* | margin-left: 1.75rem; /\* 28px \*/ | | space-y-7 > \* + \* | margin-top: 1.75rem; /\* 28px \*/ | | space-x-8 > \* + \* | margin-left: 2rem; /\* 32px \*/ | | space-y-8 > \* + \* | margin-top: 2rem; /\* 32px \*/ | | space-x-9 > \* + \* | margin-left: 2.25rem; /\* 36px \*/ | | space-y-9 > \* + \* | margin-top: 2.25rem; /\* 36px \*/ | | space-x-10 > \* + \* | margin-left: 2.5rem; /\* 40px \*/ | | space-y-10 > \* + \* | margin-top: 2.5rem; /\* 40px \*/ | | space-x-11 > \* + \* | margin-left: 2.75rem; /\* 44px \*/ | | space-y-11 > \* + \* | margin-top: 2.75rem; /\* 44px \*/ | | space-x-12 > \* + \* | margin-left: 3rem; /\* 48px \*/ | | space-y-12 > \* + \* | margin-top: 3rem; /\* 48px \*/ | | space-x-14 > \* + \* | margin-left: 3.5rem; /\* 56px \*/ | | space-y-14 > \* + \* | margin-top: 3.5rem; /\* 56px \*/ | | space-x-16 > \* + \* | margin-left: 4rem; /\* 64px \*/ | | space-y-16 > \* + \* | margin-top: 4rem; /\* 64px \*/ | | space-x-20 > \* + \* | margin-left: 5rem; /\* 80px \*/ | | space-y-20 > \* + \* | margin-top: 5rem; /\* 80px \*/ | | space-x-24 > \* + \* | margin-left: 6rem; /\* 96px \*/ | | space-y-24 > \* + \* | margin-top: 6rem; /\* 96px \*/ | | space-x-28 > \* + \* | margin-left: 7rem; /\* 112px \*/ | | space-y-28 > \* + \* | margin-top: 7rem; /\* 112px \*/ | | space-x-32 > \* + \* | margin-left: 8rem; /\* 128px \*/ | | space-y-32 > \* + \* | margin-top: 8rem; /\* 128px \*/ | | space-x-36 > \* + \* | margin-left: 9rem; /\* 144px \*/ | | space-y-36 > \* + \* | margin-top: 9rem; /\* 144px \*/ | | space-x-40 > \* + \* | margin-left: 10rem; /\* 160px \*/ | | space-y-40 > \* + \* | margin-top: 10rem; /\* 160px \*/ | | space-x-44 > \* + \* | margin-left: 11rem; /\* 176px \*/ | | space-y-44 > \* + \* | margin-top: 11rem; /\* 176px \*/ | | space-x-48 > \* + \* | margin-left: 12rem; /\* 192px \*/ | | space-y-48 > \* + \* | margin-top: 12rem; /\* 192px \*/ | | space-x-52 > \* + \* | margin-left: 13rem; /\* 208px \*/ | | space-y-52 > \* + \* | margin-top: 13rem; /\* 208px \*/ | | space-x-56 > \* + \* | margin-left: 14rem; /\* 224px \*/ | | space-y-56 > \* + \* | margin-top: 14rem; /\* 224px \*/ | | space-x-60 > \* + \* | margin-left: 15rem; /\* 240px \*/ | | space-y-60 > \* + \* | margin-top: 15rem; /\* 240px \*/ | | space-x-64 > \* + \* | margin-left: 16rem; /\* 256px \*/ | | space-y-64 > \* + \* | margin-top: 16rem; /\* 256px \*/ | | space-x-72 > \* + \* | margin-left: 18rem; /\* 288px \*/ | | space-y-72 > \* + \* | margin-top: 18rem; /\* 288px \*/ | | space-x-80 > \* + \* | margin-left: 20rem; /\* 320px \*/ | | space-y-80 > \* + \* | margin-top: 20rem; /\* 320px \*/ | | space-x-96 > \* + \* | margin-left: 24rem; /\* 384px \*/ | | space-y-96 > \* + \* | margin-top: 24rem; /\* 384px \*/ | | space-x-px > \* + \* | margin-left: 1px; | | space-y-px > \* + \* | margin-top: 1px; | | space-y-reverse > \* + \* | --tw-space-y-reverse: 1; | | space-x-reverse > \* + \* | --tw-space-x-reverse: 1; | Basic usage ----------- ### Add horizontal space between children Control the horizontal space between elements using the `space-x-{amount}` utilities. ``` <div class="flex space-x-4 ..."> <div>01</div> <div>02</div> <div>03</div> </div> ``` ### Add vertical space between children Control the vertical space between elements using the `space-y-{amount}` utilities. ``` <div class="flex flex-col space-y-4 ..."> <div>01</div> <div>02</div> <div>03</div> </div> ``` ### Reversing children order If your elements are in reverse order (using say `flex-row-reverse` or `flex-col-reverse`), use the `space-x-reverse` or `space-y-reverse` utilities to ensure the space is added to the correct side of each element. ``` <div class="flex flex-row-reverse space-x-4 space-x-reverse ..."> <div>01</div> <div>02</div> <div>03</div> </div> ``` ### Using negative values To use a negative space value, prefix the class name with a dash to convert it to a negative value. ``` <div class="flex -space-x-4 ..."> <!-- ... --> </div> ``` Limitations ----------- These utilities are really just a shortcut for adding margin to all-but-the-first-item in a group, and aren’t designed to handle complex cases like grids, layouts that wrap, or situations where the children are rendered in a complex custom order rather than their natural DOM order. For those situations, it’s better to use the [gap utilities](gap) when possible, or add margin to every element with a matching negative margin on the parent: ``` <div class="flow-root"> <div class="-m-2 flex flex-wrap"> <div class="m-2 ..."></div> <div class="m-2 ..."></div> <div class="m-2 ..."></div> </div> </div> ``` ### Cannot be paired with divide utilities The `space-*` utilities are not designed to work together with the [divide utilities](divide-width). For those situations, consider adding margin/padding utilities to the children instead. Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:space-x-8` to only apply the `space-x-8` utility on hover. ``` <div class="flex space-x-2 hover:space-x-8"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:space-x-8` to apply the `space-x-8` utility at only medium screen sizes and above. ``` <div class="flex space-x-2 md:space-x-8"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind’s space scale uses the [default spacing scale](customizing-spacing). You can customize your spacing scale by editing `theme.spacing` or `theme.extend.spacing` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { spacing: { '5px': '5px', } } } } ``` Alternatively, you can customize just the space scale by editing `theme.space` or `theme.extend.space` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { space: { '5px': '5px', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `space-{x|y}` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="space-y-[5px]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation.
programming_docs
tailwindcss Object Fit Quick reference --------------- | Class | Properties | | --- | --- | | object-contain | object-fit: contain; | | object-cover | object-fit: cover; | | object-fill | object-fit: fill; | | object-none | object-fit: none; | | object-scale-down | object-fit: scale-down; | Basic usage ----------- ### Resizing to cover a container Resize an element’s content to cover its container using `.object-cover`. ``` <div class="bg-indigo-300 ..."> <img class="object-cover h-48 w-96 ..."> </div> ``` ### Containing an element Resize an element’s content to stay contained within its container using `.object-contain`. ``` <div class="bg-purple-300 ..."> <img class="object-contain h-48 w-96 ..."> </div> ``` ### Stretching to fit a container Stretch an element’s content to fit its container using `.object-fill`. ``` <div class="bg-sky-300 ..."> <img class="object-fill h-48 w-96 ..."> </div> ``` ### Scaling down if too large Display an element’s content at its original size but scale it down to fit its container if necessary using `.object-scale-down`. ``` <div class="bg-cyan-300"> <img class="object-scale-down h-48 w-96 ..."> </div> ``` ### Using an element's original size Display an element’s content at its original size ignoring the container size using `.object-none`. ``` <div class="bg-yellow-300"> <img class="object-none h-48 w-96 ..."> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:object-scale-down` to only apply the `object-scale-down` utility on hover. ``` <img class="object-contain hover:object-scale-down"> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:object-scale-down` to apply the `object-scale-down` utility at only medium screen sizes and above. ``` <img class="object-contain md:object-scale-down"> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Box Shadow Quick reference --------------- | Class | Properties | | --- | --- | | shadow-sm | box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05); | | shadow | box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1); | | shadow-md | box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); | | shadow-lg | box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); | | shadow-xl | box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1); | | shadow-2xl | box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25); | | shadow-inner | box-shadow: inset 0 2px 4px 0 rgb(0 0 0 / 0.05); | | shadow-none | box-shadow: 0 0 #0000; | Basic usage ----------- ### Adding an outer shadow Use the `shadow-sm`, `shadow`, `shadow-md`, `shadow-lg`, `shadow-xl`, or `shadow-2xl` utilities to apply different sized outer box shadows to an element. ``` <div class="shadow-md ..."></div> <div class="shadow-lg ..."></div> <div class="shadow-xl ..."></div> <div class="shadow-2xl ..."></div> ``` ### Adding an inner shadow Use the `shadow-inner` utility to apply a subtle inset box shadow to an element. This can be useful for things like form controls or wells. ``` <div class="shadow-inner ..."></div> ``` ### Removing the shadow Use `shadow-none` to remove an existing box shadow from an element. This is most commonly used to remove a shadow that was applied at a smaller breakpoint. ``` <div class="shadow-none ..."></div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:shadow-lg` to only apply the `shadow-lg` utility on hover. ``` <div class="shadow hover:shadow-lg"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:shadow-lg` to apply the `shadow-lg` utility at only medium screen sizes and above. ``` <div class="shadow md:shadow-lg"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind provides six drop shadow utilities, one inner shadow utility, and a utility for removing existing shadows. You can customize these values by editing `theme.boxShadow` or `theme.extend.boxShadow` in your `tailwind.config.js` file. If a `DEFAULT` shadow is provided, it will be used for the non-suffixed `shadow` utility. Any other keys will be used as suffixes, for example the key `'2'` will create a corresponding `shadow-2` utility. tailwind.config.js ``` module.exports = { theme: { extend: { boxShadow: { '3xl': '0 35px 60px -15px rgba(0, 0, 0, 0.3)', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `box-shadow` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="shadow-[0_35px_60px_-15px_rgba(0,0,0,0.3)]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Background Repeat Quick reference --------------- | Class | Properties | | --- | --- | | bg-repeat | background-repeat: repeat; | | bg-no-repeat | background-repeat: no-repeat; | | bg-repeat-x | background-repeat: repeat-x; | | bg-repeat-y | background-repeat: repeat-y; | | bg-repeat-round | background-repeat: round; | | bg-repeat-space | background-repeat: space; | Basic usage ----------- ### Repeat Use `bg-repeat` to repeat the background image both vertically and horizontally. ``` <div class="bg-repeat ..." style="background-image: url(...)"></div> ``` ### No Repeat Use `bg-no-repeat` when you don’t want to repeat the background image. ``` <div class="bg-no-repeat bg-center ..." style="background-image: url(...)"></div> ``` ### Repeat Horizontally Use `bg-repeat-x` to repeat the background image only horizontally. ``` <div class="bg-repeat-x bg-center ..." style="background-image: url(...)"></div> ``` ### Repeat Vertically Use `bg-repeat-y` to repeat the background image only vertically. ``` <div class="bg-repeat-y bg-center ..." style="background-image: url(...)"></div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:bg-repeat-x` to only apply the `bg-repeat-x` utility on hover. ``` <div class="bg-repeat hover:bg-repeat-x"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:bg-repeat-x` to apply the `bg-repeat-x` utility at only medium screen sizes and above. ``` <div class="bg-repeat md:bg-repeat-x"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Cursor Quick reference --------------- | Class | Properties | Preview | | --- | --- | --- | | cursor-auto | cursor: auto; | | | cursor-default | cursor: default; | | | cursor-pointer | cursor: pointer; | | | cursor-wait | cursor: wait; | | | cursor-text | cursor: text; | | | cursor-move | cursor: move; | | | cursor-help | cursor: help; | | | cursor-not-allowed | cursor: not-allowed; | | | cursor-none | cursor: none; | | | cursor-context-menu | cursor: context-menu; | | | cursor-progress | cursor: progress; | | | cursor-cell | cursor: cell; | | | cursor-crosshair | cursor: crosshair; | | | cursor-vertical-text | cursor: vertical-text; | | | cursor-alias | cursor: alias; | | | cursor-copy | cursor: copy; | | | cursor-no-drop | cursor: no-drop; | | | cursor-grab | cursor: grab; | | | cursor-grabbing | cursor: grabbing; | | | cursor-all-scroll | cursor: all-scroll; | | | cursor-col-resize | cursor: col-resize; | | | cursor-row-resize | cursor: row-resize; | | | cursor-n-resize | cursor: n-resize; | | | cursor-e-resize | cursor: e-resize; | | | cursor-s-resize | cursor: s-resize; | | | cursor-w-resize | cursor: w-resize; | | | cursor-ne-resize | cursor: ne-resize; | | | cursor-nw-resize | cursor: nw-resize; | | | cursor-se-resize | cursor: se-resize; | | | cursor-sw-resize | cursor: sw-resize; | | | cursor-ew-resize | cursor: ew-resize; | | | cursor-ns-resize | cursor: ns-resize; | | | cursor-nesw-resize | cursor: nesw-resize; | | | cursor-nwse-resize | cursor: nwse-resize; | | | cursor-zoom-in | cursor: zoom-in; | | | cursor-zoom-out | cursor: zoom-out; | | Basic Usage ----------- ### Setting the cursor style Use the `cursor-{style}` to control which cursor is displayed when hovering over an element. ``` <button type="button" class="cursor-pointer ..."> Submit </button> <button type="button" class="cursor-progress ..."> Saving... </button> <button type="button" disabled class="cursor-not-allowed ..."> Confirm </button> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `focus:cursor-auto` to only apply the `cursor-auto` utility on focus. ``` <div class="cursor-not-allowed focus:cursor-auto"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:cursor-auto` to apply the `cursor-auto` utility at only medium screen sizes and above. ``` <div class="cursor-not-allowed md:cursor-auto"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind includes `cursor` utilities for many built in options. You can customize these values by editing `theme.cursor` or `theme.extend.cursor` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { cursor: { 'fancy': 'url(hand.cur), pointer', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `cursor` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="cursor-[url(hand.cur),_pointer]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Whitespace Quick reference --------------- | Class | Properties | | --- | --- | | whitespace-normal | white-space: normal; | | whitespace-nowrap | white-space: nowrap; | | whitespace-pre | white-space: pre; | | whitespace-pre-line | white-space: pre-line; | | whitespace-pre-wrap | white-space: pre-wrap; | Basic usage ----------- ### Normal Use `whitespace-normal` to cause text to wrap normally within an element. Newlines and spaces will be collapsed. ``` <div class="w-3/4 ..."> <div class="whitespace-normal ...">Hey everyone! It's almost 2022 and we still don't know if there is aliens living among us, or do we? Maybe the person writing this is an alien. You will never know.</div> </div> ``` ### No Wrap Use `whitespace-nowrap` to prevent text from wrapping within an element. Newlines and spaces will be collapsed. ``` <div class="w-3/4 overflow-x-auto ..."> <div class="whitespace-nowrap ...">Hey everyone! It's almost 2022 and we still don't know if there is aliens living among us, or do we? Maybe the person writing this is an alien. You will never know.</div> </div> ``` ### Pre Use `whitespace-pre` to preserve newlines and spaces within an element. Text will not be wrapped. ``` <div class="w-3/4 overflow-x-auto ..."> <div class="whitespace-pre ...">Hey everyone! It's almost 2022 and we still don't know if there is aliens living among us, or do we? Maybe the person writing this is an alien. You will never know.</div> </div> ``` ### Pre Line Use `whitespace-pre-line` to preserve newlines but not spaces within an element. Text will be wrapped normally. ``` <div class="w-3/4 ..."> <div class="whitespace-pre-line ...">Hey everyone! It's almost 2022 and we still don't know if there is aliens living among us, or do we? Maybe the person writing this is an alien. You will never know.</div> </div> ``` ### Pre Wrap Use `whitespace-pre-wrap` to preserve newlines and spaces within an element. Text will be wrapped normally. ``` <div class="w-3/4 ..."> <div class="whitespace-pre-wrap ...">Hey everyone! It's almost 2022 and we still don't know if there is aliens living among us, or do we? Maybe the person writing this is an alien. You will never know.</div> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:whitespace-pre` to only apply the `whitespace-pre` utility on hover. ``` <div class="whitespace-normal hover:whitespace-pre"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:whitespace-pre` to apply the `whitespace-pre` utility at only medium screen sizes and above. ``` <div class="whitespace-normal md:whitespace-pre"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Translate Quick reference --------------- | Class | Properties | | --- | --- | | translate-x-0 | transform: translateX(0px); | | translate-y-0 | transform: translateY(0px); | | translate-x-px | transform: translateX(1px); | | translate-y-px | transform: translateY(1px); | | translate-x-0.5 | transform: translateX(0.125rem); | | translate-y-0.5 | transform: translateY(0.125rem); | | translate-x-1 | transform: translateX(0.25rem); | | translate-y-1 | transform: translateY(0.25rem); | | translate-x-1.5 | transform: translateX(0.375rem); | | translate-y-1.5 | transform: translateY(0.375rem); | | translate-x-2 | transform: translateX(0.5rem); | | translate-y-2 | transform: translateY(0.5rem); | | translate-x-2.5 | transform: translateX(0.625rem); | | translate-y-2.5 | transform: translateY(0.625rem); | | translate-x-3 | transform: translateX(0.75rem); | | translate-y-3 | transform: translateY(0.75rem); | | translate-x-3.5 | transform: translateX(0.875rem); | | translate-y-3.5 | transform: translateY(0.875rem); | | translate-x-4 | transform: translateX(1rem); | | translate-y-4 | transform: translateY(1rem); | | translate-x-5 | transform: translateX(1.25rem); | | translate-y-5 | transform: translateY(1.25rem); | | translate-x-6 | transform: translateX(1.5rem); | | translate-y-6 | transform: translateY(1.5rem); | | translate-x-7 | transform: translateX(1.75rem); | | translate-y-7 | transform: translateY(1.75rem); | | translate-x-8 | transform: translateX(2rem); | | translate-y-8 | transform: translateY(2rem); | | translate-x-9 | transform: translateX(2.25rem); | | translate-y-9 | transform: translateY(2.25rem); | | translate-x-10 | transform: translateX(2.5rem); | | translate-y-10 | transform: translateY(2.5rem); | | translate-x-11 | transform: translateX(2.75rem); | | translate-y-11 | transform: translateY(2.75rem); | | translate-x-12 | transform: translateX(3rem); | | translate-y-12 | transform: translateY(3rem); | | translate-x-14 | transform: translateX(3.5rem); | | translate-y-14 | transform: translateY(3.5rem); | | translate-x-16 | transform: translateX(4rem); | | translate-y-16 | transform: translateY(4rem); | | translate-x-20 | transform: translateX(5rem); | | translate-y-20 | transform: translateY(5rem); | | translate-x-24 | transform: translateX(6rem); | | translate-y-24 | transform: translateY(6rem); | | translate-x-28 | transform: translateX(7rem); | | translate-y-28 | transform: translateY(7rem); | | translate-x-32 | transform: translateX(8rem); | | translate-y-32 | transform: translateY(8rem); | | translate-x-36 | transform: translateX(9rem); | | translate-y-36 | transform: translateY(9rem); | | translate-x-40 | transform: translateX(10rem); | | translate-y-40 | transform: translateY(10rem); | | translate-x-44 | transform: translateX(11rem); | | translate-y-44 | transform: translateY(11rem); | | translate-x-48 | transform: translateX(12rem); | | translate-y-48 | transform: translateY(12rem); | | translate-x-52 | transform: translateX(13rem); | | translate-y-52 | transform: translateY(13rem); | | translate-x-56 | transform: translateX(14rem); | | translate-y-56 | transform: translateY(14rem); | | translate-x-60 | transform: translateX(15rem); | | translate-y-60 | transform: translateY(15rem); | | translate-x-64 | transform: translateX(16rem); | | translate-y-64 | transform: translateY(16rem); | | translate-x-72 | transform: translateX(18rem); | | translate-y-72 | transform: translateY(18rem); | | translate-x-80 | transform: translateX(20rem); | | translate-y-80 | transform: translateY(20rem); | | translate-x-96 | transform: translateX(24rem); | | translate-y-96 | transform: translateY(24rem); | | translate-x-1/2 | transform: translateX(50%); | | translate-x-1/3 | transform: translateX(33.333333%); | | translate-x-2/3 | transform: translateX(66.666667%); | | translate-x-1/4 | transform: translateX(25%); | | translate-x-2/4 | transform: translateX(50%); | | translate-x-3/4 | transform: translateX(75%); | | translate-x-full | transform: translateX(100%); | | translate-y-1/2 | transform: translateY(50%); | | translate-y-1/3 | transform: translateY(33.333333%); | | translate-y-2/3 | transform: translateY(66.666667%); | | translate-y-1/4 | transform: translateY(25%); | | translate-y-2/4 | transform: translateY(50%); | | translate-y-3/4 | transform: translateY(75%); | | translate-y-full | transform: translateY(100%); | Basic usage ----------- ### Translating an element Use the `translate-x-{amount}` and `translate-y-{amount}` utilities to translate an element. ``` <img class="translate-y-6 ..."> <img class="-translate-y-6 ..."> <img class="translate-x-6 ..."> ``` ### Using negative values To use a negative translate value, prefix the class name with a dash to convert it to a negative value. ``` <img class="-translate-y-6 ..."> ``` ### Removing transforms To remove all of the transforms on an element at once, use the `transform-none` utility: ``` <div class="scale-75 translate-x-4 skew-y-3 md:transform-none"> <!-- ... --> </div> ``` This can be useful when you want to remove transforms conditionally, such as on hover or at a particular breakpoint. ### Hardware acceleration If your transition performs better when rendered by the GPU instead of the CPU, you can force hardware acceleration by adding the `transform-gpu` utility: ``` <div class="translate-y-6 transform-gpu"> <!-- ... --> </div> ``` Use `transform-cpu` to force things back to the CPU if you need to undo this conditionally. Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:translate-y-12` to only apply the `translate-y-12` utility on hover. ``` <div class="hover:translate-y-12"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:translate-y-12` to apply the `translate-y-12` utility at only medium screen sizes and above. ``` <div class="md:translate-y-12"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind provides fixed value `translate` utilities that match the [default spacing scale](customizing-spacing), as well as 50% and 100% variations for translating relative to the element’s size. You can customize your spacing scale by editing `theme.spacing` or `theme.extend.spacing` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { spacing: { '4.25': '17rem', } } } } ``` Alternatively, you can customize just the translate scale by editing `theme.translate` or `theme.extend.translate` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { translate: { '4.25': '17rem', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `translate` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="translate-y-[17rem]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation.
programming_docs
tailwindcss Width Quick reference --------------- | Class | Properties | | --- | --- | | w-0 | width: 0px; | | w-px | width: 1px; | | w-0.5 | width: 0.125rem; /\* 2px \*/ | | w-1 | width: 0.25rem; /\* 4px \*/ | | w-1.5 | width: 0.375rem; /\* 6px \*/ | | w-2 | width: 0.5rem; /\* 8px \*/ | | w-2.5 | width: 0.625rem; /\* 10px \*/ | | w-3 | width: 0.75rem; /\* 12px \*/ | | w-3.5 | width: 0.875rem; /\* 14px \*/ | | w-4 | width: 1rem; /\* 16px \*/ | | w-5 | width: 1.25rem; /\* 20px \*/ | | w-6 | width: 1.5rem; /\* 24px \*/ | | w-7 | width: 1.75rem; /\* 28px \*/ | | w-8 | width: 2rem; /\* 32px \*/ | | w-9 | width: 2.25rem; /\* 36px \*/ | | w-10 | width: 2.5rem; /\* 40px \*/ | | w-11 | width: 2.75rem; /\* 44px \*/ | | w-12 | width: 3rem; /\* 48px \*/ | | w-14 | width: 3.5rem; /\* 56px \*/ | | w-16 | width: 4rem; /\* 64px \*/ | | w-20 | width: 5rem; /\* 80px \*/ | | w-24 | width: 6rem; /\* 96px \*/ | | w-28 | width: 7rem; /\* 112px \*/ | | w-32 | width: 8rem; /\* 128px \*/ | | w-36 | width: 9rem; /\* 144px \*/ | | w-40 | width: 10rem; /\* 160px \*/ | | w-44 | width: 11rem; /\* 176px \*/ | | w-48 | width: 12rem; /\* 192px \*/ | | w-52 | width: 13rem; /\* 208px \*/ | | w-56 | width: 14rem; /\* 224px \*/ | | w-60 | width: 15rem; /\* 240px \*/ | | w-64 | width: 16rem; /\* 256px \*/ | | w-72 | width: 18rem; /\* 288px \*/ | | w-80 | width: 20rem; /\* 320px \*/ | | w-96 | width: 24rem; /\* 384px \*/ | | w-auto | width: auto; | | w-1/2 | width: 50%; | | w-1/3 | width: 33.333333%; | | w-2/3 | width: 66.666667%; | | w-1/4 | width: 25%; | | w-2/4 | width: 50%; | | w-3/4 | width: 75%; | | w-1/5 | width: 20%; | | w-2/5 | width: 40%; | | w-3/5 | width: 60%; | | w-4/5 | width: 80%; | | w-1/6 | width: 16.666667%; | | w-2/6 | width: 33.333333%; | | w-3/6 | width: 50%; | | w-4/6 | width: 66.666667%; | | w-5/6 | width: 83.333333%; | | w-1/12 | width: 8.333333%; | | w-2/12 | width: 16.666667%; | | w-3/12 | width: 25%; | | w-4/12 | width: 33.333333%; | | w-5/12 | width: 41.666667%; | | w-6/12 | width: 50%; | | w-7/12 | width: 58.333333%; | | w-8/12 | width: 66.666667%; | | w-9/12 | width: 75%; | | w-10/12 | width: 83.333333%; | | w-11/12 | width: 91.666667%; | | w-full | width: 100%; | | w-screen | width: 100vw; | | w-min | width: min-content; | | w-max | width: max-content; | | w-fit | width: fit-content; | Basic usage ----------- ### Fixed widths Use `w-{number}` or `w-px` to set an element to a fixed width. ``` <div class="w-96 ..."></div> <div class="w-80 ..."></div> <div class="w-64 ..."></div> <div class="w-48 ..."></div> <div class="w-40 ..."></div> <div class="w-32 ..."></div> <div class="w-24 ..."></div> ``` ### Percentage widths Use `w-{fraction}` or `w-full` to set an element to a percentage based width. ``` <div class="flex ..."> <div class="w-1/2 ... ">w-1/2</div> <div class="w-1/2 ... ">w-1/2</div> </div> <div class="flex ..."> <div class="w-2/5 ...">w-2/5</div> <div class="w-3/5 ...">w-3/5</div> </div> <div class="flex ..."> <div class="w-1/3 ...">w-1/3</div> <div class="w-2/3 ...">w-2/3</div> </div> <div class="flex ..."> <div class="w-1/4 ...">w-1/4</div> <div class="w-3/4 ...">w-3/4</div> </div> <div class="flex ..."> <div class="w-1/5 ...">w-1/5</div> <div class="w-4/5 ...">w-4/5</div> </div> <div class="flex ..."> <div class="w-1/6 ...">w-1/6</div> <div class="w-5/6 ...">w-5/6</div> </div> <div class="w-full ...">w-full</div> ``` ### Viewport width Use `w-screen` to make an element span the entire width of the viewport. ``` <div class="w-screen"> <!-- ... --> </div> ``` ### Resetting the width The `w-auto` utility can be useful if you need to remove an element’s assigned width under a specific condition, like at a particular breakpoint: ``` <div class="w-full md:w-auto"> <!-- ... --> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:w-full` to only apply the `w-full` utility on hover. ``` <div class="w-1/2 hover:w-full"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:w-full` to apply the `w-full` utility at only medium screen sizes and above. ``` <div class="w-1/2 md:w-full"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind’s width scale is a combination of the [default spacing scale](customizing-spacing#default-spacing-scale) as well as some additional values specific to widths. You can customize your spacing scale by editing `theme.spacing` or `theme.extend.spacing` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { spacing: { '128': '32rem', } } } } ``` To customize width separately, use the `theme.width` section of your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { width: { '128': '32rem', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `width` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="w-[32rem]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Min-Height Quick reference --------------- | Class | Properties | | --- | --- | | min-h-0 | min-height: 0px; | | min-h-full | min-height: 100%; | | min-h-screen | min-height: 100vh; | | min-h-min | min-height: min-content; | | min-h-max | min-height: max-content; | | min-h-fit | min-height: fit-content; | Basic usage ----------- ### Setting the minimum height Set the minimum height of an element using the `min-h-0`, `min-h-full`, or `min-h-screen` utilities. ``` <div class="h-48"> <div class="h-24 min-h-full"> <!-- ... --> </div> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:min-h-full` to only apply the `min-h-full` utility on hover. ``` <div class="h-24 min-h-0 hover:min-h-full"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:min-h-full` to apply the `min-h-full` utility at only medium screen sizes and above. ``` <div class="h-24 min-h-0 md:min-h-full"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme You can customize your `min-height` scale by editing `theme.minHeight` or `theme.extend.minHeight` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { minHeight: { '1/2': '50%', } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `min-height` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="min-h-[50%]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Scale Quick reference --------------- | Class | Properties | | --- | --- | | scale-0 | transform: scale(0); | | scale-x-0 | transform: scaleX(0); | | scale-y-0 | transform: scaleY(0); | | scale-50 | transform: scale(.5); | | scale-x-50 | transform: scaleX(.5); | | scale-y-50 | transform: scaleY(.5); | | scale-75 | transform: scale(.75); | | scale-x-75 | transform: scaleX(.75); | | scale-y-75 | transform: scaleY(.75); | | scale-90 | transform: scale(.9); | | scale-x-90 | transform: scaleX(.9); | | scale-y-90 | transform: scaleY(.9); | | scale-95 | transform: scale(.95); | | scale-x-95 | transform: scaleX(.95); | | scale-y-95 | transform: scaleY(.95); | | scale-100 | transform: scale(1); | | scale-x-100 | transform: scaleX(1); | | scale-y-100 | transform: scaleY(1); | | scale-105 | transform: scale(1.05); | | scale-x-105 | transform: scaleX(1.05); | | scale-y-105 | transform: scaleY(1.05); | | scale-110 | transform: scale(1.1); | | scale-x-110 | transform: scaleX(1.1); | | scale-y-110 | transform: scaleY(1.1); | | scale-125 | transform: scale(1.25); | | scale-x-125 | transform: scaleX(1.25); | | scale-y-125 | transform: scaleY(1.25); | | scale-150 | transform: scale(1.5); | | scale-x-150 | transform: scaleX(1.5); | | scale-y-150 | transform: scaleY(1.5); | Basic usage ----------- ### Scaling an element Use the `scale-{percentage}`, `scale-x-{percentage}`, and `scale-y-{percentage}` utilities to scale an element. ``` <img class="scale-75 ..."> <img class="scale-100 ..."> <img class="scale-125 ..."> ``` ### Using negative values To use a negative scale value, prefix the class name with a dash to convert it to a negative value. ``` <img class="-scale-50"> ``` ### Removing transforms To remove all of the transforms on an element at once, use the `transform-none` utility: ``` <div class="scale-75 translate-x-4 skew-y-3 md:transform-none"> <!-- ... --> </div> ``` This can be useful when you want to remove transforms conditionally, such as on hover or at a particular breakpoint. ### Hardware acceleration If your transition performs better when rendered by the GPU instead of the CPU, you can force hardware acceleration by adding the `transform-gpu` utility: ``` <div class="scale-150 transform-gpu"> <!-- ... --> </div> ``` Use `transform-cpu` to force things back to the CPU if you need to undo this conditionally. Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:scale-125` to only apply the `scale-125` utility on hover. ``` <div class="hover:scale-125"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:scale-125` to apply the `scale-125` utility at only medium screen sizes and above. ``` <div class="md:scale-125"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind includes a handful of general purpose `scale` utilities. You can customize these values by editing `theme.scale` or `theme.extend.scale` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { scale: { '175': '1.75', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `scale` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="scale-[1.7]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Word Break Quick reference --------------- | Class | Properties | | --- | --- | | break-normal | overflow-wrap: normal; word-break: normal; | | break-words | overflow-wrap: break-word; | | break-all | word-break: break-all; | Basic usage ----------- ### Normal Use `break-normal` to only add line breaks at normal word break points. ``` <p class="break-normal ...">...</p> ``` ### Break Words Use `break-words` to add line breaks mid-word if needed. ``` <p class="break-words ...">...</p> ``` ### Break All Use `break-all` to add line breaks whenever necessary, without trying to preserve whole words. ``` <p class="break-all ...">...</p> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:break-all` to only apply the `break-all` utility on hover. ``` <p class="break-normal hover:break-all"> <!-- ... --> </p> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:break-all` to apply the `break-all` utility at only medium screen sizes and above. ``` <p class="break-normal md:break-all"> <!-- ... --> </p> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Border Radius Quick reference --------------- | Class | Properties | | --- | --- | | rounded-none | border-radius: 0px; | | rounded-sm | border-radius: 0.125rem; /\* 2px \*/ | | rounded | border-radius: 0.25rem; /\* 4px \*/ | | rounded-md | border-radius: 0.375rem; /\* 6px \*/ | | rounded-lg | border-radius: 0.5rem; /\* 8px \*/ | | rounded-xl | border-radius: 0.75rem; /\* 12px \*/ | | rounded-2xl | border-radius: 1rem; /\* 16px \*/ | | rounded-3xl | border-radius: 1.5rem; /\* 24px \*/ | | rounded-full | border-radius: 9999px; | | rounded-t-none | border-top-left-radius: 0px; border-top-right-radius: 0px; | | rounded-t-sm | border-top-left-radius: 0.125rem; /\* 2px \*/ border-top-right-radius: 0.125rem; /\* 2px \*/ | | rounded-t | border-top-left-radius: 0.25rem; /\* 4px \*/ border-top-right-radius: 0.25rem; /\* 4px \*/ | | rounded-t-md | border-top-left-radius: 0.375rem; /\* 6px \*/ border-top-right-radius: 0.375rem; /\* 6px \*/ | | rounded-t-lg | border-top-left-radius: 0.5rem; /\* 8px \*/ border-top-right-radius: 0.5rem; /\* 8px \*/ | | rounded-t-xl | border-top-left-radius: 0.75rem; /\* 12px \*/ border-top-right-radius: 0.75rem; /\* 12px \*/ | | rounded-t-2xl | border-top-left-radius: 1rem; /\* 16px \*/ border-top-right-radius: 1rem; /\* 16px \*/ | | rounded-t-3xl | border-top-left-radius: 1.5rem; /\* 24px \*/ border-top-right-radius: 1.5rem; /\* 24px \*/ | | rounded-t-full | border-top-left-radius: 9999px; border-top-right-radius: 9999px; | | rounded-r-none | border-top-right-radius: 0px; border-bottom-right-radius: 0px; | | rounded-r-sm | border-top-right-radius: 0.125rem; /\* 2px \*/ border-bottom-right-radius: 0.125rem; /\* 2px \*/ | | rounded-r | border-top-right-radius: 0.25rem; /\* 4px \*/ border-bottom-right-radius: 0.25rem; /\* 4px \*/ | | rounded-r-md | border-top-right-radius: 0.375rem; /\* 6px \*/ border-bottom-right-radius: 0.375rem; /\* 6px \*/ | | rounded-r-lg | border-top-right-radius: 0.5rem; /\* 8px \*/ border-bottom-right-radius: 0.5rem; /\* 8px \*/ | | rounded-r-xl | border-top-right-radius: 0.75rem; /\* 12px \*/ border-bottom-right-radius: 0.75rem; /\* 12px \*/ | | rounded-r-2xl | border-top-right-radius: 1rem; /\* 16px \*/ border-bottom-right-radius: 1rem; /\* 16px \*/ | | rounded-r-3xl | border-top-right-radius: 1.5rem; /\* 24px \*/ border-bottom-right-radius: 1.5rem; /\* 24px \*/ | | rounded-r-full | border-top-right-radius: 9999px; border-bottom-right-radius: 9999px; | | rounded-b-none | border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; | | rounded-b-sm | border-bottom-right-radius: 0.125rem; /\* 2px \*/ border-bottom-left-radius: 0.125rem; /\* 2px \*/ | | rounded-b | border-bottom-right-radius: 0.25rem; /\* 4px \*/ border-bottom-left-radius: 0.25rem; /\* 4px \*/ | | rounded-b-md | border-bottom-right-radius: 0.375rem; /\* 6px \*/ border-bottom-left-radius: 0.375rem; /\* 6px \*/ | | rounded-b-lg | border-bottom-right-radius: 0.5rem; /\* 8px \*/ border-bottom-left-radius: 0.5rem; /\* 8px \*/ | | rounded-b-xl | border-bottom-right-radius: 0.75rem; /\* 12px \*/ border-bottom-left-radius: 0.75rem; /\* 12px \*/ | | rounded-b-2xl | border-bottom-right-radius: 1rem; /\* 16px \*/ border-bottom-left-radius: 1rem; /\* 16px \*/ | | rounded-b-3xl | border-bottom-right-radius: 1.5rem; /\* 24px \*/ border-bottom-left-radius: 1.5rem; /\* 24px \*/ | | rounded-b-full | border-bottom-right-radius: 9999px; border-bottom-left-radius: 9999px; | | rounded-l-none | border-top-left-radius: 0px; border-bottom-left-radius: 0px; | | rounded-l-sm | border-top-left-radius: 0.125rem; /\* 2px \*/ border-bottom-left-radius: 0.125rem; /\* 2px \*/ | | rounded-l | border-top-left-radius: 0.25rem; /\* 4px \*/ border-bottom-left-radius: 0.25rem; /\* 4px \*/ | | rounded-l-md | border-top-left-radius: 0.375rem; /\* 6px \*/ border-bottom-left-radius: 0.375rem; /\* 6px \*/ | | rounded-l-lg | border-top-left-radius: 0.5rem; /\* 8px \*/ border-bottom-left-radius: 0.5rem; /\* 8px \*/ | | rounded-l-xl | border-top-left-radius: 0.75rem; /\* 12px \*/ border-bottom-left-radius: 0.75rem; /\* 12px \*/ | | rounded-l-2xl | border-top-left-radius: 1rem; /\* 16px \*/ border-bottom-left-radius: 1rem; /\* 16px \*/ | | rounded-l-3xl | border-top-left-radius: 1.5rem; /\* 24px \*/ border-bottom-left-radius: 1.5rem; /\* 24px \*/ | | rounded-l-full | border-top-left-radius: 9999px; border-bottom-left-radius: 9999px; | | rounded-tl-none | border-top-left-radius: 0px; | | rounded-tl-sm | border-top-left-radius: 0.125rem; /\* 2px \*/ | | rounded-tl | border-top-left-radius: 0.25rem; /\* 4px \*/ | | rounded-tl-md | border-top-left-radius: 0.375rem; /\* 6px \*/ | | rounded-tl-lg | border-top-left-radius: 0.5rem; /\* 8px \*/ | | rounded-tl-xl | border-top-left-radius: 0.75rem; /\* 12px \*/ | | rounded-tl-2xl | border-top-left-radius: 1rem; /\* 16px \*/ | | rounded-tl-3xl | border-top-left-radius: 1.5rem; /\* 24px \*/ | | rounded-tl-full | border-top-left-radius: 9999px; | | rounded-tr-none | border-top-right-radius: 0px; | | rounded-tr-sm | border-top-right-radius: 0.125rem; /\* 2px \*/ | | rounded-tr | border-top-right-radius: 0.25rem; /\* 4px \*/ | | rounded-tr-md | border-top-right-radius: 0.375rem; /\* 6px \*/ | | rounded-tr-lg | border-top-right-radius: 0.5rem; /\* 8px \*/ | | rounded-tr-xl | border-top-right-radius: 0.75rem; /\* 12px \*/ | | rounded-tr-2xl | border-top-right-radius: 1rem; /\* 16px \*/ | | rounded-tr-3xl | border-top-right-radius: 1.5rem; /\* 24px \*/ | | rounded-tr-full | border-top-right-radius: 9999px; | | rounded-br-none | border-bottom-right-radius: 0px; | | rounded-br-sm | border-bottom-right-radius: 0.125rem; /\* 2px \*/ | | rounded-br | border-bottom-right-radius: 0.25rem; /\* 4px \*/ | | rounded-br-md | border-bottom-right-radius: 0.375rem; /\* 6px \*/ | | rounded-br-lg | border-bottom-right-radius: 0.5rem; /\* 8px \*/ | | rounded-br-xl | border-bottom-right-radius: 0.75rem; /\* 12px \*/ | | rounded-br-2xl | border-bottom-right-radius: 1rem; /\* 16px \*/ | | rounded-br-3xl | border-bottom-right-radius: 1.5rem; /\* 24px \*/ | | rounded-br-full | border-bottom-right-radius: 9999px; | | rounded-bl-none | border-bottom-left-radius: 0px; | | rounded-bl-sm | border-bottom-left-radius: 0.125rem; /\* 2px \*/ | | rounded-bl | border-bottom-left-radius: 0.25rem; /\* 4px \*/ | | rounded-bl-md | border-bottom-left-radius: 0.375rem; /\* 6px \*/ | | rounded-bl-lg | border-bottom-left-radius: 0.5rem; /\* 8px \*/ | | rounded-bl-xl | border-bottom-left-radius: 0.75rem; /\* 12px \*/ | | rounded-bl-2xl | border-bottom-left-radius: 1rem; /\* 16px \*/ | | rounded-bl-3xl | border-bottom-left-radius: 1.5rem; /\* 24px \*/ | | rounded-bl-full | border-bottom-left-radius: 9999px; | Basic usage ----------- ### Rounded corners Use utilities like `.rounded-sm`, `.rounded`, or `.rounded-lg` to apply different border radius sizes to an element. ``` <div class="rounded ..."></div> <div class="rounded-md ..."></div> <div class="rounded-lg ..."></div> <div class="rounded-full ..."></div> ``` ### Pill buttons Use the `rounded-full` utility to create pill buttons. ``` <button class="rounded-full ...">Save Changes</button> ``` ### No rounding Use `rounded-none` to remove an existing border radius from an element. This is most commonly used to remove a border radius that was applied at a smaller breakpoint. ``` <button class="rounded-none ...">Save Changes</button> ``` ### Rounding sides separately Use `rounded-{t|r|b|l}{-size?}` to only round one side of an element. ``` <div class="rounded-t-lg ..."></div> <div class="rounded-r-lg ..."></div> <div class="rounded-b-lg ..."></div> <div class="rounded-l-lg ..."></div> ``` Rounding corners separately --------------------------- Use `rounded-{tl|tr|br|bl}{-size?}` to only round one corner an element. ``` <div class="rounded-tl-lg ..."></div> <div class="rounded-tr-lg ..."></div> <div class="rounded-br-lg ..."></div> <div class="rounded-bl-lg ..."></div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:rounded-lg` to only apply the `rounded-lg` utility on hover. ``` <div class="rounded hover:rounded-lg"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:rounded-lg` to apply the `rounded-lg` utility at only medium screen sizes and above. ``` <div class="rounded md:rounded-lg"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind provides five border radius size utilities. You can change, add, or remove these by editing the `theme.borderRadius` section of your Tailwind config. tailwind.config.js ``` module.exports = { theme: { borderRadius: { 'none': '0', 'sm': '0.125rem', DEFAULT: '0.25rem', DEFAULT: '4px', 'md': '0.375rem', 'lg': '0.5rem', 'full': '9999px', 'large': '12px', } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `border-radius` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="rounded-[12px]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation.
programming_docs
tailwindcss Place Items Quick reference --------------- | Class | Properties | | --- | --- | | place-items-start | place-items: start; | | place-items-end | place-items: end; | | place-items-center | place-items: center; | | place-items-stretch | place-items: stretch; | Basic usage ----------- ### Start Use `place-items-start` to place grid items on the start of their grid areas on both axes: ``` <div class="grid grid-cols-3 gap-4 place-items-start ..."> <div>01</div> <div>02</div> <div>03</div> <div>04</div> <div>05</div> <div>06</div> </div> ``` ### End Use `place-items-end` to place grid items on the end of their grid areas on both axes: ``` <div class="grid grid-cols-3 gap-4 place-items-end h-56 ..."> <div>01</div> <div>02</div> <div>03</div> <div>04</div> <div>05</div> <div>06</div> </div> ``` ### Center Use `place-items-center` to place grid items on the center of their grid areas on both axes: ``` <div class="grid grid-cols-3 gap-4 place-items-center h-56 ..."> <div>01</div> <div>02</div> <div>03</div> <div>04</div> <div>05</div> <div>06</div> </div> ``` ### Stretch Use `place-items-stretch` to stretch items along their grid areas on both axes: ``` <div class="grid grid-cols-3 gap-4 place-items-stretch h-56 ..."> <div>01</div> <div>02</div> <div>03</div> <div>04</div> <div>05</div> <div>06</div> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:place-items-center` to only apply the `place-items-center` utility on hover. ``` <div class="grid place-items-start hover:place-items-center"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:place-items-center` to apply the `place-items-center` utility at only medium screen sizes and above. ``` <div class="grid place-items-start md:place-items-center"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Table Layout Quick reference --------------- | Class | Properties | | --- | --- | | table-auto | table-layout: auto; | | table-fixed | table-layout: fixed; | Basic usage ----------- ### Auto Use `table-auto` to allow the table to automatically size columns to fit the contents of the cell. ``` <table class="table-auto"> <thead> <tr> <th>Song</th> <th>Artist</th> <th>Year</th> </tr> </thead> <tbody> <tr> <td>The Sliding Mr. Bones (Next Stop, Pottersville)</td> <td>Malcolm Lockyer</td> <td>1961</td> </tr> <tr> <td>Witchy Woman</td> <td>The Eagles</td> <td>1972</td> </tr> <tr> <td>Shining Star</td> <td>Earth, Wind, and Fire</td> <td>1975</td> </tr> </tbody> </table> ``` ### Fixed Use `table-fixed` to allow the table to ignore the content and use fixed widths for columns. The width of the first row will set the column widths for the whole table. You can manually set the widths for some columns and the rest of the available width will be divided evenly amongst the columns without explicit width. ``` <table class="table-fixed"> <thead> <tr> <th>Song</th> <th>Artist</th> <th>Year</th> </tr> </thead> <tbody> <tr> <td>The Sliding Mr. Bones (Next Stop, Pottersville)</td> <td>Malcolm Lockyer</td> <td>1961</td> </tr> <tr> <td>Witchy Woman</td> <td>The Eagles</td> <td>1972</td> </tr> <tr> <td>Shining Star</td> <td>Earth, Wind, and Fire</td> <td>1975</td> </tr> </tbody> </table> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:table-fixed` to only apply the `table-fixed` utility on hover. ``` <table class="hover:table-fixed"> <!-- ... --> </table> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:table-fixed` to apply the `table-fixed` utility at only medium screen sizes and above. ``` <table class="md:table-fixed"> <!-- ... --> </table> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Border Collapse Quick reference --------------- | Class | Properties | | --- | --- | | border-collapse | border-collapse: collapse; | | border-separate | border-collapse: separate; | Basic usage ----------- ### Collapse Use `border-collapse` to combine adjacent cell borders into a single border when possible. Note that this includes collapsing borders on the top-level `<table>` tag. ``` <table class="border-collapse border border-slate-400 ..."> <thead> <tr> <th class="border border-slate-300 ...">State</th> <th class="border border-slate-300 ...">City</th> </tr> </thead> <tbody> <tr> <td class="border border-slate-300 ...">Indiana</td> <td class="border border-slate-300 ...">Indianapolis</td> </tr> <tr> <td class="border border-slate-300 ...">Ohio</td> <td class="border border-slate-300 ...">Columbus</td> </tr> <tr> <td class="border border-slate-300 ...">Michigan</td> <td class="border border-slate-300 ...">Detroit</td> </tr> </tbody> </table><table class="border-collapse border border-slate-500 ..."> <thead> <tr> <th class="border border-slate-600 ...">State</th> <th class="border border-slate-600 ...">City</th> </tr> </thead> <tbody> <tr> <td class="border border-slate-700 ...">Indiana</td> <td class="border border-slate-700 ...">Indianapolis</td> </tr> <tr> <td class="border border-slate-700 ...">Ohio</td> <td class="border border-slate-700 ...">Columbus</td> </tr> <tr> <td class="border border-slate-700 ...">Michigan</td> <td class="border border-slate-700 ...">Detroit</td> </tr> </tbody> </table> ``` ### Separate Use `border-separate` to force each cell to display its own separate borders. ``` <table class="border-separate border border-slate-400 ..."> <thead> <tr> <th class="border border-slate-300 ...">State</th> <th class="border border-slate-300 ...">City</th> </tr> </thead> <tbody> <tr> <td class="border border-slate-300 ...">Indiana</td> <td class="border border-slate-300 ...">Indianapolis</td> </tr> <tr> <td class="border border-slate-300 ...">Ohio</td> <td class="border border-slate-300 ...">Columbus</td> </tr> <tr> <td class="border border-slate-300 ...">Michigan</td> <td class="border border-slate-300 ...">Detroit</td> </tr> </tbody> </table><table class="border-separate border border-slate-500 ..."> <thead> <tr> <th class="border border-slate-600 ...">State</th> <th class="border border-slate-600 ...">City</th> </tr> </thead> <tbody> <tr> <td class="border border-slate-700 ...">Indiana</td> <td class="border border-slate-700 ...">Indianapolis</td> </tr> <tr> <td class="border border-slate-700 ...">Ohio</td> <td class="border border-slate-700 ...">Columbus</td> </tr> <tr> <td class="border border-slate-700 ...">Michigan</td> <td class="border border-slate-700 ...">Detroit</td> </tr> </tbody> </table> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:border-collapse` to only apply the `border-collapse` utility on hover. ``` <table class="hover:border-collapse"> <!-- ... --> </table> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:border-collapse` to apply the `border-collapse` utility at only medium screen sizes and above. ``` <table class="md:border-collapse"> <!-- ... --> </table> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Utility-First Fundamentals Overview -------- Traditionally, whenever you need to style something on the web, you write CSS. Using a traditional approach where custom designs require custom CSS ``` <div class="chat-notification"> <div class="chat-notification-logo-wrapper"> <img class="chat-notification-logo" src="/img/logo.svg" alt="ChitChat Logo"> </div> <div class="chat-notification-content"> <h4 class="chat-notification-title">ChitChat</h4> <p class="chat-notification-message">You have a new message!</p> </div> </div> <style> .chat-notification { display: flex; max-width: 24rem; margin: 0 auto; padding: 1.5rem; border-radius: 0.5rem; background-color: #fff; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04); } .chat-notification-logo-wrapper { flex-shrink: 0; } .chat-notification-logo { height: 3rem; width: 3rem; } .chat-notification-content { margin-left: 1.5rem; padding-top: 0.25rem; } .chat-notification-title { color: #1a202c; font-size: 1.25rem; line-height: 1.25; } .chat-notification-message { color: #718096; font-size: 1rem; line-height: 1.5; } </style> ``` With Tailwind, you style elements by applying pre-existing classes directly in your HTML. Using utility classes to build custom designs without writing CSS ``` <div class="p-6 max-w-sm mx-auto bg-white rounded-xl shadow-lg flex items-center space-x-4"> <div class="shrink-0"> <img class="h-12 w-12" src="/img/logo.svg" alt="ChitChat Logo"> </div> <div> <div class="text-xl font-medium text-black">ChitChat</div> <p class="text-slate-500">You have a new message!</p> </div> </div> ``` In the example above, we’ve used: * Tailwind’s [flexbox](display#flex) and <padding> utilities (`flex`, `shrink-0`, and `p-6`) to control the overall card layout * The <max-width> and <margin> utilities (`max-w-sm` and `mx-auto`) to constrain the card width and center it horizontally * The [background color](background-color), [border radius](border-radius), and <box-shadow> utilities (`bg-white`, `rounded-xl`, and `shadow-lg`) to style the card’s appearance * The <width> and <height> utilities (`w-12` and `h-12`) to size the logo image * The [space-between](space) utilities (`space-x-4`) to handle the spacing between the logo and the text * The [font size](font-size), [text color](text-color), and <font-weight> utilities (`text-xl`, `text-black`, `font-medium`, etc.) to style the card text This approach allows us to implement a completely custom component design without writing a single line of custom CSS. Now I know what you’re thinking, *“this is an atrocity, what a horrible mess!”* and you’re right, it’s kind of ugly. In fact it’s just about impossible to think this is a good idea the first time you see it — **you have to actually try it**. But once you’ve actually built something this way, you’ll quickly notice some really important benefits: * **You aren’t wasting energy inventing class names**. No more adding silly class names like `sidebar-inner-wrapper` just to be able to style something, and no more agonizing over the perfect abstract name for something that’s really just a flex container. * **Your CSS stops growing**. Using a traditional approach, your CSS files get bigger every time you add a new feature. With utilities, everything is reusable so you rarely need to write new CSS. * **Making changes feels safer**. CSS is global and you never know what you’re breaking when you make a change. Classes in your HTML are local, so you can change them without worrying about something else breaking. When you realize how productive you can be working exclusively in HTML with predefined utility classes, working any other way will feel like torture. Why not just use inline styles? ------------------------------- A common reaction to this approach is wondering, “isn’t this just inline styles?” and in some ways it is — you’re applying styles directly to elements instead of assigning them a class name and then styling that class. But using utility classes has a few important advantages over inline styles: * **Designing with constraints**. Using inline styles, every value is a magic number. With utilities, you’re choosing styles from a predefined [design system](theme), which makes it much easier to build visually consistent UIs. * **Responsive design**. You can’t use media queries in inline styles, but you can use Tailwind’s [responsive utilities](responsive-design) to build fully responsive interfaces easily. * **Hover, focus, and other states**. Inline styles can’t target states like hover or focus, but Tailwind’s [state variants](hover-focus-and-other-states) make it easy to style those states with utility classes. This component is fully responsive and includes a button with hover and focus styles, and is built entirely with utility classes: ``` <div class="py-8 px-8 max-w-sm mx-auto bg-white rounded-xl shadow-lg space-y-2 sm:py-4 sm:flex sm:items-center sm:space-y-0 sm:space-x-6"> <img class="block mx-auto h-24 rounded-full sm:mx-0 sm:shrink-0" src="/img/erin-lindford.jpg" alt="Woman's Face"> <div class="text-center space-y-2 sm:text-left"> <div class="space-y-0.5"> <p class="text-lg text-black font-semibold"> Erin Lindford </p> <p class="text-slate-500 font-medium"> Product Engineer </p> </div> <button class="px-4 py-1 text-sm text-purple-600 font-semibold rounded-full border border-purple-200 hover:text-white hover:bg-purple-600 hover:border-transparent focus:outline-none focus:ring-2 focus:ring-purple-600 focus:ring-offset-2">Message</button> </div> </div> ``` Maintainability concerns ------------------------ The biggest maintainability concern when using a utility-first approach is managing commonly repeated utility combinations. This is easily solved by [extracting components and partials](reusing-styles#extracting-components-and-partials), and using [editor and language features](reusing-styles#using-editor-and-language-features) like multi-cursor editing and simple loops. ``` <!-- PrimaryButton.vue --> <template> <button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded"> <slot/> </button> </template> ``` Aside from that, maintaining a utility-first CSS project turns out to be a lot easier than maintaining a large CSS codebase, simply because HTML is so much easier to maintain than CSS. Large companies like GitHub, Netflix, Heroku, Kickstarter, Twitch, Segment, and more are using this approach with great success. If you’d like to hear about others’ experiences with this approach, check out the following resources: * [By The Numbers: A Year and a Half with Atomic CSS](https://medium.com/@johnpolacek/by-the-numbers-a-year-and-half-with-atomic-css-39d75b1263b4) by John Polacek * [Building a Scalable CSS Architecture](https://blog.algolia.com/redesigning-our-docs-part-4-building-a-scalable-css-architecture/) by Sarah Dayan of Algolia * [No, Utility Classes Aren’t the Same As Inline Styles](https://frontstuff.io/no-utility-classes-arent-the-same-as-inline-styles) by Sarah Dayan of Algolia * [Diana Mounter on using utility classes at GitHub](http://www.fullstackradio.com/75), a podcast interview For even more, check out [The Case for Atomic/Utility-First CSS](https://johnpolacek.github.io/the-case-for-atomic-css/), curated by [John Polacek](https://twitter.com/johnpolacek). tailwindcss Transform Origin Quick reference --------------- | Class | Properties | | --- | --- | | origin-center | transform-origin: center; | | origin-top | transform-origin: top; | | origin-top-right | transform-origin: top right; | | origin-right | transform-origin: right; | | origin-bottom-right | transform-origin: bottom right; | | origin-bottom | transform-origin: bottom; | | origin-bottom-left | transform-origin: bottom left; | | origin-left | transform-origin: left; | | origin-top-left | transform-origin: top left; | Basic usage ----------- ### Changing the transform origin Specify an element’s transform origin using the `origin-{keyword}` utilities. ``` <img class="origin-center rotate-45 ..."> <img class="origin-top-left rotate-12 ..."> <img class="origin-bottom -rotate-12 ..."> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:origin-top` to only apply the `origin-top` utility on hover. ``` <div class="origin-center hover:origin-top"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:origin-top` to apply the `origin-top` utility at only medium screen sizes and above. ``` <div class="origin-center md:origin-top"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind provides `transform-origin` utilities for all of the built-in browser keyword options. You can customize these values by editing `theme.transformOrigin` or `theme.extend.transformOrigin` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { transformOrigin: { 'top-left-1/3-3/4': '33% 75%', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `transform-origin` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="origin-[33%_75%]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Transition Delay Quick reference --------------- | Class | Properties | | --- | --- | | delay-75 | transition-delay: 75ms; | | delay-100 | transition-delay: 100ms; | | delay-150 | transition-delay: 150ms; | | delay-200 | transition-delay: 200ms; | | delay-300 | transition-delay: 300ms; | | delay-500 | transition-delay: 500ms; | | delay-700 | transition-delay: 700ms; | | delay-1000 | transition-delay: 1000ms; | Basic usage ----------- ### Delaying transitions Use the `delay-{amount}` utilities to control an element’s transition-delay. ``` <button class="transition delay-150 duration-300 ease-in-out ...">Button A</button> <button class="transition delay-300 duration-300 ease-in-out ...">Button B</button> <button class="transition delay-700 duration-300 ease-in-out ...">Button C</button> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:delay-300` to only apply the `delay-300` utility on hover. ``` <div class="transition duration-300 delay-150 hover:delay-300"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:delay-300` to apply the `delay-300` utility at only medium screen sizes and above. ``` <div class="transition duration-300 delay-150 md:delay-300"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind provides eight general purpose transition-delay utilities. You can customize these values by editing `theme.transitionDelay` or `theme.extend.transitionDelay` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { transitionDelay: { '0': '0ms', '2000': '2000ms', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `transition-delay` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="delay-[2000ms]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation.
programming_docs
tailwindcss Text Indent Quick reference --------------- | Class | Properties | | --- | --- | | indent-0 | text-indent: 0px; | | indent-px | text-indent: 1px; | | indent-0.5 | text-indent: 0.125rem; /\* 2px \*/ | | indent-1 | text-indent: 0.25rem; /\* 4px \*/ | | indent-1.5 | text-indent: 0.375rem; /\* 6px \*/ | | indent-2 | text-indent: 0.5rem; /\* 8px \*/ | | indent-2.5 | text-indent: 0.625rem; /\* 10px \*/ | | indent-3 | text-indent: 0.75rem; /\* 12px \*/ | | indent-3.5 | text-indent: 0.875rem; /\* 14px \*/ | | indent-4 | text-indent: 1rem; /\* 16px \*/ | | indent-5 | text-indent: 1.25rem; /\* 20px \*/ | | indent-6 | text-indent: 1.5rem; /\* 24px \*/ | | indent-7 | text-indent: 1.75rem; /\* 28px \*/ | | indent-8 | text-indent: 2rem; /\* 32px \*/ | | indent-9 | text-indent: 2.25rem; /\* 36px \*/ | | indent-10 | text-indent: 2.5rem; /\* 40px \*/ | | indent-11 | text-indent: 2.75rem; /\* 44px \*/ | | indent-12 | text-indent: 3rem; /\* 48px \*/ | | indent-14 | text-indent: 3.5rem; /\* 56px \*/ | | indent-16 | text-indent: 4rem; /\* 64px \*/ | | indent-20 | text-indent: 5rem; /\* 80px \*/ | | indent-24 | text-indent: 6rem; /\* 96px \*/ | | indent-28 | text-indent: 7rem; /\* 112px \*/ | | indent-32 | text-indent: 8rem; /\* 128px \*/ | | indent-36 | text-indent: 9rem; /\* 144px \*/ | | indent-40 | text-indent: 10rem; /\* 160px \*/ | | indent-44 | text-indent: 11rem; /\* 176px \*/ | | indent-48 | text-indent: 12rem; /\* 192px \*/ | | indent-52 | text-indent: 13rem; /\* 208px \*/ | | indent-56 | text-indent: 14rem; /\* 224px \*/ | | indent-60 | text-indent: 15rem; /\* 240px \*/ | | indent-64 | text-indent: 16rem; /\* 256px \*/ | | indent-72 | text-indent: 18rem; /\* 288px \*/ | | indent-80 | text-indent: 20rem; /\* 320px \*/ | | indent-96 | text-indent: 24rem; /\* 384px \*/ | Basic usage ----------- ### Adding a text indent Use the `indent-{width}` utilities to set the amount of empty space (indentation) that’s shown before text in a block. ``` <p class="indent-8"> So I started to walk into the water. I won't lie to you boys, I was terrified. But I pressed on, and as I made my way past the breakers a strange calm came over me. I don't know if it was divine intervention or the kinship of all living things but I tell you Jerry at that moment, I <em>was</em> a marine biologist. </p> ``` ### Using negative values To use a negative text indent value, prefix the class name with a dash to convert it to a negative value. ``` <div class="-indent-8"> So I started to walk into the water. I won't lie to... </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:indent-8` to only apply the `indent-8` utility on hover. ``` <div class="indent-4 hover:indent-8"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:indent-8` to apply the `indent-8` utility at only medium screen sizes and above. ``` <div class="indent-4 md:indent-8"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme The default text indent scale is based on the [default spacing scale](customizing-spacing#default-spacing-scale). You can customize your spacing scale by editing `theme.spacing` or `theme.extend.spacing` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { spacing: { '128': '32rem', } } } } ``` Alternatively, you can customize just the text indent scale by editing `theme.textIndent` or `theme.extend.textIndent` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { textIndent: { '128': '32rem', } } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `text-indent` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="indent-[50%]"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Content Quick reference --------------- | Class | Properties | | --- | --- | | content-none | content: none; | Basic usage ----------- ### Setting a pseudo-element's content Use the `content-{value}` utilities along with the `before` and `after` variant modifiers to set the contents of the `::before` and `::after` pseudo-elements. Out of the box, `content-none` is the only available preconfigured content utility. And while you can add additional utilities by [customizing your theme](#customizing-your-theme), it generally makes more sense to just use an arbitrary value. Use the square bracket notation to define any arbitrary content value on the fly. ``` Higher resolution means more than just a better-quality image. With a Retina 6K display, <a class="text-blue-600 after:content-['_↗'] ..." href="https://www. apple.com/pro-display-xdr/" target="_blank">Pro Display XDR</a> gives you nearly 40 percent more screen real estate than a 5K display.Higher resolution means more than just a better-quality image. With a Retina 6K display, <a class="text-sky-400 after:content-['_↗'] ..." href="https://www. apple.com/pro-display-xdr/" target="_blank">Pro Display XDR</a> gives you nearly 40 percent more screen real estate than a 5K display. ``` ### Referencing an attribute value These content utilities even support CSS features like the `attr()` function, which you can use to reference a value stored in an attribute: ``` <div before="Hello World" class="before:content-[attr(before)]"> <!-- ... --> </div> ``` ### Using spaces and underscores Since whitespace denotes the end of a class in HTML, replace any spaces in an arbitrary value with an underscore: ``` <div class="before:content-['Hello_World']"> <!-- ... --> </div> ``` If you need to include an actual underscore, you can do this by escaping it with a backslash: ``` <div class="before:content-['Hello\_World']"> <!-- ... --> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:before:content-['Hovering']` to only apply the `before:content-['Hovering']` utility on hover. ``` <div class="before:content-['Not_Hovering'] hover:before:content-['Hovering']"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:before:content-['Desktop']` to apply the `before:content-['Desktop']` utility at only medium screen sizes and above. ``` <div class="before:content-['Mobile'] md:before:content-['Desktop']"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). Using custom values ------------------- ### Customizing your theme By default, Tailwind only provides the `content-none` utility. You can customize these values by editing `theme.content` or `theme.extend.content` in your `tailwind.config.js` file. tailwind.config.js ``` module.exports = { theme: { extend: { content: { 'link': 'url("/icons/link.svg")', }, } } } ``` Learn more about customizing the default theme in the [theme customization](theme#customizing-the-default-theme) documentation. ### Arbitrary values If you need to use a one-off `content` value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value. ``` <div class="before:content-['Hello_World']"> <!-- ... --> </div> ``` Learn more about arbitrary value support in the [arbitrary values](adding-custom-styles#using-arbitrary-values) documentation. tailwindcss Background Blend Mode Quick reference --------------- | Class | Properties | | --- | --- | | bg-blend-normal | background-blend-mode: normal; | | bg-blend-multiply | background-blend-mode: multiply; | | bg-blend-screen | background-blend-mode: screen; | | bg-blend-overlay | background-blend-mode: overlay; | | bg-blend-darken | background-blend-mode: darken; | | bg-blend-lighten | background-blend-mode: lighten; | | bg-blend-color-dodge | background-blend-mode: color-dodge; | | bg-blend-color-burn | background-blend-mode: color-burn; | | bg-blend-hard-light | background-blend-mode: hard-light; | | bg-blend-soft-light | background-blend-mode: soft-light; | | bg-blend-difference | background-blend-mode: difference; | | bg-blend-exclusion | background-blend-mode: exclusion; | | bg-blend-hue | background-blend-mode: hue; | | bg-blend-saturation | background-blend-mode: saturation; | | bg-blend-color | background-blend-mode: color; | | bg-blend-luminosity | background-blend-mode: luminosity; | Basic usage ----------- ### Setting the background blend mode Use the `bg-blend-{mode}` utilities to control how an element’s background image(s) should blend with its background color. ``` <div class="bg-blend-multiply ..."> <!-- ... --> </div> ``` Applying conditionally ---------------------- ### Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use `hover:bg-blend-darken` to only apply the `bg-blend-darken` utility on hover. ``` <div class="bg-blend-lighten hover:bg-blend-darken"> <!-- ... --> </div> ``` For a complete list of all available state modifiers, check out the [Hover, Focus, & Other States](hover-focus-and-other-states) documentation. ### Breakpoints and media queries You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use `md:bg-blend-darken` to apply the `bg-blend-darken` utility at only medium screen sizes and above. ``` <div class="bg-blend-lighten md:bg-blend-darken"> <!-- ... --> </div> ``` To learn more, check out the documentation on [Responsive Design](responsive-design), [Dark Mode](dark-mode) and [other media query modifiers](hover-focus-and-other-states#media-queries). tailwindcss Responsive Design Overview -------- Every utility class in Tailwind can be applied conditionally at different breakpoints, which makes it a piece of cake to build complex responsive interfaces without ever leaving your HTML. There are five breakpoints by default, inspired by common device resolutions: | Breakpoint prefix | Minimum width | CSS | | --- | --- | --- | | `sm` | 640px | `@media (min-width: 640px) { ... }` | | `md` | 768px | `@media (min-width: 768px) { ... }` | | `lg` | 1024px | `@media (min-width: 1024px) { ... }` | | `xl` | 1280px | `@media (min-width: 1280px) { ... }` | | `2xl` | 1536px | `@media (min-width: 1536px) { ... }` | To add a utility but only have it take effect at a certain breakpoint, all you need to do is prefix the utility with the breakpoint name, followed by the `:` character: ``` <!-- Width of 16 by default, 32 on medium screens, and 48 on large screens --> <img class="w-16 md:w-32 lg:w-48" src="..."> ``` This works for **every utility class in the framework**, which means you can change literally anything at a given breakpoint — even things like letter spacing or cursor styles. Here’s a simple example of a marketing page component that uses a stacked layout on small screens, and a side-by-side layout on larger screens *(resize your browser to see it in action)*: ``` <div class="max-w-md mx-auto bg-white rounded-xl shadow-md overflow-hidden md:max-w-2xl"> <div class="md:flex"> <div class="md:shrink-0"> <img class="h-48 w-full object-cover md:h-full md:w-48" src="/img/building.jpg" alt="Modern building architecture"> </div> <div class="p-8"> <div class="uppercase tracking-wide text-sm text-indigo-500 font-semibold">Company retreats</div> <a href="#" class="block mt-1 text-lg leading-tight font-medium text-black hover:underline">Incredible accomodation for your team</a> <p class="mt-2 text-slate-500">Looking to take your team away on a retreat to enjoy awesome food and take in some sunshine? We have a list of places to do just that.</p> </div> </div> </div> ``` Here’s how the example above works: * By default, the outer `div` is `display: block`, but by adding the `md:flex` utility, it becomes `display: flex` on medium screens and larger. * When the parent is a flex container, we want to make sure the image never shrinks, so we’ve added `md:shrink-0` to prevent shrinking on medium screens and larger. Technically we could have just used `shrink-0` since it would do nothing on smaller screens, but since it only matters on `md` screens, it’s a good idea to make that clear in the class name. * On small screens the image is automatically full width by default. On medium screens and up, we’ve constrained the width to a fixed size and ensured the image is full height using `md:h-full md:w-48`. We’ve only used one breakpoint in this example, but you could easily customize this component at other sizes using the `sm`, `lg`, `xl`, or `2xl` responsive prefixes as well. Mobile First ------------ By default, Tailwind uses a mobile first breakpoint system, similar to what you might be used to in other frameworks like Bootstrap. What this means is that unprefixed utilities (like `uppercase`) take effect on all screen sizes, while prefixed utilities (like `md:uppercase`) only take effect at the specified breakpoint *and above*. ### Targeting mobile screens Where this approach surprises people most often is that to style something for mobile, you need to use the unprefixed version of a utility, not the `sm:` prefixed version. Don’t think of `sm:` as meaning “on small screens”, think of it as “at the small *breakpoint*“. Don't use `sm:` to target mobile devices ``` <!-- This will only center text on screens 640px and wider, not on small screens --> <div class="sm:text-center"></div> ``` Use unprefixed utilities to target mobile, and override them at larger breakpoints ``` <!-- This will center text on mobile, and left align it on screens 640px and wider --> <div class="text-center sm:text-left"></div> ``` For this reason, it’s often a good idea to implement the mobile layout for a design first, then layer on any changes that make sense for `sm` screens, followed by `md` screens, etc. ### Targeting a single breakpoint Tailwind’s breakpoints only include a `min-width` and don’t include a `max-width`, which means any utilities you add at a smaller breakpoint will also be applied at larger breakpoints. If you’d like to apply a utility at one breakpoint only, the solution is to *undo* that utility at larger sizes by adding another utility that counteracts it. Here is an example where the background color is red at the `md` breakpoint, but green at every other breakpoint: ``` <div class="bg-green-500 md:bg-red-500 lg:bg-green-500"> <!-- ... --> </div> ``` Notice that **we did not** have to specify a background color for the `sm` breakpoint or the `xl` breakpoint — you only need to specify when a utility should *start* taking effect, not when it should stop. Customizing breakpoints ----------------------- You can completely customize your breakpoints in your `tailwind.config.js` file: tailwind.config.js ``` module.exports = { theme: { screens: { 'tablet': '640px', // => @media (min-width: 640px) { ... } 'laptop': '1024px', // => @media (min-width: 1024px) { ... } 'desktop': '1280px', // => @media (min-width: 1280px) { ... } }, } } ``` Learn more in the [customizing breakpoints documentation](/docs/screens). php Gmagick::getimagegamma Gmagick::getimagegamma ====================== (PECL gmagick >= Unknown) Gmagick::getimagegamma — Gets the image gamma ### Description ``` public Gmagick::getimagegamma(): float ``` Gets the image gamma ### Parameters This function has no parameters. ### Return Values Returns the image gamma on success ### Errors/Exceptions Throws an **GmagickException** on error. php inet_ntop inet\_ntop ========== (PHP 5 >= 5.1.0, PHP 7, PHP 8) inet\_ntop — Converts a packed internet address to a human readable representation ### Description ``` inet_ntop(string $ip): string|false ``` This function converts a 32bit IPv4, or 128bit IPv6 address (if PHP was built with IPv6 support enabled) into an address family appropriate string representation. ### Parameters `ip` A 32bit IPv4, or 128bit IPv6 address. ### Return Values Returns a string representation of the address or **`false`** on failure. ### Examples **Example #1 **inet\_ntop()** Example** ``` <?php $packed = chr(127) . chr(0) . chr(0) . chr(1); $expanded = inet_ntop($packed); /* Outputs: 127.0.0.1 */ echo $expanded; $packed = str_repeat(chr(0), 15) . chr(1); $expanded = inet_ntop($packed); /* Outputs: ::1 */ echo $expanded; ?> ``` ### See Also * [long2ip()](function.long2ip) - Converts an long integer address into a string in (IPv4) Internet standard dotted format * [ip2long()](function.ip2long) - Converts a string containing an (IPv4) Internet Protocol dotted address into a long integer * [inet\_pton()](function.inet-pton) - Converts a human readable IP address to its packed in\_addr representation php ImagickDraw::setTextAlignment ImagickDraw::setTextAlignment ============================= (PECL imagick 2, PECL imagick 3) ImagickDraw::setTextAlignment — Specifies a text alignment ### Description ``` public ImagickDraw::setTextAlignment(int $alignment): bool ``` **Warning**This function is currently not documented; only its argument list is available. Specifies a text alignment to be applied when annotating with text. ### Parameters `alignment` One of the [ALIGN](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.align) constant (`imagick::ALIGN_*`). ### Return Values No value is returned. ### Examples **Example #1 **ImagickDraw::setTextAlignment()** example** ``` <?php function setTextAlignment($strokeColor, $fillColor, $backgroundColor) {     $draw = new \ImagickDraw();     $draw->setStrokeColor($strokeColor);     $draw->setFillColor($fillColor);     $draw->setStrokeWidth(1);     $draw->setFontSize(36);     $draw->setTextAlignment(\Imagick::ALIGN_LEFT);     $draw->annotation(250, 75, "Lorem Ipsum!");     $draw->setTextAlignment(\Imagick::ALIGN_CENTER);     $draw->annotation(250, 150, "Lorem Ipsum!");     $draw->setTextAlignment(\Imagick::ALIGN_RIGHT);     $draw->annotation(250, 225, "Lorem Ipsum!");     $draw->line(250, 0, 250, 500);     $imagick = new \Imagick();     $imagick->newImage(500, 500, $backgroundColor);     $imagick->setImageFormat("png");     $imagick->drawImage($draw);     header("Content-Type: image/png");     echo $imagick->getImageBlob(); } ?> ```
programming_docs
php Gmagick::getimagematte Gmagick::getimagematte ====================== (PECL gmagick >= Unknown) Gmagick::getimagematte — Check if the image has a matte channel ### Description ``` public Gmagick::getimagematte(): int ``` Returns **`true`** if the image has a matte channel, otherwise **`false`**. ### Parameters This function has no parameters. ### Return Values Returns **`true`** if the image has a matte channel, otherwise **`false`**. ### Errors/Exceptions Throws an **GmagickException** on error. php ImagickDraw::popPattern ImagickDraw::popPattern ======================= (PECL imagick 2, PECL imagick 3) ImagickDraw::popPattern — Terminates a pattern definition ### Description ``` public ImagickDraw::popPattern(): bool ``` **Warning**This function is currently not documented; only its argument list is available. Terminates a pattern definition. ### Return Values Returns **`true`** on success or **`false`** on failure. php juliantojd juliantojd ========== (PHP 4, PHP 5, PHP 7, PHP 8) juliantojd — Converts a Julian Calendar date to Julian Day Count ### Description ``` juliantojd(int $month, int $day, int $year): int ``` Valid Range for Julian Calendar 4713 B.C. to 9999 A.D. Although this function can handle dates all the way back to 4713 B.C., such use may not be meaningful. The calendar was created in 46 B.C., but the details did not stabilize until at least 8 A.D., and perhaps as late at the 4th century. Also, the beginning of a year varied from one culture to another - not all accepted January as the first month. **Caution** Remember, the current calendar system being used worldwide is the Gregorian calendar. [gregoriantojd()](function.gregoriantojd) can be used to convert such dates to their Julian Day count. ### Parameters `month` The month as a number from 1 (for January) to 12 (for December) `day` The day as a number from 1 to 31 `year` The year as a number between -4713 and 9999 ### Return Values The julian day for the given julian date as an integer. ### See Also * [jdtojulian()](function.jdtojulian) - Converts a Julian Day Count to a Julian Calendar Date * [cal\_to\_jd()](function.cal-to-jd) - Converts from a supported calendar to Julian Day Count php CachingIterator::offsetExists CachingIterator::offsetExists ============================= (PHP 5 >= 5.2.0, PHP 7, PHP 8) CachingIterator::offsetExists — The offsetExists purpose ### Description ``` public CachingIterator::offsetExists(string $key): bool ``` **Warning**This function is currently not documented; only its argument list is available. ### Parameters `key` The index being checked. ### Return Values Returns **`true`** if an entry referenced by the offset exists, **`false`** otherwise. php posix_getegid posix\_getegid ============== (PHP 4, PHP 5, PHP 7, PHP 8) posix\_getegid — Return the effective group ID of the current process ### Description ``` posix_getegid(): int ``` Return the numeric effective group ID of the current process. ### Parameters This function has no parameters. ### Return Values Returns an int of the effective group ID. ### Examples **Example #1 **posix\_getegid()** example** This example will print out the effective group id, once it is changed with [posix\_setegid()](function.posix-setegid). ``` <?php echo 'My real group id is '.posix_getgid(); //20 posix_setegid(40); echo 'My real group id is '.posix_getgid(); //20 echo 'My effective group id is '.posix_getegid(); //40 ?> ``` ### Notes **posix\_getegid()** is different than [posix\_getgid()](function.posix-getgid) because effective group ID can be changed by a calling process using [posix\_setegid()](function.posix-setegid). ### See Also * [posix\_getgrgid()](function.posix-getgrgid) - Return info about a group by group id * [posix\_getgid()](function.posix-getgid) - Return the real group ID of the current process * [posix\_setgid()](function.posix-setgid) - Set the GID of the current process php apache_lookup_uri apache\_lookup\_uri =================== (PHP 4, PHP 5, PHP 7, PHP 8) apache\_lookup\_uri — Perform a partial request for the specified URI and return all info about it ### Description ``` apache_lookup_uri(string $filename): object|false ``` This performs a partial request for a URI. It goes just far enough to obtain all the important information about the given resource. This function is supported when PHP is installed as an Apache module webserver. ### Parameters `filename` The filename (URI) that's being requested. ### Return Values An object of related URI information. The properties of this object are: * status * the\_request * status\_line * method * content\_type * handler * uri * filename * path\_info * args * boundary * no\_cache * no\_local\_copy * allowed * send\_bodyct * bytes\_sent * byterange * clength * unparsed\_uri * mtime * request\_time Returns **`false`** on failure. ### Examples **Example #1 **apache\_lookup\_uri()** example** ``` <?php $info = apache_lookup_uri('index.php?var=value'); print_r($info); if (file_exists($info->filename)) {     echo 'file exists!'; } ?> ``` The above example will output something similar to: ``` stdClass Object ( [status] => 200 [the_request] => GET /dir/file.php HTTP/1.1 [method] => GET [mtime] => 0 [clength] => 0 [chunked] => 0 [content_type] => application/x-httpd-php [no_cache] => 0 [no_local_copy] => 1 [unparsed_uri] => /dir/index.php?var=value [uri] => /dir/index.php [filename] => /home/htdocs/dir/index.php [args] => var=value [allowed] => 0 [sent_bodyct] => 0 [bytes_sent] => 0 [request_time] => 1074282764 ) file exists! ``` php EventUtil::setSocketOption EventUtil::setSocketOption ========================== (PECL event >= 1.6.0) EventUtil::setSocketOption — Sets socket options ### Description ``` public static EventUtil::setSocketOption( mixed $socket , int $level , int $optname , mixed $optval ): bool ``` Sets socket options. ### Parameters `socket` Socket resource, stream, or numeric file descriptor associated with the socket. `level` One of `EventUtil::SOL_*` constants. Specifies the protocol level at which the option resides. For example, to retrieve options at the socket level, a `level` parameter of **`EventUtil::SOL_SOCKET`** would be used. Other levels, such as TCP, can be used by specifying the protocol number of that level. Protocol numbers can be found by using the [getprotobyname()](function.getprotobyname) function. See [EventUtil constants](class.eventutil#eventutil.constants) . `optname` Option name(type). Has the same meaning as corresponding parameter of [socket\_get\_option()](function.socket-get-option) function. See [EventUtil constants](class.eventutil#eventutil.constants) . `optval` Accepts the same values as `optval` parameter of the [socket\_get\_option()](function.socket-get-option) function. ### Return Values Returns **`true`** on success or **`false`** on failure. ### See Also * [socket\_get\_option()](function.socket-get-option) - Gets socket options for the socket * [socket\_set\_option()](function.socket-set-option) - Sets socket options for the socket php posix_kill posix\_kill =========== (PHP 4, PHP 5, PHP 7, PHP 8) posix\_kill — Send a signal to a process ### Description ``` posix_kill(int $process_id, int $signal): bool ``` Send the signal `signal` to the process with the process identifier `process_id`. ### Parameters `process_id` The process identifier. `signal` One of the [PCNTL signals constants](https://www.php.net/manual/en/pcntl.constants.php). ### Return Values Returns **`true`** on success or **`false`** on failure. ### See Also * The kill(2) manual page of the POSIX system, which contains additional information about negative process identifiers, the special pid 0, the special pid -1, and the signal number 0. php SolrQuery::setGroupNGroups SolrQuery::setGroupNGroups ========================== (PECL solr >= 2.2.0) SolrQuery::setGroupNGroups — If true, Solr includes the number of groups that have matched the query in the results ### Description ``` public SolrQuery::setGroupNGroups(bool $value): SolrQuery ``` If true, Solr includes the number of groups that have matched the query in the results. ### Parameters `value` ### Return Values ### See Also * [SolrQuery::setGroup()](solrquery.setgroup) - Enable/Disable result grouping (group parameter) * [SolrQuery::addGroupField()](solrquery.addgroupfield) - Add a field to be used to group results * [SolrQuery::addGroupFunction()](solrquery.addgroupfunction) - Allows grouping results based on the unique values of a function query (group.func parameter) * [SolrQuery::addGroupQuery()](solrquery.addgroupquery) - Allows grouping of documents that match the given query * [SolrQuery::addGroupSortField()](solrquery.addgroupsortfield) - Add a group sort field (group.sort parameter) * [SolrQuery::setGroupFacet()](solrquery.setgroupfacet) - Sets group.facet parameter * [SolrQuery::setGroupOffset()](solrquery.setgroupoffset) - Sets the group.offset parameter * [SolrQuery::setGroupLimit()](solrquery.setgrouplimit) - Specifies the number of results to return for each group. The server default value is 1 * [SolrQuery::setGroupMain()](solrquery.setgroupmain) - If true, the result of the first field grouping command is used as the main result list in the response, using group.format=simple * [SolrQuery::setGroupTruncate()](solrquery.setgrouptruncate) - If true, facet counts are based on the most relevant document of each group matching the query * [SolrQuery::setGroupFormat()](solrquery.setgroupformat) - Sets the group format, result structure (group.format parameter) * [SolrQuery::setGroupCachePercent()](solrquery.setgroupcachepercent) - Enables caching for result grouping php array_udiff array\_udiff ============ (PHP 5, PHP 7, PHP 8) array\_udiff — Computes the difference of arrays by using a callback function for data comparison ### Description ``` array_udiff(array $array, array ...$arrays, callable $value_compare_func): array ``` Computes the difference of arrays by using a callback function for data comparison. This is unlike [array\_diff()](function.array-diff) which uses an internal function for comparing the data. ### Parameters `array` The first array. `arrays` Arrays to compare against. `value_compare_func` The callback comparison function. The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second. ``` callback(mixed $a, mixed $b): int ``` ### Return Values Returns an array containing all the values of `array` that are not present in any of the other arguments. ### Examples **Example #1 **array\_udiff()** example using stdClass Objects** ``` <?php // Arrays to compare $array1 = array(new stdclass, new stdclass,                 new stdclass, new stdclass,                ); $array2 = array(                 new stdclass, new stdclass,                ); // Set some properties for each object $array1[0]->width = 11; $array1[0]->height = 3; $array1[1]->width = 7;  $array1[1]->height = 1; $array1[2]->width = 2;  $array1[2]->height = 9; $array1[3]->width = 5;  $array1[3]->height = 7; $array2[0]->width = 7;  $array2[0]->height = 5; $array2[1]->width = 9;  $array2[1]->height = 2; function compare_by_area($a, $b) {     $areaA = $a->width * $a->height;     $areaB = $b->width * $b->height;          if ($areaA < $areaB) {         return -1;     } elseif ($areaA > $areaB) {         return 1;     } else {         return 0;     } } print_r(array_udiff($array1, $array2, 'compare_by_area')); ?> ``` The above example will output: ``` Array ( [0] => stdClass Object ( [width] => 11 [height] => 3 ) [1] => stdClass Object ( [width] => 7 [height] => 1 ) ) ``` **Example #2 **array\_udiff()** example using DateTime Objects** ``` <?php class MyCalendar {     public $free = array();     public $booked = array();     public function __construct($week = 'now') {         $start = new DateTime($week);         $start->modify('Monday this week midnight');         $end = clone $start;         $end->modify('Friday this week midnight');         $interval = new DateInterval('P1D');         foreach (new DatePeriod($start, $interval, $end) as $freeTime) {             $this->free[] = $freeTime;         }     }     public function bookAppointment(DateTime $date, $note) {         $this->booked[] = array('date' => $date->modify('midnight'), 'note' => $note);     }     public function checkAvailability() {         return array_udiff($this->free, $this->booked, array($this, 'customCompare'));     }          public function customCompare($free, $booked) {         if (is_array($free)) $a = $free['date'];         else $a = $free;         if (is_array($booked)) $b = $booked['date'];         else $b = $booked;         if ($a == $b) {             return 0;         } elseif ($a > $b) {             return 1;         } else {             return -1;         }     } } // Create a calendar for weekly appointments $myCalendar = new MyCalendar; // Book some appointments for this week $myCalendar->bookAppointment(new DateTime('Monday this week'), "Cleaning GoogleGuy's apartment."); $myCalendar->bookAppointment(new DateTime('Wednesday this week'), "Going on a snowboarding trip."); $myCalendar->bookAppointment(new DateTime('Friday this week'), "Fixing buggy code."); // Check availability of days by comparing $booked dates against $free dates echo "I'm available on the following days this week...\n\n"; foreach ($myCalendar->checkAvailability() as $free) {     echo $free->format('l'), "\n";  } echo "\n\n"; echo "I'm busy on the following days this week...\n\n"; foreach ($myCalendar->booked as $booked) {     echo $booked['date']->format('l'), ": ", $booked['note'], "\n";  } ?> ``` The above example will output: ``` I'm available on the following days this week... Tuesday Thursday I'm busy on the following days this week... Monday: Cleaning GoogleGuy's apartment. Wednesday: Going on a snowboarding trip. Friday: Fixing buggy code. ``` ### Notes > **Note**: Please note that this function only checks one dimension of a n-dimensional array. Of course you can check deeper dimensions by using `array_udiff($array1[0], $array2[0], "data_compare_func");`. > > ### See Also * [array\_diff()](function.array-diff) - Computes the difference of arrays * [array\_diff\_assoc()](function.array-diff-assoc) - Computes the difference of arrays with additional index check * [array\_diff\_uassoc()](function.array-diff-uassoc) - Computes the difference of arrays with additional index check which is performed by a user supplied callback function * [array\_udiff\_assoc()](function.array-udiff-assoc) - Computes the difference of arrays with additional index check, compares data by a callback function * [array\_udiff\_uassoc()](function.array-udiff-uassoc) - Computes the difference of arrays with additional index check, compares data and indexes by a callback function * [array\_intersect()](function.array-intersect) - Computes the intersection of arrays * [array\_intersect\_assoc()](function.array-intersect-assoc) - Computes the intersection of arrays with additional index check * [array\_uintersect()](function.array-uintersect) - Computes the intersection of arrays, compares data by a callback function * [array\_uintersect\_assoc()](function.array-uintersect-assoc) - Computes the intersection of arrays with additional index check, compares data by a callback function * [array\_uintersect\_uassoc()](function.array-uintersect-uassoc) - Computes the intersection of arrays with additional index check, compares data and indexes by separate callback functions php Gmagick::getimagebackgroundcolor Gmagick::getimagebackgroundcolor ================================ (PECL gmagick >= Unknown) Gmagick::getimagebackgroundcolor — Returns the image background color ### Description ``` public Gmagick::getimagebackgroundcolor(): GmagickPixel ``` Returns the image background color. ### Parameters This function has no parameters. ### Return Values Returns an GmagickPixel set to the background color of the image. ### Errors/Exceptions Throws an **GmagickException** on error. php tidy::parseString tidy::parseString ================= tidy\_parse\_string =================== (PHP 5, PHP 7, PHP 8, PECL tidy >= 0.5.2) tidy::parseString -- tidy\_parse\_string — Parse a document stored in a string ### Description Object-oriented style ``` public tidy::parseString(string $string, array|string|null $config = null, ?string $encoding = null): bool ``` Procedural style ``` tidy_parse_string(string $string, array|string|null $config = null, ?string $encoding = null): tidy|false ``` Parses a document stored in a string. ### Parameters `string` The data to be parsed. `config` The config `config` can be passed either as an array or as a string. If a string is passed, it is interpreted as the name of the configuration file, otherwise, it is interpreted as the options themselves. For an explanation about each option, visit [» http://api.html-tidy.org/#quick-reference](http://api.html-tidy.org/#quick-reference). `encoding` The `encoding` parameter sets the encoding for input/output documents. The possible values for encoding are: `ascii`, `latin0`, `latin1`, `raw`, `utf8`, `iso2022`, `mac`, `win1252`, `ibm858`, `utf16`, `utf16le`, `utf16be`, `big5`, and `shiftjis`. ### Return Values **tidy::parseString()** returns **`true`** on success. **tidy\_parse\_string()** returns a new [tidy](class.tidy) instance on success. Both, the method and the function return **`false`** on failure. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | `config` and `encoding` are nullable now. | ### Examples **Example #1 **tidy::parseString()** example** ``` <?php ob_start(); ?> <html>   <head>    <title>test</title>   </head>   <body>    <p>error<br>another line</i>   </body> </html> <?php $buffer = ob_get_clean(); $config = array('indent' => TRUE,                 'output-xhtml' => TRUE,                 'wrap' => 200); $tidy = tidy_parse_string($buffer, $config, 'UTF8'); $tidy->cleanRepair(); echo $tidy; ?> ``` The above example will output: ``` <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> test </title> </head> <body> <p> error<br /> another line </p> </body> </html> ``` ### See Also * [tidy::parseFile()](tidy.parsefile) - Parse markup in file or URI * [tidy::repairFile()](tidy.repairfile) - Repair a file and return it as a string * [tidy::repairString()](tidy.repairstring) - Repair a string using an optionally provided configuration file php enchant_broker_free enchant\_broker\_free ===================== (PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL enchant >= 0.1.0 ) enchant\_broker\_free — Free the broker resource and its dictionaries **Warning**This function has been *DEPRECATED* as of PHP 8.0.0. Relying on this function is highly discouraged. ### Description ``` enchant_broker_free(EnchantBroker $broker): bool ``` Free a broker with all its dictionaries. As of PHP 8.0.0, it is recommended to unset the object instead of calling this function. ### Parameters `broker` An Enchant broker returned by [enchant\_broker\_init()](function.enchant-broker-init). ### Return Values Returns **`true`** on success or **`false`** on failure. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | `broker` expects an [EnchantBroker](class.enchantbroker) instance now; previoulsy, a [resource](language.types.resource) was expected. | ### See Also * [enchant\_broker\_init()](function.enchant-broker-init) - Create a new broker object capable of requesting
programming_docs
php odbc_commit odbc\_commit ============ (PHP 4, PHP 5, PHP 7, PHP 8) odbc\_commit — Commit an ODBC transaction ### Description ``` odbc_commit(resource $odbc): bool ``` Commits all pending transactions on the connection. ### Parameters `odbc` The ODBC connection identifier, see [odbc\_connect()](function.odbc-connect) for details. ### Return Values Returns **`true`** on success or **`false`** on failure. php strtok strtok ====== (PHP 4, PHP 5, PHP 7, PHP 8) strtok — Tokenize string ### Description ``` strtok(string $string, string $token): string|false ``` Alternative signature (not supported with named arguments): ``` strtok(string $token): string|false ``` **strtok()** splits a string (`string`) into smaller strings (tokens), with each token being delimited by any character from `token`. That is, if you have a string like "This is an example string" you could tokenize this string into its individual words by using the space character as the `token`. Note that only the first call to strtok uses the `string` argument. Every subsequent call to strtok only needs the `token` to use, as it keeps track of where it is in the current string. To start over, or to tokenize a new string you simply call strtok with the `string` argument again to initialize it. Note that you may put multiple tokens in the `token` parameter. The string will be tokenized when any one of the characters in the `token` argument is found. > > **Note**: > > > This function behaves slightly different from what one may expect being familiar with [explode()](function.explode). First, a sequence of two or more contiguous `token` characters in the parsed string is considered to be a single delimiter. Also, a `token` situated at the start or end of the string is ignored. For example, if a string `";aaa;;bbb;"` is used, successive calls to **strtok()** with `";"` as a `token` would return strings "aaa" and "bbb", and then **`false`**. As a result, the string will be split into only two elements, while `explode(";", $string)` would return an array of 5 elements. > > ### Parameters `string` The string being split up into smaller strings (tokens). `token` The delimiter used when splitting up `string`. ### Return Values A string token, or **`false`** if no more tokens are available. ### Examples **Example #1 **strtok()** example** ``` <?php $string = "This is\tan example\nstring"; /* Use tab and newline as tokenizing characters as well  */ $tok = strtok($string, " \n\t"); while ($tok !== false) {     echo "Word=$tok<br />";     $tok = strtok(" \n\t"); } ?> ``` **Example #2 **strtok()** behavior on empty part found** ``` <?php $first_token  = strtok('/something', '/'); $second_token = strtok('/'); var_dump($first_token, $second_token); ?> ``` The above example will output: ``` string(9) "something" bool(false) ``` **Example #3 The difference between **strtok()** and [explode()](function.explode)** ``` <?php $string = ";aaa;;bbb;"; $parts = []; $tok = strtok($string, ";"); while ($tok !== false) {     $parts[] = $tok;     $tok = strtok(";"); } echo json_encode($parts),"\n"; $parts = explode(";", $string); echo json_encode($parts),"\n"; ``` The above example will output: ``` ["aaa","bbb"] ["","aaa","","bbb",""] ``` ### Notes **Warning**This function may return Boolean **`false`**, but may also return a non-Boolean value which evaluates to **`false`**. Please read the section on [Booleans](language.types.boolean) for more information. Use [the === operator](language.operators.comparison) for testing the return value of this function. ### See Also * [explode()](function.explode) - Split a string by a string php gmp_abs gmp\_abs ======== (PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8) gmp\_abs — Absolute value ### Description ``` gmp_abs(GMP|int|string $num): GMP ``` Get the absolute value of a number. ### Parameters `num` A [GMP](class.gmp) object, an int or a numeric string. ### Return Values Returns the absolute value of `num`, as a GMP number. ### Examples **Example #1 **gmp\_abs()** example** ``` <?php $abs1 = gmp_abs("274982683358"); $abs2 = gmp_abs("-274982683358"); echo gmp_strval($abs1) . "\n"; echo gmp_strval($abs2) . "\n"; ?> ``` The above example will output: ``` 274982683358 274982683358 ``` php EventListener::setErrorCallback EventListener::setErrorCallback =============================== (PECL event >= 1.2.6-beta) EventListener::setErrorCallback — Set event listener's error callback ### Description ``` public EventListener::setErrorCallback( string $cb ): void ``` Set event listener's error callback ### Parameters `cb` The error callback. Should match the following prototype: ``` callback( EventListener $listener = null , mixed $data = null ): void ``` `listener` The [EventListener](class.eventlistener) object. `data` User custom data attached to the callback. ### Return Values ### See Also * [EventListener::setCallback()](eventlistener.setcallback) - The setCallback purpose php ftp_login ftp\_login ========== (PHP 4, PHP 5, PHP 7, PHP 8) ftp\_login — Logs in to an FTP connection ### Description ``` ftp_login(FTP\Connection $ftp, string $username, string $password): bool ``` Logs in to the given FTP connection. ### Parameters `ftp` An [FTP\Connection](class.ftp-connection) instance. `username` The username (`USER`). `password` The password (`PASS`). ### Return Values Returns **`true`** on success or **`false`** on failure. If login fails, PHP will also throw a warning. ### Changelog | Version | Description | | --- | --- | | 8.1.0 | The `ftp` parameter expects an [FTP\Connection](class.ftp-connection) instance now; previously, a [resource](language.types.resource) was expected. | ### Examples **Example #1 **ftp\_login()** example** ``` <?php                       $ftp_server = "ftp.example.com"; $ftp_user = "foo"; $ftp_pass = "bar"; // set up a connection or die $ftp = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server");  // try to login if (@ftp_login($ftp, $ftp_user, $ftp_pass)) {     echo "Connected as $ftp_user@$ftp_server\n"; } else {     echo "Couldn't connect as $ftp_user\n"; } // close the connection ftp_close($ftp);   ?> ``` php SplDoublyLinkedList::pop SplDoublyLinkedList::pop ======================== (PHP 5 >= 5.3.0, PHP 7, PHP 8) SplDoublyLinkedList::pop — Pops a node from the end of the doubly linked list ### Description ``` public SplDoublyLinkedList::pop(): mixed ``` ### Parameters This function has no parameters. ### Return Values The value of the popped node. ### Errors/Exceptions Throws [RuntimeException](class.runtimeexception) when the data-structure is empty. php openssl_dh_compute_key openssl\_dh\_compute\_key ========================= (PHP 5 >= 5.3.0, PHP 7, PHP 8) openssl\_dh\_compute\_key — Computes shared secret for public value of remote DH public key and local DH key ### Description ``` openssl_dh_compute_key(string $public_key, OpenSSLAsymmetricKey $private_key): string|false ``` The shared secret returned by **openssl\_dh\_compute\_key()** is often used as an encryption key to secretly communicate with a remote party. This is known as the Diffie-Hellman key exchange. > **Note**: ECDH is only supported as of PHP 8.1.0 *and* OpenSSL 3.0.0. > > ### Parameters `public_key` DH Public key of the remote party. `private_key` A local DH private key, corresponding to the public key to be shared with the remote party. ### Return Values Returns shared secret on success or **`false`** on failure. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | `private_key` accepts an [OpenSSLAsymmetricKey](class.opensslasymmetrickey) now; previously, a [resource](language.types.resource) of type `OpenSSL key` was accepted. | ### Examples **Example #1 Compute a shared secret** First generate a public/private DH keypair locally, and have the remote party do the same. We need to use the `openssl` command-line utility. ``` # generate private/public key keypair openssl dhparam -out dhparam.pem 2048 openssl genpkey -paramfile dhparam.pem -out privatekey.pem # extract public key only openssl pkey -in privatekey.pem -pubout -out publickey.pem ``` Next, send your public key to the remote party. Use the `openssl pkey` command to view the public key you will be sent from the remote party. ``` openssl pkey -pubin -in remotepublickey.pem -text -noout ``` The above example will output something similar to: ``` PKCS#3 DH Public-Key: (2048 bit) public-key: 67:e5:e5:fa:e0:7b:0f:96:2c:dc:96:44:5f:50:02: 9e:8d:c2:6c:04:68:b0:d1:1d:75:66:fc:63:f5:e3: 42:30:b8:96:c1:45:cc:08:60:b4:21:3b:dd:ee:66: 88:db:77:d9:1e:11:89:d4:5c:f2:7a:f2:f1:fe:1c: 77:9d:6f:13:b8:b2:56:00:ef:cb:3b:60:79:74:02: 98:f5:f9:8e:3e:b5:62:08:de:ca:8c:c3:40:4a:80: 79:d5:43:06:17:a8:19:56:af:cc:95:5e:e2:32:2d: d2:14:7b:76:5a:9a:f1:3c:76:76:35:cc:7b:c1:a5: f4:39:e5:b6:ca:71:3f:7c:3f:97:e5:ab:86:c1:cd: 0e:e6:ee:04:c9:e6:2d:80:7e:59:c0:49:eb:b6:64: 4f:a8:f9:bb:a3:87:b3:3d:76:01:9e:2b:16:94:a4: 37:30:fb:35:e2:63:be:23:90:b9:ef:3f:46:46:04: 94:8f:60:79:7a:51:55:d6:1a:1d:f5:d9:7f:4a:3e: aa:ac:b0:d0:82:cc:c2:e0:94:e0:54:c1:17:83:0b: 74:08:4d:5a:79:ae:ff:7f:1c:04:ab:23:39:4a:ae: 87:83:55:43:ab:7a:7c:04:9d:20:80:bb:af:5f:16: a3:e3:20:b9:21:47:8c:f8:7f:a8:60:80:9e:61:77: 36 [...abbreviated...] ``` Use this public key as a parameter to **openssl\_dh\_compute\_key()** in order to compute the shared secret. ``` <?php $remote_public_key = '67e5e5fae07b0f962cdc96445f50029e8dc26c0468b0d11d7566fc63f5e34230b896c145cc0860b4213bddee6688db77d91e1189d45cf27af2f1fe1c779d6f13b8b25600efcb3b6079740298f5f98e3eb56208deca8cc3404a8079d5430617a81956afcc955ee2322dd2147b765a9af13c767635cc7bc1a5f439e5b6ca713f7c3f97e5ab86c1cd0ee6ee04c9e62d807e59c049ebb6644fa8f9bba387b33d76019e2b1694a43730fb35e263be2390b9ef3f464604948f60797a5155d61a1df5d97f4a3eaaacb0d082ccc2e094e054c117830b74084d5a79aeff7f1c04ab23394aae87835543ab7a7c049d2080bbaf5f16a3e320b921478cf87fa860809e617736'; $local_priv_key = openssl_pkey_get_private('file://privatekey.pem'); $shared_secret = openssl_dh_compute_key(hex2bin($remote_public_key), $local_priv_key); echo bin2hex($shared_secret)."\n"; ?> ``` **Example #2 Generate a DH public/private keypair in php** First, generate the DH prime number ``` openssl dhparam -out dhparam.pem 2048 openssl dh -in dhparam.pem -noout -text ``` The above example will output something similar to: ``` PKCS#3 DH Parameters: (2048 bit) prime: 00:a3:25:1e:73:3f:44:b9:2b:ee:f4:9d:9f:37:6a: 4b:fd:1d:bd:f4:af:da:c8:10:77:59:41:c6:5f:73: d2:88:29:39:cd:1c:5f:c3:9f:0f:22:d2:9c:20:c1: e4:c0:18:03:b8:b6:d8:da:ad:3b:39:a6:da:8e:fe: 12:30:e9:03:5d:22:ba:ef:18:d2:7b:69:f9:5b:cb: 78:c6:0c:8c:6b:f2:49:92:c2:49:e0:45:77:72:b3: 55:36:30:f2:40:17:89:18:50:03:fa:2d:54:7a:7f: 34:4c:73:32:b6:88:14:51:14:be:80:57:95:e6:a3: f6:51:ff:17:47:4f:15:d6:0e:6c:47:53:72:2c:2a: 4c:21:cb:7d:f3:49:97:c9:47:5e:40:33:7b:99:52: 7e:7a:f3:52:27:80:de:1b:26:6b:40:bb:14:11:0b: fb:e6:d8:2f:cf:a0:06:2f:96:b9:1c:0b:b4:cb:d3: a6:62:9c:48:67:f6:81:f2:c6:ff:45:03:0a:9d:67: 9d:ce:27:d9:6b:48:5d:ca:fb:c2:5d:84:9b:8b:cb: 40:c7:a4:0c:8a:6e:f4:ab:ba:b6:10:c3:b8:25:4d: cf:60:96:f4:db:e8:00:1c:58:47:7a:fb:51:86:d1: 22:d7:4e:94:31:7a:d5:da:3d:53:de:da:bb:64:8d: 62:6b generator: 2 (0x2) ``` Prime and generator values ares passed as p and g into [openssl\_pkey\_new()](function.openssl-pkey-new) ``` <?php $configargs = array(); $configargs['p'] = hex2bin('00a3251e733f44b92beef49d9f376a4bfd1dbdf4afdac810775941c65f73d2882939cd1c5fc39f0f22d29c20c1e4c01803b8b6d8daad3b39a6da8efe1230e9035d22baef18d27b69f95bcb78c60c8c6bf24992c249e0457772b3553630f2401789185003fa2d547a7f344c7332b688145114be805795e6a3f651ff17474f15d60e6c4753722c2a4c21cb7df34997c9475e40337b99527e7af3522780de1b266b40bb14110bfbe6d82fcfa0062f96b91c0bb4cbd3a6629c4867f681f2c6ff45030a9d679dce27d96b485dcafbc25d849b8bcb40c7a40c8a6ef4abbab610c3b8254dcf6096f4dbe8001c58477afb5186d122d74e94317ad5da3d53dedabb648d626b'); $configargs['g'] = hex2bin('02'); $private_key = openssl_pkey_new(array('dh' => $configargs)); openssl_pkey_export_to_file($private_key,'privatekey.pem',$passphrase='y0urp@s5phr@se'); $details = openssl_pkey_get_details($private_key); $local_pub_key = $details['dh']['pub_key']; echo bin2hex($local_pub_key)."\n";//you can send your public key to the remote party $details = openssl_pkey_get_details(openssl_pkey_get_public("file://remotepublickey.pem")); $remote_public_key = $details['dh']['pub_key']; $shared_secret = openssl_dh_compute_key($remote_public_key, $private_key); echo bin2hex($shared_secret)."\n"; ?> ``` ### See Also * [openssl\_pkey\_new()](function.openssl-pkey-new) - Generates a new private key * [openssl\_pkey\_get\_details()](function.openssl-pkey-get-details) - Returns an array with the key details * [openssl\_pkey\_get\_private()](function.openssl-pkey-get-private) - Get a private key * [openssl\_pkey\_get\_public()](function.openssl-pkey-get-public) - Extract public key from certificate and prepare it for use php ReflectionFunctionAbstract::getTentativeReturnType ReflectionFunctionAbstract::getTentativeReturnType ================================================== (PHP 8 >= 8.1.0) ReflectionFunctionAbstract::getTentativeReturnType — Returns the tentative return type associated with the function ### Description ``` public ReflectionFunctionAbstract::getTentativeReturnType(): ?ReflectionType ``` Returns the tentative return type associated with the function. ### Parameters This function has no parameters. ### Return Values Returns a [ReflectionType](class.reflectiontype) object if a tentative return type is specified, **`null`** otherwise. ### Examples **Example #1 **ReflectionFunctionAbstract::getTentativeReturnType()** example** ``` <?php $method = new ReflectionMethod(\ArrayAccess::class, 'offsetGet'); var_dump($method->getTentativeReturnType()); ``` The above example will output something similar to: ``` object(ReflectionNamedType)#2 (0) { } ``` ### See Also * [ReflectionFunctionAbstract::getReturnType()](reflectionfunctionabstract.getreturntype) - Gets the specified return type of a function * [ReflectionFunctionAbstract::hasTentativeReturnType()](reflectionfunctionabstract.hastentativereturntype) - Returns whether the function has a tentative return type * [Return Type Compatibility with Internal Classes](language.oop5.inheritance#language.oop5.inheritance.internal-classes) php PDO::inTransaction PDO::inTransaction ================== (PHP 5 >= 5.3.3, Bundled pdo\_pgsql, PHP 7, PHP 8) PDO::inTransaction — Checks if inside a transaction ### Description ``` public PDO::inTransaction(): bool ``` Checks if a transaction is currently active within the driver. This method only works for database drivers that support transactions. ### Parameters This function has no parameters. ### Return Values Returns **`true`** if a transaction is currently active, and **`false`** if not. php Ds\Map::hasKey Ds\Map::hasKey ============== (PECL ds >= 1.0.0) Ds\Map::hasKey — Determines whether the map contains a given key ### Description ``` public Ds\Map::hasKey(mixed $key): bool ``` Determines whether the map contains a given key. ### Parameters `key` The key to look for. ### Return Values Returns **`true`** if the key could found, **`false`** otherwise. ### Examples **Example #1 **Ds\Map::hasKey()** example** ``` <?php $map = new \Ds\Map(["a" => 1, "b" => 2, "c" => 3]); var_dump($map->hasKey("a")); // true var_dump($map->hasKey("e")); // false ?> ``` The above example will output something similar to: ``` bool(true) bool(false) ``` php password_algos password\_algos =============== (PHP 7 >= 7.4.0, PHP 8) password\_algos — Get available password hashing algorithm IDs ### Description ``` password_algos(): array ``` Returns a complete list of all registered password hashing algorithm IDs as an array of strings. ### Parameters This function has no parameters. ### Return Values Returns the available password hashing algorithm IDs. ### Examples **Example #1 Basic **password()** usage** ``` <?php print_r(password_algos()); ?> ``` The above example will output something similar to: ``` Array ( [0] => 2y [1] => argon2i [2] => argon2id ) ``` php each each ==== (PHP 4, PHP 5, PHP 7) each — Return the current key and value pair from an array and advance the array cursor **Warning**This function has been *DEPRECATED* as of PHP 7.2.0, and *REMOVED* as of PHP 8.0.0. Relying on this function is highly discouraged. ### Description ``` each(array|object &$array): array ``` Return the current key and value pair from an array and advance the array cursor. After **each()** has executed, the array cursor will be left on the next element of the array, or past the last element if it hits the end of the array. You have to use [reset()](function.reset) if you want to traverse the array again using each. ### Parameters `array` The input array. ### Return Values Returns the current key and value pair from the array `array`. This pair is returned in a four-element array, with the keys `0`, `1`, `key`, and `value`. Elements `0` and `key` contain the key name of the array element, and `1` and `value` contain the data. If the internal pointer for the array points past the end of the array contents, **each()** returns **`false`**. ### Examples **Example #1 **each()** examples** ``` <?php $foo = array("bob", "fred", "jussi", "jouni", "egon", "marliese"); $bar = each($foo); print_r($bar); ?> ``` $bar now contains the following key/value pairs: ``` Array ( [1] => bob [value] => bob [0] => 0 [key] => 0 ) ``` ``` <?php $foo = array("Robert" => "Bob", "Seppo" => "Sepi"); $bar = each($foo); print_r($bar); ?> ``` $bar now contains the following key/value pairs: ``` Array ( [1] => Bob [value] => Bob [0] => Robert [key] => Robert ) ``` **each()** is typically used in conjunction with [list()](function.list) to traverse an array, here's an example: **Example #2 Traversing an array with **each()**** ``` <?php $fruit = array('a' => 'apple', 'b' => 'banana', 'c' => 'cranberry'); reset($fruit); while (list($key, $val) = each($fruit)) {     echo "$key => $val\n"; } ?> ``` The above example will output: ``` a => apple b => banana c => cranberry ``` **Caution** Because assigning an array to another variable resets the original array's pointer, our example above would cause an endless loop had we assigned $fruit to another variable inside the loop. **Warning** **each()** will also accept objects, but may return unexpected results. It's therefore not recommended to iterate though object properties with **each()**. ### See Also * [key()](function.key) - Fetch a key from an array * [list()](function.list) - Assign variables as if they were an array * [current()](function.current) - Return the current element in an array * [reset()](function.reset) - Set the internal pointer of an array to its first element * [next()](function.next) - Advance the internal pointer of an array * [prev()](function.prev) - Rewind the internal array pointer * [foreach](control-structures.foreach) * [Object Iteration](language.oop5.iterations)
programming_docs
php Imagick::motionBlurImage Imagick::motionBlurImage ======================== (PECL imagick 2, PECL imagick 3) Imagick::motionBlurImage — Simulates motion blur ### Description ``` public Imagick::motionBlurImage( float $radius, float $sigma, float $angle, int $channel = Imagick::CHANNEL_DEFAULT ): bool ``` Simulates motion blur. We convolve the image with a Gaussian operator of the given radius and standard deviation (sigma). For reasonable results, radius should be larger than sigma. Use a radius of 0 and MotionBlurImage() selects a suitable radius for you. Angle gives the angle of the blurring motion. ### Parameters `radius` The radius of the Gaussian, in pixels, not counting the center pixel. `sigma` The standard deviation of the Gaussian, in pixels. `angle` Apply the effect along this angle. `channel` Provide any channel constant that is valid for your channel mode. To apply to more than one channel, combine channeltype constants using bitwise operators. Refer to this list of [channel constants](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.channel). The channel argument affects only if Imagick is compiled against ImageMagick version 6.4.4 or greater. ### Return Values Returns **`true`** on success. ### Examples **Example #1 **Imagick::motionBlurImage()**** ``` <?php function motionBlurImage($imagePath, $radius, $sigma, $angle, $channel) {     $imagick = new \Imagick(realpath($imagePath));     $imagick->motionBlurImage($radius, $sigma, $angle, $channel);     header("Content-Type: image/jpg");     echo $imagick->getImageBlob(); } ?> ``` php Imagick::setImageOpacity Imagick::setImageOpacity ======================== (PECL imagick 2, PECL imagick 3) Imagick::setImageOpacity — Sets the image opacity level **Warning**This function has been *DEPRECATED* as of Imagick 3.4.4. Relying on this function is highly discouraged. ### Description ``` public Imagick::setImageOpacity(float $opacity): bool ``` Sets the image to the specified opacity level. This method is available if Imagick has been compiled against ImageMagick version 6.3.1 or newer. This method operates on all channels, which means that for example opacity value of 0.5 will set all transparent areas to partially opaque. To add transparency to areas that are not already transparent use [Imagick::evaluateImage()](imagick.evaluateimage) ### Parameters `opacity` The level of transparency: 1.0 is fully opaque and 0.0 is fully transparent. ### Return Values Returns **`true`** on success. ### Examples **Example #1 A **Imagick::setImageOpacity()** example** An example of using Imagick::setImageOpacity() ``` <?php /* Create the object */ $image = new Imagick('source.png'); /* Set the opacity */ $image->setImageOpacity(0.7); /* output the image */ header('Content-type: image/png'); echo $image; ?> ``` php ibase_blob_get ibase\_blob\_get ================ (PHP 5, PHP 7 < 7.4.0) ibase\_blob\_get — Get len bytes data from open blob ### Description ``` ibase_blob_get(resource $blob_handle, int $len): string ``` This function returns at most `len` bytes from a BLOB that has been opened for reading by [ibase\_blob\_open()](function.ibase-blob-open). > > **Note**: > > > It is not possible to read from a BLOB that has been opened for writing by [ibase\_blob\_create()](function.ibase-blob-create). > > ### Parameters `blob_handle` A BLOB handle opened with [ibase\_blob\_open()](function.ibase-blob-open). `len` Size of returned data. ### Return Values Returns at most `len` bytes from the BLOB, or **`false`** on failure. ### Examples **Example #1 **ibase\_blob\_get()** example** ``` <?php $result    = ibase_query("SELECT blob_value FROM table"); $data      = ibase_fetch_object($result); $blob_data = ibase_blob_info($data->BLOB_VALUE); $blob_hndl = ibase_blob_open($data->BLOB_VALUE); echo         ibase_blob_get($blob_hndl, $blob_data[0]); ?> ``` Whilst this example doesn't do much more than a 'ibase\_blob\_echo($data->BLOB\_VALUE)' would do, it does show you how to get information into a $variable to manipulate as you please. ### See Also * [ibase\_blob\_open()](function.ibase-blob-open) - Open blob for retrieving data parts * [ibase\_blob\_close()](function.ibase-blob-close) - Close blob * [ibase\_blob\_echo()](function.ibase-blob-echo) - Output blob contents to browser php ibase_blob_cancel ibase\_blob\_cancel =================== (PHP 5, PHP 7 < 7.4.0) ibase\_blob\_cancel — Cancel creating blob ### Description ``` ibase_blob_cancel(resource $blob_handle): bool ``` This function will discard a BLOB if it has not yet been closed by [ibase\_blob\_close()](function.ibase-blob-close). ### Parameters `blob_handle` A BLOB handle opened with [ibase\_blob\_create()](function.ibase-blob-create). ### Return Values Returns **`true`** on success or **`false`** on failure. ### See Also * [ibase\_blob\_close()](function.ibase-blob-close) - Close blob * [ibase\_blob\_create()](function.ibase-blob-create) - Create a new blob for adding data * [ibase\_blob\_import()](function.ibase-blob-import) - Create blob, copy file in it, and close it php array_diff_key array\_diff\_key ================ (PHP 5 >= 5.1.0, PHP 7, PHP 8) array\_diff\_key — Computes the difference of arrays using keys for comparison ### Description ``` array_diff_key(array $array, array ...$arrays): array ``` Compares the keys from `array` against the keys from `arrays` and returns the difference. This function is like [array\_diff()](function.array-diff) except the comparison is done on the keys instead of the values. ### Parameters `array` The array to compare from `arrays` Arrays to compare against ### Return Values Returns an array containing all the entries from `array` whose keys are absent from all of the other arrays. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | This function can now be called with only one parameter. Formerly, at least two parameters have been required. | ### Examples **Example #1 **array\_diff\_key()** example** The two keys from the `key => value` pairs are considered equal only if `(string) $key1 === (string) $key2` . In other words a strict type check is executed so the string representation must be the same. ``` <?php $array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4); $array2 = array('green' => 5, 'yellow' => 7, 'cyan' => 8); var_dump(array_diff_key($array1, $array2)); ?> ``` The above example will output: ``` array(3) { ["blue"]=> int(1) ["red"]=> int(2) ["purple"]=> int(4) } ``` ``` <?php $array1 = array('blue' => 1, 'red'  => 2, 'green' => 3, 'purple' => 4); $array2 = array('green' => 5, 'yellow' => 7, 'cyan' => 8); $array3 = array('blue' => 6, 'yellow' => 7, 'mauve' => 8); var_dump(array_diff_key($array1, $array2, $array3)); ?> ``` The above example will output: ``` array(2) { ["red"]=> int(2) ["purple"]=> int(4) } ``` ### Notes > > **Note**: > > > This function only checks one dimension of a n-dimensional array. Of course you can check deeper dimensions by using `array_diff_key($array1[0], $array2[0]);`. > > ### See Also * [array\_diff()](function.array-diff) - Computes the difference of arrays * [array\_udiff()](function.array-udiff) - Computes the difference of arrays by using a callback function for data comparison * [array\_diff\_assoc()](function.array-diff-assoc) - Computes the difference of arrays with additional index check * [array\_diff\_uassoc()](function.array-diff-uassoc) - Computes the difference of arrays with additional index check which is performed by a user supplied callback function * [array\_udiff\_assoc()](function.array-udiff-assoc) - Computes the difference of arrays with additional index check, compares data by a callback function * [array\_udiff\_uassoc()](function.array-udiff-uassoc) - Computes the difference of arrays with additional index check, compares data and indexes by a callback function * [array\_diff\_ukey()](function.array-diff-ukey) - Computes the difference of arrays using a callback function on the keys for comparison * [array\_intersect()](function.array-intersect) - Computes the intersection of arrays * [array\_intersect\_assoc()](function.array-intersect-assoc) - Computes the intersection of arrays with additional index check * [array\_intersect\_uassoc()](function.array-intersect-uassoc) - Computes the intersection of arrays with additional index check, compares indexes by a callback function * [array\_intersect\_key()](function.array-intersect-key) - Computes the intersection of arrays using keys for comparison * [array\_intersect\_ukey()](function.array-intersect-ukey) - Computes the intersection of arrays using a callback function on the keys for comparison php svn_delete svn\_delete =========== (PECL svn >= 0.4.0) svn\_delete — Delete items from a working copy or repository ### Description ``` svn_delete(string $path, bool $force = false): bool ``` Deletes the file, directory or symbolic link at `path` from the working directory. The item will be deleted from the repository the next time you call [svn\_commit()](function.svn-commit) on the working copy. ### Parameters `path` Path of item to delete. > **Note**: Relative paths will be resolved as if the current working directory was the one that contains the PHP binary. To use the calling script's working directory, use [realpath()](function.realpath) or dirname(\_\_FILE\_\_). > > `force` If **`true`**, the file will be deleted even if it has local modifications. Otherwise, local modifications will result in a failure. Default is **`false`** ### Return Values Returns **`true`** on success or **`false`** on failure. ### Notes **Warning**This function is *EXPERIMENTAL*. The behaviour of this function, its name, and surrounding documentation may change without notice in a future release of PHP. This function should be used at your own risk. ### See Also * [» SVN documentation on svn delete](http://svnbook.red-bean.com/en/1.2/svn.ref.svn.c.delete.html) php ssh2_send_eof ssh2\_send\_eof =============== (PECL ssh2 >= 1.3) ssh2\_send\_eof — Send EOF to stream ### Description ``` ssh2_send_eof(resource $channel): bool ``` Sends an EOF to the stream; this is typically used to close standard input, while keeping output and error alive. For example, one can send a remote process some data over standard input, close it to start processing, and still be able to read out the results without creating additional files. ### Parameters `channel` An SSH stream; can be acquired through functions like [ssh2\_fetch\_stream()](function.ssh2-fetch-stream) or [ssh2\_connect()](function.ssh2-connect). ### Return Values Returns **`true`** on success or **`false`** on failure. ### See Also * [ssh2\_fetch\_stream()](function.ssh2-fetch-stream) - Fetch an extended data stream php lzf_decompress lzf\_decompress =============== (PECL lzf >= 0.1.0) lzf\_decompress — LZF decompression ### Description ``` lzf_decompress(string $data): string ``` [lzf\_compress()](function.lzf-compress) decompresses the given `data` string containing lzf encoded data. ### Parameters `data` The compressed string. ### Return Values Returns the decompressed data or **`false`** if an error occurred. ### See Also * [lzf\_compress()](function.lzf-compress) - LZF compression php join join ==== (PHP 4, PHP 5, PHP 7, PHP 8) join — Alias of [implode()](function.implode) ### Description This function is an alias of: [implode()](function.implode). php Imagick::resizeImage Imagick::resizeImage ==================== (PECL imagick 2, PECL imagick 3) Imagick::resizeImage — Scales an image ### Description ``` public Imagick::resizeImage( int $columns, int $rows, int $filter, float $blur, bool $bestfit = false, bool $legacy = false ): bool ``` Scales an image to the desired dimensions with a [filter](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.filters). > **Note**: The behavior of the parameter `bestfit` changed in Imagick 3.0.0. Before this version given dimensions 400x400 an image of dimensions 200x150 would be left untouched. In Imagick 3.0.0 and later the image would be scaled up to size 400x300 as this is the "best fit" for the given dimensions. If `bestfit` parameter is used both width and height must be given. > > ### Parameters `columns` Width of the image `rows` Height of the image `filter` Refer to the list of [filter constants](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.filters). `blur` The blur factor where > 1 is blurry, < 1 is sharp. `bestfit` Optional fit parameter. ### Return Values Returns **`true`** on success. ### Changelog | Version | Description | | --- | --- | | PECL imagick 2.1.0 | Added optional fit parameter. This method now supports proportional scaling. Pass zero as either parameter for proportional scaling. | ### Examples **Example #1 **Imagick::resizeImage()**** ``` <?php function resizeImage($imagePath, $width, $height, $filterType, $blur, $bestFit, $cropZoom) {     //The blur factor where > 1 is blurry, < 1 is sharp.     $imagick = new \Imagick(realpath($imagePath));     $imagick->resizeImage($width, $height, $filterType, $blur, $bestFit);     $cropWidth = $imagick->getImageWidth();     $cropHeight = $imagick->getImageHeight();     if ($cropZoom) {         $newWidth = $cropWidth / 2;         $newHeight = $cropHeight / 2;         $imagick->cropimage(             $newWidth,             $newHeight,             ($cropWidth - $newWidth) / 2,             ($cropHeight - $newHeight) / 2         );         $imagick->scaleimage(             $imagick->getImageWidth() * 4,             $imagick->getImageHeight() * 4         );     }     header("Content-Type: image/jpg");     echo $imagick->getImageBlob(); } ?> ``` php eio_ftruncate eio\_ftruncate ============== (PECL eio >= 0.0.1dev) eio\_ftruncate — Truncate a file ### Description ``` eio_ftruncate( mixed $fd, int $offset = 0, int $pri = EIO_PRI_DEFAULT, callable $callback = NULL, mixed $data = NULL ): resource ``` **eio\_ftruncate()** causes a regular file referenced by `fd` file descriptor to be truncated to precisely `length` bytes. ### Parameters `fd` Stream, Socket resource, or numeric file descriptor. `offset` Offset from beginning of the file `pri` The request priority: **`EIO_PRI_DEFAULT`**, **`EIO_PRI_MIN`**, **`EIO_PRI_MAX`**, or **`null`**. If **`null`** passed, `pri` internally is set to **`EIO_PRI_DEFAULT`**. `callback` `callback` function is called when the request is done. It should match the following prototype: ``` void callback(mixed $data, int $result[, resource $req]); ``` `data` is custom data passed to the request. `result` request-specific result value; basically, the value returned by corresponding system call. `req` is optional request resource which can be used with functions like [eio\_get\_last\_error()](function.eio-get-last-error) `data` Arbitrary variable passed to `callback`. ### Return Values **eio\_ftruncate()** returns request resource on success, or **`false`** on failure. ### See Also * [eio\_truncate()](function.eio-truncate) - Truncate a file php mb_ereg mb\_ereg ======== (PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8) mb\_ereg — Regular expression match with multibyte support ### Description ``` mb_ereg(string $pattern, string $string, array &$matches = null): bool ``` Executes the regular expression match with multibyte support. ### Parameters `pattern` The search pattern. `string` The search string. `matches` If matches are found for parenthesized substrings of `pattern` and the function is called with the third argument `matches`, the matches will be stored in the elements of the array `matches`. If no matches are found, `matches` is set to an empty array. $matches[1] will contain the substring which starts at the first left parenthesis; $matches[2] will contain the substring starting at the second, and so on. $matches[0] will contain a copy of the complete string matched. ### Return Values Returns whether `pattern` matches `string`. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | This function returns **`true`** on success now. Previously, it returned the byte length of the matched string if a match for `pattern` was found in `string` and `matches` was passed. If the optional parameter `matches` was not passed or the length of the matched string was `0`, this function returned `1`. | | 7.1.0 | **mb\_ereg()** will now set `matches` to an empty array, if nothing matched. Formerly, `matches` was not modified in that case. | ### Notes > > **Note**: > > > The internal encoding or the character encoding specified by [mb\_regex\_encoding()](function.mb-regex-encoding) will be used as the character encoding for this function. > > > ### See Also * [mb\_regex\_encoding()](function.mb-regex-encoding) - Set/Get character encoding for multibyte regex * [mb\_eregi()](function.mb-eregi) - Regular expression match ignoring case with multibyte support php BackedEnum::tryFrom BackedEnum::tryFrom =================== (PHP 8 >= 8.1.0) BackedEnum::tryFrom — Maps a scalar to an enum instance or null ### Description ``` public static BackedEnum::tryFrom(int|string $value): ?static ``` The **tryFrom()** method translates a string or int into the corresponding Enum case, if any. If there is no matching case defined, it will return null. ### Parameters `value` The scalar value to map to an enum case. ### Return Values A case instance of this enumeration, or null if not found. ### Examples **Example #1 Basic usage** The following example illustrates how enum cases are returned. ``` <?php enum Suit: string {     case Hearts = 'H';     case Diamonds = 'D';     case Clubs = 'C';     case Spades = 'S'; } $h = Suit::tryFrom('H'); var_dump($h); $b = Suit::tryFrom('B') ?? Suit::Spades; var_dump($b); ?> ``` The above example will output: ``` enum(Suit::Hearts) enum(Suit::Spades) ``` ### See Also * [UnitEnum::cases()](unitenum.cases) - Generates a list of cases on an enum * [BackedEnum::from()](backedenum.from) - Maps a scalar to an enum instance php Ds\Stack::push Ds\Stack::push ============== (PECL ds >= 1.0.0) Ds\Stack::push — Pushes values onto the stack ### Description ``` public Ds\Stack::push(mixed ...$values): void ``` Pushes `values` onto the stack. ### Parameters `values` The values to push onto the stack. ### Return Values No value is returned. ### Examples **Example #1 **Ds\Stack::push()** example** ``` <?php $stack = new \Ds\Stack(); $stack->push("a"); $stack->push("b"); $stack->push("c", "d"); $stack->push(...["e", "f"]); print_r($stack); ?> ``` The above example will output something similar to: ``` Ds\Stack Object ( [0] => a [1] => b [2] => c [3] => d [4] => e [5] => f ) ``` php ReflectionProperty::isReadOnly ReflectionProperty::isReadOnly ============================== (PHP 8 >= 8.1.0) ReflectionProperty::isReadOnly — Checks if property is readonly ### Description ``` public ReflectionProperty::isReadOnly(): bool ``` Checks whether the [property is readonly](language.oop5.properties#language.oop5.properties.readonly-properties). ### Parameters This function has no parameters. ### Return Values **`true`** if the property is readonly, **`false`** otherwise. ### See Also * [ReflectionProperty::isPublic()](reflectionproperty.ispublic) - Checks if property is public * [ReflectionProperty::isProtected()](reflectionproperty.isprotected) - Checks if property is protected * [ReflectionProperty::isPrivate()](reflectionproperty.isprivate) - Checks if property is private * [ReflectionProperty::isStatic()](reflectionproperty.isstatic) - Checks if property is static
programming_docs
php Imagick::getImagePixelColor Imagick::getImagePixelColor =========================== (PECL imagick 2, PECL imagick 3) Imagick::getImagePixelColor — Returns the color of the specified pixel ### Description ``` public Imagick::getImagePixelColor(int $x, int $y): ImagickPixel ``` Returns the color of the specified pixel. ### Parameters `x` The x-coordinate of the pixel `y` The y-coordinate of the pixel ### Return Values Returns an ImagickPixel instance for the color at the coordinates given. ### Errors/Exceptions Throws ImagickException on error. php openal_source_set openal\_source\_set =================== (PECL openal >= 0.1.0) openal\_source\_set — Set source property ### Description ``` openal_source_set(resource $source, int $property, mixed $setting): bool ``` ### Parameters `source` An [Open AL(Source)](https://www.php.net/manual/en/openal.resources.php) resource (previously created by [openal\_source\_create()](function.openal-source-create)). `property` Property to set, one of: **`AL_BUFFER`** (OpenAL(Source)), **`AL_LOOPING`** (bool), **`AL_SOURCE_RELATIVE`** (int), **`AL_SOURCE_STATE`** (int), **`AL_PITCH`** (float), **`AL_GAIN`** (float), **`AL_MIN_GAIN`** (float), **`AL_MAX_GAIN`** (float), **`AL_MAX_DISTANCE`** (float), **`AL_ROLLOFF_FACTOR`** (float), **`AL_CONE_OUTER_GAIN`** (float), **`AL_CONE_INNER_ANGLE`** (float), **`AL_CONE_OUTER_ANGLE`** (float), **`AL_REFERENCE_DISTANCE`** (float), **`AL_POSITION`** (array(float,float,float)), **`AL_VELOCITY`** (array(float,float,float)), **`AL_DIRECTION`** (array(float,float,float)). `setting` Value to assign to specified `property`. Refer to the description of `property` for a description of the value(s) expected. ### Return Values Returns **`true`** on success or **`false`** on failure. ### See Also * [openal\_source\_create()](function.openal-source-create) - Generate a source resource * [openal\_source\_get()](function.openal-source-get) - Retrieve an OpenAL source property * [openal\_source\_play()](function.openal-source-play) - Start playing the source php simplexml_load_string simplexml\_load\_string ======================= (PHP 5, PHP 7, PHP 8) simplexml\_load\_string — Interprets a string of XML into an object ### Description ``` simplexml_load_string( string $data, ?string $class_name = SimpleXMLElement::class, int $options = 0, string $namespace_or_prefix = "", bool $is_prefix = false ): SimpleXMLElement|false ``` Takes a well-formed XML string and returns it as an object. ### Parameters `data` A well-formed XML string `class_name` You may use this optional parameter so that **simplexml\_load\_string()** will return an object of the specified class. That class should extend the [SimpleXMLElement](class.simplexmlelement) class. `options` Since Libxml 2.6.0, you may also use the `options` parameter to specify [additional Libxml parameters](https://www.php.net/manual/en/libxml.constants.php). `namespace_or_prefix` Namespace prefix or URI. `is_prefix` **`true`** if `namespace_or_prefix` is a prefix, **`false`** if it's a URI; defaults to **`false`**. ### Return Values Returns an object of class [SimpleXMLElement](class.simplexmlelement) with properties containing the data held within the xml document, or **`false`** on failure. **Warning**This function may return Boolean **`false`**, but may also return a non-Boolean value which evaluates to **`false`**. Please read the section on [Booleans](language.types.boolean) for more information. Use [the === operator](language.operators.comparison) for testing the return value of this function. ### Errors/Exceptions Produces an **`E_WARNING`** error message for each error found in the XML data. **Tip** Use [libxml\_use\_internal\_errors()](function.libxml-use-internal-errors) to suppress all XML errors, and [libxml\_get\_errors()](function.libxml-get-errors) to iterate over them afterwards. ### Examples **Example #1 Interpret an XML string** ``` <?php $string = <<<XML <?xml version='1.0'?>  <document>  <title>Forty What?</title>  <from>Joe</from>  <to>Jane</to>  <body>   I know that's the answer -- but what's the question?  </body> </document> XML; $xml = simplexml_load_string($string); print_r($xml); ?> ``` The above example will output: ``` SimpleXMLElement Object ( [title] => Forty What? [from] => Joe [to] => Jane [body] => I know that's the answer -- but what's the question? ) ``` At this point, you can go about using `$xml->body` and such. ### See Also * [simplexml\_load\_file()](function.simplexml-load-file) - Interprets an XML file into an object * [SimpleXMLElement::\_\_construct()](simplexmlelement.construct) - Creates a new SimpleXMLElement object * [Dealing with XML errors](https://www.php.net/manual/en/simplexml.examples-errors.php) * [libxml\_use\_internal\_errors()](function.libxml-use-internal-errors) - Disable libxml errors and allow user to fetch error information as needed * [Basic SimpleXML usage](https://www.php.net/manual/en/simplexml.examples-basic.php) php odbc_fetch_into odbc\_fetch\_into ================= (PHP 4, PHP 5, PHP 7, PHP 8) odbc\_fetch\_into — Fetch one result row into array ### Description ``` odbc_fetch_into(resource $statement, array &$array, int $row = 0): int|false ``` Fetch one result row into array. ### Parameters `statement` The result resource. `array` The result array that can be of any type since it will be converted to type array. The array will contain the column values starting at array index 0. `row` The row number. ### Return Values Returns the number of columns in the result; **`false`** on error. ### Examples **Example #1 **odbc\_fetch\_into()** examples** ``` <?php $rc = odbc_fetch_into($res_id, $my_array); ?> ``` or ``` <?php $rc = odbc_fetch_into($res_id, $my_array, 2); ?> ``` php ReflectionClass::getReflectionConstant ReflectionClass::getReflectionConstant ====================================== (PHP 7 >= 7.1.0, PHP 8) ReflectionClass::getReflectionConstant — Gets a [ReflectionClassConstant](class.reflectionclassconstant) for a class's constant ### Description ``` public ReflectionClass::getReflectionConstant(string $name): ReflectionClassConstant|false ``` Gets a [ReflectionClassConstant](class.reflectionclassconstant) for a class's property. ### Parameters `name` The class constant name. ### Return Values A [ReflectionClassConstant](class.reflectionclassconstant), or **`false`** on failure. ### See Also * [ReflectionClass::getReflectionConstants()](reflectionclass.getreflectionconstants) - Gets class constants * [ReflectionClassConstant](class.reflectionclassconstant) php error_get_last error\_get\_last ================ (PHP 5 >= 5.2.0, PHP 7, PHP 8) error\_get\_last — Get the last occurred error ### Description ``` error_get_last(): ?array ``` Gets information about the last error that occurred. ### Parameters This function has no parameters. ### Return Values Returns an associative array describing the last error with keys "type", "message", "file" and "line". If the error has been caused by a PHP internal function then the "message" begins with its name. Returns **`null`** if there hasn't been an error yet. ### Examples **Example #1 An **error\_get\_last()** example** ``` <?php echo $a; print_r(error_get_last()); ?> ``` The above example will output something similar to: ``` Array ( [type] => 8 [message] => Undefined variable: a [file] => C:\WWW\index.php [line] => 2 ) ``` ### See Also * [Error constants](https://www.php.net/manual/en/errorfunc.constants.php) * Variable [$php\_errormsg](reserved.variables.phperrormsg) * [error\_clear\_last()](function.error-clear-last) - Clear the most recent error * [Directive `display_errors`](https://www.php.net/manual/en/errorfunc.configuration.php#ini.display-errors) * [Directive `html_errors`](https://www.php.net/manual/en/errorfunc.configuration.php#ini.html-errors) * [Directive `xmlrpc_errors`](https://www.php.net/manual/en/errorfunc.configuration.php#ini.xmlrpc-errors) php The ZookeeperException class The ZookeeperException class ============================ Introduction ------------ (PECL zookeeper >= 0.3.0) The ZooKeeper exception handling class. Class synopsis -------------- class **ZookeeperException** extends [Exception](class.exception) { /\* Inherited properties \*/ protected string [$message](class.exception#exception.props.message) = ""; private string [$string](class.exception#exception.props.string) = ""; protected int [$code](class.exception#exception.props.code); protected string [$file](class.exception#exception.props.file) = ""; protected int [$line](class.exception#exception.props.line); private array [$trace](class.exception#exception.props.trace) = []; private ?[Throwable](class.throwable) [$previous](class.exception#exception.props.previous) = null; /\* Inherited methods \*/ ``` final public Exception::getMessage(): string ``` ``` final public Exception::getPrevious(): ?Throwable ``` ``` final public Exception::getCode(): int ``` ``` final public Exception::getFile(): string ``` ``` final public Exception::getLine(): int ``` ``` final public Exception::getTrace(): array ``` ``` final public Exception::getTraceAsString(): string ``` ``` public Exception::__toString(): string ``` ``` private Exception::__clone(): void ``` } php geoip_netspeedcell_by_name geoip\_netspeedcell\_by\_name ============================= (PECL geoip >= 1.1.0) geoip\_netspeedcell\_by\_name — Get the Internet connection speed ### Description ``` geoip_netspeedcell_by_name(string $hostname): string ``` The **geoip\_netspeedcell\_by\_name()** function will return the Internet connection type and speed corresponding to a hostname or an IP address. This function is only available if using GeoIP Library version 1.4.8 or newer. This function is currently only available to users who have bought a commercial GeoIP NetSpeedCell Edition. A warning will be issued if the proper database cannot be located. The return value is a string, common values are: * Cable/DSL * Dialup * Cellular * Corporate ### Parameters `hostname` The hostname or IP address. ### Return Values Returns the connection speed on success, or **`false`** if the address cannot be found in the database. ### Examples **Example #1 A **geoip\_netspeedcell\_by\_name()** example** This will output the connection speed of the host example.com. ``` <?php $netspeed = geoip_netspeedcell_by_name('www.example.com'); if ($netspeed) {     echo 'The connection type is: '. $netspeed; } ?> ``` The above example will output: ``` The connection type is: Corporate ``` php ArrayAccess::offsetExists ArrayAccess::offsetExists ========================= (PHP 5, PHP 7, PHP 8) ArrayAccess::offsetExists — Whether an offset exists ### Description ``` public ArrayAccess::offsetExists(mixed $offset): bool ``` Whether or not an offset exists. This method is executed when using [isset()](function.isset) or [empty()](function.empty) on objects implementing [ArrayAccess](class.arrayaccess). > > **Note**: > > > When using [empty()](function.empty) [ArrayAccess::offsetGet()](arrayaccess.offsetget) will be called and checked if empty only if **ArrayAccess::offsetExists()** returns **`true`**. > > ### Parameters `offset` An offset to check for. ### Return Values Returns **`true`** on success or **`false`** on failure. > > **Note**: > > > The return value will be casted to bool if non-boolean was returned. > > ### Examples **Example #1 **ArrayAccess::offsetExists()** example** ``` <?php class obj implements arrayaccess {     public function offsetSet($offset, $value): void {         var_dump(__METHOD__);     }     public function offsetExists($var): bool {         var_dump(__METHOD__);         if ($var == "foobar") {             return true;         }         return false;     }     public function offsetUnset($var): void {         var_dump(__METHOD__);     }     #[ReturnTypeWillChange]     public function offsetGet($var) {         var_dump(__METHOD__);         return "value";     } } $obj = new obj; echo "Runs obj::offsetExists()\n"; var_dump(isset($obj["foobar"])); echo "\nRuns obj::offsetExists() and obj::offsetGet()\n"; var_dump(empty($obj["foobar"])); echo "\nRuns obj::offsetExists(), *not* obj:offsetGet() as there is nothing to get\n"; var_dump(empty($obj["foobaz"])); ?> ``` The above example will output something similar to: ``` Runs obj::offsetExists() string(17) "obj::offsetExists" bool(true) Runs obj::offsetExists() and obj::offsetGet() string(17) "obj::offsetExists" string(14) "obj::offsetGet" bool(false) Runs obj::offsetExists(), *not* obj:offsetGet() as there is nothing to get string(17) "obj::offsetExists" bool(true) ``` php Exceptions Exceptions ========== Table of Contents ----------------- * [Extending Exceptions](language.exceptions.extending) PHP has an exception model similar to that of other programming languages. An exception can be [`throw`](language.exceptions)n, and caught ("[`catch`](language.exceptions)ed") within PHP. Code may be surrounded in a [`try`](language.exceptions) block, to facilitate the catching of potential exceptions. Each [`try`](language.exceptions) must have at least one corresponding [`catch`](language.exceptions) or [`finally`](language.exceptions) block. If an exception is thrown and its current function scope has no [`catch`](language.exceptions) block, the exception will "bubble up" the call stack to the calling function until it finds a matching [`catch`](language.exceptions) block. All [`finally`](language.exceptions) blocks it encounters along the way will be executed. If the call stack is unwound all the way to the global scope without encountering a matching [`catch`](language.exceptions) block, the program will terminate with a fatal error unless a global exception handler has been set. The thrown object must be an [`instanceof`](language.operators.type) [Throwable](class.throwable). Trying to throw an object that is not will result in a PHP Fatal Error. As of PHP 8.0.0, the [`throw`](language.exceptions) keyword is an expression and may be used in any expression context. In prior versions it was a statement and was required to be on its own line. `catch` ------- A [`catch`](language.exceptions) block defines how to respond to a thrown exception. A [`catch`](language.exceptions) block defines one or more types of exception or error it can handle, and optionally a variable to which to assign the exception. (The variable was required prior to PHP 8.0.0.) The first [`catch`](language.exceptions) block a thrown exception or error encounters that matches the type of the thrown object will handle the object. Multiple [`catch`](language.exceptions) blocks can be used to catch different classes of exceptions. Normal execution (when no exception is thrown within the [`try`](language.exceptions) block) will continue after that last [`catch`](language.exceptions) block defined in sequence. Exceptions can be [`throw`](language.exceptions)n (or re-thrown) within a [`catch`](language.exceptions) block. If not, execution will continue after the [`catch`](language.exceptions) block that was triggered. When an exception is thrown, code following the statement will not be executed, and PHP will attempt to find the first matching [`catch`](language.exceptions) block. If an exception is not caught, a PHP Fatal Error will be issued with an "`Uncaught Exception ...`" message, unless a handler has been defined with [set\_exception\_handler()](function.set-exception-handler). As of PHP 7.1.0, a [`catch`](language.exceptions) block may specify multiple exceptions using the pipe (`|`) character. This is useful for when different exceptions from different class hierarchies are handled the same. As of PHP 8.0.0, the variable name for a caught exception is optional. If not specified, the [`catch`](language.exceptions) block will still execute but will not have access to the thrown object. `finally` --------- A [`finally`](language.exceptions) block may also be specified after or instead of [`catch`](language.exceptions) blocks. Code within the [`finally`](language.exceptions) block will always be executed after the [`try`](language.exceptions) and [`catch`](language.exceptions) blocks, regardless of whether an exception has been thrown, and before normal execution resumes. One notable interaction is between the [`finally`](language.exceptions) block and a [`return`](function.return) statement. If a [`return`](function.return) statement is encountered inside either the [`try`](language.exceptions) or the [`catch`](language.exceptions) blocks, the [`finally`](language.exceptions) block will still be executed. Moreover, the [`return`](function.return) statement is evaluated when encountered, but the result will be returned after the [`finally`](language.exceptions) block is executed. Additionally, if the [`finally`](language.exceptions) block also contains a [`return`](function.return) statement, the value from the [`finally`](language.exceptions) block is returned. Global exception handler ------------------------ If an exception is allowed to bubble up to the global scope, it may be caught by a global exception handler if set. The [set\_exception\_handler()](function.set-exception-handler) function can set a function that will be called in place of a [`catch`](language.exceptions) block if no other block is invoked. The effect is essentially the same as if the entire program were wrapped in a [`try`](language.exceptions)-[`catch`](language.exceptions) block with that function as the [`catch`](language.exceptions). Notes ----- > > **Note**: > > > Internal PHP functions mainly use [Error reporting](https://www.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting), only modern [Object-oriented](https://www.php.net/manual/en/language.oop5.php) extensions use exceptions. However, errors can be easily translated to exceptions with [ErrorException](class.errorexception). This technique only works with non-fatal errors, however. > > **Example #1 Converting error reporting to exceptions** > > > ``` > <?php > function exceptions_error_handler($severity, $message, $filename, $lineno) { >     throw new ErrorException($message, 0, $severity, $filename, $lineno); > } > > set_error_handler('exceptions_error_handler'); > ?> > ``` > **Tip** The [Standard PHP Library (SPL)](https://www.php.net/manual/en/intro.spl.php) provides a good number of [built-in exceptions](https://www.php.net/manual/en/spl.exceptions.php). Examples -------- **Example #2 Throwing an Exception** ``` <?php function inverse($x) {     if (!$x) {         throw new Exception('Division by zero.');     }     return 1/$x; } try {     echo inverse(5) . "\n";     echo inverse(0) . "\n"; } catch (Exception $e) {     echo 'Caught exception: ',  $e->getMessage(), "\n"; } // Continue execution echo "Hello World\n"; ?> ``` The above example will output: ``` 0.2 Caught exception: Division by zero. Hello World ``` **Example #3 Exception handling with a [`finally`](language.exceptions) block** ``` <?php function inverse($x) {     if (!$x) {         throw new Exception('Division by zero.');     }     return 1/$x; } try {     echo inverse(5) . "\n"; } catch (Exception $e) {     echo 'Caught exception: ',  $e->getMessage(), "\n"; } finally {     echo "First finally.\n"; } try {     echo inverse(0) . "\n"; } catch (Exception $e) {     echo 'Caught exception: ',  $e->getMessage(), "\n"; } finally {     echo "Second finally.\n"; } // Continue execution echo "Hello World\n"; ?> ``` The above example will output: ``` 0.2 First finally. Caught exception: Division by zero. Second finally. Hello World ``` **Example #4 Interaction between the [`finally`](language.exceptions) block and [`return`](function.return)** ``` <?php function test() {     try {         throw new Exception('foo');     } catch (Exception $e) {         return 'catch';     } finally {         return 'finally';     } } echo test(); ?> ``` The above example will output: ``` finally ``` **Example #5 Nested Exception** ``` <?php class MyException extends Exception { } class Test {     public function testing() {         try {             try {                 throw new MyException('foo!');             } catch (MyException $e) {                 // rethrow it                 throw $e;             }         } catch (Exception $e) {             var_dump($e->getMessage());         }     } } $foo = new Test; $foo->testing(); ?> ``` The above example will output: ``` string(4) "foo!" ``` **Example #6 Multi catch exception handling** ``` <?php class MyException extends Exception { } class MyOtherException extends Exception { } class Test {     public function testing() {         try {             throw new MyException();         } catch (MyException | MyOtherException $e) {             var_dump(get_class($e));         }     } } $foo = new Test; $foo->testing(); ?> ``` The above example will output: ``` string(11) "MyException" ``` **Example #7 Omitting the caught variable** Only permitted in PHP 8.0.0 and later. ``` <?php class SpecificException extends Exception {} function test() {     throw new SpecificException('Oopsie'); } try {     test(); } catch (SpecificException) {     print "A SpecificException was thrown, but we don't care about the details."; } ?> ``` **Example #8 Throw as an expression** Only permitted in PHP 8.0.0 and later. ``` <?php class SpecificException extends Exception {} function test() {     do_something_risky() or throw new Exception('It did not work'); } try {     test(); } catch (Exception $e) {     print $e->getMessage(); } ?> ```
programming_docs
php RecursiveIteratorIterator::callHasChildren RecursiveIteratorIterator::callHasChildren ========================================== (PHP 5 >= 5.1.0, PHP 7, PHP 8) RecursiveIteratorIterator::callHasChildren — Has children ### Description ``` public RecursiveIteratorIterator::callHasChildren(): bool ``` Called for each element to test whether it has children. **Warning**This function is currently not documented; only its argument list is available. ### Parameters This function has no parameters. ### Return Values Returns whether the element has children. php The Thread class The Thread class ================ Introduction ------------ (PECL pthreads >= 2.0.0) When the start method of a Thread is invoked, the run method code will be executed in separate Thread, in parallel. After the run method is executed the Thread will exit immediately, it will be joined with the creating Thread at the appropriate time. **Warning** Relying on the engine to determine when a Thread should join may cause undesirable behaviour; the programmer should be explicit, where possible. Class synopsis -------------- class **Thread** extends [Threaded](class.threaded) implements [Countable](class.countable), [Traversable](class.traversable), [ArrayAccess](class.arrayaccess) { /\* Methods \*/ ``` public getCreatorId(): int ``` ``` public static getCurrentThread(): Thread ``` ``` public static getCurrentThreadId(): int ``` ``` public getThreadId(): int ``` ``` public isJoined(): bool ``` ``` public isStarted(): bool ``` ``` public join(): bool ``` ``` public start(int $options = ?): bool ``` /\* Inherited methods \*/ ``` public Threaded::chunk(int $size, bool $preserve): array ``` ``` public Threaded::count(): int ``` ``` public Threaded::extend(string $class): bool ``` ``` public Threaded::isRunning(): bool ``` ``` public Threaded::isTerminated(): bool ``` ``` public Threaded::merge(mixed $from, bool $overwrite = ?): bool ``` ``` public Threaded::notify(): bool ``` ``` public Threaded::notifyOne(): bool ``` ``` public Threaded::pop(): bool ``` ``` public Threaded::run(): void ``` ``` public Threaded::shift(): mixed ``` ``` public Threaded::synchronized(Closure $block, mixed ...$args): mixed ``` ``` public Threaded::wait(int $timeout = ?): bool ``` } Table of Contents ----------------- * [Thread::getCreatorId](thread.getcreatorid) — Identification * [Thread::getCurrentThread](thread.getcurrentthread) — Identification * [Thread::getCurrentThreadId](thread.getcurrentthreadid) — Identification * [Thread::getThreadId](thread.getthreadid) — Identification * [Thread::isJoined](thread.isjoined) — State Detection * [Thread::isStarted](thread.isstarted) — State Detection * [Thread::join](thread.join) — Synchronization * [Thread::start](thread.start) — Execution php ReflectionClass::getStaticProperties ReflectionClass::getStaticProperties ==================================== (PHP 5, PHP 7, PHP 8) ReflectionClass::getStaticProperties — Gets static properties ### Description ``` public ReflectionClass::getStaticProperties(): ?array ``` Get the static properties. **Warning**This function is currently not documented; only its argument list is available. ### Parameters This function has no parameters. ### Return Values The static properties, as an array, or **`null`** on failure. ### See Also * [ReflectionClass::getStaticPropertyValue()](reflectionclass.getstaticpropertyvalue) - Gets static property value * [ReflectionClass::setStaticPropertyValue()](reflectionclass.setstaticpropertyvalue) - Sets static property value php Yaf_Config_Abstract::get Yaf\_Config\_Abstract::get ========================== (Yaf >=1.0.0) Yaf\_Config\_Abstract::get — Getter ### Description ``` abstract public Yaf_Config_Abstract::get(string $name, mixed $value): mixed ``` **Warning**This function is currently not documented; only its argument list is available. ### Parameters This function has no parameters. ### Return Values php XSLTProcessor::setProfiling XSLTProcessor::setProfiling =========================== (PHP >= 5.3.0, PHP 7, PHP 8) XSLTProcessor::setProfiling — Sets profiling output file ### Description ``` public XSLTProcessor::setProfiling(?string $filename): bool ``` Sets the file to output profiling information when processing a stylesheet. ### Parameters `filename` Path to the file to dump profiling information. ### Return Values Returns **`true`** on success or **`false`** on failure. ### Examples **Example #1 Example profiling output** ``` <?php // Load the XML source $xml = new DOMDocument; $xml->load('collection.xml'); $xsl = new DOMDocument; $xsl->load('collection.xsl'); // Configure the transformer $proc = new XSLTProcessor; $proc->setProfiling('profiling.txt'); $proc->importStyleSheet($xsl); // attach the xsl rules echo trim($proc->transformToDoc($xml)->firstChild->wholeText); ?> ``` The above code will produce the following information in the profiling file: ``` number match name mode Calls Tot 100us Avg 0 cd 2 3 1 1 collection 1 1 1 Total 3 4 ``` php XMLWriter::writeComment XMLWriter::writeComment ======================= xmlwriter\_write\_comment ========================= (PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL xmlwriter >= 0.1.0) XMLWriter::writeComment -- xmlwriter\_write\_comment — Write full comment tag ### Description Object-oriented style ``` public XMLWriter::writeComment(string $content): bool ``` Procedural style ``` xmlwriter_write_comment(XMLWriter $writer, string $content): bool ``` Writes a full comment. ### Parameters `writer` Only for procedural calls. The [XMLWriter](class.xmlwriter) instance that is being modified. This object is returned from a call to [xmlwriter\_open\_uri()](xmlwriter.openuri) or [xmlwriter\_open\_memory()](xmlwriter.openmemory). `content` The contents of the comment. ### Return Values Returns **`true`** on success or **`false`** on failure. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | `writer` expects an [XMLWriter](class.xmlwriter) instance now; previously, a resource was expected. | ### See Also * [XMLWriter::startComment()](xmlwriter.startcomment) - Create start comment * [XMLWriter::endComment()](xmlwriter.endcomment) - Create end comment php is_infinite is\_infinite ============ (PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8) is\_infinite — Finds whether a value is infinite ### Description ``` is_infinite(float $num): bool ``` Returns **`true`** if `num` is infinite (positive or negative), like the result of `log(0)` or any value too big to fit into a float on this platform. ### Parameters `num` The value to check ### Return Values **`true`** if `num` is infinite, else **`false`**. ### See Also * [is\_finite()](function.is-finite) - Finds whether a value is a legal finite number * [is\_nan()](function.is-nan) - Finds whether a value is not a number php ZipArchive::renameIndex ZipArchive::renameIndex ======================= (PHP 5 >= 5.2.0, PHP 7, PHP 8, PECL zip >= 1.5.0) ZipArchive::renameIndex — Renames an entry defined by its index ### Description ``` public ZipArchive::renameIndex(int $index, string $new_name): bool ``` Renames an entry defined by its index. ### Parameters `index` Index of the entry to rename. `new_name` New name. ### Return Values Returns **`true`** on success or **`false`** on failure. ### Examples **Example #1 Rename one entry** ``` <?php $zip = new ZipArchive; $res = $zip->open('test.zip'); if ($res === TRUE) {     $zip->renameIndex(2,'newname.txt');     $zip->close(); } else {     echo 'failed, code:' . $res; } ?> ``` php Zookeeper::delete Zookeeper::delete ================= (PECL zookeeper >= 0.2.0) Zookeeper::delete — Delete a node in zookeeper synchronously ### Description ``` public Zookeeper::delete(string $path, int $version = -1): bool ``` ### Parameters `path` The name of the node. Expressed as a file name with slashes separating ancestors of the node. `version` The expected version of the node. The function will fail if the actual version of the node does not match the expected version. If -1 is used the version check will not take place. ### Return Values Returns **`true`** on success or **`false`** on failure. ### Errors/Exceptions This method emits PHP error/warning when parameters count or types are wrong or fail to delete node. **Caution** Since version 0.3.0, this method emits [ZookeeperException](class.zookeeperexception) and it's derivatives. ### Examples **Example #1 **Zookeeper::delete()** example** Delete a existing node. ``` <?php $zookeeper = new Zookeeper('locahost:2181'); $path = '/path/to/node'; $r = $zookeeper->delete($path); if ($r)   echo 'SUCCESS'; else   echo 'ERR'; ?> ``` The above example will output: ``` SUCCESS ``` ### See Also * [Zookeeper::create()](zookeeper.create) - Create a node synchronously * [Zookeeper::getChildren()](zookeeper.getchildren) - Lists the children of a node synchronously * [ZookeeperException](class.zookeeperexception) php None Never ----- never is a return-only type indicating the function does not terminate. This means that it either calls [exit()](function.exit), throws an exception, or is an infinite loop. Therefore, it cannot be part of a [union type](language.types.type-system#language.types.type-system.composite.union) declaration. Available as of PHP 8.1.0. never is, in type theory parlance, the bottom type. Meaning it is the subtype of every other type and can replace any other return type during inheritance. php OAuth::getLastResponse OAuth::getLastResponse ====================== (PECL OAuth >= 0.99.1) OAuth::getLastResponse — Get the last response ### Description ``` public OAuth::getLastResponse(): string ``` Get the raw response of the most recent request. ### Parameters This function has no parameters. ### Return Values Returns a string containing the last response. ### See Also * [OAuth::getLastResponseInfo()](oauth.getlastresponseinfo) - Get HTTP information about the last response * [OAuth::fetch()](oauth.fetch) - Fetch an OAuth protected resource php QuickHashStringIntHash::getSize QuickHashStringIntHash::getSize =============================== (No version information available, might only be in Git) QuickHashStringIntHash::getSize — Returns the number of elements in the hash ### Description ``` public QuickHashStringIntHash::getSize(): int ``` Returns the number of elements in the hash. ### Parameters This function has no parameters. ### Return Values The number of elements in the hash. ### Examples **Example #1 **QuickHashStringIntHash::getSize()** example** ``` <?php $hash = new QuickHashStringIntHash( 8 ); var_dump( $hash->add( "two", 2 ) ); var_dump( $hash->add( "three", 5 ) ); var_dump( $hash->getSize() ); ?> ``` The above example will output something similar to: ``` bool(true) bool(true) int(2) ``` php IntlGregorianCalendar::isLeapYear IntlGregorianCalendar::isLeapYear ================================= (PHP 5 >= 5.5.0, PHP 7, PHP 8) IntlGregorianCalendar::isLeapYear — Determine if the given year is a leap year ### Description ``` public IntlGregorianCalendar::isLeapYear(int $year): bool ``` **Warning**This function is currently not documented; only its argument list is available. ### Parameters `year` ### Return Values Returns **`true`** for leap years, **`false`** otherwise and on failure. php bindec bindec ====== (PHP 4, PHP 5, PHP 7, PHP 8) bindec — Binary to decimal ### Description ``` bindec(string $binary_string): int|float ``` Returns the decimal equivalent of the binary number represented by the `binary_string` argument. **bindec()** converts a binary number to an int or, if needed for size reasons, float. **bindec()** interprets all `binary_string` values as unsigned integers. This is because **bindec()** sees the most significant bit as another order of magnitude rather than as the sign bit. ### Parameters `binary_string` The binary string to convert. Any invalid characters in `binary_string` are silently ignored. As of PHP 7.4.0 supplying any invalid characters is deprecated. **Warning** The parameter must be a string. Using other data types will produce unexpected results. ### Return Values The decimal value of `binary_string` ### Changelog | Version | Description | | --- | --- | | 7.4.0 | Passing invalid characters will now generate a deprecation notice. The result will still be computed as if the invalid characters did not exist. | ### Examples **Example #1 **bindec()** example** ``` <?php echo bindec('110011') . "\n"; echo bindec('000110011') . "\n"; echo bindec('111'); ?> ``` The above example will output: ``` 51 51 7 ``` **Example #2 **bindec()** interprets input as unsigned integers** ``` <?php /*  * The lesson from this example is in the output  * rather than the PHP code itself.  */ $magnitude_lower = pow(2, (PHP_INT_SIZE * 8) - 2); p($magnitude_lower - 1); p($magnitude_lower, 'See the rollover?  Watch it next time around...'); p(PHP_INT_MAX, 'PHP_INT_MAX'); p(~PHP_INT_MAX, 'interpreted to be one more than PHP_INT_MAX'); if (PHP_INT_SIZE == 4) {     $note = 'interpreted to be the largest unsigned integer'; } else {     $note = 'interpreted to be the largest unsigned integer               (18446744073709551615) but skewed by float precision'; } p(-1, $note); function p($input, $note = '') {     echo "input:        $input\n";     $format = '%0' . (PHP_INT_SIZE * 8) . 'b';     $bin = sprintf($format, $input);     echo "binary:       $bin\n";     ini_set('precision', 20);  // For readability on 64 bit boxes.     $dec = bindec($bin);     echo 'bindec():     ' . $dec . "\n";     if ($note) {         echo "NOTE:         $note\n";     }     echo "\n"; } ?> ``` Output of the above example on 32 bit machines: ``` input: 1073741823 binary: 00111111111111111111111111111111 bindec(): 1073741823 input: 1073741824 binary: 01000000000000000000000000000000 bindec(): 1073741824 NOTE: See the rollover? Watch it next time around... input: 2147483647 binary: 01111111111111111111111111111111 bindec(): 2147483647 NOTE: PHP_INT_MAX input: -2147483648 binary: 10000000000000000000000000000000 bindec(): 2147483648 NOTE: interpreted to be one more than PHP_INT_MAX input: -1 binary: 11111111111111111111111111111111 bindec(): 4294967295 NOTE: interpreted to be the largest unsigned integer ``` Output of the above example on 64 bit machines: ``` input: 4611686018427387903 binary: 0011111111111111111111111111111111111111111111111111111111111111 bindec(): 4611686018427387903 input: 4611686018427387904 binary: 0100000000000000000000000000000000000000000000000000000000000000 bindec(): 4611686018427387904 NOTE: See the rollover? Watch it next time around... input: 9223372036854775807 binary: 0111111111111111111111111111111111111111111111111111111111111111 bindec(): 9223372036854775807 NOTE: PHP_INT_MAX input: -9223372036854775808 binary: 1000000000000000000000000000000000000000000000000000000000000000 bindec(): 9223372036854775808 NOTE: interpreted to be one more than PHP_INT_MAX input: -1 binary: 1111111111111111111111111111111111111111111111111111111111111111 bindec(): 18446744073709551616 NOTE: interpreted to be the largest unsigned integer (18446744073709551615) but skewed by float precision ``` ### Notes > > **Note**: > > > The function can convert numbers that are too large to fit into the platforms int type, larger values are returned as float in that case. > > ### See Also * [decbin()](function.decbin) - Decimal to binary * [octdec()](function.octdec) - Octal to decimal * [hexdec()](function.hexdec) - Hexadecimal to decimal * [base\_convert()](function.base-convert) - Convert a number between arbitrary bases php SolrQuery::setHighlightRegexPattern SolrQuery::setHighlightRegexPattern =================================== (PECL solr >= 0.9.2) SolrQuery::setHighlightRegexPattern — Specify the regular expression for fragmenting ### Description ``` public SolrQuery::setHighlightRegexPattern(string $value): SolrQuery ``` Specifies the regular expression for fragmenting. This could be used to extract sentences ### Parameters `value` The regular expression for fragmenting. This could be used to extract sentences ### Return Values Returns the current SolrQuery object, if the return value is used. php ArrayIterator::offsetGet ArrayIterator::offsetGet ======================== (PHP 5, PHP 7, PHP 8) ArrayIterator::offsetGet — Get value for an offset ### Description ``` public ArrayIterator::offsetGet(mixed $key): mixed ``` Gets the value from the provided offset. **Warning**This function is currently not documented; only its argument list is available. ### Parameters `key` The offset to get the value from. ### Return Values The value at offset `key`. ### See Also * [ArrayIterator::offsetSet()](arrayiterator.offsetset) - Set value for an offset * [ArrayIterator::offsetUnset()](arrayiterator.offsetunset) - Unset value for an offset php strptime strptime ======== (PHP 5 >= 5.1.0, PHP 7, PHP 8) strptime — Parse a time/date generated with [strftime()](function.strftime) **Warning**This function has been *DEPRECATED* as of PHP 8.1.0. Relying on this function is highly discouraged. ### Description ``` strptime(string $timestamp, string $format): array|false ``` **strptime()** returns an array with the `timestamp` parsed, or **`false`** on error. Month and weekday names and other language dependent strings respect the current locale set with [setlocale()](function.setlocale) (**`LC_TIME`**). ### Parameters `timestamp` (string) The string to parse (e.g. returned from [strftime()](function.strftime)). `format` (string) The format used in `timestamp` (e.g. the same as used in [strftime()](function.strftime)). Note that some of the format options available to [strftime()](function.strftime) may not have any effect within **strptime()**; the exact subset that are supported will vary based on the operating system and C library in use. For more information about the format options, read the [strftime()](function.strftime) page. ### Return Values Returns an array or **`false`** on failure. **The following parameters are returned in the array**| parameters | Description | | --- | --- | | `"tm_sec"` | Seconds after the minute (0-61) | | `"tm_min"` | Minutes after the hour (0-59) | | `"tm_hour"` | Hour since midnight (0-23) | | `"tm_mday"` | Day of the month (1-31) | | `"tm_mon"` | Months since January (0-11) | | `"tm_year"` | Years since 1900 | | `"tm_wday"` | Days since Sunday (0-6) | | `"tm_yday"` | Days since January 1 (0-365) | | `"unparsed"` | the `timestamp` part which was not recognized using the specified `format` | ### Changelog | Version | Description | | --- | --- | | 8.1.0 | This function has been deprecated. Use [date\_parse\_from\_format()](function.date-parse-from-format) instead (for locale-independent parsing), or [IntlDateFormatter::parse()](intldateformatter.parse) (for locale-dependent parsing) | ### Examples **Example #1 **strptime()** example** ``` <?php $format = '%d/%m/%Y %H:%M:%S'; $strf = strftime($format); echo "$strf\n"; print_r(strptime($strf, $format)); ?> ``` The above example will output something similar to: ``` 03/10/2004 15:54:19 Array ( [tm_sec] => 19 [tm_min] => 54 [tm_hour] => 15 [tm_mday] => 3 [tm_mon] => 9 [tm_year] => 104 [tm_wday] => 0 [tm_yday] => 276 [unparsed] => ) ``` ### Notes > **Note**: This function is not implemented on Windows platforms. > > > > **Note**: > > > Internally, this function calls the `strptime()` function provided by the system's C library. This function can exhibit noticeably different behaviour across different operating systems. The use of [date\_parse\_from\_format()](function.date-parse-from-format), which does not suffer from these issues, is recommended. > > > > **Note**: > > > `"tm_sec"` includes any leap seconds (currently upto 2 a year). For more information on leap seconds, see the [» Wikipedia article on leap seconds](http://en.wikipedia.org/wiki/Leap_second). > > ### See Also * [IntlDateFormatter::parse()](intldateformatter.parse) - Parse string to a timestamp value * [DateTime::createFromFormat()](datetime.createfromformat) - Parses a time string according to a specified format * [checkdate()](function.checkdate) - Validate a Gregorian date * [strftime()](function.strftime) - Format a local time/date according to locale settings * [date\_parse\_from\_format()](function.date-parse-from-format) - Get info about given date formatted according to the specified format
programming_docs
php SimpleXMLIterator::rewind SimpleXMLIterator::rewind ========================= (PHP 5, PHP 7, PHP 8) SimpleXMLIterator::rewind — Rewind to the first element ### Description ``` public SimpleXMLIterator::rewind(): void ``` This method rewinds the [SimpleXMLIterator](class.simplexmliterator) to the first element. ### Parameters This function has no parameters. ### Return Values No value is returned. ### Examples **Example #1 Rewind to the first element** ``` <?php $xmlIterator = new SimpleXMLIterator('<books><book>PHP Basics</book><book>XML Basics</book></books>'); $xmlIterator->rewind(); var_dump($xmlIterator->current()); ?> ``` The above example will output: ``` object(SimpleXMLIterator)#2 (1) { [0]=> string(10) "PHP Basics" } ``` php The PDOStatement class The PDOStatement class ====================== Introduction ------------ (PHP 5 >= 5.1.0, PHP 7, PHP 8, PECL pdo >= 1.0.0) Represents a prepared statement and, after the statement is executed, an associated result set. Class synopsis -------------- class **PDOStatement** implements [IteratorAggregate](class.iteratoraggregate) { /\* Properties \*/ public string [$queryString](class.pdostatement#pdostatement.props.querystring); /\* Methods \*/ ``` public bindColumn( string|int $column, mixed &$var, int $type = PDO::PARAM_STR, int $maxLength = 0, mixed $driverOptions = null ): bool ``` ``` public bindParam( string|int $param, mixed &$var, int $type = PDO::PARAM_STR, int $maxLength = 0, mixed $driverOptions = null ): bool ``` ``` public bindValue(string|int $param, mixed $value, int $type = PDO::PARAM_STR): bool ``` ``` public closeCursor(): bool ``` ``` public columnCount(): int ``` ``` public debugDumpParams(): ?bool ``` ``` public errorCode(): ?string ``` ``` public errorInfo(): array ``` ``` public execute(?array $params = null): bool ``` ``` public fetch(int $mode = PDO::FETCH_DEFAULT, int $cursorOrientation = PDO::FETCH_ORI_NEXT, int $cursorOffset = 0): mixed ``` ``` public fetchAll(int $mode = PDO::FETCH_DEFAULT): array ``` ``` public fetchAll(int $mode = PDO::FETCH_COLUMN, int $column): array ``` ``` public fetchAll(int $mode = PDO::FETCH_CLASS, string $class, ?array $constructorArgs): array ``` ``` public fetchAll(int $mode = PDO::FETCH_FUNC, callable $callback): array ``` ``` public fetchColumn(int $column = 0): mixed ``` ``` public fetchObject(?string $class = "stdClass", array $constructorArgs = []): object|false ``` ``` public getAttribute(int $name): mixed ``` ``` public getColumnMeta(int $column): array|false ``` ``` public getIterator(): Iterator ``` ``` public nextRowset(): bool ``` ``` public rowCount(): int ``` ``` public setAttribute(int $attribute, mixed $value): bool ``` ``` public setFetchMode(int $mode): bool ``` ``` public setFetchMode(int $mode = PDO::FETCH_COLUMN, int $colno): bool ``` ``` public setFetchMode(int $mode = PDO::FETCH_CLASS, string $class, ?array $constructorArgs = null): bool ``` ``` public setFetchMode(int $mode = PDO::FETCH_INTO, object $object): bool ``` } Properties ---------- queryString Used query string. Changelog --------- | Version | Description | | --- | --- | | 8.0.0 | **PDOStatement** implements [IteratorAggregate](class.iteratoraggregate) now instead of [Traversable](class.traversable). | Table of Contents ----------------- * [PDOStatement::bindColumn](pdostatement.bindcolumn) — Bind a column to a PHP variable * [PDOStatement::bindParam](pdostatement.bindparam) — Binds a parameter to the specified variable name * [PDOStatement::bindValue](pdostatement.bindvalue) — Binds a value to a parameter * [PDOStatement::closeCursor](pdostatement.closecursor) — Closes the cursor, enabling the statement to be executed again * [PDOStatement::columnCount](pdostatement.columncount) — Returns the number of columns in the result set * [PDOStatement::debugDumpParams](pdostatement.debugdumpparams) — Dump an SQL prepared command * [PDOStatement::errorCode](pdostatement.errorcode) — Fetch the SQLSTATE associated with the last operation on the statement handle * [PDOStatement::errorInfo](pdostatement.errorinfo) — Fetch extended error information associated with the last operation on the statement handle * [PDOStatement::execute](pdostatement.execute) — Executes a prepared statement * [PDOStatement::fetch](pdostatement.fetch) — Fetches the next row from a result set * [PDOStatement::fetchAll](pdostatement.fetchall) — Fetches the remaining rows from a result set * [PDOStatement::fetchColumn](pdostatement.fetchcolumn) — Returns a single column from the next row of a result set * [PDOStatement::fetchObject](pdostatement.fetchobject) — Fetches the next row and returns it as an object * [PDOStatement::getAttribute](pdostatement.getattribute) — Retrieve a statement attribute * [PDOStatement::getColumnMeta](pdostatement.getcolumnmeta) — Returns metadata for a column in a result set * [PDOStatement::getIterator](pdostatement.getiterator) — Gets result set iterator * [PDOStatement::nextRowset](pdostatement.nextrowset) — Advances to the next rowset in a multi-rowset statement handle * [PDOStatement::rowCount](pdostatement.rowcount) — Returns the number of rows affected by the last SQL statement * [PDOStatement::setAttribute](pdostatement.setattribute) — Set a statement attribute * [PDOStatement::setFetchMode](pdostatement.setfetchmode) — Set the default fetch mode for this statement php FilterIterator::current FilterIterator::current ======================= (PHP 5 >= 5.1.0, PHP 7, PHP 8) FilterIterator::current — Get the current element value ### Description ``` public FilterIterator::current(): mixed ``` **Warning**This function is currently not documented; only its argument list is available. Get the current element value. ### Parameters This function has no parameters. ### Return Values The current element value. ### See Also * [FilterIterator::key()](filteriterator.key) - Get the current key * [FilterIterator::next()](filteriterator.next) - Move the iterator forward php imagegrabwindow imagegrabwindow =============== (PHP 5 >= 5.2.2, PHP 7, PHP 8) imagegrabwindow — Captures a window ### Description ``` imagegrabwindow(int $handle, bool $client_area = false): GdImage|false ``` Grabs a window or its client area using a windows handle (HWND property in COM instance) > > **Note**: > > > This function is only available on Windows. > > ### Parameters `handle` The HWND window ID. `client_area` Include the client area of the application window. ### Return Values Returns an image object on success, **`false`** on failure. ### Errors/Exceptions E\_NOTICE is issued if `handle` is invalid window handle. E\_WARNING is issued if the Windows API is too old. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | On success, this function returns a [GDImage](class.gdimage) instance now; previously, a resource was returned. | | 8.0.0 | `client_area` expects a bool now; previously it expected an int. | ### Examples **Example #1 **imagegrabwindow()** example** Capture a window (IE for example) ``` <?php $browser = new COM("InternetExplorer.Application"); $handle = $browser->HWND; $browser->Visible = true; $im = imagegrabwindow($handle); $browser->Quit(); imagepng($im, "iesnap.png"); imagedestroy($im); ?> ``` Capture a window (IE for example) but with its content ``` <?php $browser = new COM("InternetExplorer.Application"); $handle = $browser->HWND; $browser->Visible = true; $browser->Navigate("http://www.libgd.org"); /* Still working? */ while ($browser->Busy) {     com_message_pump(4000); } $im = imagegrabwindow($handle, 0); $browser->Quit(); imagepng($im, "iesnap.png"); imagedestroy($im); ?> ``` ### See Also * [imagegrabscreen()](function.imagegrabscreen) - Captures the whole screen php eio_grp_cancel eio\_grp\_cancel ================ (PECL eio >= 0.0.1dev) eio\_grp\_cancel — Cancels a request group ### Description ``` eio_grp_cancel(resource $grp): void ``` **eio\_grp\_cancel()** cancels a group request specified by `grp` request group resource. ### Parameters `grp` The request group resource returned by [eio\_grp()](function.eio-grp). ### Return Values No value is returned. ### See Also * [eio\_grp()](function.eio-grp) - Creates a request group * [eio\_grp\_add()](function.eio-grp-add) - Adds a request to the request group php ldap_add ldap\_add ========= (PHP 4, PHP 5, PHP 7, PHP 8) ldap\_add — Add entries to LDAP directory ### Description ``` ldap_add( LDAP\Connection $ldap, string $dn, array $entry, ?array $controls = null ): bool ``` Add entries in the LDAP directory. ### Parameters `ldap` An [LDAP\Connection](class.ldap-connection) instance, returned by [ldap\_connect()](function.ldap-connect). `dn` The distinguished name of an LDAP entity. `entry` An array that specifies the information about the entry. The values in the entries are indexed by individual attributes. In case of multiple values for an attribute, they are indexed using integers starting with 0. ``` <?php $entry["attribute1"] = "value"; $entry["attribute2"][0] = "value1"; $entry["attribute2"][1] = "value2"; ?> ``` `controls` Array of [LDAP Controls](https://www.php.net/manual/en/ldap.controls.php) to send with the request. ### Return Values Returns **`true`** on success or **`false`** on failure. ### Changelog | Version | Description | | --- | --- | | 8.1.0 | The `ldap` parameter expects an [LDAP\Connection](class.ldap-connection) instance now; previously, a [resource](language.types.resource) was expected. | | 8.0.0 | `controls` is nullable now; previously, it defaulted to `[]`. | | 7.3.0 | Support for `controls` added | ### Examples **Example #1 Complete example with authenticated bind** ``` <?php $ds = ldap_connect("localhost");  // assuming the LDAP server is on this host if ($ds) {     // bind with appropriate dn to give update access     $r = ldap_bind($ds, "cn=root, o=My Company, c=US", "secret");     // prepare data     $info["cn"] = "John Jones";     $info["sn"] = "Jones";     $info["objectclass"] = "person";     // add data to directory     $r = ldap_add($ds, "cn=John Jones, o=My Company, c=US", $info);     ldap_close($ds); } else {     echo "Unable to connect to LDAP server"; } ?> ``` ### Notes > **Note**: This function is binary-safe. > > ### See Also * [ldap\_add\_ext()](function.ldap-add-ext) - Add entries to LDAP directory * [ldap\_delete()](function.ldap-delete) - Delete an entry from a directory php sapi_windows_cp_conv sapi\_windows\_cp\_conv ======================= (PHP 7 >= 7.1.0, PHP 8) sapi\_windows\_cp\_conv — Convert string from one codepage to another ### Description ``` sapi_windows_cp_conv(int|string $in_codepage, int|string $out_codepage, string $subject): ?string ``` Convert string from one codepage to another. ### Parameters `in_codepage` The codepage of the `subject` string. Either the codepage name or identifier. `out_codepage` The codepage to convert the `subject` string to. Either the codepage name or identifier. `subject` The string to convert. ### Return Values The `subject` string converted to `out_codepage`, or **`null`** on failure. ### Errors/Exceptions This function issues E\_WARNING level errors, if invalid codepages are given, or if the subject is not valid for `in_codepage`. ### See Also * [sapi\_windows\_cp\_get()](function.sapi-windows-cp-get) - Get current codepage * [iconv()](function.iconv) - Convert a string from one character encoding to another php openssl_pkcs12_export openssl\_pkcs12\_export ======================= (PHP 5 >= 5.2.2, PHP 7, PHP 8) openssl\_pkcs12\_export — Exports a PKCS#12 Compatible Certificate Store File to variable ### Description ``` openssl_pkcs12_export( OpenSSLCertificate|string $certificate, string &$output, OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $private_key, string $passphrase, array $options = [] ): bool ``` **openssl\_pkcs12\_export()** stores `certificate` into a string named by `output` in a PKCS#12 file format. ### Parameters `x509` See [Key/Certificate parameters](https://www.php.net/manual/en/openssl.certparams.php) for a list of valid values. `output` On success, this will hold the PKCS#12. `private_key` Private key component of PKCS#12 file. See [Public/Private Key parameters](https://www.php.net/manual/en/openssl.certparams.php) for a list of valid values. `passphrase` Encryption password for unlocking the PKCS#12 file. `options` Optional array, other keys will be ignored. | Key | Description | | --- | --- | | `"extracerts"` | array of extra certificates or a single certificate to be included in the PKCS#12 file. | | `"friendlyname"` | string to be used for the supplied certificate and key | ### Return Values Returns **`true`** on success or **`false`** on failure. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | `certificate` accepts an [OpenSSLCertificate](class.opensslcertificate) instance now; previously, a [resource](language.types.resource) of type `OpenSSL X.509 CSR` was accepted. | | 8.0.0 | `private_key` accepts an [OpenSSLAsymmetricKey](class.opensslasymmetrickey) or [OpenSSLCertificate](class.opensslcertificate) instance now; previously, a [resource](language.types.resource) of type `OpenSSL key` or `OpenSSL X.509` was accepted. | php strrev strrev ====== (PHP 4, PHP 5, PHP 7, PHP 8) strrev — Reverse a string ### Description ``` strrev(string $string): string ``` Returns `string`, reversed. ### Parameters `string` The string to be reversed. ### Return Values Returns the reversed string. ### Examples **Example #1 Reversing a string with **strrev()**** ``` <?php echo strrev("Hello world!"); // outputs "!dlrow olleH" ?> ``` php OAuthProvider::tokenHandler OAuthProvider::tokenHandler =========================== (PECL OAuth >= 1.0.0) OAuthProvider::tokenHandler — Set the tokenHandler handler callback ### Description ``` public OAuthProvider::tokenHandler(callable $callback_function): void ``` Sets the token handler callback, which will later be called with [OAuthProvider::callTokenHandler()](oauthprovider.calltokenhandler). **Warning**This function is currently not documented; only its argument list is available. ### Parameters `callback_function` The [callable](language.types.callable) functions name. ### Return Values No value is returned. ### Examples **Example #1 Example **OAuthProvider::tokenHandler()** callback** ``` <?php function tokenHandler($provider) {          if ($provider->token === 'rejected') {         return OAUTH_TOKEN_REJECTED;     } elseif ($provider->token === 'revoked') {         return OAUTH_TOKEN_REVOKED;     }     $provider->token_secret = "the_tokens_secret";     return OAUTH_OK; } ?> ``` ### See Also * [OAuthProvider::callTokenHandler()](oauthprovider.calltokenhandler) - Calls the tokenNonceHandler callback php SoapClient::__getLastResponseHeaders SoapClient::\_\_getLastResponseHeaders ====================================== (PHP 5, PHP 7, PHP 8) SoapClient::\_\_getLastResponseHeaders — Returns the SOAP headers from the last response ### Description ``` public SoapClient::__getLastResponseHeaders(): ?string ``` Returns the SOAP headers from the last response. > > **Note**: > > > This function only works if the [SoapClient](class.soapclient) object was created with the `trace` option set to **`true`**. > > ### Parameters This function has no parameters. ### Return Values The last SOAP response headers. ### Examples **Example #1 SoapClient::\_\_getLastResponse() example** ``` <?php $client = SoapClient("some.wsdl", array('trace' => 1)); $result = $client->SomeFunction(); echo "RESPONSE HEADERS:\n" . $client->__getLastResponseHeaders() . "\n"; ?> ``` ### See Also * [SoapClient::\_\_getLastRequestHeaders()](soapclient.getlastrequestheaders) - Returns the SOAP headers from the last request * [SoapClient::\_\_getLastRequest()](soapclient.getlastrequest) - Returns last SOAP request * [SoapClient::\_\_getLastResponse()](soapclient.getlastresponse) - Returns last SOAP response php openssl_pkcs7_decrypt openssl\_pkcs7\_decrypt ======================= (PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8) openssl\_pkcs7\_decrypt — Decrypts an S/MIME encrypted message ### Description ``` openssl_pkcs7_decrypt( string $input_filename, string $output_filename, OpenSSLCertificate|string $certificate, OpenSSLAsymmetricKey|OpenSSLCertificate|array|string|null $private_key = null ): bool ``` Decrypts the S/MIME encrypted message contained in the file specified by `input_filename` using the certificate and its associated private key specified by `certificate` and `private_key`. ### Parameters `input_filename` `output_filename` The decrypted message is written to the file specified by `output_filename`. `certificate` `private_key` ### Return Values Returns **`true`** on success or **`false`** on failure. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | `private_key` accepts an [OpenSSLAsymmetricKey](class.opensslasymmetrickey) or [OpenSSLCertificate](class.opensslcertificate) instance now; previously, a [resource](language.types.resource) of type `OpenSSL key` or `OpenSSL X.509 CSR` was accepted. | ### Examples **Example #1 **openssl\_pkcs7\_decrypt()** example** ``` <?php // $cert and $key are assumed to contain your personal certificate and private // key pair, and that you are the recipient of an S/MIME message $infilename = "encrypted.msg";  // this file holds your encrypted message $outfilename = "decrypted.msg"; // make sure you can write to this file if (openssl_pkcs7_decrypt($infilename, $outfilename, $cert, $key)) {     echo "decrypted!"; } else {     echo "failed to decrypt!"; } ?> ``` php Stomp::getReadTimeout Stomp::getReadTimeout ===================== stomp\_get\_read\_timeout ========================= (PECL stomp >= 0.3.0) Stomp::getReadTimeout -- stomp\_get\_read\_timeout — Gets read timeout ### Description Object-oriented style (method): ``` public Stomp::getReadTimeout(): array ``` Procedural style: ``` stomp_get_read_timeout(resource $link): array ``` Gets read timeout ### Parameters `link` Procedural style only: The stomp link identifier returned by [stomp\_connect()](stomp.construct). ### Return Values Returns an array with 2 elements: sec and usec. ### Examples **Example #1 Object-oriented style** ``` <?php /* connection */ try {     $stomp = new Stomp('tcp://localhost:61613'); } catch(StompException $e) {     die('Connection failed: ' . $e->getMessage()); } var_dump($stomp->getReadTimeout()); /* close connection */ unset($stomp); ?> ``` The above example will output something similar to: ``` array(2) { ["sec"]=> int(2) ["usec"]=> int(0) } ``` **Example #2 Procedural style** ``` <?php /* connection */ $link = stomp_connect('ssl://localhost:61612'); /* check connection */ if (!$link) {     die('Connection failed: ' . stomp_connect_error()); } var_dump(stomp_get_read_timeout($link)); /* close connection */ stomp_close($link); ?> ``` The above example will output something similar to: ``` array(2) { ["sec"]=> int(2) ["usec"]=> int(0) } ``` php preg_replace preg\_replace ============= (PHP 4, PHP 5, PHP 7, PHP 8) preg\_replace — Perform a regular expression search and replace ### Description ``` preg_replace( string|array $pattern, string|array $replacement, string|array $subject, int $limit = -1, int &$count = null ): string|array|null ``` Searches `subject` for matches to `pattern` and replaces them with `replacement`. ### Parameters `pattern` The pattern to search for. It can be either a string or an array with strings. Several [PCRE modifiers](reference.pcre.pattern.modifiers) are also available. `replacement` The string or an array with strings to replace. If this parameter is a string and the `pattern` parameter is an array, all patterns will be replaced by that string. If both `pattern` and `replacement` parameters are arrays, each `pattern` will be replaced by the `replacement` counterpart. If there are fewer elements in the `replacement` array than in the `pattern` array, any extra `pattern`s will be replaced by an empty string. `replacement` may contain references of the form `\n` or `$n`, with the latter form being the preferred one. Every such reference will be replaced by the text captured by the n'th parenthesized pattern. n can be from 0 to 99, and `\0` or `$0` refers to the text matched by the whole pattern. Opening parentheses are counted from left to right (starting from 1) to obtain the number of the capturing subpattern. Note that backslashes in string literals may require to be escaped. When working with a replacement pattern where a backreference is immediately followed by another number (i.e.: placing a literal number immediately after a matched pattern), you cannot use the familiar `\1` notation for your backreference. `\11`, for example, would confuse **preg\_replace()** since it does not know whether you want the `\1` backreference followed by a literal `1`, or the `\11` backreference followed by nothing. In this case the solution is to use `${1}1`. This creates an isolated `$1` backreference, leaving the `1` as a literal. When using the deprecated `e` modifier, this function escapes some characters (namely `'`, `"`, `\` and NULL) in the strings that replace the backreferences. This is done to ensure that no syntax errors arise from backreference usage with either single or double quotes (e.g. `'strlen(\'$1\')+strlen("$2")'`). Make sure you are aware of PHP's [string syntax](language.types.string) to know exactly how the interpreted string will look. `subject` The string or an array with strings to search and replace. If `subject` is an array, then the search and replace is performed on every entry of `subject`, and the return value is an array as well. If the `subject` array is associative, keys will be preserved in the returned value. `limit` The maximum possible replacements for each pattern in each `subject` string. Defaults to `-1` (no limit). `count` If specified, this variable will be filled with the number of replacements done. ### Return Values **preg\_replace()** returns an array if the `subject` parameter is an array, or a string otherwise. If matches are found, the new `subject` will be returned, otherwise `subject` will be returned unchanged or **`null`** if an error occurred. ### Errors/Exceptions Using the "\e" modifier is an error; an **`E_WARNING`** is emitted in this case. If the regex pattern passed does not compile to a valid regex, an **`E_WARNING`** is emitted. ### Examples **Example #1 Using backreferences followed by numeric literals** ``` <?php $string = 'April 15, 2003'; $pattern = '/(\w+) (\d+), (\d+)/i'; $replacement = '${1}1,$3'; echo preg_replace($pattern, $replacement, $string); ?> ``` The above example will output: ``` April1,2003 ``` **Example #2 Using indexed arrays with **preg\_replace()**** ``` <?php $string = 'The quick brown fox jumps over the lazy dog.'; $patterns = array(); $patterns[0] = '/quick/'; $patterns[1] = '/brown/'; $patterns[2] = '/fox/'; $replacements = array(); $replacements[2] = 'bear'; $replacements[1] = 'black'; $replacements[0] = 'slow'; echo preg_replace($patterns, $replacements, $string); ?> ``` The above example will output: ``` The bear black slow jumps over the lazy dog. ``` By ksorting patterns and replacements, we should get what we wanted. ``` <?php ksort($patterns); ksort($replacements); echo preg_replace($patterns, $replacements, $string); ?> ``` The above example will output: ``` The slow black bear jumps over the lazy dog. ``` **Example #3 Replacing several values** ``` <?php $patterns = array ('/(19|20)(\d{2})-(\d{1,2})-(\d{1,2})/',                    '/^\s*{(\w+)}\s*=/'); $replace = array ('\3/\4/\1\2', '$\1 ='); echo preg_replace($patterns, $replace, '{startDate} = 1999-5-27'); ?> ``` The above example will output: ``` $startDate = 5/27/1999 ``` **Example #4 Strip whitespace** This example strips excess whitespace from a string. ``` <?php $str = 'foo   o'; $str = preg_replace('/\s\s+/', ' ', $str); // This will be 'foo o' now echo $str; ?> ``` **Example #5 Using the `count` parameter** ``` <?php $count = 0; echo preg_replace(array('/\d/', '/\s/'), '*', 'xp 4 to', -1 , $count); echo $count; //3 ?> ``` The above example will output: ``` xp***to 3 ``` ### Notes > > **Note**: > > > When using arrays with `pattern` and `replacement`, the keys are processed in the order they appear in the array. This is *not necessarily* the same as the numerical index order. If you use indexes to identify which `pattern` should be replaced by which `replacement`, you should perform a [ksort()](function.ksort) on each array prior to calling **preg\_replace()**. > > > > **Note**: > > > When both `pattern` and `replacement` are arrays, matching rules will operate sequentially. That is, the second `pattern`/`replacement` pair will operate on the string that results from the first `pattern`/`replacement` pair, not the original string. If you want to simulate replacements operating in parallel, such as swapping two values, replace one pattern by an intermediary placeholder, then in a later pair replace that intermediary placeholder with the desired replacement. > > > ``` > <?php > $p = array('/a/', '/b/', '/c/'); > $r = array('b', 'c', 'd'); > print_r(preg_replace($p, $r, 'a')); > // prints d > ?> > ``` > ### See Also * [PCRE Patterns](https://www.php.net/manual/en/pcre.pattern.php) * [preg\_quote()](function.preg-quote) - Quote regular expression characters * [preg\_filter()](function.preg-filter) - Perform a regular expression search and replace * [preg\_match()](function.preg-match) - Perform a regular expression match * [preg\_replace\_callback()](function.preg-replace-callback) - Perform a regular expression search and replace using a callback * [preg\_split()](function.preg-split) - Split string by a regular expression * [preg\_last\_error()](function.preg-last-error) - Returns the error code of the last PCRE regex execution
programming_docs
php ReflectionClass::newInstance ReflectionClass::newInstance ============================ (PHP 5, PHP 7, PHP 8) ReflectionClass::newInstance — Creates a new class instance from given arguments ### Description ``` public ReflectionClass::newInstance(mixed ...$args): object ``` Creates a new instance of the class. The given arguments are passed to the class constructor. ### Parameters `args` Accepts a variable number of arguments which are passed to the class constructor, much like [call\_user\_func()](function.call-user-func). ### Return Values ### Errors/Exceptions A [ReflectionException](class.reflectionexception) if the class constructor is not public. A [ReflectionException](class.reflectionexception) if the class does not have a constructor and the `args` parameter contains one or more parameters. ### See Also * [ReflectionClass::newInstanceArgs()](reflectionclass.newinstanceargs) - Creates a new class instance from given arguments * [ReflectionClass::newInstanceWithoutConstructor()](reflectionclass.newinstancewithoutconstructor) - Creates a new class instance without invoking the constructor php Phar::getSupportedSignatures Phar::getSupportedSignatures ============================ (PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 1.1.0) Phar::getSupportedSignatures — Return array of supported signature types ### Description ``` final public static Phar::getSupportedSignatures(): array ``` Return array of supported signature types ### Parameters No parameters. ### Return Values Returns an array containing any of `MD5`, `SHA-1`, `SHA-256`, `SHA-512`, or `OpenSSL`. ### See Also * [Phar::getSignature()](phar.getsignature) - Return MD5/SHA1/SHA256/SHA512/OpenSSL signature of a Phar archive * [Phar::setSignatureAlgorithm()](phar.setsignaturealgorithm) - Set the signature algorithm for a phar and apply it php yaml_parse yaml\_parse =========== (PECL yaml >= 0.4.0) yaml\_parse — Parse a YAML stream ### Description ``` yaml_parse( string $input, int $pos = 0, int &$ndocs = ?, array $callbacks = null ): mixed ``` Convert all or part of a YAML document stream to a PHP variable. ### Parameters `input` The string to parse as a YAML document stream. `pos` Document to extract from stream (`-1` for all documents, `0` for first document, ...). `ndocs` If `ndocs` is provided, then it is filled with the number of documents found in stream. `callbacks` Content handlers for YAML nodes. Associative array of YAML tag => [callable](language.types.callable) mappings. See [parse callbacks](https://www.php.net/manual/en/yaml.callbacks.parse.php) for more details. ### Return Values Returns the value encoded in `input` in appropriate PHP type or **`false`** on failure. If `pos` is `-1` an array will be returned with one entry for each document found in the stream. ### Examples **Example #1 **yaml\_parse()** example** ``` <?php $yaml = <<<EOD --- invoice: 34843 date: "2001-01-23" bill-to: &id001   given: Chris   family: Dumars   address:     lines: |-       458 Walkman Dr.               Suite #292     city: Royal Oak     state: MI     postal: 48046 ship-to: *id001 product: - sku: BL394D   quantity: 4   description: Basketball   price: 450 - sku: BL4438H   quantity: 1   description: Super Hoop   price: 2392 tax: 251.420000 total: 4443.520000 comments: Late afternoon is best. Backup contact is Nancy Billsmer @ 338-4338. ... EOD; $parsed = yaml_parse($yaml); var_dump($parsed); ?> ``` The above example will output something similar to: ``` array(8) { ["invoice"]=> int(34843) ["date"]=> string(10) "2001-01-23" ["bill-to"]=> &array(3) { ["given"]=> string(5) "Chris" ["family"]=> string(6) "Dumars" ["address"]=> array(4) { ["lines"]=> string(34) "458 Walkman Dr. Suite #292" ["city"]=> string(9) "Royal Oak" ["state"]=> string(2) "MI" ["postal"]=> int(48046) } } ["ship-to"]=> &array(3) { ["given"]=> string(5) "Chris" ["family"]=> string(6) "Dumars" ["address"]=> array(4) { ["lines"]=> string(34) "458 Walkman Dr. Suite #292" ["city"]=> string(9) "Royal Oak" ["state"]=> string(2) "MI" ["postal"]=> int(48046) } } ["product"]=> array(2) { [0]=> array(4) { ["sku"]=> string(6) "BL394D" ["quantity"]=> int(4) ["description"]=> string(10) "Basketball" ["price"]=> int(450) } [1]=> array(4) { ["sku"]=> string(7) "BL4438H" ["quantity"]=> int(1) ["description"]=> string(10) "Super Hoop" ["price"]=> int(2392) } } ["tax"]=> float(251.42) ["total"]=> float(4443.52) ["comments"]=> string(68) "Late afternoon is best. Backup contact is Nancy Billsmer @ 338-4338." } ``` ### Notes **Warning** Processing untrusted user input with **yaml\_parse()** is dangerous if the use of [unserialize()](function.unserialize) is enabled for nodes using the `!php/object` tag. This behavior can be disabled by using the `yaml.decode_php` ini setting. ### See Also * [yaml\_parse\_file()](function.yaml-parse-file) - Parse a YAML stream from a file * [yaml\_parse\_url()](function.yaml-parse-url) - Parse a Yaml stream from a URL * [yaml\_emit()](function.yaml-emit) - Returns the YAML representation of a value php eio_dup2 eio\_dup2 ========= (PECL eio >= 0.0.1dev) eio\_dup2 — Duplicate a file descriptor ### Description ``` eio_dup2( mixed $fd, mixed $fd2, int $pri = EIO_PRI_DEFAULT, callable $callback = NULL, mixed $data = NULL ): resource ``` **eio\_dup2()** duplicates file descriptor. ### Parameters `fd` Source stream, Socket resource, or numeric file descriptor `fd2` Target stream, Socket resource, or numeric file descriptor `pri` The request priority: **`EIO_PRI_DEFAULT`**, **`EIO_PRI_MIN`**, **`EIO_PRI_MAX`**, or **`null`**. If **`null`** passed, `pri` internally is set to **`EIO_PRI_DEFAULT`**. `callback` `callback` function is called when the request is done. It should match the following prototype: ``` void callback(mixed $data, int $result[, resource $req]); ``` `data` is custom data passed to the request. `result` request-specific result value; basically, the value returned by corresponding system call. `req` is optional request resource which can be used with functions like [eio\_get\_last\_error()](function.eio-get-last-error) `data` Arbitrary variable passed to `callback`. ### Return Values **eio\_dup2()** returns request resource on success, or **`false`** on failure. php array_intersect_uassoc array\_intersect\_uassoc ======================== (PHP 5, PHP 7, PHP 8) array\_intersect\_uassoc — Computes the intersection of arrays with additional index check, compares indexes by a callback function ### Description ``` array_intersect_uassoc(array $array, array ...$arrays, callable $key_compare_func): array ``` **array\_intersect\_uassoc()** returns an array containing all the values of `array` that are present in all the arguments. Note that the keys are used in the comparison unlike in [array\_intersect()](function.array-intersect). ### Parameters `array` Initial array for comparison of the arrays. `arrays` Arrays to compare keys against. `key_compare_func` The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second. ``` callback(mixed $a, mixed $b): int ``` ### Return Values Returns the values of `array` whose values exist in all of the arguments. ### Examples **Example #1 **array\_intersect\_uassoc()** example** ``` <?php $array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red"); $array2 = array("a" => "GREEN", "B" => "brown", "yellow", "red"); print_r(array_intersect_uassoc($array1, $array2, "strcasecmp")); ?> ``` The above example will output: ``` Array ( [b] => brown ) ``` ### See Also * [array\_intersect()](function.array-intersect) - Computes the intersection of arrays * [array\_intersect\_assoc()](function.array-intersect-assoc) - Computes the intersection of arrays with additional index check * [array\_uintersect\_assoc()](function.array-uintersect-assoc) - Computes the intersection of arrays with additional index check, compares data by a callback function * [array\_uintersect\_uassoc()](function.array-uintersect-uassoc) - Computes the intersection of arrays with additional index check, compares data and indexes by separate callback functions * [array\_intersect\_key()](function.array-intersect-key) - Computes the intersection of arrays using keys for comparison * [array\_intersect\_ukey()](function.array-intersect-ukey) - Computes the intersection of arrays using a callback function on the keys for comparison php DateTimeImmutable::__set_state DateTimeImmutable::\_\_set\_state ================================= (PHP 5 >= 5.5.0, PHP 7, PHP 8) DateTimeImmutable::\_\_set\_state — The \_\_set\_state handler ### Description ``` public static DateTimeImmutable::__set_state(array $array): DateTimeImmutable ``` The [\_\_set\_state()](language.oop5.magic#object.set-state) handler. ### Parameters `array` Initialization array. ### Return Values Returns a new instance of a DateTimeImmutable object. php AssertionError AssertionError ============== Introduction ------------ (PHP 7, PHP 8) **AssertionError** is thrown when an assertion made via [assert()](function.assert) fails. Class synopsis -------------- class **AssertionError** extends [Error](class.error) { /\* Inherited properties \*/ protected string [$message](class.error#error.props.message) = ""; private string [$string](class.error#error.props.string) = ""; protected int [$code](class.error#error.props.code); protected string [$file](class.error#error.props.file) = ""; protected int [$line](class.error#error.props.line); private array [$trace](class.error#error.props.trace) = []; private ?[Throwable](class.throwable) [$previous](class.error#error.props.previous) = null; /\* Inherited methods \*/ ``` final public Error::getMessage(): string ``` ``` final public Error::getPrevious(): ?Throwable ``` ``` final public Error::getCode(): int ``` ``` final public Error::getFile(): string ``` ``` final public Error::getLine(): int ``` ``` final public Error::getTrace(): array ``` ``` final public Error::getTraceAsString(): string ``` ``` public Error::__toString(): string ``` ``` private Error::__clone(): void ``` } php openssl_cms_verify openssl\_cms\_verify ==================== (PHP 8) openssl\_cms\_verify — Verify a CMS signature ### Description ``` openssl_cms_verify( string $input_filename, int $flags = 0, ?string $certificates = null, array $ca_info = [], ?string $untrusted_certificates_filename = null, ?string $content = null, ?string $pk7 = null, ?string $sigfile = null, int $encoding = OPENSSL_ENCODING_SMIME ): bool ``` This function verifies a CMS signature, either attached or detached, with the specified encoding. ### Parameters `input_filename` The input file. `flags` Flags to pass to **cms\_verify()**. `certificates` A file with the signer certificate and optionally intermediate certificates. `ca_info` An array containing self-signed certificate authority certificates. `untrusted_certificates_filename` A file containing additional intermediate certificates. `content` A file pointing to the content when signatures are detached. `pk7` `sigfile` A file to save the signature to. `encoding` The encoding of the input file. One of **`OPENSSL_ENCODING_SMIME`**, **`OPENSSL_ENCODING_DER`** or **`OPENSSL_ENCODING_PEM`**. ### Return Values Returns **`true`** on success or **`false`** on failure. php XMLWriter::writeDtdElement XMLWriter::writeDtdElement ========================== xmlwriter\_write\_dtd\_element ============================== (PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL xmlwriter >= 0.1.0) XMLWriter::writeDtdElement -- xmlwriter\_write\_dtd\_element — Write full DTD element tag ### Description Object-oriented style ``` public XMLWriter::writeDtdElement(string $name, string $content): bool ``` Procedural style ``` xmlwriter_write_dtd_element(XMLWriter $writer, string $name, string $content): bool ``` Writes a full DTD element. ### Parameters `writer` Only for procedural calls. The [XMLWriter](class.xmlwriter) instance that is being modified. This object is returned from a call to [xmlwriter\_open\_uri()](xmlwriter.openuri) or [xmlwriter\_open\_memory()](xmlwriter.openmemory). `name` The name of the DTD element. `content` The content of the element. ### Return Values Returns **`true`** on success or **`false`** on failure. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | `writer` expects an [XMLWriter](class.xmlwriter) instance now; previously, a resource was expected. | ### See Also * [XMLWriter::startDtdElement()](xmlwriter.startdtdelement) - Create start DTD element * [XMLWriter::endDtdElement()](xmlwriter.enddtdelement) - End current DTD element php openssl_cms_encrypt openssl\_cms\_encrypt ===================== (PHP 8) openssl\_cms\_encrypt — Encrypt a CMS message ### Description ``` openssl_cms_encrypt( string $input_filename, string $output_filename, OpenSSLCertificate|array|string $certificate, ?array $headers, int $flags = 0, int $encoding = OPENSSL_ENCODING_SMIME, int $cipher_algo = OPENSSL_CIPHER_AES_128_CBC ): bool ``` This function encrypts content to one or more recipients, based on the certificates that are passed to it. ### Parameters `input_filename` The file to be encrypted. `output_filename` The output file. `certificate` Recipients to encrypt to. `headers` Headers to include when S/MIME is used. `flags` Flags to be passed to CMS\_sign. `encoding` An encoding to output. One of **`OPENSSL_ENCODING_SMIME`**, **`OPENSSL_ENCODING_DER`** or **`OPENSSL_ENCODING_PEM`**. `cipher_algo` A cypher to use. ### Return Values Returns **`true`** on success or **`false`** on failure. ### Changelog | Version | Description | | --- | --- | | 8.1.0 | The default cipher algorithm (`cipher_algo`) is now AES-128-CBC (**`OPENSSL_CIPHER_AES_128_CBC`**). Previously, PKCS7/CMS was used (**`OPENSSL_CIPHER_RC2_40`**). | php ImagickPixelIterator::getIteratorRow ImagickPixelIterator::getIteratorRow ==================================== (PECL imagick 2, PECL imagick 3) ImagickPixelIterator::getIteratorRow — Returns the current pixel iterator row ### Description ``` public ImagickPixelIterator::getIteratorRow(): int ``` **Warning**This function is currently not documented; only its argument list is available. Returns the current pixel iterator row. ### Return Values Returns the integer offset of the row, throwing ImagickPixelIteratorException on error. php Collator::getStrength Collator::getStrength ===================== collator\_get\_strength ======================= (PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0) Collator::getStrength -- collator\_get\_strength — Get current collation strength ### Description Object-oriented style ``` public Collator::getStrength(): int ``` Procedural style ``` collator_get_strength(Collator $object): int ``` ### Parameters `object` [Collator](class.collator) object. ### Return Values Returns current collation strength, or **`false`** on failure. ### Examples **Example #1 **collator\_get\_strength()** example** ``` <?php $coll     = collator_create( 'en_US' ); $strength = collator_get_strength( $coll ); ?> ``` ### See Also * [[Collator](class.collator) constants](class.collator#intl.collator-constants) * [collator\_set\_strength()](collator.setstrength) - Set collation strength * [collator\_get\_attribute()](collator.getattribute) - Get collation attribute value php rawurldecode rawurldecode ============ (PHP 4, PHP 5, PHP 7, PHP 8) rawurldecode — Decode URL-encoded strings ### Description ``` rawurldecode(string $string): string ``` Returns a string in which the sequences with percent (`%`) signs followed by two hex digits have been replaced with literal characters. ### Parameters `string` The URL to be decoded. ### Return Values Returns the decoded URL, as a string. ### Examples **Example #1 **rawurldecode()** example** ``` <?php echo rawurldecode('foo%20bar%40baz'); // foo bar@baz ?> ``` ### Notes > > **Note**: > > > **rawurldecode()** does not decode plus symbols ('+') into spaces. [urldecode()](function.urldecode) does. > > ### See Also * [rawurlencode()](function.rawurlencode) - URL-encode according to RFC 3986 * [urldecode()](function.urldecode) - Decodes URL-encoded string * [urlencode()](function.urlencode) - URL-encodes string * [» RFC 3986](http://www.faqs.org/rfcs/rfc3986) php Yaf_Config_Simple::current Yaf\_Config\_Simple::current ============================ (Yaf >=1.0.0) Yaf\_Config\_Simple::current — The current purpose ### Description ``` public Yaf_Config_Simple::current(): void ``` **Warning**This function is currently not documented; only its argument list is available. ### Parameters This function has no parameters. ### Return Values php gmp_xor gmp\_xor ======== (PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8) gmp\_xor — Bitwise XOR ### Description ``` gmp_xor(GMP|int|string $num1, GMP|int|string $num2): GMP ``` Calculates bitwise exclusive OR (XOR) of two GMP numbers. ### Parameters `num1` A [GMP](class.gmp) object, an int or a numeric string. `num2` A [GMP](class.gmp) object, an int or a numeric string. ### Return Values A [GMP](class.gmp) object. ### Examples **Example #1 **gmp\_xor()** example** ``` <?php $xor1 = gmp_init("1101101110011101", 2); $xor2 = gmp_init("0110011001011001", 2); $xor3 = gmp_xor($xor1, $xor2); echo gmp_strval($xor3, 2) . "\n"; ?> ``` The above example will output: ``` 1011110111000100 ``` php Ds\Sequence::rotate Ds\Sequence::rotate =================== (PECL ds >= 1.0.0) Ds\Sequence::rotate — Rotates the sequence by a given number of rotations ### Description ``` abstract public Ds\Sequence::rotate(int $rotations): void ``` Rotates the sequence by a given number of rotations, which is equivalent to successively calling `$sequence->push($sequence->shift())` if the number of rotations is positive, or `$sequence->unshift($sequence->pop())` if negative. ### Parameters `rotations` The number of times the sequence should be rotated. ### Return Values No value is returned.. The sequence of the current instance will be rotated. ### Examples **Example #1 **Ds\Sequence::rotate()** example** ``` <?php $sequence = new \Ds\Vector(["a", "b", "c", "d"]); $sequence->rotate(1);  // "a" is shifted, then pushed. print_r($sequence); $sequence->rotate(2);  // "b" and "c" are both shifted, the pushed. print_r($sequence); ?> ``` The above example will output something similar to: ``` ( [0] => b [1] => c [2] => d [3] => a ) Ds\Vector Object ( [0] => d [1] => a [2] => b [3] => c ) ``` php The EvSignal class The EvSignal class ================== Introduction ------------ (PECL ev >= 0.2.0) **EvSignal** watchers will trigger an event when the process receives a specific signal one or more times. Even though signals are very asynchronous, *libev* will try its best to deliver signals synchronously, i.e. as part of the normal event processing, like any other event. There is no limit for the number of watchers for the same signal, but only within the same loop, i.e. one can watch for **`SIGINT`** in the default loop and for **`SIGIO`** in another loop, but it is not allowed to watch for **`SIGINT`** in both the default loop and another loop at the same time. At the moment, **`SIGCHLD`** is permanently tied to the default loop. If possible and supported, *libev* will install its handlers with `SA_RESTART` (or equivalent) behaviour enabled, so system calls should not be unduly interrupted. In case of a problem with system calls getting interrupted by signals, all the signals can be blocked in an [EvCheck](class.evcheck) watcher and unblocked in a [EvPrepare](class.evprepare) watcher. Class synopsis -------------- class **EvSignal** extends [EvWatcher](class.evwatcher) { /\* Properties \*/ public [$signum](class.evsignal#evsignal.props.signum); /\* Inherited properties \*/ public [$is\_active](class.evwatcher#evwatcher.props.is-active); public [$data](class.evwatcher#evwatcher.props.data); public [$is\_pending](class.evwatcher#evwatcher.props.is-pending); public [$priority](class.evwatcher#evwatcher.props.priority); /\* Methods \*/ public [\_\_construct](evsignal.construct)( int `$signum` , [callable](language.types.callable) `$callback` , [mixed](language.types.declarations#language.types.declarations.mixed) `$data` = **`null`** , int `$priority` = 0 ) ``` final public static createStopped( int $signum , callable $callback , mixed $data = null , int $priority = 0 ): EvSignal ``` ``` public set( int $signum ): void ``` /\* Inherited methods \*/ ``` public EvWatcher::clear(): int ``` ``` public EvWatcher::feed( int $revents ): void ``` ``` public EvWatcher::getLoop(): EvLoop ``` ``` public EvWatcher::invoke( int $revents ): void ``` ``` public EvWatcher::keepalive( bool $value = ?): bool ``` ``` public EvWatcher::setCallback( callable $callback ): void ``` ``` public EvWatcher::start(): void ``` ``` public EvWatcher::stop(): void ``` } Properties ---------- signum Signal number. See the constants exported by *pcntl* extension. See also `signal(7)` man page. Table of Contents ----------------- * [EvSignal::\_\_construct](evsignal.construct) — Constructs EvSignal watcher object * [EvSignal::createStopped](evsignal.createstopped) — Create stopped EvSignal watcher object * [EvSignal::set](evsignal.set) — Configures the watcher
programming_docs
php Imagick::getQuantumDepth Imagick::getQuantumDepth ======================== (PECL imagick 2, PECL imagick 3) Imagick::getQuantumDepth — Gets the quantum depth ### Description ``` public static Imagick::getQuantumDepth(): array ``` Returns the Imagick quantum depth. ### Parameters This function has no parameters. ### Return Values Returns an array with `"quantumDepthLong"` and `"quantumDepthString"` members. ### Errors/Exceptions Throws ImagickException on error. php gnupg_addencryptkey gnupg\_addencryptkey ==================== (PECL gnupg >= 0.5) gnupg\_addencryptkey — Add a key for encryption ### Description ``` gnupg_addencryptkey(resource $identifier, string $fingerprint): bool ``` ### Parameters `identifier` The gnupg identifier, from a call to [gnupg\_init()](function.gnupg-init) or **gnupg**. `fingerprint` The fingerprint key. ### Return Values Returns **`true`** on success or **`false`** on failure. ### Examples **Example #1 Procedural **gnupg\_addencryptkey()** example** ``` <?php $res = gnupg_init(); gnupg_addencryptkey($res,"8660281B6051D071D94B5B230549F9DC851566DC"); ?> ``` **Example #2 OO **gnupg\_addencryptkey()** example** ``` <?php $gpg = new gnupg(); $gpg->addencryptkey("8660281B6051D071D94B5B230549F9DC851566DC"); ?> ``` php EvPeriodic::again EvPeriodic::again ================= (PECL ev >= 0.2.0) EvPeriodic::again — Simply stops and restarts the periodic watcher again ### Description ``` public EvPeriodic::again(): void ``` Simply stops and restarts the periodic watcher again. This is only useful when attributes are changed. ### Parameters This function has no parameters. ### Return Values No value is returned. ### See Also * [EvTimer::again()](evtimer.again) - Restarts the timer watcher php ReflectionFunctionAbstract::isInternal ReflectionFunctionAbstract::isInternal ====================================== (PHP 5 >= 5.2.0, PHP 7, PHP 8) ReflectionFunctionAbstract::isInternal — Checks if is internal ### Description ``` public ReflectionFunctionAbstract::isInternal(): bool ``` Checks whether the function is internal, as opposed to user-defined. ### Parameters This function has no parameters. ### Return Values **`true`** if it's internal, otherwise **`false`** ### See Also * [ReflectionFunctionAbstract::isUserDefined()](reflectionfunctionabstract.isuserdefined) - Checks if user defined php zip_entry_filesize zip\_entry\_filesize ==================== (PHP 4 >= 4.1.0, PHP 5 >= 5.2.0, PHP 7, PHP 8, PECL zip >= 1.0.0) zip\_entry\_filesize — Retrieve the actual file size of a directory entry **Warning**This function has been *DEPRECATED* as of PHP 8.0.0. Relying on this function is highly discouraged. ### Description ``` zip_entry_filesize(resource $zip_entry): int|false ``` Returns the actual size of the specified directory entry. ### Parameters `zip_entry` A directory entry returned by [zip\_read()](function.zip-read). ### Return Values The size of the directory entry, or **`false`** on failure. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | This function is deprecated in favor of the Object API, see [ZipArchive::statIndex()](ziparchive.statindex). | ### See Also * [zip\_open()](function.zip-open) - Open a ZIP file archive * [zip\_read()](function.zip-read) - Read next entry in a ZIP file archive php mysqli::reap_async_query mysqli::reap\_async\_query ========================== mysqli\_reap\_async\_query ========================== (PHP 5 >= 5.3.0, PHP 7, PHP 8) mysqli::reap\_async\_query -- mysqli\_reap\_async\_query — Get result from async query ### Description Object-oriented style ``` public mysqli::reap_async_query(): mysqli_result|bool ``` Procedural style ``` mysqli_reap_async_query(mysqli $mysql): mysqli_result|bool ``` Get result from async query. > > **Note**: > > > Available only with [mysqlnd](https://www.php.net/manual/en/book.mysqlnd.php). > > ### Parameters `mysql` Procedural style only: A [mysqli](class.mysqli) object returned by [mysqli\_connect()](function.mysqli-connect) or [mysqli\_init()](mysqli.init) ### Return Values Returns **`false`** on failure. For successful queries which produce a result set, such as `SELECT, SHOW, DESCRIBE` or `EXPLAIN`, **mysqli\_reap\_async\_query()** will return a [mysqli\_result](class.mysqli-result) object. For other successful queries, **mysqli\_reap\_async\_query()** will return **`true`**. ### See Also * [mysqli\_poll()](mysqli.poll) - Poll connections php grapheme_strpos grapheme\_strpos ================ (PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0) grapheme\_strpos — Find position (in grapheme units) of first occurrence of a string ### Description Procedural style ``` grapheme_strpos(string $haystack, string $needle, int $offset = 0): int|false ``` Find position (in grapheme units) of first occurrence of a string ### Parameters `haystack` The string to look in. Must be valid UTF-8. `needle` The string to look for. Must be valid UTF-8. `offset` The optional `offset` parameter allows you to specify where in `haystack` to start searching as an offset in grapheme units (not bytes or characters). If the offset is negative, it is treated relative to the end of the string. The position returned is still relative to the beginning of `haystack` regardless of the value of `offset`. ### Return Values Returns the position as an integer. If `needle` is not found, **grapheme\_strpos()** will return **`false`**. ### Changelog | Version | Description | | --- | --- | | 7.1.0 | Support for negative `offset`s has been added. | ### Examples **Example #1 **grapheme\_strpos()** example** ``` <?php $char_a_ring_nfd = "a\xCC\x8A";  // 'LATIN SMALL LETTER A WITH RING ABOVE' (U+00E5) normalization form "D" $char_o_diaeresis_nfd = "o\xCC\x88"; // 'LATIN SMALL LETTER O WITH DIAERESIS' (U+00F6) normalization form "D" print grapheme_strpos( $char_a_ring_nfd . $char_a_ring_nfd . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd); ?> ``` The above example will output: ``` 2 ``` ### See Also * [grapheme\_stripos()](function.grapheme-stripos) - Find position (in grapheme units) of first occurrence of a case-insensitive string * [grapheme\_stristr()](function.grapheme-stristr) - Returns part of haystack string from the first occurrence of case-insensitive needle to the end of haystack * [grapheme\_strripos()](function.grapheme-strripos) - Find position (in grapheme units) of last occurrence of a case-insensitive string * [grapheme\_strrpos()](function.grapheme-strrpos) - Find position (in grapheme units) of last occurrence of a string * [grapheme\_strstr()](function.grapheme-strstr) - Returns part of haystack string from the first occurrence of needle to the end of haystack * [» Unicode Text Segmentation: Grapheme Cluster Boundaries](http://unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries) php Ds\Vector::sorted Ds\Vector::sorted ================= (PECL ds >= 1.0.0) Ds\Vector::sorted — Returns a sorted copy ### Description ``` public Ds\Vector::sorted(callable $comparator = ?): Ds\Vector ``` Returns a sorted copy, using an optional `comparator` function. ### Parameters `comparator` The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second. ``` callback(mixed $a, mixed $b): int ``` **Caution** Returning *non-integer* values from the comparison function, such as float, will result in an internal cast to int of the callback's return value. So values such as 0.99 and 0.1 will both be cast to an integer value of 0, which will compare such values as equal. ### Return Values Returns a sorted copy of the vector. ### Examples **Example #1 **Ds\Vector::sorted()** example** ``` <?php $vector = new \Ds\Vector([4, 5, 1, 3, 2]); print_r($vector->sorted()); ?> ``` The above example will output something similar to: ``` Ds\Vector Object ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 ) ``` **Example #2 **Ds\Vector::sorted()** example using a comparator** ``` <?php $vector = new \Ds\Vector([4, 5, 1, 3, 2]); $sorted = $vector->sorted(function($a, $b) {     return $b <=> $a; }); print_r($sorted); ?> ``` The above example will output something similar to: ``` Ds\Vector Object ( [0] => 5 [1] => 4 [2] => 3 [3] => 2 [4] => 1 ) ``` php str_shuffle str\_shuffle ============ (PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8) str\_shuffle — Randomly shuffles a string ### Description ``` str_shuffle(string $string): string ``` **str\_shuffle()** shuffles a string. One permutation of all possible is created. **Caution** This function does not generate cryptographically secure values, and *must not* be used for cryptographic purposes, or purposes that require returned values to be unguessable. If cryptographically secure randomness is required, the [Random\Randomizer](https://www.php.net/manual/en/class.random-randomizer.php) may be used with the [Random\Engine\Secure](https://www.php.net/manual/en/class.random-engine-secure.php) engine. For simple use cases, the [random\_int()](https://www.php.net/manual/en/function.random-int.php) and [random\_bytes()](https://www.php.net/manual/en/function.random-bytes.php) functions provide a convenient and secure API that is backed by the operating system’s CSPRNG. ### Parameters `string` The input string. ### Return Values Returns the shuffled string. ### Changelog | Version | Description | | --- | --- | | 7.1.0 | The internal randomization algorithm [has been changed](https://www.php.net/manual/en/migration71.incompatible.php#migration71.incompatible.rand-srand-aliases) to use the [» Mersenne Twister](http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html) Random Number Generator instead of the libc rand function. | ### Examples **Example #1 **str\_shuffle()** example** ``` <?php $str = 'abcdef'; $shuffled = str_shuffle($str); // This will echo something like: bfdaec echo $shuffled; ?> ``` ### See Also * [Random\Randomizer::shuffleBytes()](https://www.php.net/manual/en/random-randomizer.shufflebytes.php) - Get a byte-wise permutation of a string * [Random\Randomizer::shuffleArray()](https://www.php.net/manual/en/random-randomizer.shufflearray.php) - Get a permutation of an array php pspell_config_create pspell\_config\_create ====================== (PHP 4 >= 4.0.2, PHP 5, PHP 7, PHP 8) pspell\_config\_create — Create a config used to open a dictionary ### Description ``` pspell_config_create( string $language, string $spelling = "", string $jargon = "", string $encoding = "" ): PSpell\Config ``` Create a config used to open a dictionary. **pspell\_config\_create()** has a very similar syntax to [pspell\_new()](function.pspell-new). In fact, using **pspell\_config\_create()** immediately followed by [pspell\_new\_config()](function.pspell-new-config) will produce the exact same result. However, after creating a new config, you can also use **pspell\_config\_\*()** functions before calling [pspell\_new\_config()](function.pspell-new-config) to take advantage of some advanced functionality. For more information and examples, check out inline manual pspell website:[» http://aspell.net/](http://aspell.net/). ### Parameters `language` The language parameter is the language code which consists of the two letter ISO 639 language code and an optional two letter ISO 3166 country code after a dash or underscore. `spelling` The spelling parameter is the requested spelling for languages with more than one spelling such as English. Known values are 'american', 'british', and 'canadian'. `jargon` The jargon parameter contains extra information to distinguish two different words lists that have the same language and spelling parameters. `encoding` The encoding parameter is the encoding that words are expected to be in. Valid values are 'utf-8', 'iso8859-\*', 'koi8-r', 'viscii', 'cp1252', 'machine unsigned 16', 'machine unsigned 32'. This parameter is largely untested, so be careful when using. ### Return Values Returns an [PSpell\Config](class.pspell-config) instance on success, or **`false`** on failure. ### Changelog | Version | Description | | --- | --- | | 8.1.0 | Returns an [PSpell\Config](class.pspell-config) instance now; previously, a [resource](language.types.resource) was returned. | ### Examples **Example #1 **pspell\_config\_create()**** ``` <?php $pspell_config = pspell_config_create("en"); pspell_config_personal($pspell_config, "/var/dictionaries/custom.pws"); pspell_config_repl($pspell_config, "/var/dictionaries/custom.repl"); $pspell = pspell_new_personal($pspell_config, "en"); ?> ``` php IntlDateFormatter::getErrorCode IntlDateFormatter::getErrorCode =============================== datefmt\_get\_error\_code ========================= (PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0) IntlDateFormatter::getErrorCode -- datefmt\_get\_error\_code — Get the error code from last operation ### Description Object-oriented style ``` public IntlDateFormatter::getErrorCode(): int ``` Procedural style ``` datefmt_get_error_code(IntlDateFormatter $formatter): int ``` Get the error code from last operation. Returns error code from the last number formatting operation. ### Parameters `formatter` The formatter resource. ### Return Values The error code, one of UErrorCode values. Initial value is U\_ZERO\_ERROR. ### Examples **Example #1 **datefmt\_get\_error\_code()** example** ``` <?php $fmt = datefmt_create(     'en_US',     IntlDateFormatter::FULL,     IntlDateFormatter::FULL,     'America/Los_Angeles',     IntlDateFormatter::GREGORIAN ); $str = datefmt_format($fmt); if (!$str) {     printf(         "ERROR: %s (%d)\n",         datefmt_get_error_message($fmt),         datefmt_get_error_code($fmt)     ); } ?> ``` **Example #2 OO example** ``` <?php $fmt = new IntlDateFormatter(     'en_US',     IntlDateFormatter::FULL,     IntlDateFormatter::FULL,     'America/Los_Angeles',     IntlDateFormatter::GREGORIAN ); $str = $fmt->format(); if (!$str) {     printf(         "ERROR: %s (%d)\n",         $fmt->getErrorMessage(),         $fmt->getErrorCode()     ); } ?> ``` The above example will output: ``` ERROR: U_ZERO_ERROR (0) ``` ### See Also * [datefmt\_get\_error\_message()](intldateformatter.geterrormessage) - Get the error text from the last operation * [intl\_get\_error\_code()](function.intl-get-error-code) - Get the last error code * [intl\_is\_failure()](function.intl-is-failure) - Check whether the given error code indicates failure php Imagick::setProgressMonitor Imagick::setProgressMonitor =========================== (PECL imagick 3 >= 3.3.0) Imagick::setProgressMonitor — Description ### Description ``` public Imagick::setProgressMonitor(callable $callback): bool ``` Set a callback that will be called during the processing of the Imagick image. ### Parameters `callback` The progress function to call. It should return true if image processing should continue, or false if it should be cancelled. The offset parameter indicates the progress and the span parameter indicates the total amount of work needed to be done. ``` callback ( mixed $offset , mixed $span ): bool ``` **Caution** The values passed to the callback function are not consistent. In particular the span parameter can increase during image processing. Because of this calculating the percentage complete of an image operation is not trivial. ### Return Values Returns **`true`** on success. ### Examples **Example #1 **Imagick::setProgressMonitor()**** ``` <?php         $abortReason = null;                  try {             $imagick = new \Imagick(realpath($this->control->getImagePath()));             $startTime = time();             $callback = function ($offset, $span)  use ($startTime, &$abortReason) {                 if (((100 * $offset) / $span)  > 20) {                     $abortReason = "Processing reached 20%";                     return false;                 }                 $nowTime = time();                 if ($nowTime - $startTime > 5) {                     $abortReason = "Image processing took more than 5 seconds";                     return false;                 }                 if (($offset % 5) == 0) {                     echo "Progress: $offset / $span <br/>";                 }                 return true;             };             $imagick->setProgressMonitor($callback);             $imagick->waveImage(2, 15);             echo "Data len is: ".strlen($imagick->getImageBlob());         }         catch(\ImagickException $e) {             if ($abortReason != null) {                 echo "Image processing was aborted: ".$abortReason."<br/>";             }             else {                 echo "ImagickException caught: ".$e->getMessage()." Exception type is ".get_class($e);             }         } ?> ``` php fbird_db_info fbird\_db\_info =============== (PHP 5, PHP 7 < 7.4.0) fbird\_db\_info — Alias of [ibase\_db\_info()](function.ibase-db-info) ### Description This function is an alias of: [ibase\_db\_info()](function.ibase-db-info). php None Namespaces overview ------------------- (PHP 5 >= 5.3.0, PHP 7, PHP 8) What are namespaces? In the broadest definition namespaces are a way of encapsulating items. This can be seen as an abstract concept in many places. For example, in any operating system directories serve to group related files, and act as a namespace for the files within them. As a concrete example, the file `foo.txt` can exist in both directory `/home/greg` and in `/home/other`, but two copies of `foo.txt` cannot co-exist in the same directory. In addition, to access the `foo.txt` file outside of the `/home/greg` directory, we must prepend the directory name to the file name using the directory separator to get `/home/greg/foo.txt`. This same principle extends to namespaces in the programming world. In the PHP world, namespaces are designed to solve two problems that authors of libraries and applications encounter when creating re-usable code elements such as classes or functions: 1. Name collisions between code you create, and internal PHP classes/functions/constants or third-party classes/functions/constants. 2. Ability to alias (or shorten) Extra\_Long\_Names designed to alleviate the first problem, improving readability of source code. PHP Namespaces provide a way in which to group related classes, interfaces, functions and constants. Here is an example of namespace syntax in PHP: **Example #1 Namespace syntax example** ``` <?php namespace my\name; // see "Defining Namespaces" section class MyClass {} function myfunction() {} const MYCONST = 1; $a = new MyClass; $c = new \my\name\MyClass; // see "Global Space" section $a = strlen('hi'); // see "Using namespaces: fallback to global                    // function/constant" section $d = namespace\MYCONST; // see "namespace operator and __NAMESPACE__                         // constant" section $d = __NAMESPACE__ . '\MYCONST'; echo constant($d); // see "Namespaces and dynamic language features" section ?> ``` > **Note**: Namespace names are case-insensitive. > > > > **Note**: > > > The Namespace name `PHP`, and compound names starting with this name (like `PHP\Classes`) are reserved for internal language use and should not be used in the userspace code. > >
programming_docs
php The Yar_Server_Exception class The Yar\_Server\_Exception class ================================ Introduction ------------ (No version information available, might only be in Git) If service threw exceptions, A Yar\_Server\_Exception will be threw in client side. Class synopsis -------------- class **Yar\_Server\_Exception** extends [Exception](class.exception) { /\* Properties \*/ protected [$\_type](class.yar-server-exception#yar-server-exception.props.type); /\* Methods \*/ ``` public getType(): string ``` /\* Inherited methods \*/ ``` final public Exception::getMessage(): string ``` ``` final public Exception::getPrevious(): ?Throwable ``` ``` final public Exception::getCode(): int ``` ``` final public Exception::getFile(): string ``` ``` final public Exception::getLine(): int ``` ``` final public Exception::getTrace(): array ``` ``` final public Exception::getTraceAsString(): string ``` ``` public Exception::__toString(): string ``` ``` private Exception::__clone(): void ``` } Properties ---------- message code file line \_type Table of Contents ----------------- * [Yar\_Server\_Exception::getType](yar-server-exception.gettype) — Retrieve exception's type php pg_close pg\_close ========= (PHP 4, PHP 5, PHP 7, PHP 8) pg\_close — Closes a PostgreSQL connection ### Description ``` pg_close(?PgSql\Connection $connection = null): bool ``` **pg\_close()** closes the non-persistent connection to a PostgreSQL database associated with the given `connection` instance. > > **Note**: > > > Using **pg\_close()** is not usually necessary, as non-persistent open connections are automatically closed at the end of the script. > > If there is open [PgSql\Lob](class.pgsql-lob) instance on the connection, do not close the connection before closing all [PgSql\Lob](class.pgsql-lob) instances. ### Parameters `connection` An [PgSql\Connection](class.pgsql-connection) instance. When `connection` is **`null`**, the default connection is used. The default connection is the last connection made by [pg\_connect()](function.pg-connect) or [pg\_pconnect()](function.pg-pconnect). **Warning**As of PHP 8.1.0, using the default connection is deprecated. ### Return Values Always returns **`true`**. ### Changelog | Version | Description | | --- | --- | | 8.1.0 | The `connection` parameter expects an [PgSql\Connection](class.pgsql-connection) instance now; previously, a [resource](language.types.resource) was expected. | | 8.0.0 | `connection` is now nullable. | ### Examples **Example #1 **pg\_close()** example** ``` <?php $dbconn = pg_connect("host=localhost port=5432 dbname=mary")    or die("Could not connect"); echo "Connected successfully"; pg_close($dbconn); ?> ``` The above example will output: ``` Connected successfully ``` ### See Also * [pg\_connect()](function.pg-connect) - Open a PostgreSQL connection php memory_get_peak_usage memory\_get\_peak\_usage ======================== (PHP 5 >= 5.2.0, PHP 7, PHP 8) memory\_get\_peak\_usage — Returns the peak of memory allocated by PHP ### Description ``` memory_get_peak_usage(bool $real_usage = false): int ``` Returns the peak of memory, in bytes, that's been allocated to your PHP script. ### Parameters `real_usage` Set this to **`true`** to get the real size of memory allocated from system. If not set or **`false`** only the memory used by `emalloc()` is reported. ### Return Values Returns the memory peak in bytes. ### See Also * [memory\_get\_usage()](function.memory-get-usage) - Returns the amount of memory allocated to PHP * [memory\_reset\_peak\_usage()](function.memory-reset-peak-usage) - Reset the peak memory usage * [memory\_limit](https://www.php.net/manual/en/ini.core.php#ini.memory-limit) php imagesetpixel imagesetpixel ============= (PHP 4, PHP 5, PHP 7, PHP 8) imagesetpixel — Set a single pixel ### Description ``` imagesetpixel( GdImage $image, int $x, int $y, int $color ): bool ``` **imagesetpixel()** draws a pixel at the specified coordinate. ### Parameters `image` A [GdImage](class.gdimage) object, returned by one of the image creation functions, such as [imagecreatetruecolor()](function.imagecreatetruecolor). `x` x-coordinate. `y` y-coordinate. `color` A color identifier created with [imagecolorallocate()](function.imagecolorallocate). ### Return Values Returns **`true`** on success or **`false`** on failure. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | `image` expects a [GdImage](class.gdimage) instance now; previously, a resource was expected. | ### Examples **Example #1 **imagesetpixel()** example** A random drawing that ends with a regular picture. ``` <?php $x = 200; $y = 200; $gd = imagecreatetruecolor($x, $y);   $corners[0] = array('x' => 100, 'y' =>  10); $corners[1] = array('x' =>   0, 'y' => 190); $corners[2] = array('x' => 200, 'y' => 190); $red = imagecolorallocate($gd, 255, 0, 0);  for ($i = 0; $i < 100000; $i++) {   imagesetpixel($gd, round($x),round($y), $red);   $a = rand(0, 2);   $x = ($x + $corners[$a]['x']) / 2;   $y = ($y + $corners[$a]['y']) / 2; }   header('Content-Type: image/png'); imagepng($gd); ?> ``` The above example will output something similar to: ### See Also * [imagecreatetruecolor()](function.imagecreatetruecolor) - Create a new true color image * [imagecolorallocate()](function.imagecolorallocate) - Allocate a color for an image * [imagecolorat()](function.imagecolorat) - Get the index of the color of a pixel php date_get_last_errors date\_get\_last\_errors ======================= (PHP 5 >= 5.3.0, PHP 7, PHP 8) date\_get\_last\_errors — Alias of [DateTime::getLastErrors()](datetime.getlasterrors) ### Description This function is an alias of: [DateTime::getLastErrors()](datetime.getlasterrors) php DOMNode::hasChildNodes DOMNode::hasChildNodes ====================== (PHP 5, PHP 7, PHP 8) DOMNode::hasChildNodes — Checks if node has children ### Description ``` public DOMNode::hasChildNodes(): bool ``` This function checks if the node has children. ### Parameters This function has no parameters. ### Return Values Returns **`true`** on success or **`false`** on failure. ### See Also * [DOMNode::hasAttributes()](domnode.hasattributes) - Checks if node has attributes php posix_getpwnam posix\_getpwnam =============== (PHP 4, PHP 5, PHP 7, PHP 8) posix\_getpwnam — Return info about a user by username ### Description ``` posix_getpwnam(string $username): array|false ``` Returns an array of information about the given user. ### Parameters `username` An alphanumeric username. ### Return Values On success an array with the following elements is returned, else **`false`** is returned: **The user information array**| Element | Description | | --- | --- | | name | The name element contains the username of the user. This is a short, usually less than 16 character "handle" of the user, not the real, full name. This should be the same as the `username` parameter used when calling the function, and hence redundant. | | passwd | The passwd element contains the user's password in an encrypted format. Often, for example on a system employing "shadow" passwords, an asterisk is returned instead. | | uid | User ID of the user in numeric form. | | gid | The group ID of the user. Use the function [posix\_getgrgid()](function.posix-getgrgid) to resolve the group name and a list of its members. | | gecos | GECOS is an obsolete term that refers to the finger information field on a Honeywell batch processing system. The field, however, lives on, and its contents have been formalized by POSIX. The field contains a comma separated list containing the user's full name, office phone, office number, and home phone number. On most systems, only the user's full name is available. | | dir | This element contains the absolute path to the home directory of the user. | | shell | The shell element contains the absolute path to the executable of the user's default shell. | ### Examples **Example #1 Example use of **posix\_getpwnam()**** ``` <?php $userinfo = posix_getpwnam("tom"); print_r($userinfo); ?> ``` The above example will output something similar to: ``` Array ( [name] => tom [passwd] => x [uid] => 10000 [gid] => 42 [gecos] => "tom,,," [dir] => "/home/tom" [shell] => "/bin/bash" ) ``` ### See Also * [posix\_getpwuid()](function.posix-getpwuid) - Return info about a user by user id * POSIX man page GETPWNAM(3) php The GdImage class The GdImage class ================= Introduction ------------ (PHP 8) A fully opaque class which replaces `gd` resources as of PHP 8.0.0. Class synopsis -------------- final class **GdImage** { } php preg_last_error_msg preg\_last\_error\_msg ====================== (PHP 8) preg\_last\_error\_msg — Returns the error message of the last PCRE regex execution ### Description ``` preg_last_error_msg(): string ``` Returns the error message of the last PCRE regex execution. ### Parameters This function has no parameters. ### Return Values Returns the error message on success, or `"No error"` if no error has occurred. ### Examples **Example #1 **preg\_last\_error\_msg()** example** ``` <?php preg_match('/(?:\D+|<\d+>)*[!?]/', 'foobar foobar foobar'); if (preg_last_error() !== PREG_NO_ERROR) {     echo preg_last_error_msg(); } ?> ``` The above example will output: ``` Backtrack limit exhausted ``` ### See Also * [preg\_last\_error()](function.preg-last-error) - Returns the error code of the last PCRE regex execution php radius_salt_encrypt_attr radius\_salt\_encrypt\_attr =========================== (PECL radius >= 1.3.0) radius\_salt\_encrypt\_attr — Salt-encrypts a value ### Description ``` radius_salt_encrypt_attr(resource $radius_handle, string $data): string|false ``` Applies the RADIUS salt-encryption algorithm to the given value. In general, this is achieved automatically by providing the **`RADIUS_OPTION_SALT`** option to an attribute setter function, but this function can be used if low-level request construction is required. ### Parameters `data` The data to be salt-encrypted. ### Return Values Returns the salt-encrypted data or **`false`** on failure. ### See Also * [radius\_put\_addr()](function.radius-put-addr) - Attaches an IP address attribute * [radius\_put\_attr()](function.radius-put-attr) - Attaches a binary attribute * [radius\_put\_int()](function.radius-put-int) - Attaches an integer attribute * [radius\_put\_string()](function.radius-put-string) - Attaches a string attribute php RecursiveArrayIterator::hasChildren RecursiveArrayIterator::hasChildren =================================== (PHP 5 >= 5.1.0, PHP 7, PHP 8) RecursiveArrayIterator::hasChildren — Returns whether current entry is an array or an object ### Description ``` public RecursiveArrayIterator::hasChildren(): bool ``` Returns whether current entry is an array or an object for which an iterator can be obtained via [RecursiveArrayIterator::getChildren()](recursivearrayiterator.getchildren). ### Parameters This function has no parameters. ### Return Values Returns **`true`** if the current entry is an array or an object, otherwise **`false`** is returned. ### Examples **Example #1 **RecursiveArrayIterator::hasChildren()** example** ``` <?php $fruits = array("a" => "lemon", "b" => "orange", array("a" => "apple", "p" => "pear")); $iterator = new RecursiveArrayIterator($fruits); while ($iterator->valid()) {     // Check if there are children     if ($iterator->hasChildren()) {         // print all children         foreach ($iterator->getChildren() as $key => $value) {             echo $key . ' : ' . $value . "\n";         }     } else {         echo "No children.\n";     }     $iterator->next(); } ?> ``` The above example will output: ``` No children. No children. a : apple p : pear ``` ### See Also * [RecursiveArrayIterator::getChildren()](recursivearrayiterator.getchildren) - Returns an iterator for the current entry if it is an array or an object php GmagickDraw::setfillcolor GmagickDraw::setfillcolor ========================= (PECL gmagick >= Unknown) GmagickDraw::setfillcolor — Sets the fill color to be used for drawing filled objects ### Description ``` public GmagickDraw::setfillcolor(mixed $color): GmagickDraw ``` Sets the fill color to be used for drawing filled objects. ### Parameters `color` [GmagickPixel](class.gmagickpixel) or string indicating color to use for filling. ### Return Values The [GmagickDraw](class.gmagickdraw) object on success. php ImagickDraw::getFillColor ImagickDraw::getFillColor ========================= (PECL imagick 2, PECL imagick 3) ImagickDraw::getFillColor — Returns the fill color ### Description ``` public ImagickDraw::getFillColor(): ImagickPixel ``` **Warning**This function is currently not documented; only its argument list is available. Returns the fill color used for drawing filled objects. ### Return Values Returns an [ImagickPixel](class.imagickpixel) object. php The Componere\Definition class The Componere\Definition class ============================== Introduction ------------ (Componere 2 >= 2.1.0) The Definition class allows the programmer to build and register a type at runtime. Should a Definition replace an existing class, the existing class will be restored when the Definition is destroyed. Class synopsis -------------- final class **Componere\Definition** extends [Componere\Abstract\Definition](class.componere-abstract-definition) { /\* Constructors \*/ public [\_\_construct](componere-definition.construct)(string `$name`) public [\_\_construct](componere-definition.construct)(string `$name`, string `$parent`) public [\_\_construct](componere-definition.construct)(string `$name`, array `$interfaces`) public [\_\_construct](componere-definition.construct)(string `$name`, string `$parent`, array `$interfaces`) /\* Methods \*/ ``` public addConstant(string $name, Componere\Value $value): Definition ``` ``` public addProperty(string $name, Componere\Value $value): Definition ``` ``` public register(): void ``` ``` public isRegistered(): bool ``` ``` public getClosure(string $name): Closure ``` ``` public getClosures(): array ``` /\* Inherited methods \*/ ``` public Componere\Abstract\Definition::addInterface(string $interface): Definition ``` ``` public Componere\Abstract\Definition::addMethod(string $name, Componere\Method $method): Definition ``` ``` public Componere\Abstract\Definition::addTrait(string $trait): Definition ``` ``` public Componere\Abstract\Definition::getReflector(): ReflectionClass ``` } Table of Contents ----------------- * [Componere\Definition::\_\_construct](componere-definition.construct) — Definition Construction * [Componere\Definition::addConstant](componere-definition.addconstant) — Add Constant * [Componere\Definition::addProperty](componere-definition.addproperty) — Add Property * [Componere\Definition::register](componere-definition.register) — Registration * [Componere\Definition::isRegistered](componere-definition.isregistered) — State Detection * [Componere\Definition::getClosure](componere-definition.getclosure) — Get Closure * [Componere\Definition::getClosures](componere-definition.getclosures) — Get Closures php radius_put_string radius\_put\_string =================== (PECL radius >= 1.1.0) radius\_put\_string — Attaches a string attribute ### Description ``` radius_put_string( resource $radius_handle, int $type, string $value, int $options = 0, int $tag = ? ): bool ``` Attaches a string attribute to the current RADIUS request. In general, [radius\_put\_attr()](function.radius-put-attr) is a more useful function for attaching string attributes, as it is binary safe. > > **Note**: > > > A request must be created via [radius\_create\_request()](function.radius-create-request) before this function can be called. > > > ### Parameters `radius_handle` The RADIUS resource. `type` The attribute type. `value` The attribute value. This value is expected by the underlying library to be null terminated, therefore this parameter is not binary safe. `options` A bitmask of the attribute options. The available options include [**`RADIUS_OPTION_TAGGED`**](https://www.php.net/manual/en/radius.constants.options.php#constant.radius-option-tagged) and [**`RADIUS_OPTION_SALT`**](https://www.php.net/manual/en/radius.constants.options.php#constant.radius-option-salt). `tag` The attribute tag. This parameter is ignored unless the [**`RADIUS_OPTION_TAGGED`**](https://www.php.net/manual/en/radius.constants.options.php#constant.radius-option-tagged) option is set. ### Return Values Returns **`true`** on success or **`false`** on failure. ### Changelog | Version | Description | | --- | --- | | PECL radius 1.3.0 | The `options` and `tag` parameters were added. | ### Examples **Example #1 **radius\_put\_string()** example** ``` <?php if (!radius_put_string($res, RADIUS_USER_NAME, 'billy')) {     echo 'RadiusError:' . radius_strerror($res). "\n<br />";     exit; } ?> ``` ### See Also * [radius\_put\_int()](function.radius-put-int) - Attaches an integer attribute * [radius\_put\_vendor\_int()](function.radius-put-vendor-int) - Attaches a vendor specific integer attribute * [radius\_put\_vendor\_string()](function.radius-put-vendor-string) - Attaches a vendor specific string attribute php Yaf_Loader::getNamespacePath Yaf\_Loader::getNamespacePath ============================= (Yaf >=3.2.0) Yaf\_Loader::getNamespacePath — Retieve path of a registered namespace ### Description ``` public Yaf_Loader::getNamespacePath(string $namespaces): string ``` retrieve path of a registered namespace ### Parameters `namespace` a string of namespace. ### Return Values string path, if the namespace is not registered, then **`null`** default library will be returned ### Examples **Example #1 [Yaf\_Loader::registerNamespace()](yaf-loader.registernamespace)example** ``` <?php $loader = Yaf_Loader::getInstance("/var/application/lib"); $loader->registerNamespace("\Vendor\PHP", "/var/lib/php"); $loader->getNamespacePath("\Vendor\PHP"); // '/var/lib/php' $loader->getNamespacePath("\Vendor\JSP"); // '/var/application/lib' ?> ``` php RarEntry::extract RarEntry::extract ================= (PECL rar >= 0.1) RarEntry::extract — Extract entry from the archive ### Description ``` public RarEntry::extract( string $dir, string $filepath = "", string $password = NULL, bool $extended_data = false ): bool ``` **RarEntry::extract()** extracts the entry's data. It will create new file in the specified `dir` with the name identical to the entry's name, unless the second argument is specified. See below for more information. ### Parameters `dir` Path to the directory where files should be extracted. This parameter is considered if and only if `filepath` is not. If both parameters are empty an extraction to the current directory will be attempted. `filepath` Path (relative or absolute) containing the directory and filename of the extracted file. This parameter overrides both the parameter `dir` and the original file name. `password` The password used to encrypt this entry. If the entry is not encrypted, this value will not be used and can be omitted. If this parameter is omitted and the entry is encrypted, the password given to [rar\_open()](rararchive.open), if any, will be used. If a wrong password is given, either explicitly or implicitly via [rar\_open()](rararchive.open), CRC checking will fail and this method will fail and return **`false`**. If no password is given and one is required, this method will fail and return **`false`**. You can check whether an entry is encrypted with [RarEntry::isEncrypted()](rarentry.isencrypted). `extended_data` If **`true`**, extended information such as NTFS ACLs and Unix owner information will be set in the extract files, as long as it's present in the archive. **Warning** Prior to version 2.0.0, this function would not handle relative paths correctly. Use [realpath()](function.realpath) as a workaround. ### Return Values Returns **`true`** on success or **`false`** on failure. ### Changelog | Version | Description | | --- | --- | | PECL rar 3.0.0 | `extended_data` was added. | | PECL rar 3.0.0 | Support for RAR archives with repeated entry names is no longer defective. | ### Examples **Example #1 **RarEntry::extract()** example** ``` <?php $rar_file = rar_open('example.rar') or die("Failed to open Rar archive"); $entry = rar_entry_get($rar_file, 'Dir/file.txt') or die("Failed to find such entry"); $entry->extract('/dir/to'); // create /dir/to/Dir/file.txt $entry->extract(false, '/dir/to/new_name.txt'); // create /dir/to/new_name.txt ?> ``` **Example #2 How to extract all files in archive:** ``` <?php /* example by Erik Jenssen aka erix */ $filename = "foobar.rar"; $filepath = "/home/foo/bar/"; $rar_file = rar_open($filepath.$filename); $list = rar_list($rar_file); foreach($list as $file) {     $entry = rar_entry_get($rar_file, $file);     $entry->extract("."); // extract to the current dir } rar_close($rar_file); ?> ``` ### See Also * [RarEntry::getStream()](rarentry.getstream) - Get file handler for entry * [`rar://` wrapper](https://www.php.net/manual/en/wrappers.rar.php)
programming_docs
php SplHeap::key SplHeap::key ============ (PHP 5 >= 5.3.0, PHP 7, PHP 8) SplHeap::key — Return current node index ### Description ``` public SplHeap::key(): int ``` This function returns the current node index ### Parameters This function has no parameters. ### Return Values The current node index. php PDO::quote PDO::quote ========== (PHP 5 >= 5.1.0, PHP 7, PHP 8, PECL pdo >= 0.2.1) PDO::quote — Quotes a string for use in a query ### Description ``` public PDO::quote(string $string, int $type = PDO::PARAM_STR): string|false ``` **PDO::quote()** places quotes around the input string (if required) and escapes special characters within the input string, using a quoting style appropriate to the underlying driver. If you are using this function to build SQL statements, you are *strongly* recommended to use [PDO::prepare()](pdo.prepare) to prepare SQL statements with bound parameters instead of using **PDO::quote()** to interpolate user input into an SQL statement. Prepared statements with bound parameters are not only more portable, more convenient, immune to SQL injection, but are often much faster to execute than interpolated queries, as both the server and client side can cache a compiled form of the query. Not all PDO drivers implement this method (notably PDO\_ODBC). Consider using prepared statements instead. **Caution** Security: the default character set =================================== The character set must be set either on the server level, or within the database connection itself (depending on the driver) for it to affect **PDO::quote()**. See the [driver-specific documentation](https://www.php.net/manual/en/pdo.drivers.php) for more information. ### Parameters `string` The string to be quoted. `type` Provides a hint to the type of data for drivers that have alternate quoting styles. For example **`PDO_PARAM_LOB`** will tell the driver to escape binary data. ### Return Values Returns a quoted string that is theoretically safe to pass into an SQL statement. Returns **`false`** if the driver does not support quoting in this way. ### Examples **Example #1 Quoting a normal string** ``` <?php $conn = new PDO('sqlite:/home/lynn/music.sql3'); /* Simple string */ $string = 'Nice'; print "Unquoted string: $string\n"; print "Quoted string: " . $conn->quote($string) . "\n"; ?> ``` The above example will output: ``` Unquoted string: Nice Quoted string: 'Nice' ``` **Example #2 Quoting a dangerous string** ``` <?php $conn = new PDO('sqlite:/home/lynn/music.sql3'); /* Dangerous string */ $string = 'Naughty \' string'; print "Unquoted string: $string\n"; print "Quoted string:" . $conn->quote($string) . "\n"; ?> ``` The above example will output: ``` Unquoted string: Naughty ' string Quoted string: 'Naughty '' string' ``` **Example #3 Quoting a complex string** ``` <?php $conn = new PDO('sqlite:/home/lynn/music.sql3'); /* Complex string */ $string = "Co'mpl''ex \"st'\"ring"; print "Unquoted string: $string\n"; print "Quoted string: " . $conn->quote($string) . "\n"; ?> ``` The above example will output: ``` Unquoted string: Co'mpl''ex "st'"ring Quoted string: 'Co''mpl''''ex "st''"ring' ``` ### See Also * [PDO::prepare()](pdo.prepare) - Prepares a statement for execution and returns a statement object * [PDOStatement::execute()](pdostatement.execute) - Executes a prepared statement php Imagick::adaptiveResizeImage Imagick::adaptiveResizeImage ============================ (PECL imagick 2, PECL imagick 3) Imagick::adaptiveResizeImage — Adaptively resize image with data dependent triangulation ### Description ``` public Imagick::adaptiveResizeImage( int $columns, int $rows, bool $bestfit = false, bool $legacy = false ): bool ``` Adaptively resize image with data-dependent triangulation. Avoids blurring across sharp color changes. Most useful when used to shrink images slightly to a slightly smaller "web size"; may not look good when a full-sized image is adaptively resized to a thumbnail. This method is available if Imagick has been compiled against ImageMagick version 6.2.9 or newer. > **Note**: The behavior of the parameter `bestfit` changed in Imagick 3.0.0. Before this version given dimensions 400x400 an image of dimensions 200x150 would be left untouched. In Imagick 3.0.0 and later the image would be scaled up to size 400x300 as this is the "best fit" for the given dimensions. If `bestfit` parameter is used both width and height must be given. > > ### Parameters `columns` The number of columns in the scaled image. `rows` The number of rows in the scaled image. `bestfit` Whether to fit the image inside a bounding box. ### Return Values Returns **`true`** on success. ### Errors/Exceptions Throws ImagickException on error. ### Changelog | Version | Description | | --- | --- | | PECL imagick 2.1.0 | Added optional fit parameter. | | PECL imagick 2.1.0 | This method now supports proportional scaling. Pass zero as either parameter for proportional scaling. | ### Examples **Example #1 Using **Imagick::adaptiveResizeImage()**** Resize an image to a standard size for the web. This method works best when resizing to a size only slightly smaller than the previous image size. ``` <?php header('Content-type: image/jpeg'); $image = new Imagick('image.jpg'); $image->adaptiveResizeImage(1024,768); echo $image; ?> ``` ### See Also * [Imagick::chopImage()](imagick.chopimage) - Removes a region of an image and trims * [Imagick::cropImage()](imagick.cropimage) - Extracts a region of the image * [Imagick::magnifyImage()](imagick.magnifyimage) - Scales an image proportionally 2x * [Imagick::minifyImage()](imagick.minifyimage) - Scales an image proportionally to half its size * [Imagick::resizeImage()](imagick.resizeimage) - Scales an image * [Imagick::scaleImage()](imagick.scaleimage) - Scales the size of an image * [Imagick::shaveImage()](imagick.shaveimage) - Shaves pixels from the image edges * [Imagick::thumbnailImage()](imagick.thumbnailimage) - Changes the size of an image * [Imagick::trimImage()](imagick.trimimage) - Remove edges from the image php image_type_to_mime_type image\_type\_to\_mime\_type =========================== (PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8) image\_type\_to\_mime\_type — Get Mime-Type for image-type returned by getimagesize, exif\_read\_data, exif\_thumbnail, exif\_imagetype ### Description ``` image_type_to_mime_type(int $image_type): string ``` The **image\_type\_to\_mime\_type()** function will determine the Mime-Type for an IMAGETYPE constant. ### Parameters `image_type` One of the `IMAGETYPE_XXX` constants. ### Return Values The returned values are as follows **Returned values Constants**| `image_type` | Returned value | | --- | --- | | **`IMAGETYPE_GIF`** | `image/gif` | | **`IMAGETYPE_JPEG`** | `image/jpeg` | | **`IMAGETYPE_PNG`** | `image/png` | | **`IMAGETYPE_SWF`** | `application/x-shockwave-flash` | | **`IMAGETYPE_PSD`** | `image/psd` | | **`IMAGETYPE_BMP`** | `image/bmp` | | **`IMAGETYPE_TIFF_II`** (intel byte order) | `image/tiff` | | **`IMAGETYPE_TIFF_MM`** (motorola byte order) | `image/tiff` | | **`IMAGETYPE_JPC`** | `application/octet-stream` | | **`IMAGETYPE_JP2`** | `image/jp2` | | **`IMAGETYPE_JPX`** | `application/octet-stream` | | **`IMAGETYPE_JB2`** | `application/octet-stream` | | **`IMAGETYPE_SWC`** | `application/x-shockwave-flash` | | **`IMAGETYPE_IFF`** | `image/iff` | | **`IMAGETYPE_WBMP`** | `image/vnd.wap.wbmp` | | **`IMAGETYPE_XBM`** | `image/xbm` | | **`IMAGETYPE_ICO`** | `image/vnd.microsoft.icon` | | **`IMAGETYPE_WEBP`** | `image/webp` | ### Examples **Example #1 **image\_type\_to\_mime\_type()** example** ``` <?php header("Content-type: " . image_type_to_mime_type(IMAGETYPE_PNG)); ?> ``` ### Notes > > **Note**: > > > This function does not require the GD image library. > > > ### See Also * [getimagesize()](function.getimagesize) - Get the size of an image * [exif\_imagetype()](function.exif-imagetype) - Determine the type of an image * [exif\_read\_data()](function.exif-read-data) - Reads the EXIF headers from an image file * [exif\_thumbnail()](function.exif-thumbnail) - Retrieve the embedded thumbnail of an image php Yaf_Config_Simple::offsetUnset Yaf\_Config\_Simple::offsetUnset ================================ (Yaf >=1.0.0) Yaf\_Config\_Simple::offsetUnset — The offsetUnset purpose ### Description ``` public Yaf_Config_Simple::offsetUnset(string $name): void ``` **Warning**This function is currently not documented; only its argument list is available. ### Parameters `name` ### Return Values php IntlTimeZone::getDisplayName IntlTimeZone::getDisplayName ============================ intltz\_get\_display\_name ========================== (PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1) IntlTimeZone::getDisplayName -- intltz\_get\_display\_name — Get a name of this time zone suitable for presentation to the user ### Description Object-oriented style (method): ``` public IntlTimeZone::getDisplayName(bool $dst = false, int $style = IntlTimeZone::DISPLAY_LONG, ?string $locale = null): string|false ``` Procedural style: ``` intltz_get_display_name( IntlTimeZone $timezone, bool $dst = false, int $style = IntlTimeZone::DISPLAY_LONG, ?string $locale = null ): string|false ``` **Warning**This function is currently not documented; only its argument list is available. ### Parameters `dst` `style` `locale` ### Return Values php Imagick::setImageInterlaceScheme Imagick::setImageInterlaceScheme ================================ (PECL imagick 2, PECL imagick 3) Imagick::setImageInterlaceScheme — Sets the image compression ### Description ``` public Imagick::setImageInterlaceScheme(int $interlace_scheme): bool ``` Sets the image compression. ### Parameters `interlace_scheme` ### Return Values Returns **`true`** on success. ### Errors/Exceptions Throws ImagickException on error. php Gmagick::addimage Gmagick::addimage ================= (PECL gmagick >= Unknown) Gmagick::addimage — Adds new image to Gmagick object image list ### Description ``` public Gmagick::addimage(Gmagick $source): Gmagick ``` Adds new image to Gmagick object from the current position of the source object. After the operation iterator position is moved at the end of the list. ### Parameters `source` The source Gmagick object ### Return Values The Gmagick object with image added ### Errors/Exceptions Throws an **GmagickException** on error. php None require ------- (PHP 4, PHP 5, PHP 7, PHP 8) `require` is identical to [include](function.include) except upon failure it will also produce a fatal **`E_COMPILE_ERROR`** level error. In other words, it will halt the script whereas [include](function.include) only emits a warning (**`E_WARNING`**) which allows the script to continue. See the [include](function.include) documentation for how this works. php mysqli_result::__construct mysqli\_result::\_\_construct ============================= (PHP 5, PHP 7, PHP 8) mysqli\_result::\_\_construct — Constructs a [mysqli\_result](class.mysqli-result) object ### Description public **mysqli\_result::\_\_construct**([mysqli](class.mysqli) `$mysql`, int `$result_mode` = **`MYSQLI_STORE_RESULT`**) This method constructs a new [mysqli\_result](class.mysqli-result) object. It can be used to create the [mysqli\_result](class.mysqli-result) object after calling the [mysqli\_real\_query()](mysqli.real-query) or [mysqli\_multi\_query()](mysqli.multi-query) function. Constructing the object manually is equivalent to calling the [mysqli\_store\_result()](mysqli.store-result) or [mysqli\_use\_result()](mysqli.use-result) function. ### Parameters `mysql` Procedural style only: A [mysqli](class.mysqli) object returned by [mysqli\_connect()](function.mysqli-connect) or [mysqli\_init()](mysqli.init) `result_mode` The result mode can be one of 2 constants indicating how the result will be returned from the MySQL server. **`MYSQLI_STORE_RESULT`** (default) - creates a [mysqli\_result](class.mysqli-result) object with buffered result set. **`MYSQLI_USE_RESULT`** - creates a [mysqli\_result](class.mysqli-result) object with unbuffered result set. As long as there are pending records waiting to be fetched, the connection line will be busy and all subsequent calls will return error `Commands out of sync`. To avoid the error all records must be fetched from the server or the result set must be discarded by calling [mysqli\_free\_result()](mysqli-result.free). The connection must remain open for the rows to be fetched. ### Examples **Example #1 Creation of a [mysqli\_result](class.mysqli-result) object** ``` <?php mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); $mysqli = new mysqli("localhost", "my_user", "my_password", "world"); /* Select queries return a result set */ $mysqli->real_query("SELECT Name FROM City LIMIT 10"); $result = new mysqli_result($mysqli); printf("Select returned %d rows.\n", $result->num_rows); ``` The above examples will output something similar to: ``` Select returned 10 rows. ``` ### See Also * [mysqli\_multi\_query()](mysqli.multi-query) - Performs one or more queries on the database * [mysqli\_real\_query()](mysqli.real-query) - Execute an SQL query * [mysqli\_store\_result()](mysqli.store-result) - Transfers a result set from the last query * [mysqli\_use\_result()](mysqli.use-result) - Initiate a result set retrieval php openssl_pkey_export openssl\_pkey\_export ===================== (PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8) openssl\_pkey\_export — Gets an exportable representation of a key into a string ### Description ``` openssl_pkey_export( OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $key, string &$output, ?string $passphrase = null, ?array $options = null ): bool ``` **openssl\_pkey\_export()** exports `key` as a PEM encoded string and stores it into `output` (which is passed by reference). > **Note**: You need to have a valid openssl.cnf installed for this function to operate correctly. See the notes under [the installation section](https://www.php.net/manual/en/openssl.installation.php) for more information. > > ### Parameters `key` `output` `passphrase` The key is optionally protected by `passphrase`. `options` `options` can be used to fine-tune the export process by specifying and/or overriding options for the openssl configuration file. See [openssl\_csr\_new()](function.openssl-csr-new) for more information about `options`. ### Return Values Returns **`true`** on success or **`false`** on failure. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | `key` accepts an [OpenSSLAsymmetricKey](class.opensslasymmetrickey) or [OpenSSLCertificate](class.opensslcertificate) instance now; previously, a [resource](language.types.resource) of type `OpenSSL key` or `OpenSSL X.509` was accepted. | php Thread::getCreatorId Thread::getCreatorId ==================== (PECL pthreads >= 2.0.0) Thread::getCreatorId — Identification ### Description ``` public Thread::getCreatorId(): int ``` Will return the identity of the Thread that created the referenced Thread ### Parameters This function has no parameters. ### Return Values A numeric identity ### Examples **Example #1 Return the identity of the Thread or Process that created the referenced Thread** ``` <?php class My extends Thread {     public function run() {         printf("%s created by Thread #%lu\n", __CLASS__, $this->getCreatorId());     } } $my = new My(); $my->start(); ?> ``` The above example will output: ``` My created by Thread #123456778899 ``` php posix_getpgid posix\_getpgid ============== (PHP 4, PHP 5, PHP 7, PHP 8) posix\_getpgid — Get process group id for job control ### Description ``` posix_getpgid(int $process_id): int|false ``` Returns the process group identifier of the process `process_id` or **`false`** on failure. ### Parameters `process_id` The process id. ### Return Values Returns the identifier, as an int. ### Examples **Example #1 Example use of **posix\_getpgid()**** ``` <?php $pid = posix_getppid(); echo posix_getpgid($pid); //35 ?> ``` ### Notes > > **Note**: > > > This is a not POSIX function, but is common on BSD and System V systems. If the system does not support this function, then it will not be included at compile time. This may be checked with [function\_exists()](function.function-exists). > > ### See Also * [posix\_getppid()](function.posix-getppid) - Return the parent process identifier * man page SETPGID(2) php GearmanClient::setDataCallback GearmanClient::setDataCallback ============================== (PECL gearman >= 0.6.0) GearmanClient::setDataCallback — Callback function when there is a data packet for a task ### Description ``` public GearmanClient::setDataCallback(callable $callback): bool ``` Sets the callback function for accepting data packets for a task. The callback function should take a single argument, a [GearmanTask](class.gearmantask) object. ### Parameters `callback` A function or method to call ### Return Values Returns **`true`** on success or **`false`** on failure. ### See Also * [GearmanClient::setCompleteCallback()](gearmanclient.setcompletecallback) - Set a function to be called on task completion * [GearmanClient::setCreatedCallback()](gearmanclient.setcreatedcallback) - Set a callback for when a task is queued * [GearmanClient::setExceptionCallback()](gearmanclient.setexceptioncallback) - Set a callback for worker exceptions * [GearmanClient::setFailCallback()](gearmanclient.setfailcallback) - Set callback for job failure * [GearmanClient::setStatusCallback()](gearmanclient.setstatuscallback) - Set a callback for collecting task status * [GearmanClient::setWarningCallback()](gearmanclient.setwarningcallback) - Set a callback for worker warnings * [GearmanClient::setWorkloadCallback()](gearmanclient.setworkloadcallback) - Set a callback for accepting incremental data updates php SolrClient::setServlet SolrClient::setServlet ====================== (PECL solr >= 0.9.2) SolrClient::setServlet — Changes the specified servlet type to a new value ### Description ``` public SolrClient::setServlet(int $type, string $value): bool ``` Changes the specified servlet type to a new value ### Parameters `type` One of the following : ``` - SolrClient::SEARCH_SERVLET_TYPE - SolrClient::UPDATE_SERVLET_TYPE - SolrClient::THREADS_SERVLET_TYPE - SolrClient::PING_SERVLET_TYPE - SolrClient::TERMS_SERVLET_TYPE ``` `value` The new value for the servlet ### Return Values Returns **`true`** on success or **`false`** on failure. php pcntl_sigprocmask pcntl\_sigprocmask ================== (PHP 5 >= 5.3.0, PHP 7, PHP 8) pcntl\_sigprocmask — Sets and retrieves blocked signals ### Description ``` pcntl_sigprocmask(int $mode, array $signals, array &$old_signals = null): bool ``` The **pcntl\_sigprocmask()** function adds, removes or sets blocked signals, depending on the `mode` parameter. ### Parameters `mode` Sets the behavior of **pcntl\_sigprocmask()**. Possible values: * **`SIG_BLOCK`**: Add the signals to the currently blocked signals. * **`SIG_UNBLOCK`**: Remove the signals from the currently blocked signals. * **`SIG_SETMASK`**: Replace the currently blocked signals by the given list of signals. `signals` List of signals. `old_signals` The `old_signals` parameter is set to an array containing the list of the previously blocked signals. ### Return Values Returns **`true`** on success or **`false`** on failure. ### Examples **Example #1 **pcntl\_sigprocmask()** example** ``` <?php pcntl_sigprocmask(SIG_BLOCK, array(SIGHUP)); $oldset = array(); pcntl_sigprocmask(SIG_UNBLOCK, array(SIGHUP), $oldset); ?> ``` ### See Also * [pcntl\_sigwaitinfo()](function.pcntl-sigwaitinfo) - Waits for signals * [pcntl\_sigtimedwait()](function.pcntl-sigtimedwait) - Waits for signals, with a timeout
programming_docs
php Gmagick::gammaimage Gmagick::gammaimage =================== (PECL gmagick >= Unknown) Gmagick::gammaimage — Gamma-corrects an image ### Description ``` public Gmagick::gammaimage(float $gamma): Gmagick ``` Gamma-corrects an image. The same image viewed on different devices will have perceptual differences in the way the image's intensities are represented on the screen. Specify individual gamma levels for the red, green, and blue channels, or adjust all three with the gamma parameter. Values typically range from 0.8 to 2.3. ### Parameters `gamma` The amount of gamma-correction. ### Return Values The gamma corrected [Gmagick](class.gmagick) object. ### Errors/Exceptions Throws an **GmagickException** on error. php CallbackFilterIterator::accept CallbackFilterIterator::accept ============================== (PHP 5 >= 5.4.0, PHP 7, PHP 8) CallbackFilterIterator::accept — Calls the callback with the current value, the current key and the inner iterator as arguments ### Description ``` public CallbackFilterIterator::accept(): bool ``` This method calls the callback with the current value, current key and the inner iterator. The callback is expected to return **`true`** if the current item is to be accepted, or **`false`** otherwise. ### Parameters This function has no parameters. ### Return Values Returns **`true`** to accept the current item, or **`false`** otherwise. ### See Also * [CallbackFilterIterator Examples](class.callbackfilteriterator#callbackfilteriterator.examples) * [CallbackFilterIterator::\_\_construct()](callbackfilteriterator.construct) - Create a filtered iterator from another iterator php assert_options assert\_options =============== (PHP 4, PHP 5, PHP 7, PHP 8) assert\_options — Set/get the various assert flags ### Description ``` assert_options(int $what, mixed $value = ?): mixed ``` Set the various [assert()](function.assert) control options or just query their current settings. > **Note**: As of PHP 7.0.0, the use of **assert\_options()** is discouraged in favor of setting and getting the php.ini directives [zend.assertions](https://www.php.net/manual/en/ini.core.php#ini.zend.assertions) and [assert.exception](https://www.php.net/manual/en/info.configuration.php#ini.assert.exception) with [ini\_set()](function.ini-set) and [ini\_get()](function.ini-get), respectively. > > ### Parameters `what` **Assert Options**| Option | INI Setting | Default value | Description | | --- | --- | --- | --- | | ASSERT\_ACTIVE | assert.active | 1 | enable [assert()](function.assert) evaluation | | ASSERT\_WARNING | assert.warning | 1 | issue a PHP warning for each failed assertion | | ASSERT\_BAIL | assert.bail | 0 | terminate execution on failed assertions | | ASSERT\_QUIET\_EVAL | assert.quiet\_eval | 0 | disable error\_reporting during assertion expression evaluation | | ASSERT\_CALLBACK | assert.callback | (**`null`**) | Callback to call on failed assertions | `value` An optional new value for the option. The callback function set via **`ASSERT_CALLBACK`** or assert.callback should have the following signature: ``` assert_callback( string $file, int $line, string $assertion, string $description = ? ): void ``` `file` The file where [assert()](function.assert) has been called. `line` The line where [assert()](function.assert) has been called. `assertion` The assertion that has been passed to [assert()](function.assert), converted to a string. `description` The description that has been passed to [assert()](function.assert). Passing an empty string as `value` resets the assert callback. ### Return Values Returns the original setting of any option or **`false`** on errors. ### Examples **Example #1 **assert\_options()** example** ``` <?php // This is our function to handle  // assert failures function assert_failure($file, $line, $assertion, $message) {     echo "The assertion $assertion in $file on line $line has failed: $message"; } // This is our test function function test_assert($parameter) {     assert(is_bool($parameter)); } // Set our assert options assert_options(ASSERT_ACTIVE,   true); assert_options(ASSERT_BAIL,     true); assert_options(ASSERT_WARNING,  false); assert_options(ASSERT_CALLBACK, 'assert_failure'); // Make an assert that would fail test_assert(1); // This is never reached due to ASSERT_BAIL  // being true echo 'Never reached'; ?> ``` ### See Also * [assert()](function.assert) - Checks if assertion is false php ReflectionClass::getDefaultProperties ReflectionClass::getDefaultProperties ===================================== (PHP 5, PHP 7, PHP 8) ReflectionClass::getDefaultProperties — Gets default properties ### Description ``` public ReflectionClass::getDefaultProperties(): array ``` Gets default properties from a class (including inherited properties). > > **Note**: > > > This method only works for static properties when used on internal classes. The default value of a static class property can not be tracked when using this method on user defined classes. > > ### Parameters This function has no parameters. ### Return Values An array of default properties, with the key being the name of the property and the value being the default value of the property or **`null`** if the property doesn't have a default value. The function does not distinguish between static and non static properties and does not take visibility modifiers into account. ### Examples **Example #1 **ReflectionClass::getDefaultProperties()** example** ``` <?php class Bar {     protected $inheritedProperty = 'inheritedDefault'; } class Foo extends Bar {     public $property = 'propertyDefault';     private $privateProperty = 'privatePropertyDefault';     public static $staticProperty = 'staticProperty';     public $defaultlessProperty; } $reflectionClass = new ReflectionClass('Foo'); var_dump($reflectionClass->getDefaultProperties()); ?> ``` The above example will output: ``` array(5) { ["staticProperty"]=> string(14) "staticProperty" ["property"]=> string(15) "propertyDefault" ["privateProperty"]=> string(22) "privatePropertyDefault" ["defaultlessProperty"]=> NULL ["inheritedProperty"]=> string(16) "inheritedDefault" } ``` ### See Also * [ReflectionClass::getProperties()](reflectionclass.getproperties) - Gets properties * [ReflectionClass::getStaticProperties()](reflectionclass.getstaticproperties) - Gets static properties * [ReflectionClass::getProperty()](reflectionclass.getproperty) - Gets a ReflectionProperty for a class's property php mcrypt_generic_deinit mcrypt\_generic\_deinit ======================= (PHP 4 >= 4.0.7, PHP 5, PHP 7 < 7.2.0, PECL mcrypt >= 1.0.0) mcrypt\_generic\_deinit — This function deinitializes an encryption module **Warning**This function has been *DEPRECATED* as of PHP 7.1.0 and *REMOVED* as of PHP 7.2.0. Relying on this function is highly discouraged. ### Description ``` mcrypt_generic_deinit(resource $td): bool ``` This function terminates encryption specified by the encryption descriptor (`td`). It clears all buffers, but does not close the module. You need to call [mcrypt\_module\_close()](function.mcrypt-module-close) yourself. (But PHP does this for you at the end of the script.) ### Parameters `td` The encryption descriptor. ### Return Values Returns **`true`** on success or **`false`** on failure. ### See Also * [mcrypt\_module\_open()](function.mcrypt-module-open) - Opens the module of the algorithm and the mode to be used * [mcrypt\_generic\_init()](function.mcrypt-generic-init) - This function initializes all buffers needed for encryption php Gmagick::setimagegamma Gmagick::setimagegamma ====================== (PECL gmagick >= Unknown) Gmagick::setimagegamma — Sets the image gamma ### Description ``` public Gmagick::setimagegamma(float $gamma): Gmagick ``` Sets the image gamma. ### Parameters `gamma` The image gamma. ### Return Values The [Gmagick](class.gmagick) object. ### Errors/Exceptions Throws an **GmagickException** on error. php The ReflectionNamedType class The ReflectionNamedType class ============================= Introduction ------------ (PHP 7 >= 7.1.0, PHP 8) Class synopsis -------------- class **ReflectionNamedType** extends [ReflectionType](class.reflectiontype) { /\* Methods \*/ ``` public getName(): string ``` ``` public isBuiltin(): bool ``` /\* Inherited methods \*/ ``` public ReflectionType::allowsNull(): bool ``` ``` public ReflectionType::__toString(): string ``` } Table of Contents ----------------- * [ReflectionNamedType::getName](reflectionnamedtype.getname) — Get the name of the type as a string * [ReflectionNamedType::isBuiltin](reflectionnamedtype.isbuiltin) — Checks if it is a built-in type php mcrypt_get_cipher_name mcrypt\_get\_cipher\_name ========================= (PHP 4, PHP 5, PHP 7 < 7.2.0, PECL mcrypt >= 1.0.0) mcrypt\_get\_cipher\_name — Gets the name of the specified cipher **Warning**This function has been *DEPRECATED* as of PHP 7.1.0 and *REMOVED* as of PHP 7.2.0. Relying on this function is highly discouraged. ### Description ``` mcrypt_get_cipher_name(int $cipher): string ``` ``` mcrypt_get_cipher_name(string $cipher): string ``` **mcrypt\_get\_cipher\_name()** is used to get the name of the specified cipher. **mcrypt\_get\_cipher\_name()** takes the cipher number as an argument (libmcrypt 2.2.x) or takes the cipher name as an argument (libmcrypt 2.4.x or higher) and returns the name of the cipher or **`false`**, if the cipher does not exist. ### Parameters `cipher` One of the **`MCRYPT_ciphername`** constants, or the name of the algorithm as string. ### Return Values This function returns the name of the cipher or **`false`** if the cipher does not exist. ### Examples **Example #1 **mcrypt\_get\_cipher\_name()** Example** ``` <?php    $cipher = MCRYPT_TripleDES;    echo mcrypt_get_cipher_name($cipher); ?> ``` The above example will output: ``` 3DES ``` php Phar::startBuffering Phar::startBuffering ==================== (PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 1.0.0) Phar::startBuffering — Start buffering Phar write operations, do not modify the Phar object on disk ### Description ``` public Phar::startBuffering(): void ``` Although technically unnecessary, the **Phar::startBuffering()** method can provide a significant performance boost when creating or modifying a Phar archive with a large number of files. Ordinarily, every time a file within a Phar archive is created or modified in any way, the entire Phar archive will be recreated with the changes. In this way, the archive will be up-to-date with the activity performed on it. However, this can be unnecessary when simply creating a new Phar archive, when it would make more sense to write the entire archive out at once. Similarly, it is often necessary to make a series of changes and to ensure that they all are possible before making any changes on disk, similar to the relational database concept of transactions. the **Phar::startBuffering()**/[Phar::stopBuffering()](phar.stopbuffering) pair of methods is provided for this purpose. Phar write buffering is per-archive, buffering active for the `foo.phar` Phar archive does not affect changes to the `bar.phar` Phar archive. ### Parameters This function has no parameters. ### Return Values No value is returned. ### Examples **Example #1 A **Phar::startBuffering()** example** ``` <?php // make sure it doesn't exist @unlink('brandnewphar.phar'); try {     $p = new Phar(dirname(__FILE__) . '/brandnewphar.phar', 0, 'brandnewphar.phar'); } catch (Exception $e) {     echo 'Could not create phar:', $e; } echo 'The new phar has ' . $p->count() . " entries\n"; $p->startBuffering(); $p['file.txt'] = 'hi'; $p['file2.txt'] = 'there'; $p['file2.txt']->setCompressedGZ(); $p['file3.txt'] = 'babyface'; $p['file3.txt']->setMetadata(42); $p->setStub("<?php function __autoload($class) {     include 'phar://myphar.phar/' . str_replace('_', '/', $class) . '.php'; } Phar::mapPhar('myphar.phar'); include 'phar://myphar.phar/startup.php'; __HALT_COMPILER();"); $p->stopBuffering(); ?> ``` ### See Also * [Phar::stopBuffering()](phar.stopbuffering) - Stop buffering write requests to the Phar archive, and save changes to disk * [Phar::isBuffering()](phar.isbuffering) - Used to determine whether Phar write operations are being buffered, or are flushing directly to disk php ibase_field_info ibase\_field\_info ================== (PHP 5, PHP 7 < 7.4.0) ibase\_field\_info — Get information about a field ### Description ``` ibase_field_info(resource $result, int $field_number): array ``` Returns an array with information about a field after a select query has been run. ### Parameters `result` An InterBase result identifier. `field_number` Field offset. ### Return Values Returns an array with the following keys: `name`, `alias`, `relation`, `length` and `type`. ### Examples **Example #1 **ibase\_field\_info()** example** ``` <?php $rs = ibase_query("SELECT * FROM tablename"); $coln = ibase_num_fields($rs); for ($i = 0; $i < $coln; $i++) {     $col_info = ibase_field_info($rs, $i);     echo "name: ". $col_info['name']. "\n";     echo "alias: ". $col_info['alias']. "\n";     echo "relation: ". $col_info['relation']. "\n";     echo "length: ". $col_info['length']. "\n";     echo "type: ". $col_info['type']. "\n"; } ?> ``` ### See Also * [ibase\_num\_fields()](function.ibase-num-fields) - Get the number of fields in a result set php EventBufferEvent::setWatermark EventBufferEvent::setWatermark ============================== (PECL event >= 1.2.6-beta) EventBufferEvent::setWatermark — Adjusts read and/or write watermarks ### Description ``` public EventBufferEvent::setWatermark( int $events , int $lowmark , int $highmark ): void ``` Adjusts the read watermarks, the write *watermarks* , or both, of a single buffer event. A buffer event watermark is an edge, a value specifying number of bytes to be read or written before callback is invoked. By default every read/write event triggers a callback invokation. See [» Fast portable non-blocking network programming with Libevent: Callbacks and watermarks](http://www.wangafu.net/~nickm/libevent-book/Ref6_bufferevent.html#_callbacks_and_watermarks) ### Parameters `events` Bitmask of **`Event::READ`** , **`Event::WRITE`** , or both. `lowmark` Minimum watermark value. `highmark` Maximum watermark value. **`0`** means "unlimited". ### Return Values No value is returned. php svn_fs_file_length svn\_fs\_file\_length ===================== (PECL svn >= 0.1.0) svn\_fs\_file\_length — Returns the length of a file from a given version of the fs ### Description ``` svn_fs_file_length(resource $fsroot, string $path): int ``` **Warning**This function is currently not documented; only its argument list is available. Returns the length of a file from a given version of the fs ### Notes **Warning**This function is *EXPERIMENTAL*. The behaviour of this function, its name, and surrounding documentation may change without notice in a future release of PHP. This function should be used at your own risk. php SolrQuery::setHighlightFormatter SolrQuery::setHighlightFormatter ================================ (PECL solr >= 0.9.2) SolrQuery::setHighlightFormatter — Specify a formatter for the highlight output ### Description ``` public SolrQuery::setHighlightFormatter(string $formatter, string $field_override = ?): SolrQuery ``` Specify a formatter for the highlight output. ### Parameters `formatter` Currently the only legal value is "simple" `field_override` The name of the field. ### Return Values Returns an instance of [SolrQuery](class.solrquery). php SplFixedArray::key SplFixedArray::key ================== (PHP 5 >= 5.3.0, PHP 7) SplFixedArray::key — Return current array index ### Description ``` public SplFixedArray::key(): int ``` Returns the current array index. ### Parameters This function has no parameters. ### Return Values The current array index. php Gmagick::normalizeimage Gmagick::normalizeimage ======================= (PECL gmagick >= Unknown) Gmagick::normalizeimage — Enhances the contrast of a color image ### Description ``` public Gmagick::normalizeimage(int $channel = ?): Gmagick ``` Enhances the contrast of a color image by adjusting the pixels color to span the entire range of colors available. ### Parameters `channel` Identify which channel to normalize. ### Return Values The [Gmagick](class.gmagick) object. ### Errors/Exceptions Throws an **GmagickException** on error. php Yaf_Dispatcher::returnResponse Yaf\_Dispatcher::returnResponse =============================== (Yaf >=1.0.0) Yaf\_Dispatcher::returnResponse — The returnResponse purpose ### Description ``` public Yaf_Dispatcher::returnResponse(bool $flag): Yaf_Dispatcher ``` ### Parameters `flag` ### Return Values php fdf_get_ap fdf\_get\_ap ============ (PHP 4 >= 4.3.0, PHP 5 < 5.3.0, PECL fdf SVN) fdf\_get\_ap — Get the appearance of a field ### Description ``` fdf_get_ap( resource $fdf_document, string $field, int $face, string $filename ): bool ``` Gets the appearance of a `field` (i.e. the value of the /AP key) and stores it in a file. ### Parameters `fdf_document` The FDF document handle, returned by [fdf\_create()](function.fdf-create), [fdf\_open()](function.fdf-open) or [fdf\_open\_string()](function.fdf-open-string). `field` `face` The possible values are **`FDFNormalAP`**, **`FDFRolloverAP`** and **`FDFDownAP`**. `filename` The appearance will be stored in this parameter. ### Return Values Returns **`true`** on success or **`false`** on failure. php finfo::buffer finfo::buffer ============= (PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL fileinfo >= 0.1.0) finfo::buffer — Alias of [finfo\_buffer()](function.finfo-buffer) ### Description ``` public finfo::buffer(string $string, int $flags = FILEINFO_NONE, ?resource $context = null): string|false ``` This function is an alias of: [finfo\_buffer()](function.finfo-buffer) php XSLTProcessor::removeParameter XSLTProcessor::removeParameter ============================== (PHP 5, PHP 7, PHP 8) XSLTProcessor::removeParameter — Remove parameter ### Description ``` public XSLTProcessor::removeParameter(string $namespace, string $name): bool ``` Removes a parameter, if set. This will make the processor use the default value for the parameter as specified in the stylesheet. ### Parameters `namespace` The namespace URI of the XSLT parameter. `name` The local name of the XSLT parameter. ### Return Values Returns **`true`** on success or **`false`** on failure. ### See Also * [XSLTProcessor::setParameter()](xsltprocessor.setparameter) - Set value for a parameter * [XSLTProcessor::getParameter()](xsltprocessor.getparameter) - Get value of a parameter php snmp2_walk snmp2\_walk =========== (PHP >= 5.2.0, PHP 7, PHP 8) snmp2\_walk — Fetch all the SNMP objects from an agent ### Description ``` snmp2_walk( string $hostname, string $community, array|string $object_id, int $timeout = -1, int $retries = -1 ): array|false ``` **snmp2\_walk()** function is used to read all the values from an SNMP agent specified by the `hostname`. ### Parameters `hostname` The SNMP agent (server). `community` The read community. `object_id` If **`null`**, `object_id` is taken as the root of the SNMP objects tree and all objects under that tree are returned as an array. If `object_id` is specified, all the SNMP objects below that `object_id` are returned. `timeout` The number of microseconds until the first timeout. `retries` The number of times to retry if timeouts occur. ### Return Values Returns an array of SNMP object values starting from the `object_id` as root or **`false`** on error. ### Examples **Example #1 **snmp2\_walk()** Example** ``` <?php $a = snmp2_walk("127.0.0.1", "public", ""); foreach ($a as $val) {     echo "$val\n"; } ?> ``` Above function call would return all the SNMP objects from the SNMP agent running on localhost. One can step through the values with a loop ### See Also * [snmp2\_real\_walk()](function.snmp2-real-walk) - Return all objects including their respective object ID within the specified one
programming_docs
php ldap_exop_passwd ldap\_exop\_passwd ================== (PHP 7 >= 7.2.0, PHP 8) ldap\_exop\_passwd — PASSWD extended operation helper ### Description ``` ldap_exop_passwd( LDAP\Connection $ldap, string $user = "", string $old_password = "", string $new_password = "", array &$controls = null ): string|bool ``` Performs a PASSWD extended operation. ### Parameters `ldap` An [LDAP\Connection](class.ldap-connection) instance, returned by [ldap\_connect()](function.ldap-connect). `user` dn of the user to change the password of. `old_password` The old password of this user. May be ommited depending of server configuration. `new_password` The new password for this user. May be omitted or empty to have a generated password. `controls` If provided, a password policy request control is send with the request and this is filled with an array of [LDAP Controls](https://www.php.net/manual/en/ldap.controls.php) returned with the request. ### Return Values Returns the generated password if `new_password` is empty or omitted. Otherwise returns **`true`** on success and **`false`** on failure. ### Changelog | Version | Description | | --- | --- | | 8.1.0 | The `ldap` parameter expects an [LDAP\Connection](class.ldap-connection) instance now; previously, a [resource](language.types.resource) was expected. | | 8.0.0 | `controls` is nullable now; previously, it defaulted to `[]`. | | 7.3.0 | Support for `controls` added | ### Examples **Example #1 PASSWD extended operation** ``` <?php $ds = ldap_connect("localhost");  // assuming the LDAP server is on this host if ($ds) {     // bind with appropriate dn to give update access     $bind = ldap_bind($ds, "cn=root, o=My Company, c=US", "secret");     if (!$bind) {       echo "Unable to bind to LDAP server";       exit;     }     // use PASSWD EXOP to change the user password for a generated one     $genpw = ldap_exop_passwd($ds, "cn=root, o=My Company, c=US", "secret");     if ($genpw) {       // use the generated password to bind       $bind = ldap_bind($ds, "cn=root, o=My Company, c=US", $genpw);     }     // set the password back to "secret"     ldap_exop_passwd($ds, "cn=root, o=My Company, c=US", $genpw, "secret");     ldap_close($ds); } else {     echo "Unable to connect to LDAP server"; } ?> ``` ### See Also * [ldap\_exop()](function.ldap-exop) - Performs an extended operation * [ldap\_parse\_exop()](function.ldap-parse-exop) - Parse result object from an LDAP extended operation php Imagick::adaptiveSharpenImage Imagick::adaptiveSharpenImage ============================= (PECL imagick 2, PECL imagick 3) Imagick::adaptiveSharpenImage — Adaptively sharpen the image ### Description ``` public Imagick::adaptiveSharpenImage(float $radius, float $sigma, int $channel = Imagick::CHANNEL_DEFAULT): bool ``` Adaptively sharpen the image by sharpening more intensely near image edges and less intensely far from edges. This method is available if Imagick has been compiled against ImageMagick version 6.2.9 or newer. ### Parameters `radius` The radius of the Gaussian, in pixels, not counting the center pixel. Use 0 for auto-select. `sigma` The standard deviation of the Gaussian, in pixels. `channel` Provide any channel constant that is valid for your channel mode. To apply to more than one channel, combine [channel constants](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.channel) using bitwise operators. Defaults to **`Imagick::CHANNEL_DEFAULT`**. Refer to this list of [channel constants](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.channel) ### Return Values Returns **`true`** on success. ### Examples **Example #1 A **Imagick::adaptiveSharpenImage()** example** Adaptively sharpen the image with radius 2 and sigma 1. ``` <?php try {     $image = new Imagick('image.png');     $image->adaptiveSharpenImage(2,1); } catch(ImagickException $e) {     echo 'Error: ' , $e->getMessage();     die(); } header('Content-type: image/png'); echo $image; ?> ``` ### See Also * [Imagick::sharpenImage()](imagick.sharpenimage) - Sharpens an image php The EventDnsBase class The EventDnsBase class ====================== Introduction ------------ (PECL event >= 1.2.6-beta) Represents Libevent's DNS base structure. Used to resolve DNS asyncronously, parse configuration files like resolv.conf etc. Class synopsis -------------- final class **EventDnsBase** { /\* Constants \*/ const int [OPTION\_SEARCH](class.eventdnsbase#eventdnsbase.constants.option-search) = 1; const int [OPTION\_NAMESERVERS](class.eventdnsbase#eventdnsbase.constants.option-nameservers) = 2; const int [OPTION\_MISC](class.eventdnsbase#eventdnsbase.constants.option-misc) = 4; const int [OPTION\_HOSTSFILE](class.eventdnsbase#eventdnsbase.constants.option-hostsfile) = 8; const int [OPTIONS\_ALL](class.eventdnsbase#eventdnsbase.constants.options-all) = 15; /\* Methods \*/ ``` public addNameserverIp( string $ip ): bool ``` ``` public addSearch( string $domain ): void ``` ``` public clearSearch(): void ``` ``` public __construct( EventBase $base , bool $initialize ) ``` ``` public countNameservers(): int ``` ``` public loadHosts( string $hosts ): bool ``` ``` public parseResolvConf( int $flags , string $filename ): bool ``` ``` public setOption( string $option , string $value ): bool ``` ``` public setSearchNdots( int $ndots ): bool ``` } Predefined Constants -------------------- **`EventDnsBase::OPTION_SEARCH`** Tells to read the domain and search fields from the `resolv.conf` file and the `ndots` option, and use them to decide which domains(if any) to search for hostnames that aren’t fully-qualified. **`EventDnsBase::OPTION_NAMESERVERS`** Tells to learn the nameservers from the `resolv.conf` file. **`EventDnsBase::OPTION_MISC`** **`EventDnsBase::OPTION_HOSTSFILE`** Tells to read a list of hosts from `/etc/hosts` as part of loading the `resolv.conf` file. **`EventDnsBase::OPTIONS_ALL`** Tells to learn as much as it can from the `resolv.conf` file. Table of Contents ----------------- * [EventDnsBase::addNameserverIp](eventdnsbase.addnameserverip) — Adds a nameserver to the DNS base * [EventDnsBase::addSearch](eventdnsbase.addsearch) — Adds a domain to the list of search domains * [EventDnsBase::clearSearch](eventdnsbase.clearsearch) — Removes all current search suffixes * [EventDnsBase::\_\_construct](eventdnsbase.construct) — Constructs EventDnsBase object * [EventDnsBase::countNameservers](eventdnsbase.countnameservers) — Gets the number of configured nameservers * [EventDnsBase::loadHosts](eventdnsbase.loadhosts) — Loads a hosts file (in the same format as /etc/hosts) from hosts file * [EventDnsBase::parseResolvConf](eventdnsbase.parseresolvconf) — Scans the resolv.conf-formatted file * [EventDnsBase::setOption](eventdnsbase.setoption) — Set the value of a configuration option * [EventDnsBase::setSearchNdots](eventdnsbase.setsearchndots) — Set the 'ndots' parameter for searches php EventBuffer::prepend EventBuffer::prepend ==================== (PECL event >= 1.2.6-beta) EventBuffer::prepend — Prepend data to the front of the buffer ### Description ``` public EventBuffer::prepend( string $data ): bool ``` Prepend data to the front of the buffer. ### Parameters `data` String to be prepended to the front of the buffer. ### Return Values Returns **`true`** on success or **`false`** on failure. ### See Also * [EventBuffer::prependBuffer()](eventbuffer.prependbuffer) - Moves all data from source buffer to the front of current buffer * [EventBuffer::add()](eventbuffer.add) - Append data to the end of an event buffer * [EventBuffer::addBuffer()](eventbuffer.addbuffer) - Move all data from a buffer provided to the current instance of EventBuffer php DateTimeZone::listIdentifiers DateTimeZone::listIdentifiers ============================= timezone\_identifiers\_list =========================== (PHP 5 >= 5.2.0, PHP 7, PHP 8) DateTimeZone::listIdentifiers -- timezone\_identifiers\_list — Returns a numerically indexed array containing all defined timezone identifiers ### Description Object-oriented style ``` public static DateTimeZone::listIdentifiers(int $timezoneGroup = DateTimeZone::ALL, ?string $countryCode = null): array ``` Procedural style ``` timezone_identifiers_list(int $timezoneGroup = DateTimeZone::ALL, ?string $countryCode = null): array ``` ### Parameters `timezoneGroup` One of the [DateTimeZone](class.datetimezone) class constants (or a combination). `countryCode` A two-letter (uppercase) ISO 3166-1 compatible country code. > **Note**: This option is only used when `timezoneGroup` is set to **`DateTimeZone::PER_COUNTRY`**. > > ### Return Values Returns the array of timezone identifiers. Only non-outdated items are returned. To get all, including outdated timezone identifiers, use the `DateTimeZone::ALL_WITH_BC` as value for `timezoneGroup`. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | Prior to this version, **`false`** was returned on failure. | | 7.1.0 | `countryCode` is nullable now. | ### Examples **Example #1 A **DateTimeZone::listIdentifiers()** example** ``` <?php $timezone_identifiers = DateTimeZone::listIdentifiers(); for ($i=0; $i < 5; $i++) {     echo "$timezone_identifiers[$i]\n"; } ?> ``` The above example will output something similar to: ``` Africa/Abidjan Africa/Accra Africa/Addis_Ababa Africa/Algiers Africa/Asmara ``` **Example #2 Listing identifiers for a specific region** ``` <?php $timezone_identifiers = DateTimeZone::listIdentifiers( DateTimeZone::ASIA ); for ($i=0; $i < 5; $i++) {     echo "$timezone_identifiers[$i]\n"; } ?> ``` The above example will output something similar to: ``` Asia/Aden Asia/Almaty Asia/Amman Asia/Anadyr Asia/Aqtau ``` **Example #3 Listing identifiers for multiple regions** ``` <?php $timezone_identifiers = DateTimeZone::listIdentifiers( DateTimeZone::ASIA | DateTimeZone::PACIFIC ); echo join( ', ', $timezone_identifiers ); ?> ``` The above example will output something similar to: ``` Asia/Aden, Asia/Almaty, Asia/Amman, Asia/Anadyr, Asia/Aqtau, Asia/Aqtobe, Asia/Ashgabat, Asia/Atyrau, Asia/Baghdad, Asia/Bahrain, Asia/Baku, Asia/Bangkok, Asia/Barnaul, Asia/Beirut, Asia/Bishkek, Asia/Brunei, Asia/Chita, Asia/Choibalsan, Asia/Colombo, Asia/Damascus, Asia/Dhaka, Asia/Dili, Asia/Dubai, Asia/Dushanbe, Asia/Famagusta, Asia/Gaza, Asia/Hebron, Asia/Ho_Chi_Minh, Asia/Hong_Kong, Asia/Hovd, Asia/Irkutsk, Asia/Jakarta, Asia/Jayapura, Asia/Jerusalem, Asia/Kabul, Asia/Kamchatka, Asia/Karachi, Asia/Kathmandu, Asia/Khandyga, Asia/Kolkata, Asia/Krasnoyarsk, Asia/Kuala_Lumpur, Asia/Kuching, Asia/Kuwait, Asia/Macau, Asia/Magadan, Asia/Makassar, Asia/Manila, Asia/Muscat, Asia/Nicosia, Asia/Novokuznetsk, Asia/Novosibirsk, Asia/Omsk, Asia/Oral, Asia/Phnom_Penh, Asia/Pontianak, Asia/Pyongyang, Asia/Qatar, Asia/Qostanay, Asia/Qyzylorda, Asia/Riyadh, Asia/Sakhalin, Asia/Samarkand, Asia/Seoul, Asia/Shanghai, Asia/Singapore, Asia/Srednekolymsk, Asia/Taipei, Asia/Tashkent, Asia/Tbilisi, Asia/Tehran, Asia/Thimphu, Asia/Tokyo, Asia/Tomsk, Asia/Ulaanbaatar, Asia/Urumqi, Asia/Ust-Nera, Asia/Vientiane, Asia/Vladivostok, Asia/Yakutsk, Asia/Yangon, Asia/Yekaterinburg, Asia/Yerevan, Pacific/Apia, Pacific/Auckland, Pacific/Bougainville, Pacific/Chatham, Pacific/Chuuk, Pacific/Easter, Pacific/Efate, Pacific/Fakaofo, Pacific/Fiji, Pacific/Funafuti, Pacific/Galapagos, Pacific/Gambier, Pacific/Guadalcanal, Pacific/Guam, Pacific/Honolulu, Pacific/Kanton, Pacific/Kiritimati, Pacific/Kosrae, Pacific/Kwajalein, Pacific/Majuro, Pacific/Marquesas, Pacific/Midway, Pacific/Nauru, Pacific/Niue, Pacific/Norfolk, Pacific/Noumea, Pacific/Pago_Pago, Pacific/Palau, Pacific/Pitcairn, Pacific/Pohnpei, Pacific/Port_Moresby, Pacific/Rarotonga, Pacific/Saipan, Pacific/Tahiti, Pacific/Tarawa, Pacific/Tongatapu, Pacific/Wake, Pacific/Wallis ``` **Example #4 Listing identifiers for a single country** ``` <?php $timezone_identifiers = DateTimeZone::listIdentifiers( DateTimeZone::PER_COUNTRY, "UA" ); foreach( $timezone_identifiers as $identifier ) {     echo "$identifier\n"; } ?> ``` The above example will output something similar to: ``` Europe/Kyiv Europe/Simferopol Europe/Uzhgorod Europe/Zaporozhye ``` ### See Also * [timezone\_abbreviations\_list()](function.timezone-abbreviations-list) - Alias of DateTimeZone::listAbbreviations php EventDnsBase::countNameservers EventDnsBase::countNameservers ============================== (PECL event >= 1.2.6-beta) EventDnsBase::countNameservers — Gets the number of configured nameservers ### Description ``` public EventDnsBase::countNameservers(): int ``` Gets the number of configured nameservers ### Parameters This function has no parameters. ### Return Values Returns the number of configured nameservers(not necessarily the number of running nameservers). This is useful for double-checking whether our calls to the various nameserver configuration functions have been successful. php Ds\Sequence::allocate Ds\Sequence::allocate ===================== (PECL ds >= 1.0.0) Ds\Sequence::allocate — Allocates enough memory for a required capacity ### Description ``` abstract public Ds\Sequence::allocate(int $capacity): void ``` Ensures that enough memory is allocated for a required capacity. This removes the need to reallocate the internal as values are added. ### Parameters `capacity` The number of values for which capacity should be allocated. > > **Note**: > > > Capacity will stay the same if this value is less than or equal to the current capacity. > > ### Return Values No value is returned. ### Examples **Example #1 **Ds\Sequence::allocate()** example** ``` <?php $sequence = new \Ds\Vector(); var_dump($sequence->capacity()); $vector->allocate(100); var_dump($sequence->capacity()); ?> ``` The above example will output something similar to: ``` int(10) int(100) ``` php The CurlMultiHandle class The CurlMultiHandle class ========================= Introduction ------------ (PHP 8) A fully opaque class which replaces `curl_multi` resources as of PHP 8.0.0. Class synopsis -------------- final class **CurlMultiHandle** { } php fpm_get_status fpm\_get\_status ================ (PHP 7 >= 7.3, PHP 8) fpm\_get\_status — Returns the current FPM pool status ### Description ``` fpm_get_status(): array|false ``` This function returns the full current FPM pool status as an associative array. It always returns the full status, including per-process status information. See the [FPM status page guide](https://www.php.net/manual/en/fpm.status.php) for further details. Note that this function will only be defined if FPM is being used to serve the script. ### Parameters This function has no parameters. ### Return Values Associative array containing the full FPM pool status, or **`false`** on failure. php Ds\Stack::isEmpty Ds\Stack::isEmpty ================= (PECL ds >= 1.0.0) Ds\Stack::isEmpty — Returns whether the stack is empty ### Description ``` public Ds\Stack::isEmpty(): bool ``` Returns whether the stack is empty. ### Parameters This function has no parameters. ### Return Values Returns **`true`** if the stack is empty, **`false`** otherwise. ### Examples **Example #1 **Ds\Stack::isEmpty()** example** ``` <?php $a = new \Ds\Stack([1, 2, 3]); $b = new \Ds\Stack(); var_dump($a->isEmpty()); var_dump($b->isEmpty()); ?> ``` The above example will output something similar to: ``` bool(false) bool(true) ``` php pcntl_wait pcntl\_wait =========== (PHP 5, PHP 7, PHP 8) pcntl\_wait — Waits on or returns the status of a forked child ### Description ``` pcntl_wait(int &$status, int $flags = 0, array &$resource_usage = []): int ``` The wait function suspends execution of the current process until a child has exited, or until a signal is delivered whose action is to terminate the current process or to call a signal handling function. If a child has already exited by the time of the call (a so-called "zombie" process), the function returns immediately. Any system resources used by the child are freed. Please see your system's wait(2) man page for specific details as to how wait works on your system. > > **Note**: > > > This function is equivalent to calling [pcntl\_waitpid()](function.pcntl-waitpid) with a `-1` `process_id` and no `flags`. > > ### Parameters `status` **pcntl\_wait()** will store status information in the `status` parameter which can be evaluated using the following functions: [pcntl\_wifexited()](function.pcntl-wifexited), [pcntl\_wifstopped()](function.pcntl-wifstopped), [pcntl\_wifsignaled()](function.pcntl-wifsignaled), [pcntl\_wexitstatus()](function.pcntl-wexitstatus), [pcntl\_wtermsig()](function.pcntl-wtermsig) and [pcntl\_wstopsig()](function.pcntl-wstopsig). `flags` If wait3 is available on your system (mostly BSD-style systems), you can provide the optional `flags` parameter. If this parameter is not provided, wait will be used for the system call. If wait3 is not available, providing a value for `flags` will have no effect. The value of `flags` is the value of zero or more of the following two constants `OR`'ed together: **Possible values for `flags`**| `WNOHANG` | Return immediately if no child has exited. | | `WUNTRACED` | Return for children which are stopped, and whose status has not been reported. | ### Return Values **pcntl\_wait()** returns the process ID of the child which exited, -1 on error or zero if WNOHANG was provided as an option (on wait3-available systems) and no child was available. ### See Also * [pcntl\_fork()](function.pcntl-fork) - Forks the currently running process * [pcntl\_signal()](function.pcntl-signal) - Installs a signal handler * [pcntl\_wifexited()](function.pcntl-wifexited) - Checks if status code represents a normal exit * [pcntl\_wifstopped()](function.pcntl-wifstopped) - Checks whether the child process is currently stopped * [pcntl\_wifsignaled()](function.pcntl-wifsignaled) - Checks whether the status code represents a termination due to a signal * [pcntl\_wexitstatus()](function.pcntl-wexitstatus) - Returns the return code of a terminated child * [pcntl\_wtermsig()](function.pcntl-wtermsig) - Returns the signal which caused the child to terminate * [pcntl\_wstopsig()](function.pcntl-wstopsig) - Returns the signal which caused the child to stop * [pcntl\_waitpid()](function.pcntl-waitpid) - Waits on or returns the status of a forked child php inet_pton inet\_pton ========== (PHP 5 >= 5.1.0, PHP 7, PHP 8) inet\_pton — Converts a human readable IP address to its packed in\_addr representation ### Description ``` inet_pton(string $ip): string|false ``` This function converts a human readable IPv4 or IPv6 address (if PHP was built with IPv6 support enabled) into an address family appropriate 32bit or 128bit binary structure. ### Parameters `ip` A human readable IPv4 or IPv6 address. ### Return Values Returns the `in_addr` representation of the given `ip`, or **`false`** if a syntactically invalid `ip` is given (for example, an IPv4 address without dots or an IPv6 address without colons). ### Examples **Example #1 **inet\_pton()** Example** ``` <?php $in_addr = inet_pton('127.0.0.1');   $in6_addr = inet_pton('::1'); ?> ``` ### See Also * [ip2long()](function.ip2long) - Converts a string containing an (IPv4) Internet Protocol dotted address into a long integer * [long2ip()](function.long2ip) - Converts an long integer address into a string in (IPv4) Internet standard dotted format * [inet\_ntop()](function.inet-ntop) - Converts a packed internet address to a human readable representation
programming_docs
php ReflectionMethod::getPrototype ReflectionMethod::getPrototype ============================== (PHP 5 >= 5.1.2, PHP 7, PHP 8) ReflectionMethod::getPrototype — Gets the method prototype (if there is one) ### Description ``` public ReflectionMethod::getPrototype(): ReflectionMethod ``` Returns the methods prototype. ### Parameters This function has no parameters. ### Return Values A [ReflectionMethod](class.reflectionmethod) instance of the method prototype. ### Errors/Exceptions A [ReflectionException](class.reflectionexception) exception is thrown if the method does not have a prototype. ### Examples **Example #1 **ReflectionMethod::getPrototype()** example** ``` <?php class Hello {     public function sayHelloTo($name) {         return 'Hello ' . $name;     } } class HelloWorld extends Hello {     public function sayHelloTo($name) {         return 'Hello world: ' . $name;     } } $reflectionMethod = new ReflectionMethod('HelloWorld', 'sayHelloTo'); var_dump($reflectionMethod->getPrototype()); ?> ``` The above example will output: ``` object(ReflectionMethod)#2 (2) { ["name"]=> string(10) "sayHelloTo" ["class"]=> string(5) "Hello" } ``` ### See Also * [ReflectionMethod::getModifiers()](reflectionmethod.getmodifiers) - Gets the method modifiers * [ReflectionMethod::hasPrototype()](reflectionmethod.hasprototype) - Returns whether a method has a prototype php Yar_Server_Exception::getType Yar\_Server\_Exception::getType =============================== (PECL yar >= 1.0.0) Yar\_Server\_Exception::getType — Retrieve exception's type ### Description ``` public Yar_Server_Exception::getType(): string ``` Get the exception original type threw by server ### Parameters This function has no parameters. ### Return Values string ### Examples **Example #1 **Yar\_Server\_Exception::getType()** example** ``` //Server.php <?php class Custom_Exception extends Exception {}; class API {     public function throw_exception($name) {         throw new Custom_Exception($name);     } } $service = new Yar_Server(new API()); $service->handle(); ?> //Client.php <?php $client = new Yar_Client("http://host/api.php"); try {     $client->throw_exception("client"); } catch (Yar_Server_Exception $e) {     var_dump($e->getType());     var_dump($e->getMessage()); } ``` The above example will output something similar to: ``` string(16) "Custom_Exception" string(6) "client" ``` ### See Also * php radius_cvt_string radius\_cvt\_string =================== (PECL radius >= 1.1.0) radius\_cvt\_string — Converts raw data to string ### Description ``` radius_cvt_string(string $data): string ``` Converts raw data to string ### Parameters `data` Input data ### Return Values Returns the string, retrieved from data. ### Examples **Example #1 **radius\_cvt\_string()** example** ``` <?php while ($resa = radius_get_attr($res)) {     if (!is_array($resa)) {         printf ("Error getting attribute: %s\n",  radius_strerror($res));         exit;     }     $attr = $resa['attr'];     $data = $resa['data'];          switch ($attr) {     case RADIUS_FILTER_ID:         $id = radius_cvt_string($data);         echo "Filter ID: $id<br>\n";         break;     } } ?> ``` ### See Also * [radius\_cvt\_addr()](function.radius-cvt-addr) - Converts raw data to IP-Address * [radius\_cvt\_int()](function.radius-cvt-int) - Converts raw data to integer php geoip_domain_by_name geoip\_domain\_by\_name ======================= (PECL geoip >= 1.1.0) geoip\_domain\_by\_name — Get the second level domain name ### Description ``` geoip_domain_by_name(string $hostname): string ``` The **geoip\_domain\_by\_name()** function will return the second level domain names associated with a hostname or an IP address. This function is currently only available to users who have bought a commercial GeoIP Domain Edition. A warning will be issued if the proper database cannot be located. ### Parameters `hostname` The hostname or IP address. ### Return Values Returns the domain name on success, or **`false`** if the address cannot be found in the database. ### Examples **Example #1 A **geoip\_domain\_by\_name()** example** This will output the domain associated with IP 61.106.139.1. ``` <?php $domain = geoip_domain_by_name('61.106.139.1'); if ($domain) {     echo 'The domain is: '. $domain; } ?> ``` The above example will output: ``` The domain is: von.co.kr ``` php sort sort ==== (PHP 4, PHP 5, PHP 7, PHP 8) sort — Sort an array in ascending order ### Description ``` sort(array &$array, int $flags = SORT_REGULAR): bool ``` Sorts `array` in place by values in ascending order. > > **Note**: > > > If two members compare as equal, they retain their original order. Prior to PHP 8.0.0, their relative order in the sorted array was undefined. > > > **Note**: This function assigns new keys to the elements in `array`. It will remove any existing keys that may have been assigned, rather than just reordering the keys. > > > > **Note**: > > > Resets array's internal pointer to the first element. > > ### Parameters `array` The input array. `flags` The optional second parameter `flags` may be used to modify the sorting behavior using these values: Sorting type flags: * **`SORT_REGULAR`** - compare items normally; the details are described in the [comparison operators](language.operators.comparison) section * **`SORT_NUMERIC`** - compare items numerically * **`SORT_STRING`** - compare items as strings * **`SORT_LOCALE_STRING`** - compare items as strings, based on the current locale. It uses the locale, which can be changed using [setlocale()](function.setlocale) * **`SORT_NATURAL`** - compare items as strings using "natural ordering" like [natsort()](function.natsort) * **`SORT_FLAG_CASE`** - can be combined (bitwise OR) with **`SORT_STRING`** or **`SORT_NATURAL`** to sort strings case-insensitively ### Return Values Always returns **`true`**. ### Examples **Example #1 **sort()** example** ``` <?php $fruits = array("lemon", "orange", "banana", "apple"); sort($fruits); foreach ($fruits as $key => $val) {     echo "fruits[" . $key . "] = " . $val . "\n"; } ?> ``` The above example will output: ``` fruits[0] = apple fruits[1] = banana fruits[2] = lemon fruits[3] = orange ``` The fruits have been sorted in alphabetical order. **Example #2 **sort()** example using case-insensitive natural ordering** ``` <?php $fruits = array(     "Orange1", "orange2", "Orange3", "orange20" ); sort($fruits, SORT_NATURAL | SORT_FLAG_CASE); foreach ($fruits as $key => $val) {     echo "fruits[" . $key . "] = " . $val . "\n"; } ?> ``` The above example will output: ``` fruits[0] = Orange1 fruits[1] = orange2 fruits[2] = Orange3 fruits[3] = orange20 ``` The fruits have been sorted like [natcasesort()](function.natcasesort). ### Notes > **Note**: Like most PHP sorting functions, **sort()** uses an implementation of [» Quicksort](http://en.wikipedia.org/wiki/Quicksort). The pivot is chosen in the middle of the partition resulting in an optimal time for already sorted arrays. This is however an implementation detail you shouldn't rely on. > > **Warning** Be careful when sorting arrays with mixed types values because **sort()** can produce unexpected results, if `flags` is **`SORT_REGULAR`**. ### See Also * [rsort()](function.rsort) - Sort an array in descending order * The [comparison of array sorting functions](https://www.php.net/manual/en/array.sorting.php) php debug_print_backtrace debug\_print\_backtrace ======================= (PHP 5, PHP 7, PHP 8) debug\_print\_backtrace — Prints a backtrace ### Description ``` debug_print_backtrace(int $options = 0, int $limit = 0): void ``` **debug\_print\_backtrace()** prints a PHP backtrace. It prints the function calls, included/required files and [eval()](function.eval)ed stuff. ### Parameters `options` This parameter is a bitmask for the following options: ****debug\_print\_backtrace()** options**| DEBUG\_BACKTRACE\_IGNORE\_ARGS | Whether or not to omit the "args" index, and thus all the function/method arguments, to save memory. | `limit` This parameter can be used to limit the number of stack frames printed. By default (`limit`=`0`) it prints all stack frames. ### Return Values No value is returned. ### Examples **Example #1 **debug\_print\_backtrace()** example** ``` <?php // include.php file function a() {     b(); } function b() {     c(); } function c(){     debug_print_backtrace(); } a(); ?> ``` ``` <?php // test.php file // this is the file you should run include 'include.php'; ?> ``` The above example will output something similar to: ``` #0 c() called at [/tmp/include.php:10] #1 b() called at [/tmp/include.php:6] #2 a() called at [/tmp/include.php:17] #3 include(/tmp/include.php) called at [/tmp/test.php:3] ``` ### See Also * [debug\_backtrace()](function.debug-backtrace) - Generates a backtrace php mb_ereg_search_getregs mb\_ereg\_search\_getregs ========================= (PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8) mb\_ereg\_search\_getregs — Retrieve the result from the last multibyte regular expression match ### Description ``` mb_ereg_search_getregs(): array|false ``` Retrieve the result from the last multibyte regular expression match ### Parameters This function has no parameters. ### Return Values An array including the sub-string of matched part by last [mb\_ereg\_search()](function.mb-ereg-search), [mb\_ereg\_search\_pos()](function.mb-ereg-search-pos), [mb\_ereg\_search\_regs()](function.mb-ereg-search-regs). If there are some matches, the first element will have the matched sub-string, the second element will have the first part grouped with brackets, the third element will have the second part grouped with brackets, and so on. It returns **`false`** on error. ### Notes > > **Note**: > > > The internal encoding or the character encoding specified by [mb\_regex\_encoding()](function.mb-regex-encoding) will be used as the character encoding for this function. > > > ### See Also * [mb\_regex\_encoding()](function.mb-regex-encoding) - Set/Get character encoding for multibyte regex * [mb\_ereg\_search\_init()](function.mb-ereg-search-init) - Setup string and regular expression for a multibyte regular expression match php EvEmbed::set EvEmbed::set ============ (PECL ev >= 0.2.0) EvEmbed::set — Configures the watcher ### Description ``` public EvEmbed::set( object $other ): void ``` Configures the watcher to use `other` event loop object. ### Parameters `other` The same as for [EvEmbed::\_\_construct()](evembed.construct) ### Return Values No value is returned. php SolrDisMaxQuery::addBoostQuery SolrDisMaxQuery::addBoostQuery ============================== (No version information available, might only be in Git) SolrDisMaxQuery::addBoostQuery — Adds a boost query field with value and optional boost (bq parameter) ### Description ``` public SolrDisMaxQuery::addBoostQuery(string $field, string $value, string $boost = ?): SolrDisMaxQuery ``` Adds a Boost Query field with value [and boost] (bq parameter) ### Parameters `field` `value` `boost` ### Return Values [SolrDisMaxQuery](class.solrdismaxquery) ### Examples **Example #1 **SolrDisMaxQuery::addBoostQuery()** example** ``` <?php $dismaxQuery = new SolrDisMaxQuery("lucene"); $dismaxQuery     ->addBoostQuery('cat', 'clothing', 2)     ->addBoostQuery('cat', 'electronics', 5.1) ; echo $dismaxQuery.PHP_EOL; ?> ``` The above example will output something similar to: ``` q=lucene&defType=edismax&bq=cat:clothing^2 cat:electronics^5.1 ``` ### See Also * [SolrDisMaxQuery::removeBoostQuery()](solrdismaxquery.removeboostquery) - Removes a boost query partial by field name (bq) * [SolrDisMaxQuery::setBoostQuery()](solrdismaxquery.setboostquery) - Directly Sets Boost Query Parameter (bq) php stats_stat_innerproduct stats\_stat\_innerproduct ========================= (PECL stats >= 1.0.0) stats\_stat\_innerproduct — Returns the inner product of two vectors ### Description ``` stats_stat_innerproduct(array $arr1, array $arr2): float ``` Returns the inner product of `arr1` and `arr2`. ### Parameters `arr1` The first array `arr2` The second array ### Return Values Returns the inner product of `arr1` and `arr2`, or **`false`** on failure. php ldap_add_ext ldap\_add\_ext ============== (PHP 7 >= 7.3.0, PHP 8) ldap\_add\_ext — Add entries to LDAP directory ### Description ``` ldap_add_ext( LDAP\Connection $ldap, string $dn, array $entry, ?array $controls = null ): LDAP\Result|false ``` Does the same thing as [ldap\_add()](function.ldap-add) but returns an [LDAP\Result](class.ldap-result) instance to be parsed with [ldap\_parse\_result()](function.ldap-parse-result). ### Parameters See [ldap\_add()](function.ldap-add) ### Return Values Returns an [LDAP\Result](class.ldap-result) instance, or **`false`** on failure. ### Changelog | Version | Description | | --- | --- | | 8.1.0 | The `ldap` parameter expects an [LDAP\Connection](class.ldap-connection) instance now; previously, a [resource](language.types.resource) was expected. | | 8.1.0 | Returns an [LDAP\Result](class.ldap-result) instance now; previously, a [resource](language.types.resource) was returned. | | 8.0.0 | `controls` is nullable now; previously, it defaulted to `[]`. | ### Notes > **Note**: This function is binary-safe. > > ### See Also * [ldap\_add()](function.ldap-add) - Add entries to LDAP directory * [ldap\_parse\_result()](function.ldap-parse-result) - Extract information from result php QuickHashIntStringHash::add QuickHashIntStringHash::add =========================== (PECL quickhash >= Unknown) QuickHashIntStringHash::add — This method adds a new entry to the hash ### Description ``` public QuickHashIntStringHash::add(int $key, string $value): bool ``` This method adds a new entry to the hash, and returns whether the entry was added. Entries are by default always added unless **`QuickHashIntStringHash::CHECK_FOR_DUPES`** has been passed when the hash was created. ### Parameters `key` The key of the entry to add. `value` The value of the entry to add. If a non-string is passed, it will be converted to a string automatically if possible. ### Return Values **`true`** when the entry was added, and **`false`** if the entry was not added. ### Examples **Example #1 **QuickHashIntStringHash::add()** example** ``` <?php echo "without dupe checking\n"; $hash = new QuickHashIntStringHash( 1024 ); var_dump( $hash->exists( 4 ) ); var_dump( $hash->get( 4 ) ); var_dump( $hash->add( 4, "twenty two" ) ); var_dump( $hash->exists( 4 ) ); var_dump( $hash->get( 4 ) ); var_dump( $hash->add( 4, "twelve" ) ); echo "\nwith dupe checking\n"; $hash = new QuickHashIntStringHash( 1024, QuickHashIntStringHash::CHECK_FOR_DUPES ); var_dump( $hash->exists( 4 ) ); var_dump( $hash->get( 4 ) ); var_dump( $hash->add( 4, "seventy eight" ) ); var_dump( $hash->exists( 4 ) ); var_dump( $hash->get( 4 ) ); var_dump( $hash->add( 4, "nine" ) ); ?> ``` The above example will output something similar to: ``` without dupe checking bool(false) bool(false) bool(true) bool(true) string(10) "twenty two" bool(true) with dupe checking bool(false) bool(false) bool(true) bool(true) string(13) "seventy eight" bool(false) ``` php IntlBreakIterator::next IntlBreakIterator::next ======================= (PHP 5 >= 5.5.0, PHP 7, PHP 8) IntlBreakIterator::next — Advance the iterator the next boundary ### Description ``` public IntlBreakIterator::next(?int $offset = null): int ``` **Warning**This function is currently not documented; only its argument list is available. ### Parameters `offset` ### Return Values php xdiff_string_bdiff xdiff\_string\_bdiff ==================== (PECL xdiff >= 1.5.0) xdiff\_string\_bdiff — Make binary diff of two strings ### Description ``` xdiff_string_bdiff(string $old_data, string $new_data): string ``` Makes a binary diff of two strings and returns the result. This function works with both text and binary data. Resulting patch can be later applied using [xdiff\_string\_bpatch()](function.xdiff-string-bpatch)/[xdiff\_file\_bpatch()](function.xdiff-file-bpatch). ### Parameters `old_data` First string with binary data. It acts as "old" data. `new_data` Second string with binary data. It acts as "new" data. ### Return Values Returns string with binary diff containing differences between "old" and "new" data or **`false`** if an internal error occurred. ### See Also * [xdiff\_string\_bpatch()](function.xdiff-string-bpatch) - Patch a string with a binary diff php stats_cdf_negative_binomial stats\_cdf\_negative\_binomial ============================== (PECL stats >= 1.0.0) stats\_cdf\_negative\_binomial — Calculates any one parameter of the negative binomial distribution given values for the others ### Description ``` stats_cdf_negative_binomial( float $par1, float $par2, float $par3, int $which ): float ``` Returns the cumulative distribution function, its inverse, or one of its parameters, of the negative binomial distribution. The kind of the return value and parameters (`par1`, `par2`, and `par3`) are determined by `which`. The following table lists the return value and parameters by `which`. CDF, x, r, and p denotes cumulative distribution function, the number of failure, the number of success, and the success rate for each trial, respectively. **Return value and parameters**| `which` | Return value | `par1` | `par2` | `par3` | | --- | --- | --- | --- | --- | | 1 | CDF | x | r | p | | 2 | x | CDF | r | p | | 3 | r | x | CDF | p | | 4 | p | x | CDF | r | ### Parameters `par1` The first parameter `par2` The second parameter `par3` The third parameter `which` The flag to determine what to be calculated ### Return Values Returns CDF, x, r, or p, determined by `which`. php stream_socket_sendto stream\_socket\_sendto ====================== (PHP 5, PHP 7, PHP 8) stream\_socket\_sendto — Sends a message to a socket, whether it is connected or not ### Description ``` stream_socket_sendto( resource $socket, string $data, int $flags = 0, string $address = "" ): int|false ``` Sends the specified `data` through the `socket`. ### Parameters `socket` The socket to send `data` to. `data` The data to be sent. `flags` The value of `flags` can be any combination of the following: **possible values for `flags`**| **`STREAM_OOB`** | Process OOB (out-of-band) data. | `address` The address specified when the socket stream was created will be used unless an alternate address is specified in `address`. If specified, it must be in dotted quad (or [ipv6]) format. ### Return Values Returns a result code, as an integer, or **`false`** on failure. ### Examples **Example #1 **stream\_socket\_sendto()** Example** ``` <?php /* Open a socket to port 1234 on localhost */ $socket = stream_socket_client('tcp://127.0.0.1:1234'); /* Send ordinary data via ordinary channels. */ fwrite($socket, "Normal data transmit."); /* Send more data out of band. */ stream_socket_sendto($socket, "Out of Band data.", STREAM_OOB); /* Close it up */ fclose($socket); ?> ``` ### See Also * [stream\_socket\_recvfrom()](function.stream-socket-recvfrom) - Receives data from a socket, connected or not * [stream\_socket\_client()](function.stream-socket-client) - Open Internet or Unix domain socket connection * [stream\_socket\_server()](function.stream-socket-server) - Create an Internet or Unix domain server socket
programming_docs
php odbc_field_precision odbc\_field\_precision ====================== (PHP 4, PHP 5, PHP 7, PHP 8) odbc\_field\_precision — Alias of [odbc\_field\_len()](function.odbc-field-len) ### Description This function is an alias of: [odbc\_field\_len()](function.odbc-field-len). ### See Also * [odbc\_field\_scale()](function.odbc-field-scale) - Get the scale of a field to get the scale of a floating point number. php Ds\Vector::__construct Ds\Vector::\_\_construct ======================== (PECL ds >= 1.0.0) Ds\Vector::\_\_construct — Creates a new instance ### Description public **Ds\Vector::\_\_construct**([mixed](language.types.declarations#language.types.declarations.mixed) `$values` = ?) Creates a new instance, using either a [traversable](class.traversable) object or an array for the initial `values`. ### Parameters `values` A traversable object or an array to use for the initial values. ### Examples **Example #1 **Ds\Vector::\_\_construct()** example** ``` <?php $vector = new \Ds\Vector(); var_dump($vector); $vector = new \Ds\Vector([1, 2, 3]); var_dump($vector); ?> ``` The above example will output something similar to: ``` object(Ds\Vector)#2 (0) { } object(Ds\Vector)#2 (3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) } ``` php Memcached::addServers Memcached::addServers ===================== (PECL memcached >= 0.1.1) Memcached::addServers — Add multiple servers to the server pool ### Description ``` public Memcached::addServers(array $servers): bool ``` **Memcached::addServers()** adds `servers` to the server pool. Each entry in `servers` is supposed to be an array containing hostname, port, and, optionally, weight of the server. No connection is established to the servers at this time. The same server may appear multiple times in the server pool, because no duplication checks are made. This is not advisable; instead, use the `weight` option to increase the selection weighting of this server. ### Parameters `array` Array of the servers to add to the pool. ### Return Values Returns **`true`** on success or **`false`** on failure. ### Examples **Example #1 **Memcached::addServers()** example** ``` <?php $m = new Memcached(); $servers = array(     array('mem1.domain.com', 11211, 33),     array('mem2.domain.com', 11211, 67) ); $m->addServers($servers); ?> ``` ### See Also * [Memcached::addServer()](memcached.addserver) - Add a server to the server pool * [Memcached::resetServerList()](memcached.resetserverlist) - Clears all servers from the server list php Parle\Parser::left Parle\Parser::left ================== (PECL parle >= 0.5.1) Parle\Parser::left — Declare a token with left-associativity ### Description ``` public Parle\Parser::left(string $tok): void ``` Declare a terminal with left associativity. ### Parameters `tok` Token name. ### Return Values No value is returned. php Componere\cast_by_ref Componere\cast\_by\_ref ======================= (Componere 2 >= 2.1.2) Componere\cast\_by\_ref — Casting ### Description ``` Componere\cast_by_ref(Type $type, $object): Type ``` ### Parameters **type** A user defined type `object` An object with a user defined type compatible with **Type** ### Return Values An object of type **Type**, cast from `object`, where members are references to `object` members ### Errors/Exceptions **Warning** Shall throw [InvalidArgumentException](class.invalidargumentexception) if the type of `object` is or is derived from an internal class **Warning** Shall throw [InvalidArgumentException](class.invalidargumentexception) if **Type** is an interface **Warning** Shall throw [InvalidArgumentException](class.invalidargumentexception) if **Type** is a trait **Warning** Shall throw [InvalidArgumentException](class.invalidargumentexception) if **Type** is an abstract **Warning** Shall throw [InvalidArgumentException](class.invalidargumentexception) if **Type** is not compatible with the type of `object` ### See Also * [Componere\cast](componere.cast) php ob_get_contents ob\_get\_contents ================= (PHP 4, PHP 5, PHP 7, PHP 8) ob\_get\_contents — Return the contents of the output buffer ### Description ``` ob_get_contents(): string|false ``` Gets the contents of the output buffer without clearing it. ### Parameters This function has no parameters. ### Return Values This will return the contents of the output buffer or **`false`**, if output buffering isn't active. ### Examples **Example #1 A simple **ob\_get\_contents()** example** ``` <?php ob_start(); echo "Hello "; $out1 = ob_get_contents(); echo "World"; $out2 = ob_get_contents(); ob_end_clean(); var_dump($out1, $out2); ?> ``` The above example will output: ``` string(6) "Hello " string(11) "Hello World" ``` ### See Also * [ob\_start()](function.ob-start) - Turn on output buffering * [ob\_get\_length()](function.ob-get-length) - Return the length of the output buffer php The OpenSSLCertificateSigningRequest class The OpenSSLCertificateSigningRequest class ========================================== Introduction ------------ (PHP 8) A fully opaque class which replaces `OpenSSL X.509 CSR` resources as of PHP 8.0.0. Class synopsis -------------- final class **OpenSSLCertificateSigningRequest** { } php gmp_fact gmp\_fact ========= (PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8) gmp\_fact — Factorial ### Description ``` gmp_fact(GMP|int|string $num): GMP ``` Calculates factorial (`num!`) of `num`. ### Parameters `num` The factorial number. A [GMP](class.gmp) object, an int or a numeric string. ### Return Values A [GMP](class.gmp) object. ### Examples **Example #1 **gmp\_fact()** example** ``` <?php $fact1 = gmp_fact(5); // 5 * 4 * 3 * 2 * 1 echo gmp_strval($fact1) . "\n"; $fact2 = gmp_fact(50); // 50 * 49 * 48, ... etc echo gmp_strval($fact2) . "\n"; ?> ``` The above example will output: ``` 120 30414093201713378043612608166064768844377641568960512000000000000 ``` php stream_isatty stream\_isatty ============== (PHP 7 >= 7.2.0, PHP 8) stream\_isatty — Check if a stream is a TTY ### Description ``` stream_isatty(resource $stream): bool ``` Determines if stream `stream` refers to a valid terminal type device. This is a more portable version of [posix\_isatty()](function.posix-isatty), since it works on Windows systems too. ### Parameters `stream` ### Return Values Returns **`true`** on success or **`false`** on failure. ### Examples **Example #1 **stream\_isatty()** example** This command can be used to determine if a standard output / standard error stream is redirected to a file. ``` php -r "var_export(stream_isatty(STDERR));" ``` The above example will output something similar to: true ``` php -r "var_export(stream_isatty(STDERR));" 2>output.txt ``` The above example will output something similar to: false php session_encode session\_encode =============== (PHP 4, PHP 5, PHP 7, PHP 8) session\_encode — Encodes the current session data as a session encoded string ### Description ``` session_encode(): string|false ``` **session\_encode()** returns a serialized string of the contents of the current session data stored in the $\_SESSION superglobal. By default, the serialization method used is internal to PHP, and is not the same as [serialize()](function.serialize). The serialization method can be set using [session.serialize\_handler](https://www.php.net/manual/en/session.configuration.php#ini.session.serialize-handler). ### Parameters This function has no parameters. ### Return Values Returns the contents of the current session encoded, or **`false`** on failure. ### Notes **Warning** Must call [session\_start()](function.session-start) before using **session\_encode()**. ### See Also * [session\_decode()](function.session-decode) - Decodes session data from a session encoded string * [session.serialize\_handler](https://www.php.net/manual/en/session.configuration.php#ini.session.serialize-handler) php The ImagickDraw class The ImagickDraw class ===================== Class synopsis -------------- (PECL imagick 2, PECL imagick 3) class **ImagickDraw** { ``` public affine(array $affine): bool ``` ``` public annotation(float $x, float $y, string $text): bool ``` ``` public arc( float $sx, float $sy, float $ex, float $ey, float $sd, float $ed ): bool ``` ``` public bezier(array $coordinates): bool ``` ``` public circle( float $ox, float $oy, float $px, float $py ): bool ``` ``` public clear(): bool ``` ``` public clone(): ImagickDraw ``` ``` public color(float $x, float $y, int $paintMethod): bool ``` ``` public comment(string $comment): bool ``` ``` public composite( int $compose, float $x, float $y, float $width, float $height, Imagick $compositeWand ): bool ``` ``` public __construct() ``` ``` public destroy(): bool ``` ``` public ellipse( float $ox, float $oy, float $rx, float $ry, float $start, float $end ): bool ``` ``` public getClipPath(): string ``` ``` public getClipRule(): int ``` ``` public getClipUnits(): int ``` ``` public getFillColor(): ImagickPixel ``` ``` public getFillOpacity(): float ``` ``` public getFillRule(): int ``` ``` public getFont(): string ``` ``` public getFontFamily(): string ``` ``` public getFontSize(): float ``` ``` public getFontStretch(): int ``` ``` public getFontStyle(): int ``` ``` public getFontWeight(): int ``` ``` public getGravity(): int ``` ``` public getStrokeAntialias(): bool ``` ``` public getStrokeColor(): ImagickPixel ``` ``` public getStrokeDashArray(): array ``` ``` public getStrokeDashOffset(): float ``` ``` public getStrokeLineCap(): int ``` ``` public getStrokeLineJoin(): int ``` ``` public getStrokeMiterLimit(): int ``` ``` public getStrokeOpacity(): float ``` ``` public getStrokeWidth(): float ``` ``` public getTextAlignment(): int ``` ``` public getTextAntialias(): bool ``` ``` public getTextDecoration(): int ``` ``` public getTextEncoding(): string ``` ``` public getTextInterlineSpacing(): float ``` ``` public getTextInterwordSpacing(): float ``` ``` public getTextKerning(): float ``` ``` public getTextUnderColor(): ImagickPixel ``` ``` public getVectorGraphics(): string ``` ``` public line( float $sx, float $sy, float $ex, float $ey ): bool ``` ``` public matte(float $x, float $y, int $paintMethod): bool ``` ``` public pathClose(): bool ``` ``` public pathCurveToAbsolute( float $x1, float $y1, float $x2, float $y2, float $x, float $y ): bool ``` ``` public pathCurveToQuadraticBezierAbsolute( float $x1, float $y1, float $x, float $y ): bool ``` ``` public pathCurveToQuadraticBezierRelative( float $x1, float $y1, float $x, float $y ): bool ``` ``` public pathCurveToQuadraticBezierSmoothAbsolute(float $x, float $y): bool ``` ``` public pathCurveToQuadraticBezierSmoothRelative(float $x, float $y): bool ``` ``` public pathCurveToRelative( float $x1, float $y1, float $x2, float $y2, float $x, float $y ): bool ``` ``` public pathCurveToSmoothAbsolute( float $x2, float $y2, float $x, float $y ): bool ``` ``` public pathCurveToSmoothRelative( float $x2, float $y2, float $x, float $y ): bool ``` ``` public pathEllipticArcAbsolute( float $rx, float $ry, float $x_axis_rotation, bool $large_arc_flag, bool $sweep_flag, float $x, float $y ): bool ``` ``` public pathEllipticArcRelative( float $rx, float $ry, float $x_axis_rotation, bool $large_arc_flag, bool $sweep_flag, float $x, float $y ): bool ``` ``` public pathFinish(): bool ``` ``` public pathLineToAbsolute(float $x, float $y): bool ``` ``` public pathLineToHorizontalAbsolute(float $x): bool ``` ``` public pathLineToHorizontalRelative(float $x): bool ``` ``` public pathLineToRelative(float $x, float $y): bool ``` ``` public pathLineToVerticalAbsolute(float $y): bool ``` ``` public pathLineToVerticalRelative(float $y): bool ``` ``` public pathMoveToAbsolute(float $x, float $y): bool ``` ``` public pathMoveToRelative(float $x, float $y): bool ``` ``` public pathStart(): bool ``` ``` public point(float $x, float $y): bool ``` ``` public polygon(array $coordinates): bool ``` ``` public polyline(array $coordinates): bool ``` ``` public pop(): bool ``` ``` public popClipPath(): bool ``` ``` public popDefs(): bool ``` ``` public popPattern(): bool ``` ``` public push(): bool ``` ``` public pushClipPath(string $clip_mask_id): bool ``` ``` public pushDefs(): bool ``` ``` public pushPattern( string $pattern_id, float $x, float $y, float $width, float $height ): bool ``` ``` public rectangle( float $x1, float $y1, float $x2, float $y2 ): bool ``` ``` public render(): bool ``` ``` public resetVectorGraphics(): bool ``` ``` public rotate(float $degrees): bool ``` ``` public roundRectangle( float $x1, float $y1, float $x2, float $y2, float $rx, float $ry ): bool ``` ``` public scale(float $x, float $y): bool ``` ``` public setClipPath(string $clip_mask): bool ``` ``` public setClipRule(int $fill_rule): bool ``` ``` public setClipUnits(int $clip_units): bool ``` ``` public setFillAlpha(float $opacity): bool ``` ``` public setFillColor(ImagickPixel $fill_pixel): bool ``` ``` public setFillOpacity(float $fillOpacity): bool ``` ``` public setFillPatternURL(string $fill_url): bool ``` ``` public setFillRule(int $fill_rule): bool ``` ``` public setFont(string $font_name): bool ``` ``` public setFontFamily(string $font_family): bool ``` ``` public setFontSize(float $pointsize): bool ``` ``` public setFontStretch(int $fontStretch): bool ``` ``` public setFontStyle(int $style): bool ``` ``` public setFontWeight(int $font_weight): bool ``` ``` public setGravity(int $gravity): bool ``` ``` public setResolution(float $x_resolution, float $y_resolution): bool ``` ``` public setStrokeAlpha(float $opacity): bool ``` ``` public setStrokeAntialias(bool $stroke_antialias): bool ``` ``` public setStrokeColor(ImagickPixel $stroke_pixel): bool ``` ``` public setStrokeDashArray(array $dashArray): bool ``` ``` public setStrokeDashOffset(float $dash_offset): bool ``` ``` public setStrokeLineCap(int $linecap): bool ``` ``` public setStrokeLineJoin(int $linejoin): bool ``` ``` public setStrokeMiterLimit(int $miterlimit): bool ``` ``` public setStrokeOpacity(float $stroke_opacity): bool ``` ``` public setStrokePatternURL(string $stroke_url): bool ``` ``` public setStrokeWidth(float $stroke_width): bool ``` ``` public setTextAlignment(int $alignment): bool ``` ``` public setTextAntialias(bool $antiAlias): bool ``` ``` public setTextDecoration(int $decoration): bool ``` ``` public setTextEncoding(string $encoding): bool ``` ``` public setTextInterlineSpacing(float $spacing): bool ``` ``` public setTextInterwordSpacing(float $spacing): bool ``` ``` public setTextKerning(float $kerning): bool ``` ``` public setTextUnderColor(ImagickPixel $under_color): bool ``` ``` public setVectorGraphics(string $xml): bool ``` ``` public setViewbox( int $x1, int $y1, int $x2, int $y2 ): bool ``` ``` public skewX(float $degrees): bool ``` ``` public skewY(float $degrees): bool ``` ``` public translate(float $x, float $y): bool ``` } Table of Contents ----------------- * [ImagickDraw::affine](imagickdraw.affine) — Adjusts the current affine transformation matrix * [ImagickDraw::annotation](imagickdraw.annotation) — Draws text on the image * [ImagickDraw::arc](imagickdraw.arc) — Draws an arc * [ImagickDraw::bezier](imagickdraw.bezier) — Draws a bezier curve * [ImagickDraw::circle](imagickdraw.circle) — Draws a circle * [ImagickDraw::clear](imagickdraw.clear) — Clears the ImagickDraw * [ImagickDraw::clone](imagickdraw.clone) — Makes an exact copy of the specified ImagickDraw object * [ImagickDraw::color](imagickdraw.color) — Draws color on image * [ImagickDraw::comment](imagickdraw.comment) — Adds a comment * [ImagickDraw::composite](imagickdraw.composite) — Composites an image onto the current image * [ImagickDraw::\_\_construct](imagickdraw.construct) — The ImagickDraw constructor * [ImagickDraw::destroy](imagickdraw.destroy) — Frees all associated resources * [ImagickDraw::ellipse](imagickdraw.ellipse) — Draws an ellipse on the image * [ImagickDraw::getClipPath](imagickdraw.getclippath) — Obtains the current clipping path ID * [ImagickDraw::getClipRule](imagickdraw.getcliprule) — Returns the current polygon fill rule * [ImagickDraw::getClipUnits](imagickdraw.getclipunits) — Returns the interpretation of clip path units * [ImagickDraw::getFillColor](imagickdraw.getfillcolor) — Returns the fill color * [ImagickDraw::getFillOpacity](imagickdraw.getfillopacity) — Returns the opacity used when drawing * [ImagickDraw::getFillRule](imagickdraw.getfillrule) — Returns the fill rule * [ImagickDraw::getFont](imagickdraw.getfont) — Returns the font * [ImagickDraw::getFontFamily](imagickdraw.getfontfamily) — Returns the font family * [ImagickDraw::getFontSize](imagickdraw.getfontsize) — Returns the font pointsize * [ImagickDraw::getFontStretch](imagickdraw.getfontstretch) — Description * [ImagickDraw::getFontStyle](imagickdraw.getfontstyle) — Returns the font style * [ImagickDraw::getFontWeight](imagickdraw.getfontweight) — Returns the font weight * [ImagickDraw::getGravity](imagickdraw.getgravity) — Returns the text placement gravity * [ImagickDraw::getStrokeAntialias](imagickdraw.getstrokeantialias) — Returns the current stroke antialias setting * [ImagickDraw::getStrokeColor](imagickdraw.getstrokecolor) — Returns the color used for stroking object outlines * [ImagickDraw::getStrokeDashArray](imagickdraw.getstrokedasharray) — Returns an array representing the pattern of dashes and gaps used to stroke paths * [ImagickDraw::getStrokeDashOffset](imagickdraw.getstrokedashoffset) — Returns the offset into the dash pattern to start the dash * [ImagickDraw::getStrokeLineCap](imagickdraw.getstrokelinecap) — Returns the shape to be used at the end of open subpaths when they are stroked * [ImagickDraw::getStrokeLineJoin](imagickdraw.getstrokelinejoin) — Returns the shape to be used at the corners of paths when they are stroked * [ImagickDraw::getStrokeMiterLimit](imagickdraw.getstrokemiterlimit) — Returns the stroke miter limit * [ImagickDraw::getStrokeOpacity](imagickdraw.getstrokeopacity) — Returns the opacity of stroked object outlines * [ImagickDraw::getStrokeWidth](imagickdraw.getstrokewidth) — Returns the width of the stroke used to draw object outlines * [ImagickDraw::getTextAlignment](imagickdraw.gettextalignment) — Returns the text alignment * [ImagickDraw::getTextAntialias](imagickdraw.gettextantialias) — Returns the current text antialias setting * [ImagickDraw::getTextDecoration](imagickdraw.gettextdecoration) — Returns the text decoration * [ImagickDraw::getTextEncoding](imagickdraw.gettextencoding) — Returns the code set used for text annotations * [ImagickDraw::getTextInterlineSpacing](imagickdraw.gettextinterlinespacing) — Description * [ImagickDraw::getTextInterwordSpacing](imagickdraw.gettextinterwordspacing) — Description * [ImagickDraw::getTextKerning](imagickdraw.gettextkerning) — Description * [ImagickDraw::getTextUnderColor](imagickdraw.gettextundercolor) — Returns the text under color * [ImagickDraw::getVectorGraphics](imagickdraw.getvectorgraphics) — Returns a string containing vector graphics * [ImagickDraw::line](imagickdraw.line) — Draws a line * [ImagickDraw::matte](imagickdraw.matte) — Paints on the image's opacity channel * [ImagickDraw::pathClose](imagickdraw.pathclose) — Adds a path element to the current path * [ImagickDraw::pathCurveToAbsolute](imagickdraw.pathcurvetoabsolute) — Draws a cubic Bezier curve * [ImagickDraw::pathCurveToQuadraticBezierAbsolute](imagickdraw.pathcurvetoquadraticbezierabsolute) — Draws a quadratic Bezier curve * [ImagickDraw::pathCurveToQuadraticBezierRelative](imagickdraw.pathcurvetoquadraticbezierrelative) — Draws a quadratic Bezier curve * [ImagickDraw::pathCurveToQuadraticBezierSmoothAbsolute](imagickdraw.pathcurvetoquadraticbeziersmoothabsolute) — Draws a quadratic Bezier curve * [ImagickDraw::pathCurveToQuadraticBezierSmoothRelative](imagickdraw.pathcurvetoquadraticbeziersmoothrelative) — Draws a quadratic Bezier curve * [ImagickDraw::pathCurveToRelative](imagickdraw.pathcurvetorelative) — Draws a cubic Bezier curve * [ImagickDraw::pathCurveToSmoothAbsolute](imagickdraw.pathcurvetosmoothabsolute) — Draws a cubic Bezier curve * [ImagickDraw::pathCurveToSmoothRelative](imagickdraw.pathcurvetosmoothrelative) — Draws a cubic Bezier curve * [ImagickDraw::pathEllipticArcAbsolute](imagickdraw.pathellipticarcabsolute) — Draws an elliptical arc * [ImagickDraw::pathEllipticArcRelative](imagickdraw.pathellipticarcrelative) — Draws an elliptical arc * [ImagickDraw::pathFinish](imagickdraw.pathfinish) — Terminates the current path * [ImagickDraw::pathLineToAbsolute](imagickdraw.pathlinetoabsolute) — Draws a line path * [ImagickDraw::pathLineToHorizontalAbsolute](imagickdraw.pathlinetohorizontalabsolute) — Draws a horizontal line path * [ImagickDraw::pathLineToHorizontalRelative](imagickdraw.pathlinetohorizontalrelative) — Draws a horizontal line * [ImagickDraw::pathLineToRelative](imagickdraw.pathlinetorelative) — Draws a line path * [ImagickDraw::pathLineToVerticalAbsolute](imagickdraw.pathlinetoverticalabsolute) — Draws a vertical line * [ImagickDraw::pathLineToVerticalRelative](imagickdraw.pathlinetoverticalrelative) — Draws a vertical line path * [ImagickDraw::pathMoveToAbsolute](imagickdraw.pathmovetoabsolute) — Starts a new sub-path * [ImagickDraw::pathMoveToRelative](imagickdraw.pathmovetorelative) — Starts a new sub-path * [ImagickDraw::pathStart](imagickdraw.pathstart) — Declares the start of a path drawing list * [ImagickDraw::point](imagickdraw.point) — Draws a point * [ImagickDraw::polygon](imagickdraw.polygon) — Draws a polygon * [ImagickDraw::polyline](imagickdraw.polyline) — Draws a polyline * [ImagickDraw::pop](imagickdraw.pop) — Destroys the current ImagickDraw in the stack, and returns to the previously pushed ImagickDraw * [ImagickDraw::popClipPath](imagickdraw.popclippath) — Terminates a clip path definition * [ImagickDraw::popDefs](imagickdraw.popdefs) — Terminates a definition list * [ImagickDraw::popPattern](imagickdraw.poppattern) — Terminates a pattern definition * [ImagickDraw::push](imagickdraw.push) — Clones the current ImagickDraw and pushes it to the stack * [ImagickDraw::pushClipPath](imagickdraw.pushclippath) — Starts a clip path definition * [ImagickDraw::pushDefs](imagickdraw.pushdefs) — Indicates that following commands create named elements for early processing * [ImagickDraw::pushPattern](imagickdraw.pushpattern) — Indicates that subsequent commands up to a ImagickDraw::opPattern() command comprise the definition of a named pattern * [ImagickDraw::rectangle](imagickdraw.rectangle) — Draws a rectangle * [ImagickDraw::render](imagickdraw.render) — Renders all preceding drawing commands onto the image * [ImagickDraw::resetVectorGraphics](imagickdraw.resetvectorgraphics) — Description * [ImagickDraw::rotate](imagickdraw.rotate) — Applies the specified rotation to the current coordinate space * [ImagickDraw::roundRectangle](imagickdraw.roundrectangle) — Draws a rounded rectangle * [ImagickDraw::scale](imagickdraw.scale) — Adjusts the scaling factor * [ImagickDraw::setClipPath](imagickdraw.setclippath) — Associates a named clipping path with the image * [ImagickDraw::setClipRule](imagickdraw.setcliprule) — Set the polygon fill rule to be used by the clipping path * [ImagickDraw::setClipUnits](imagickdraw.setclipunits) — Sets the interpretation of clip path units * [ImagickDraw::setFillAlpha](imagickdraw.setfillalpha) — Sets the opacity to use when drawing using the fill color or fill texture * [ImagickDraw::setFillColor](imagickdraw.setfillcolor) — Sets the fill color to be used for drawing filled objects * [ImagickDraw::setFillOpacity](imagickdraw.setfillopacity) — Sets the opacity to use when drawing using the fill color or fill texture * [ImagickDraw::setFillPatternURL](imagickdraw.setfillpatternurl) — Sets the URL to use as a fill pattern for filling objects * [ImagickDraw::setFillRule](imagickdraw.setfillrule) — Sets the fill rule to use while drawing polygons * [ImagickDraw::setFont](imagickdraw.setfont) — Sets the fully-specified font to use when annotating with text * [ImagickDraw::setFontFamily](imagickdraw.setfontfamily) — Sets the font family to use when annotating with text * [ImagickDraw::setFontSize](imagickdraw.setfontsize) — Sets the font pointsize to use when annotating with text * [ImagickDraw::setFontStretch](imagickdraw.setfontstretch) — Sets the font stretch to use when annotating with text * [ImagickDraw::setFontStyle](imagickdraw.setfontstyle) — Sets the font style to use when annotating with text * [ImagickDraw::setFontWeight](imagickdraw.setfontweight) — Sets the font weight * [ImagickDraw::setGravity](imagickdraw.setgravity) — Sets the text placement gravity * [ImagickDraw::setResolution](imagickdraw.setresolution) — Description * [ImagickDraw::setStrokeAlpha](imagickdraw.setstrokealpha) — Specifies the opacity of stroked object outlines * [ImagickDraw::setStrokeAntialias](imagickdraw.setstrokeantialias) — Controls whether stroked outlines are antialiased * [ImagickDraw::setStrokeColor](imagickdraw.setstrokecolor) — Sets the color used for stroking object outlines * [ImagickDraw::setStrokeDashArray](imagickdraw.setstrokedasharray) — Specifies the pattern of dashes and gaps used to stroke paths * [ImagickDraw::setStrokeDashOffset](imagickdraw.setstrokedashoffset) — Specifies the offset into the dash pattern to start the dash * [ImagickDraw::setStrokeLineCap](imagickdraw.setstrokelinecap) — Specifies the shape to be used at the end of open subpaths when they are stroked * [ImagickDraw::setStrokeLineJoin](imagickdraw.setstrokelinejoin) — Specifies the shape to be used at the corners of paths when they are stroked * [ImagickDraw::setStrokeMiterLimit](imagickdraw.setstrokemiterlimit) — Specifies the miter limit * [ImagickDraw::setStrokeOpacity](imagickdraw.setstrokeopacity) — Specifies the opacity of stroked object outlines * [ImagickDraw::setStrokePatternURL](imagickdraw.setstrokepatternurl) — Sets the pattern used for stroking object outlines * [ImagickDraw::setStrokeWidth](imagickdraw.setstrokewidth) — Sets the width of the stroke used to draw object outlines * [ImagickDraw::setTextAlignment](imagickdraw.settextalignment) — Specifies a text alignment * [ImagickDraw::setTextAntialias](imagickdraw.settextantialias) — Controls whether text is antialiased * [ImagickDraw::setTextDecoration](imagickdraw.settextdecoration) — Specifies a decoration * [ImagickDraw::setTextEncoding](imagickdraw.settextencoding) — Specifies the text code set * [ImagickDraw::setTextInterlineSpacing](imagickdraw.settextinterlinespacing) — Description * [ImagickDraw::setTextInterwordSpacing](imagickdraw.settextinterwordspacing) — Description * [ImagickDraw::setTextKerning](imagickdraw.settextkerning) — Description * [ImagickDraw::setTextUnderColor](imagickdraw.settextundercolor) — Specifies the color of a background rectangle * [ImagickDraw::setVectorGraphics](imagickdraw.setvectorgraphics) — Sets the vector graphics * [ImagickDraw::setViewbox](imagickdraw.setviewbox) — Sets the overall canvas size * [ImagickDraw::skewX](imagickdraw.skewx) — Skews the current coordinate system in the horizontal direction * [ImagickDraw::skewY](imagickdraw.skewy) — Skews the current coordinate system in the vertical direction * [ImagickDraw::translate](imagickdraw.translate) — Applies a translation to the current coordinate system
programming_docs
php The DOMParentNode interface The DOMParentNode interface =========================== Interface synopsis ------------------ (PHP 8) interface **DOMParentNode** { /\* Methods \*/ ``` public append(DOMNode|string ...$nodes): void ``` ``` public prepend(DOMNode|string ...$nodes): void ``` } Table of Contents ----------------- * [DOMParentNode::append](domparentnode.append) — Appends nodes after the last child node * [DOMParentNode::prepend](domparentnode.prepend) — Prepends nodes before the first child node php fbird_trans fbird\_trans ============ (PHP 5, PHP 7 < 7.4.0) fbird\_trans — Alias of [ibase\_trans()](function.ibase-trans) ### Description This function is an alias of: [ibase\_trans()](function.ibase-trans). php eio_open eio\_open ========= (PECL eio >= 0.0.1dev) eio\_open — Opens a file ### Description ``` eio_open( string $path, int $flags, int $mode, int $pri, callable $callback, mixed $data = NULL ): resource ``` **eio\_open()** opens file specified by `path` in access mode `mode` with ### Parameters `path` Path of the file to be opened. **Warning** In some SAPIs(e.g. *PHP-FPM*) it could fail, if you don't specify full path. `flags` One of *EIO\_O\_\** constants, or their combinations. *EIO\_O\_\** constants have the same meaning, as their corresponding *O\_\** counterparts defined in `fnctl.h` C header file. Default is **`EIO_O_RDWR`**. `mode` One of *EIO\_S\_I\** constants, or their combination (via bitwise OR operator). The constants have the same meaning as their *S\_I\** counterparts defined in [» sys/stat.h](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_stat.h.html) C header file. Required, if a file is created. Otherwise ignored. `pri` The request priority: **`EIO_PRI_DEFAULT`**, **`EIO_PRI_MIN`**, **`EIO_PRI_MAX`**, or **`null`**. If **`null`** passed, `pri` internally is set to **`EIO_PRI_DEFAULT`**. `callback` `callback` function is called when the request is done. It should match the following prototype: ``` void callback(mixed $data, int $result[, resource $req]); ``` `data` is custom data passed to the request. `result` request-specific result value; basically, the value returned by corresponding system call. `req` is optional request resource which can be used with functions like [eio\_get\_last\_error()](function.eio-get-last-error) `data` Arbitrary variable passed to `callback`. ### Return Values **eio\_open()** returns file descriptor in `result` argument of `callback` on success; otherwise, `result` is equal to **`-1`**. ### Examples **Example #1 **eio\_open()** example** ``` <?php $temp_filename = "eio-temp-file.tmp"; /* Is called when eio_close() finishes */ function my_close_cb($data, $result) {  // Zero indicates success     var_dump($result == 0);  @unlink($data); } /* Is called when eio_open() finishes */ function my_file_opened_callback($data, $result) {  // $result should contain the file descriptor     var_dump($result > 0);     if ($result > 0) {   // Close the file         eio_close($result, EIO_PRI_DEFAULT, "my_close_cb", $data);         eio_event_loop();     } } // Create new file for reading and writing // Deny group and others to do anything with that file eio_open($temp_filename, EIO_O_CREAT | EIO_O_RDWR, EIO_S_IRUSR | EIO_S_IWUSR,   EIO_PRI_DEFAULT, "my_file_opened_callback", $temp_filename); eio_event_loop(); ?> ``` The above example will output something similar to: ``` bool(true) bool(true) ``` ### See Also * [eio\_mknod()](function.eio-mknod) - Create a special or ordinary file php SplObjectStorage::removeAll SplObjectStorage::removeAll =========================== (PHP 5 >= 5.3.0, PHP 7, PHP 8) SplObjectStorage::removeAll — Removes objects contained in another storage from the current storage ### Description ``` public SplObjectStorage::removeAll(SplObjectStorage $storage): int ``` Removes objects contained in another storage from the current storage. ### Parameters `storage` The storage containing the elements to remove. ### Return Values Returns the number of remaining objects. ### Examples **Example #1 **SplObjectStorage::removeAll()** example** ``` <?php $o1 = new StdClass; $o2 = new StdClass; $a = new SplObjectStorage(); $a[$o1] = "foo"; $b = new SplObjectStorage(); $b[$o1] = "bar"; $b[$o2] = "gee"; var_dump(count($b)); $b->removeAll($a); var_dump(count($b)); ?> ``` The above example will output something similar to: ``` int(2) int(1) ``` ### See Also * [SplObjectStorage::addAll()](splobjectstorage.addall) - Adds all objects from another storage php OAuthProvider::calltokenHandler OAuthProvider::calltokenHandler =============================== (PECL OAuth >= 1.0.0) OAuthProvider::calltokenHandler — Calls the tokenNonceHandler callback ### Description ``` public OAuthProvider::calltokenHandler(): void ``` Calls the registered token handler callback function, which is set with [OAuthProvider::tokenHandler()](oauthprovider.tokenhandler). **Warning**This function is currently not documented; only its argument list is available. ### Parameters This function has no parameters. ### Return Values No value is returned. ### Errors/Exceptions Emits an **`E_ERROR`** level error if the callback function cannot be called, or was not specified. ### See Also * [OAuthProvider::tokenHandler()](oauthprovider.tokenhandler) - Set the tokenHandler handler callback php SolrQuery::getHighlightRequireFieldMatch SolrQuery::getHighlightRequireFieldMatch ======================================== (PECL solr >= 0.9.2) SolrQuery::getHighlightRequireFieldMatch — Returns if a field will only be highlighted if the query matched in this particular field ### Description ``` public SolrQuery::getHighlightRequireFieldMatch(): bool ``` Returns if a field will only be highlighted if the query matched in this particular field. ### Parameters This function has no parameters. ### Return Values Returns a boolean on success and **`null`** if not set. php IntlBreakIterator::getText IntlBreakIterator::getText ========================== (PHP 5 >= 5.5.0, PHP 7, PHP 8) IntlBreakIterator::getText — Get the text being scanned ### Description ``` public IntlBreakIterator::getText(): ?string ``` **Warning**This function is currently not documented; only its argument list is available. ### Parameters This function has no parameters. ### Return Values php Thread::getCurrentThread Thread::getCurrentThread ======================== (PECL pthreads >= 2.0.0) Thread::getCurrentThread — Identification ### Description ``` public static Thread::getCurrentThread(): Thread ``` Return a reference to the currently executing Thread ### Parameters This function has no parameters. ### Return Values An object representing the currently executing Thread ### Examples **Example #1 Return the currently executing Thread** ``` <?php class My extends Thread {     public function run() {         var_dump(Thread::getCurrentThread());     } } $my = new My(); $my->start(); ?> ``` The above example will output: ``` object(My)#2 (0) { } ``` php ReflectionFunctionAbstract::getExtension ReflectionFunctionAbstract::getExtension ======================================== (PHP 5 >= 5.2.0, PHP 7, PHP 8) ReflectionFunctionAbstract::getExtension — Gets extension info ### Description ``` public ReflectionFunctionAbstract::getExtension(): ?ReflectionExtension ``` Get the extension information of a function. ### Parameters This function has no parameters. ### Return Values The extension information, as a [ReflectionExtension](class.reflectionextension) object, or **`null`** for user-defined functions. ### See Also * [ReflectionFunctionAbstract::getExtensionName()](reflectionfunctionabstract.getextensionname) - Gets extension name php ReflectionExtension::export ReflectionExtension::export =========================== (PHP 5, PHP 7) ReflectionExtension::export — Export **Warning**This function has been *DEPRECATED* as of PHP 7.4.0, and *REMOVED* as of PHP 8.0.0. Relying on this function is highly discouraged. ### Description ``` public static ReflectionExtension::export(string $name, string $return = false): string ``` Exports a reflected extension. The output format of this function is the same as the CLI argument `--re [extension]`. ### Parameters `name` The reflection to export. `return` Setting to **`true`** will return the export, as opposed to emitting it. Setting to **`false`** (the default) will do the opposite. ### Return Values If the `return` parameter is set to **`true`**, then the export is returned as a string, otherwise **`null`** is returned. ### See Also * [ReflectionExtension::info()](reflectionextension.info) - Print extension info * [ReflectionExtension::\_\_toString()](reflectionextension.tostring) - To string php OAuth::setCAPath OAuth::setCAPath ================ (PECL OAuth >= 0.99.8) OAuth::setCAPath — Set CA path and info ### Description ``` public OAuth::setCAPath(string $ca_path = ?, string $ca_info = ?): mixed ``` Sets the Certificate Authority (CA), both for path and info. **Warning**This function is currently not documented; only its argument list is available. ### Parameters `ca_path` The CA Path being set. `ca_info` The CA Info being set. ### Return Values Returns **`true`** on success, or **`false`** if either `ca_path` or `ca_info` are considered invalid. ### Changelog | Version | Description | | --- | --- | | PECL oauth 1.0.0 | Previously returned **`null`** on failure, instead of **`false`**. | ### See Also * [OAuth::getCaPath()](oauth.getcapath) - Gets CA information php fdiv fdiv ==== (PHP 8) fdiv — Divides two numbers, according to IEEE 754 ### Description ``` fdiv(float $num1, float $num2): float ``` Returns the floating point result of dividing the `num1` by the `num2`. If the `num2` is zero, then one of `INF`, `-INF`, or `NAN` will be returned. Note that in comparisons, `NAN` will never `==` or `===`, any value, including itself. ### Parameters `num1` The dividend (numerator) `num2` The divisor ### Return Values The floating point result of `num1`/`num2` ### Examples **Example #1 Using **fdiv()**** ``` <?php var_dump(fdiv(5.7, 1.3)); // float(4.384615384615385) var_dump(fdiv(4, 2)); // float(2) var_dump(fdiv(1.0, 0.0)); // float(INF) var_dump(fdiv(-1.0, 0.0)); // float(-INF) var_dump(fdiv(0.0, 0.0)); // float(NAN) ?> ``` ### See Also * [`/`](language.operators.arithmetic) - Floating-point division * [intdiv()](function.intdiv) - Integer division * [fmod()](function.fmod) - Modulus php ssdeep_fuzzy_hash_filename ssdeep\_fuzzy\_hash\_filename ============================= (PECL ssdeep >= 1.0.0) ssdeep\_fuzzy\_hash\_filename — Create a fuzzy hash from a file ### Description ``` ssdeep_fuzzy_hash_filename(string $file_name): string ``` **ssdeep\_fuzzy\_hash\_filename()** calculates the hash of the file specified by `file_name` using [» context-triggered piecewise hashing](http://dfrws.org/2006/proceedings/12-Kornblum.pdf), and returns that hash. ### Parameters `file_name` The filename of the file to hash. ### Return Values Returns a string on success, **`false`** otherwise. php Yaf_Application::getAppDirectory Yaf\_Application::getAppDirectory ================================= (Yaf >=2.1.4) Yaf\_Application::getAppDirectory — Get the application directory ### Description ``` public Yaf_Application::getAppDirectory(): Yaf_Application ``` ### Parameters `directory` ### Return Values php stats_cdf_cauchy stats\_cdf\_cauchy ================== (PECL stats >= 1.0.0) stats\_cdf\_cauchy — Calculates any one parameter of the Cauchy distribution given values for the others ### Description ``` stats_cdf_cauchy( float $par1, float $par2, float $par3, int $which ): float ``` Returns the cumulative distribution function, its inverse, or one of its parameters, of the Cauchy distribution. The kind of the return value and parameters (`par1`, `par2`, and `par3`) are determined by `which`. The following table lists the return value and parameters by `which`. CDF, x, x0, and gamma denotes cumulative distribution function, the value of the random variable, the location and the scale parameter of the Cauchy distribution, respectively. **Return value and parameters**| `which` | Return value | `par1` | `par2` | `par3` | | --- | --- | --- | --- | --- | | 1 | CDF | x | x0 | gamma | | 2 | x | CDF | x0 | gamma | | 3 | x0 | x | CDF | gamma | | 4 | gamma | x | CDF | x0 | ### Parameters `par1` The first parameter `par2` The second parameter `par3` The third parameter `which` The flag to determine what to be calculated ### Return Values Returns CDF, x, x0, or gamma, determined by `which`. php gd_info gd\_info ======== (PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8) gd\_info — Retrieve information about the currently installed GD library ### Description ``` gd_info(): array ``` Gets information about the version and capabilities of the installed GD library. ### Parameters This function has no parameters. ### Return Values Returns an associative array. **Elements of array returned by **gd\_info()****| Attribute | Meaning | | --- | --- | | GD Version | string value describing the installed `libgd` version. | | FreeType Support | bool value. **`true`** if FreeType Support is installed. | | FreeType Linkage | string value describing the way in which FreeType was linked. Expected values are: 'with freetype', 'with TTF library', and 'with unknown library'. This element will only be defined if `FreeType Support` evaluated to **`true`**. | | GIF Read Support | bool value. **`true`** if support for *reading* `GIF` images is included. | | GIF Create Support | bool value. **`true`** if support for *creating* `GIF` images is included. | | JPEG Support | bool value. **`true`** if `JPEG` support is included. | | PNG Support | bool value. **`true`** if `PNG` support is included. | | WBMP Support | bool value. **`true`** if `WBMP` support is included. | | XBM Support | bool value. **`true`** if `XBM` support is included. | | WebP Support | bool value. **`true`** if `WebP` support is included. | | AVIF Support | bool value. **`true`** if `AVIF` support is included. Available as of PHP 8.1.0. | ### Examples **Example #1 Using **gd\_info()**** ``` <?php var_dump(gd_info()); ?> ``` The above example will output something similar to: ``` array(10) { ["GD Version"]=> string(24) "bundled (2.1.0 compatible)" ["FreeType Support"]=> bool(false) ["GIF Read Support"]=> bool(true) ["GIF Create Support"]=> bool(false) ["JPEG Support"]=> bool(false) ["PNG Support"]=> bool(true) ["WBMP Support"]=> bool(true) ["XBM Support"]=> bool(false) ["WebP Support"]=> bool(false) ["AVIF Support"]=> bool(false) } ``` ### See Also * [imagepng()](function.imagepng) - Output a PNG image to either the browser or a file * [imagejpeg()](function.imagejpeg) - Output image to browser or file * [imagegif()](function.imagegif) - Output image to browser or file * [imagewbmp()](function.imagewbmp) - Output image to browser or file * [imagewebp()](function.imagewebp) - Output a WebP image to browser or file * [imageavif()](function.imageavif) - Output image to browser or file * [imagetypes()](function.imagetypes) - Return the image types supported by this PHP build php eio_utime eio\_utime ========== (PECL eio >= 0.0.1dev) eio\_utime — Change file last access and modification times ### Description ``` eio_utime( string $path, float $atime, float $mtime, int $pri = EIO_PRI_DEFAULT, callable $callback = NULL, mixed $data = NULL ): resource ``` ### Parameters `path` Path to the file. `atime` Access time `mtime` Modification time `pri` The request priority: **`EIO_PRI_DEFAULT`**, **`EIO_PRI_MIN`**, **`EIO_PRI_MAX`**, or **`null`**. If **`null`** passed, `pri` internally is set to **`EIO_PRI_DEFAULT`**. `callback` `callback` function is called when the request is done. It should match the following prototype: ``` void callback(mixed $data, int $result[, resource $req]); ``` `data` is custom data passed to the request. `result` request-specific result value; basically, the value returned by corresponding system call. `req` is optional request resource which can be used with functions like [eio\_get\_last\_error()](function.eio-get-last-error) `data` Arbitrary variable passed to `callback`. ### Return Values **eio\_utime()** returns request resource on success, or **`false`** on failure. ### See Also * [eio\_futime()](function.eio-futime) - Change file last access and modification times php The SyncReaderWriter class The SyncReaderWriter class ========================== Introduction ------------ (PECL sync >= 1.0.0) A cross-platform, native implementation of named and unnamed reader-writer objects. A reader-writer object allows many readers or one writer to access a resource. This is an efficient solution for managing resources where access will primarily be read-only but exclusive write access is occasionally necessary. Class synopsis -------------- class **SyncReaderWriter** { /\* Methods \*/ ``` public __construct(string $name = ?, int $autounlock = 1) ``` ``` public readlock(int $wait = -1): bool ``` ``` public readunlock(): bool ``` ``` public writelock(int $wait = -1): bool ``` ``` public writeunlock(): bool ``` } Table of Contents ----------------- * [SyncReaderWriter::\_\_construct](syncreaderwriter.construct) — Constructs a new SyncReaderWriter object * [SyncReaderWriter::readlock](syncreaderwriter.readlock) — Waits for a read lock * [SyncReaderWriter::readunlock](syncreaderwriter.readunlock) — Releases a read lock * [SyncReaderWriter::writelock](syncreaderwriter.writelock) — Waits for an exclusive write lock * [SyncReaderWriter::writeunlock](syncreaderwriter.writeunlock) — Releases a write lock php pg_insert pg\_insert ========== (PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8) pg\_insert — Insert array into table ### Description ``` pg_insert( PgSql\Connection $connection, string $table_name, array $values, int $flags = PGSQL_DML_EXEC ): PgSql\Result|string|bool ``` **pg\_insert()** inserts the values of `values` into the table specified by `table_name`. If `flags` is specified, [pg\_convert()](function.pg-convert) is applied to `values` with the specified flags. By default **pg\_insert()** passes raw values. Values must be escaped or the **`PGSQL_DML_ESCAPE`** flag must be specified in `flags`. **`PGSQL_DML_ESCAPE`** quotes and escapes parameters/identifiers. Therefore, table/column names become case sensitive. Note that neither escape nor prepared query can protect LIKE query, JSON, Array, Regex, etc. These parameters should be handled according to their contexts. i.e. Escape/validate values. ### Parameters `connection` An [PgSql\Connection](class.pgsql-connection) instance. `table_name` Name of the table into which to insert rows. The table `table_name` must at least have as many columns as `values` has elements. `values` An array whose keys are field names in the table `table_name`, and whose values are the values of those fields that are to be inserted. `flags` Any number of **`PGSQL_CONV_OPTS`**, **`PGSQL_DML_NO_CONV`**, **`PGSQL_DML_ESCAPE`**, **`PGSQL_DML_EXEC`**, **`PGSQL_DML_ASYNC`** or **`PGSQL_DML_STRING`** combined. If **`PGSQL_DML_STRING`** is part of the `flags` then query string is returned. When **`PGSQL_DML_NO_CONV`** or **`PGSQL_DML_ESCAPE`** is set, it does not call [pg\_convert()](function.pg-convert) internally. ### Return Values Returns **`true`** on success or **`false`** on failure.. Or returns a string on success if **`PGSQL_DML_STRING`** is passed via `flags`. ### Changelog | Version | Description | | --- | --- | | 8.1.0 | Returns an [PgSql\Result](class.pgsql-result) instance now; previously, a [resource](language.types.resource) was returned. | | 8.1.0 | The `connection` parameter expects an [PgSql\Connection](class.pgsql-connection) instance now; previously, a [resource](language.types.resource) was expected. | ### Examples **Example #1 **pg\_insert()** example** ``` <?php    $dbconn = pg_connect('dbname=foo');   // This is safe somewhat, since all values are escaped.   // However PostgreSQL supports JSON/Array. These are not   // safe by neither escape nor prepared query.   $res = pg_insert($dbconn, 'post_log', $_POST, PG_DML_ESCAPE);   if ($res) {       echo "POST data is successfully logged\n";   } else {       echo "User must have sent wrong inputs\n";   } ?> ``` ### See Also * [pg\_convert()](function.pg-convert) - Convert associative array values into forms suitable for SQL statements
programming_docs
php SplDoublyLinkedList::offsetUnset SplDoublyLinkedList::offsetUnset ================================ (PHP 5 >= 5.3.0, PHP 7, PHP 8) SplDoublyLinkedList::offsetUnset — Unsets the value at the specified $index ### Description ``` public SplDoublyLinkedList::offsetUnset(int $index): void ``` Unsets the value at the specified index. ### Parameters `index` The index being unset. ### Return Values No value is returned. ### Errors/Exceptions Throws [OutOfRangeException](class.outofrangeexception) when `index` is out of bounds or when `index` cannot be parsed as an integer. php Transliterator::create Transliterator::create ====================== transliterator\_create ====================== (PHP 5 >= 5.4.0, PHP 7, PHP 8, PECL intl >= 2.0.0) Transliterator::create -- transliterator\_create — Create a transliterator ### Description Object-oriented style ``` public static Transliterator::create(string $id, int $direction = Transliterator::FORWARD): ?Transliterator ``` Procedural style ``` transliterator_create(string $id, int $direction = Transliterator::FORWARD): ?Transliterator ``` Opens a Transliterator by ID. **Warning**This function is currently not documented; only its argument list is available. ### Parameters `id` The ID. A list of all registered transliterator IDs can be retrieved by using [Transliterator::listIDs()](transliterator.listids). `direction` The direction, defaults to [Transliterator::FORWARD](class.transliterator#transliterator.constants.forward). May also be set to [Transliterator::REVERSE](class.transliterator#transliterator.constants.reverse). ### Return Values Returns a [Transliterator](class.transliterator) object on success, or **`null`** on failure. ### See Also * [Transliterator::getErrorMessage()](transliterator.geterrormessage) - Get last error message * [Transliterator::\_\_construct()](transliterator.construct) - Private constructor to deny instantiation php dir dir === (PHP 4, PHP 5, PHP 7, PHP 8) dir — Return an instance of the Directory class ### Description ``` dir(string $directory, ?resource $context = null): Directory|false ``` A pseudo-object-oriented mechanism for reading a directory. The given `directory` is opened. ### Parameters `directory` Directory to open `context` A [context stream](https://www.php.net/manual/en/stream.contexts.php) resource. ### Return Values Returns an instance of [Directory](class.directory), or **`false`** in case of error. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | `context` is now nullable. | ### Examples **Example #1 **dir()** example** Please note the fashion in which [Directory::read()](directory.read)'s return value is checked in the example below. We are explicitly testing whether the return value is identical to (equal to and of the same type as - see [Comparison Operators](language.operators.comparison) for more information) **`false`** since otherwise, any directory entry whose name evaluates to **`false`** will stop the loop. ``` <?php $d = dir("/etc/php5"); echo "Handle: " . $d->handle . "\n"; echo "Path: " . $d->path . "\n"; while (false !== ($entry = $d->read())) {    echo $entry."\n"; } $d->close(); ?> ``` The above example will output something similar to: ``` Handle: Resource id #2 Path: /etc/php5 . .. apache cgi cli ``` ### Notes > > **Note**: > > > The order in which directory entries are returned by the read method is system-dependent. > > php session_module_name session\_module\_name ===================== (PHP 4, PHP 5, PHP 7, PHP 8) session\_module\_name — Get and/or set the current session module ### Description ``` session_module_name(?string $module = null): string|false ``` **session\_module\_name()** gets the name of the current session module, which is also known as [session.save\_handler](https://www.php.net/manual/en/session.configuration.php#ini.session.save-handler). ### Parameters `module` If `module` is specified and not **`null`**, that module will be used instead. Passing `"user"` to this parameter is forbidden. Instead [session\_set\_save\_handler()](function.session-set-save-handler) has to be called to set a user defined session handler. ### Return Values Returns the name of the current session module, or **`false`** on failure. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | `module` is nullable now. | | 7.2.0 | It is now explicitly forbidden to set the module name to `"user"`. Formerly, this has been silently ignored. | php Imagick::setImageRenderingIntent Imagick::setImageRenderingIntent ================================ (PECL imagick 2, PECL imagick 3) Imagick::setImageRenderingIntent — Sets the image rendering intent ### Description ``` public Imagick::setImageRenderingIntent(int $rendering_intent): bool ``` Sets the image rendering intent. ### Parameters `rendering_intent` ### Return Values Returns **`true`** on success. ### Errors/Exceptions Throws ImagickException on error. php The streamWrapper class The streamWrapper class ======================= Introduction ------------ (PHP 4 >= 4.3.2, PHP 5, PHP 7, PHP 8) Allows you to implement your own protocol handlers and streams for use with all the other filesystem functions (such as [fopen()](function.fopen), [fread()](function.fread) etc.). > > **Note**: > > > This is *NOT* a real class, only a prototype of how a class defining its own protocol should be. > > > > **Note**: > > > Implementing the methods in other ways than described here can lead to undefined behaviour. > > An instance of this class is initialized as soon as a stream function tries to access the protocol it is associated with. Class synopsis -------------- class streamWrapper { /\* Properties \*/ public resource [$context](class.streamwrapper#streamwrapper.props.context); /\* Methods \*/ public [\_\_construct](streamwrapper.construct)() ``` public dir_closedir(): bool ``` ``` public dir_opendir(string $path, int $options): bool ``` ``` public dir_readdir(): string ``` ``` public dir_rewinddir(): bool ``` ``` public mkdir(string $path, int $mode, int $options): bool ``` ``` public rename(string $path_from, string $path_to): bool ``` ``` public rmdir(string $path, int $options): bool ``` ``` public stream_cast(int $cast_as): resource ``` ``` public stream_close(): void ``` ``` public stream_eof(): bool ``` ``` public stream_flush(): bool ``` ``` public stream_lock(int $operation): bool ``` ``` public stream_metadata(string $path, int $option, mixed $value): bool ``` ``` public stream_open( string $path, string $mode, int $options, ?string &$opened_path ): bool ``` ``` public stream_read(int $count): string|false ``` ``` public stream_seek(int $offset, int $whence = SEEK_SET): bool ``` ``` public stream_set_option(int $option, int $arg1, int $arg2): bool ``` ``` public stream_stat(): array|false ``` ``` public stream_tell(): int ``` ``` public stream_truncate(int $new_size): bool ``` ``` public stream_write(string $data): int ``` ``` public unlink(string $path): bool ``` ``` public url_stat(string $path, int $flags): array|false ``` public [\_\_destruct](streamwrapper.destruct)() } Properties ---------- resource context The current [context](https://www.php.net/manual/en/context.php), or **`null`** if no context was passed to the caller function. Use the [stream\_context\_get\_options()](function.stream-context-get-options) to parse the context. > > **Note**: > > > This property *must* be public so PHP can populate it with the actual context resource. > > See Also -------- * [Example class registered as stream wrapper](https://www.php.net/manual/en/stream.streamwrapper.example-1.php) * [stream\_wrapper\_register()](function.stream-wrapper-register) * [stream\_wrapper\_unregister()](function.stream-wrapper-unregister) * [stream\_wrapper\_restore()](function.stream-wrapper-restore) Table of Contents ----------------- * [streamWrapper::\_\_construct](streamwrapper.construct) — Constructs a new stream wrapper * [streamWrapper::\_\_destruct](streamwrapper.destruct) — Destructs an existing stream wrapper * [streamWrapper::dir\_closedir](streamwrapper.dir-closedir) — Close directory handle * [streamWrapper::dir\_opendir](streamwrapper.dir-opendir) — Open directory handle * [streamWrapper::dir\_readdir](streamwrapper.dir-readdir) — Read entry from directory handle * [streamWrapper::dir\_rewinddir](streamwrapper.dir-rewinddir) — Rewind directory handle * [streamWrapper::mkdir](streamwrapper.mkdir) — Create a directory * [streamWrapper::rename](streamwrapper.rename) — Renames a file or directory * [streamWrapper::rmdir](streamwrapper.rmdir) — Removes a directory * [streamWrapper::stream\_cast](streamwrapper.stream-cast) — Retrieve the underlaying resource * [streamWrapper::stream\_close](streamwrapper.stream-close) — Close a resource * [streamWrapper::stream\_eof](streamwrapper.stream-eof) — Tests for end-of-file on a file pointer * [streamWrapper::stream\_flush](streamwrapper.stream-flush) — Flushes the output * [streamWrapper::stream\_lock](streamwrapper.stream-lock) — Advisory file locking * [streamWrapper::stream\_metadata](streamwrapper.stream-metadata) — Change stream metadata * [streamWrapper::stream\_open](streamwrapper.stream-open) — Opens file or URL * [streamWrapper::stream\_read](streamwrapper.stream-read) — Read from stream * [streamWrapper::stream\_seek](streamwrapper.stream-seek) — Seeks to specific location in a stream * [streamWrapper::stream\_set\_option](streamwrapper.stream-set-option) — Change stream options * [streamWrapper::stream\_stat](streamwrapper.stream-stat) — Retrieve information about a file resource * [streamWrapper::stream\_tell](streamwrapper.stream-tell) — Retrieve the current position of a stream * [streamWrapper::stream\_truncate](streamwrapper.stream-truncate) — Truncate stream * [streamWrapper::stream\_write](streamwrapper.stream-write) — Write to stream * [streamWrapper::unlink](streamwrapper.unlink) — Delete a file * [streamWrapper::url\_stat](streamwrapper.url-stat) — Retrieve information about a file php Yaf_Config_Abstract::set Yaf\_Config\_Abstract::set ========================== (Yaf >=1.0.0) Yaf\_Config\_Abstract::set — Setter ### Description ``` abstract public Yaf_Config_Abstract::set(): Yaf_Config_Abstract ``` **Warning**This function is currently not documented; only its argument list is available. ### Parameters This function has no parameters. ### Return Values php gmp_scan1 gmp\_scan1 ========== (PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8) gmp\_scan1 — Scan for 1 ### Description ``` gmp_scan1(GMP|int|string $num1, int $start): int ``` Scans `num1`, starting with bit `start`, towards more significant bits, until the first set bit is found. ### Parameters `num1` The number to scan. A [GMP](class.gmp) object, an int or a numeric string. `start` The starting bit. ### Return Values Returns the index of the found bit, as an int. If no set bit is found, -1 is returned. ### Examples **Example #1 **gmp\_scan1()** example** ``` <?php // "1" bit is found at position 3. index starts at 0 $s1 = gmp_init("01000", 2); echo gmp_scan1($s1, 0) . "\n"; // "1" bit is found at position 9. index starts at 5 $s2 = gmp_init("01000001111", 2); echo gmp_scan1($s2, 5) . "\n"; ?> ``` The above example will output: ``` 3 9 ``` php ImagickDraw::getTextInterlineSpacing ImagickDraw::getTextInterlineSpacing ==================================== (PECL imagick 3 >= 3.1.0) ImagickDraw::getTextInterlineSpacing — Description ### Description ``` public ImagickDraw::getTextInterlineSpacing(): float ``` Gets the text interword spacing. ### Parameters This function has no parameters. ### Return Values php escapeshellarg escapeshellarg ============== (PHP 4 >= 4.0.3, PHP 5, PHP 7, PHP 8) escapeshellarg — Escape a string to be used as a shell argument ### Description ``` escapeshellarg(string $arg): string ``` **escapeshellarg()** adds single quotes around a string and quotes/escapes any existing single quotes allowing you to pass a string directly to a shell function and having it be treated as a single safe argument. This function should be used to escape individual arguments to shell functions coming from user input. The shell functions include [exec()](function.exec), [system()](function.system) and the [backtick operator](language.operators.execution). On Windows, **escapeshellarg()** instead replaces percent signs, exclamation marks (delayed variable substitution) and double quotes with spaces and adds double quotes around the string. Furthermore, each streak of consecutive backslashes (`\`) is escaped by one additional backslash. ### Parameters `arg` The argument that will be escaped. ### Return Values The escaped string. ### Examples **Example #1 **escapeshellarg()** example** ``` <?php system('ls '.escapeshellarg($dir)); ?> ``` ### See Also * [escapeshellcmd()](function.escapeshellcmd) - Escape shell metacharacters * [exec()](function.exec) - Execute an external program * [popen()](function.popen) - Opens process file pointer * [system()](function.system) - Execute an external program and display the output * [backtick operator](language.operators.execution) php The PhpToken class The PhpToken class ================== Introduction ------------ (PHP 8) This class provides an alternative to [token\_get\_all()](function.token-get-all). While the function returns tokens either as a single-character string, or an array with a token ID, token text and line number, [PhpToken::tokenize()](phptoken.tokenize) normalizes all tokens into PhpToken objects, which makes code operating on tokens more memory efficient and readable. Class synopsis -------------- class **PhpToken** implements [Stringable](class.stringable) { /\* Properties \*/ public int [$id](class.phptoken#phptoken.props.id); public string [$text](class.phptoken#phptoken.props.text); public int [$line](class.phptoken#phptoken.props.line); public int [$pos](class.phptoken#phptoken.props.pos); /\* Methods \*/ final public [\_\_construct](phptoken.construct)( int `$id`, string `$text`, int `$line` = -1, int `$pos` = -1 ) ``` public getTokenName(): ?string ``` ``` public is(int|string|array $kind): bool ``` ``` public isIgnorable(): bool ``` ``` public __toString(): string ``` ``` public static tokenize(string $code, int $flags = 0): array ``` } Properties ---------- id One of the T\_\* constants, or an ASCII codepoint representing a single-char token. text The textual content of the token. line The starting line number (1-based) of the token. pos The starting position (0-based) in the tokenized string (the number of bytes). Table of Contents ----------------- * [PhpToken::\_\_construct](phptoken.construct) — Returns a new PhpToken object * [PhpToken::getTokenName](phptoken.gettokenname) — Returns the name of the token. * [PhpToken::is](phptoken.is) — Tells whether the token is of given kind. * [PhpToken::isIgnorable](phptoken.isignorable) — Tells whether the token would be ignored by the PHP parser. * [PhpToken::\_\_toString](phptoken.tostring) — Returns the textual content of the token. * [PhpToken::tokenize](phptoken.tokenize) — Splits given source into PHP tokens, represented by PhpToken objects. php The Yaf_View_Simple class The Yaf\_View\_Simple class =========================== Introduction ------------ (Yaf >=1.0.0) **Yaf\_View\_Simple** is the built-in template engine in Yaf, it is a simple but fast template engine, and only support PHP script template. Class synopsis -------------- class **Yaf\_View\_Simple** implements [Yaf\_View\_Interface](class.yaf-view-interface) { /\* Properties \*/ protected [$\_tpl\_vars](class.yaf-view-simple#yaf-view-simple.props.tpl-vars); protected [$\_tpl\_dir](class.yaf-view-simple#yaf-view-simple.props.tpl-dir); /\* Methods \*/ final public [\_\_construct](yaf-view-simple.construct)(string `$template_dir`, array `$options` = ?) ``` public assign(string $name, mixed $value = ?): bool ``` ``` public assignRef(string $name, mixed &$value): bool ``` ``` public clear(string $name = ?): bool ``` ``` public display(string $tpl, array $tpl_vars = ?): bool ``` ``` public eval(string $tpl_content, array $tpl_vars = ?): string ``` ``` public __get(string $name = ?): void ``` ``` public getScriptPath(): string ``` ``` public __isset(string $name): void ``` ``` public render(string $tpl, array $tpl_vars = ?): string ``` ``` public __set(string $name, mixed $value): void ``` ``` public setScriptPath(string $template_dir): bool ``` } Properties ---------- \_tpl\_vars \_tpl\_dir Table of Contents ----------------- * [Yaf\_View\_Simple::assign](yaf-view-simple.assign) — Assign values * [Yaf\_View\_Simple::assignRef](yaf-view-simple.assignref) — The assignRef purpose * [Yaf\_View\_Simple::clear](yaf-view-simple.clear) — Clear Assigned values * [Yaf\_View\_Simple::\_\_construct](yaf-view-simple.construct) — Constructor of Yaf\_View\_Simple * [Yaf\_View\_Simple::display](yaf-view-simple.display) — Render and display * [Yaf\_View\_Simple::eval](yaf-view-simple.eval) — Render template * [Yaf\_View\_Simple::\_\_get](yaf-view-simple.get) — Retrieve assigned variable * [Yaf\_View\_Simple::getScriptPath](yaf-view-simple.getscriptpath) — Get templates directory * [Yaf\_View\_Simple::\_\_isset](yaf-view-simple.isset) — The \_\_isset purpose * [Yaf\_View\_Simple::render](yaf-view-simple.render) — Render template * [Yaf\_View\_Simple::\_\_set](yaf-view-simple.set) — Set value to engine * [Yaf\_View\_Simple::setScriptPath](yaf-view-simple.setscriptpath) — Set tempaltes directory php SolrQuery::getTermsLowerBound SolrQuery::getTermsLowerBound ============================= (PECL solr >= 0.9.2) SolrQuery::getTermsLowerBound — Returns the term to start at ### Description ``` public SolrQuery::getTermsLowerBound(): string ``` Returns the term to start at ### Parameters This function has no parameters. ### Return Values Returns a string on success and **`null`** if not set. php enum_exists enum\_exists ============ (PHP 8 >= 8.1.0) enum\_exists — Checks if the enum has been defined ### Description ``` enum_exists(string $enum, bool $autoload = true): bool ``` This function checks whether or not the given [enum](https://www.php.net/manual/en/language.enumerations.php) has been defined. ### Parameters `enum` The enum name. The name is matched in a case-insensitive manner. `autoload` Whether to call [\_\_autoload](language.oop5.autoload) by default. ### Return Values Returns **`true`** if `enum` is a defined enum, **`false`** otherwise. ### Examples **Example #1 **enum\_exists()** example** ``` <?php // Check that the enum exists before trying to use it if (enum_exists(Suit::class)) {     $myclass = Suit::Hearts; } ?> ``` ### See Also * [function\_exists()](function.function-exists) - Return true if the given function has been defined * [class\_exists()](function.class-exists) - Checks if the class has been defined * [interface\_exists()](function.interface-exists) - Checks if the interface has been defined * [get\_declared\_classes()](function.get-declared-classes) - Returns an array with the name of the defined classes php ini_get_all ini\_get\_all ============= (PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8) ini\_get\_all — Gets all configuration options ### Description ``` ini_get_all(?string $extension = null, bool $details = true): array|false ``` Returns all the registered configuration options. ### Parameters `extension` An optional extension name. If not **`null`** or the string `core`, the function returns only options specific for that extension. `details` Retrieve details settings or only the current value for each setting. Default is **`true`** (retrieve details). ### Return Values Returns an associative array with directive name as the array key. Returns **`false`** and raises an **`E_WARNING`** level error if the `extension` doesn't exist. When `details` is **`true`** (default) the array will contain `global_value` (set in php.ini), `local_value` (perhaps set with [ini\_set()](function.ini-set) or .htaccess), and `access` (the access level). When `details` is **`false`** the value will be the current value of the option. See the [manual section](https://www.php.net/manual/en/configuration.changes.modes.php) for information on what access levels mean. > > **Note**: > > > It's possible for a directive to have multiple access levels, which is why `access` shows the appropriate bitmask values. > > ### Examples **Example #1 **ini\_get\_all()** examples** ``` <?php print_r(ini_get_all("pcre")); print_r(ini_get_all()); ?> ``` The above example will output something similar to: ``` Array ( [pcre.backtrack_limit] => Array ( [global_value] => 100000 [local_value] => 100000 [access] => 7 ) [pcre.recursion_limit] => Array ( [global_value] => 100000 [local_value] => 100000 [access] => 7 ) ) Array ( [allow_call_time_pass_reference] => Array ( [global_value] => 0 [local_value] => 0 [access] => 6 ) [allow_url_fopen] => Array ( [global_value] => 1 [local_value] => 1 [access] => 4 ) ... ) ``` **Example #2 Disabling `details`** ``` <?php print_r(ini_get_all("pcre", false)); // Added in PHP 5.3.0 print_r(ini_get_all(null, false)); // Added in PHP 5.3.0 ?> ``` The above example will output something similar to: ``` Array ( [pcre.backtrack_limit] => 100000 [pcre.recursion_limit] => 100000 ) Array ( [allow_call_time_pass_reference] => 0 [allow_url_fopen] => 1 ... ) ``` ### Notes > > **Note**: > > > **ini\_get\_all()** ignores "array" ini options such as pdo.dsn.\*. > > ### See Also * [How to change configuration settings](https://www.php.net/manual/en/configuration.changes.php) * [ini\_get()](function.ini-get) - Gets the value of a configuration option * [ini\_restore()](function.ini-restore) - Restores the value of a configuration option * [ini\_set()](function.ini-set) - Sets the value of a configuration option * [get\_loaded\_extensions()](function.get-loaded-extensions) - Returns an array with the names of all modules compiled and loaded * [phpinfo()](function.phpinfo) - Outputs information about PHP's configuration * [ReflectionExtension::getINIEntries()](reflectionextension.getinientries) - Gets extension ini entries
programming_docs
php None Introduction ------------ The syntax and semantics of the regular expressions supported by PCRE are described below. Regular expressions are also described in the Perl documentation and in a number of other books, some of which have copious examples. Jeffrey Friedl's "Mastering Regular Expressions", published by O'Reilly (ISBN 1-56592-257-3), covers them in great detail. The description here is intended as reference documentation. A regular expression is a pattern that is matched against a subject string from left to right. Most characters stand for themselves in a pattern, and match the corresponding characters in the subject. As a trivial example, the pattern `The quick brown fox` matches a portion of a subject string that is identical to itself. php ibase_service_detach ibase\_service\_detach ====================== (PHP 5, PHP 7 < 7.4.0) ibase\_service\_detach — Disconnect from the service manager ### Description ``` ibase_service_detach(resource $service_handle): bool ``` ### Parameters `service_handle` A previously created connection to the database server. ### Return Values Returns **`true`** on success or **`false`** on failure. ### Examples **Example #1 **ibase\_service\_detach()** example** ``` <?php     // Attach to the remote Firebird server by ip address     if (($service = ibase_service_attach('10.1.1.199', 'sysdba', 'masterkey')) != FALSE) {                  // Successfully attached.          // Fetch server version (something like 'LI-V3.0.4.33054 Firebird 3.0')         $server_version  = ibase_server_info($service, IBASE_SVC_SERVER_VERSION);         // Fetch server implementation (something like 'Firebird/Linux/AMD/Intel/x64')         $server_implementation = ibase_server_info($service, IBASE_SVC_IMPLEMENTATION);         // Detach from server (disconnect)         if(ibase_service_detach($service) == FALSE) {             echo "Error on service detach.";         }         else {             echo "Successfully detached from service.";         }     }     else {         // Output message on error         $conn_error = ibase_errmsg();         die($conn_error);     } ?> ``` php eio_write eio\_write ========== (PECL eio >= 0.0.1dev) eio\_write — Write to file ### Description ``` eio_write( mixed $fd, string $str, int $length = 0, int $offset = 0, int $pri = EIO_PRI_DEFAULT, callable $callback = NULL, mixed $data = NULL ): resource ``` **eio\_write()** writes up to `length` bytes from `str` at `offset` offset from the beginning of the file. ### Parameters `fd` Stream, Socket resource, or numeric file descriptor, e.g. returned by [eio\_open()](function.eio-open) `str` Source string `length` Maximum number of bytes to write. `offset` Offset from the beginning of file. `pri` The request priority: **`EIO_PRI_DEFAULT`**, **`EIO_PRI_MIN`**, **`EIO_PRI_MAX`**, or **`null`**. If **`null`** passed, `pri` internally is set to **`EIO_PRI_DEFAULT`**. `callback` `callback` function is called when the request is done. It should match the following prototype: ``` void callback(mixed $data, int $result[, resource $req]); ``` `data` is custom data passed to the request. `result` request-specific result value; basically, the value returned by corresponding system call. `req` is optional request resource which can be used with functions like [eio\_get\_last\_error()](function.eio-get-last-error) `data` Arbitrary variable passed to `callback`. ### Return Values **eio\_write()** returns request resource on success, or **`false`** on failure. ### See Also * [eio\_open()](function.eio-open) - Opens a file php SolrDisMaxQuery::setBigramPhraseSlop SolrDisMaxQuery::setBigramPhraseSlop ==================================== (No version information available, might only be in Git) SolrDisMaxQuery::setBigramPhraseSlop — Sets Bigram Phrase Slop (ps2 parameter) ### Description ``` public SolrDisMaxQuery::setBigramPhraseSlop(string $slop): SolrDisMaxQuery ``` Sets Bigram Phrase Slop (ps2 parameter). A default slop for Bigram phrase fields. ### Parameters `slop` ### Return Values [SolrDisMaxQuery](class.solrdismaxquery) ### Examples **Example #1 **SolrDisMaxQuery::setBigramPhraseSlop()** example** ``` <?php $dismaxQuery = new SolrDisMaxQuery('lucene'); $dismaxQuery->setBigramPhraseSlop(5); echo $dismaxQuery.PHP_EOL; ?> ``` The above example will output something similar to: ``` q=lucene&defType=edismax&ps2=5 ``` php stats_rand_gen_int stats\_rand\_gen\_int ===================== (PECL stats >= 1.0.0) stats\_rand\_gen\_int — Generates random integer between 1 and 2147483562 ### Description ``` stats_rand_gen_int(): int ``` Returns a random integer between 1 and 2147483562 ### Parameters This function has no parameters. ### Return Values A random integer php ArrayIterator::offsetSet ArrayIterator::offsetSet ======================== (PHP 5, PHP 7, PHP 8) ArrayIterator::offsetSet — Set value for an offset ### Description ``` public ArrayIterator::offsetSet(mixed $key, mixed $value): void ``` Sets a value for a given offset. **Warning**This function is currently not documented; only its argument list is available. ### Parameters `key` The index to set for. `value` The new value to store at the index. ### Return Values No value is returned. ### See Also * [ArrayIterator::offsetGet()](arrayiterator.offsetget) - Get value for an offset * [ArrayIterator::offsetUnset()](arrayiterator.offsetunset) - Unset value for an offset php SplObjectStorage::unserialize SplObjectStorage::unserialize ============================= (PHP 5 >= 5.2.2, PHP 7, PHP 8) SplObjectStorage::unserialize — Unserializes a storage from its string representation ### Description ``` public SplObjectStorage::unserialize(string $data): void ``` Unserializes storage entries and attach them to the current storage. ### Parameters `data` The serialized representation of a storage. ### Return Values No value is returned. ### Examples **Example #1 **SplObjectStorage::unserialize()** example** ``` <?php $s1 = new SplObjectStorage; $s2 = new SplObjectStorage; $o = new StdClass; $s1[$o] = "data"; $s2->unserialize($s1->serialize()); var_dump(count($s2)); ?> ``` The above example will output something similar to: ``` int(1) ``` ### See Also * [SplObjectStorage::serialize()](splobjectstorage.serialize) - Serializes the storage php None return ------ (PHP 4, PHP 5, PHP 7, PHP 8) `return` returns program control to the calling module. Execution resumes at the expression following the called module's invocation. If called from within a function, the `return` statement immediately ends execution of the current function, and returns its argument as the value of the function call. `return` also ends the execution of an [eval()](function.eval) statement or script file. If called from the global scope, then execution of the current script file is ended. If the current script file was [include](function.include)d or [require](function.require)d, then control is passed back to the calling file. Furthermore, if the current script file was [include](function.include)d, then the value given to `return` will be returned as the value of the [include](function.include) call. If `return` is called from within the main script file, then script execution ends. If the current script file was named by the [auto\_prepend\_file](https://www.php.net/manual/en/ini.core.php#ini.auto-prepend-file) or [auto\_append\_file](https://www.php.net/manual/en/ini.core.php#ini.auto-append-file) configuration options in php.ini, then that script file's execution is ended. For more information, see [Returning values](functions.returning-values). > **Note**: Note that since `return` is a language construct and not a function, the parentheses surrounding its argument are not required and their use is discouraged. > > > **Note**: If no parameter is supplied, then the parentheses must be omitted and **`null`** will be returned. Calling `return` with parentheses but with no arguments will result in a parse error. > > As of PHP 7.1.0, return statements without an argument in functions which declare a return type trigger **`E_COMPILE_ERROR`**, unless the return type is void, in which case return statements with an argument trigger that error. php SplObjectStorage::count SplObjectStorage::count ======================= (PHP 5 >= 5.1.0, PHP 7, PHP 8) SplObjectStorage::count — Returns the number of objects in the storage ### Description ``` public SplObjectStorage::count(int $mode = COUNT_NORMAL): int ``` Counts the number of objects in the storage. ### Parameters `mode` If the optional `mode` parameter is set to **`COUNT_RECURSIVE`** (or 1), **SplObjectStorage::count()** will recursively count the storage. ### Return Values The number of objects in the storage. ### Examples **Example #1 **SplObjectStorage::count()** example** ``` <?php $s = new SplObjectStorage(); $o1 = new StdClass; $o2 = new StdClass; $s->attach($o1); $s->attach($o2); $s->attach($o1); var_dump($s->count()); var_dump(count($s)); ?> ``` The above example will output something similar to: ``` int(2) int(2) ``` ### See Also * [SplObjectStorage::attach()](splobjectstorage.attach) - Adds an object in the storage * [SplObjectStorage::detach()](splobjectstorage.detach) - Removes an object from the storage php stats_skew stats\_skew =========== (PECL stats >= 1.0.0) stats\_skew — Computes the skewness of the data in the array ### Description ``` stats_skew(array $a): float ``` Returns the skewness of the values in `a`. ### Parameters `a` The input array ### Return Values Returns the skewness of the values in `a`, or **`false`** if `a` is empty or is not an array. php Normalizer::isNormalized Normalizer::isNormalized ======================== normalizer\_is\_normalized ========================== (PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0) Normalizer::isNormalized -- normalizer\_is\_normalized — Checks if the provided string is already in the specified normalization form ### Description Object-oriented style ``` public static Normalizer::isNormalized(string $string, int $form = Normalizer::FORM_C): bool ``` Procedural style ``` normalizer_is_normalized(string $string, int $form = Normalizer::FORM_C): bool ``` Checks if the provided string is already in the specified normalization form. ### Parameters `string` The input string to normalize `form` One of the normalization forms. ### Return Values **`true`** if normalized, **`false`** otherwise or if there an error ### Examples **Example #1 **normalizer\_is\_normalized()** example** ``` <?php $char_A_ring = "\xC3\x85"; // 'LATIN CAPITAL LETTER A WITH RING ABOVE' (U+00C5) $char_combining_ring_above = "\xCC\x8A";  // 'COMBINING RING ABOVE' (U+030A)   $char_orig = 'A' . $char_combining_ring_above; $char_norm = normalizer_normalize( 'A' . $char_combining_ring_above, Normalizer::FORM_C );   echo ( normalizer_is_normalized($char_orig, Normalizer::FORM_C) ) ? "normalized" : "not normalized"; echo '; '; echo ( normalizer_is_normalized($char_norm, Normalizer::FORM_C) ) ? "normalized" : "not normalized"; ?> ``` **Example #2 OO example** ``` <?php $char_A_ring = "\xC3\x85"; // 'LATIN CAPITAL LETTER A WITH RING ABOVE' (U+00C5) $char_combining_ring_above = "\xCC\x8A";  // 'COMBINING RING ABOVE' (U+030A)   $char_orig = 'A' . $char_combining_ring_above; $char_norm = Normalizer::normalize( 'A' . $char_combining_ring_above, Normalizer::FORM_C );   echo ( Normalizer::isNormalized($char_orig, Normalizer::FORM_C) ) ? "normalized" : "not normalized"; echo '; '; echo ( Normalizer::isNormalized($char_norm, Normalizer::FORM_C) ) ? "normalized" : "not normalized"; ?> ``` The above example will output: ``` not normalized; normalized ``` ### See Also * [normalizer\_normalize()](normalizer.normalize) - Normalizes the input provided and returns the normalized string php xdiff_file_diff xdiff\_file\_diff ================= (PECL xdiff >= 0.2.0) xdiff\_file\_diff — Make unified diff of two files ### Description ``` xdiff_file_diff( string $old_file, string $new_file, string $dest, int $context = 3, bool $minimal = false ): bool ``` Makes an unified diff containing differences between `old_file` and `new_file` and stores it in `dest` file. The resulting file is human-readable. An optional `context` parameter specifies how many lines of context should be added around each change. Setting `minimal` parameter to true will result in outputting the shortest patch file possible (can take a long time). ### Parameters `old_file` Path to the first file. This file acts as "old" file. `new_file` Path to the second file. This file acts as "new" file. `dest` Path of the resulting patch file. `context` Indicates how many lines of context you want to include in diff result. `minimal` Set this parameter to **`true`** if you want to minimalize size of the result (can take a long time). ### Return Values Returns **`true`** on success or **`false`** on failure. ### Examples **Example #1 **xdiff\_file\_diff()** example** The following code makes unified diff of two php files with context length of 2. ``` <?php $old_version = 'my_script.php'; $new_version = 'my_new_script.php'; xdiff_file_diff($old_version, $new_version, 'my_script.diff', 2); ?> ``` ### Notes > > **Note**: > > > This function doesn't work well with binary files. To make diff of binary files use [xdiff\_file\_bdiff()](function.xdiff-file-bdiff)/[xdiff\_file\_rabdiff()](function.xdiff-file-rabdiff) function. > > ### See Also * [xdiff\_file\_patch()](function.xdiff-file-patch) - Patch a file with an unified diff php ibase_pconnect ibase\_pconnect =============== (PHP 5, PHP 7 < 7.4.0) ibase\_pconnect — Open a persistent connection to an InterBase database ### Description ``` ibase_pconnect( string $database = ?, string $username = ?, string $password = ?, string $charset = ?, int $buffers = ?, int $dialect = ?, string $role = ?, int $sync = ? ): resource ``` Opens a persistent connection to an InterBase database. **ibase\_pconnect()** acts very much like [ibase\_connect()](function.ibase-connect) with two major differences. First, when connecting, the function will first try to find a (persistent) link that's already opened with the same parameters. If one is found, an identifier for it will be returned instead of opening a new connection. Second, the connection to the InterBase server will not be closed when the execution of the script ends. Instead, the link will remain open for future use ([ibase\_close()](function.ibase-close) will not close links established by **ibase\_pconnect()**). This type of link is therefore called 'persistent'. ### Parameters `database` The `database` argument has to be a valid path to database file on the server it resides on. If the server is not local, it must be prefixed with either 'hostname:' (TCP/IP), '//hostname/' (NetBEUI) or 'hostname@' (IPX/SPX), depending on the connection protocol used. `username` The user name. Can be set with the `ibase.default_user` php.ini directive. `password` The password for `username`. Can be set with the `ibase.default_password` php.ini directive. `charset` `charset` is the default character set for a database. `buffers` `buffers` is the number of database buffers to allocate for the server-side cache. If 0 or omitted, server chooses its own default. `dialect` `dialect` selects the default SQL dialect for any statement executed within a connection, and it defaults to the highest one supported by client libraries. Functional only with InterBase 6 and up. `role` Functional only with InterBase 5 and up. `sync` ### Return Values Returns an InterBase link identifier on success, or **`false`** on error. ### See Also * [ibase\_close()](function.ibase-close) - Close a connection to an InterBase database * [ibase\_connect()](function.ibase-connect) - Open a connection to a database php The OAuthProvider class The OAuthProvider class ======================= Introduction ------------ (PECL OAuth >= 1.0.0) Manages an OAuth provider class. See also an external in-depth tutorial titled [» Writing an OAuth Provider Service](http://toys.lerdorf.com/archives/55-Writing-an-OAuth-Provider-Service.html), which takes a hands-on approach to providing this service. There are also [» OAuth provider examples](https://svn.php.net/viewvc/pecl/oauth/trunk/examples) within the OAuth extensions sources. Class synopsis -------------- class **OAuthProvider** { /\* Methods \*/ ``` final public addRequiredParameter(string $req_params): bool ``` ``` public callconsumerHandler(): void ``` ``` public callTimestampNonceHandler(): void ``` ``` public calltokenHandler(): void ``` ``` public checkOAuthRequest(string $uri = ?, string $method = ?): void ``` ``` public __construct(array $params_array = ?) ``` ``` public consumerHandler(callable $callback_function): void ``` ``` final public static generateToken(int $size, bool $strong = false): string ``` ``` public is2LeggedEndpoint(mixed $params_array): void ``` ``` public isRequestTokenEndpoint(bool $will_issue_request_token): void ``` ``` final public removeRequiredParameter(string $req_params): bool ``` ``` final public static reportProblem(string $oauthexception, bool $send_headers = true): string ``` ``` final public setParam(string $param_key, mixed $param_val = ?): bool ``` ``` final public setRequestTokenPath(string $path): bool ``` ``` public timestampNonceHandler(callable $callback_function): void ``` ``` public tokenHandler(callable $callback_function): void ``` } Table of Contents ----------------- * [OAuthProvider::addRequiredParameter](oauthprovider.addrequiredparameter) — Add required parameters * [OAuthProvider::callconsumerHandler](oauthprovider.callconsumerhandler) — Calls the consumerNonceHandler callback * [OAuthProvider::callTimestampNonceHandler](oauthprovider.calltimestampnoncehandler) — Calls the timestampNonceHandler callback * [OAuthProvider::calltokenHandler](oauthprovider.calltokenhandler) — Calls the tokenNonceHandler callback * [OAuthProvider::checkOAuthRequest](oauthprovider.checkoauthrequest) — Check an oauth request * [OAuthProvider::\_\_construct](oauthprovider.construct) — Constructs a new OAuthProvider object * [OAuthProvider::consumerHandler](oauthprovider.consumerhandler) — Set the consumerHandler handler callback * [OAuthProvider::generateToken](oauthprovider.generatetoken) — Generate a random token * [OAuthProvider::is2LeggedEndpoint](oauthprovider.is2leggedendpoint) — is2LeggedEndpoint * [OAuthProvider::isRequestTokenEndpoint](oauthprovider.isrequesttokenendpoint) — Sets isRequestTokenEndpoint * [OAuthProvider::removeRequiredParameter](oauthprovider.removerequiredparameter) — Remove a required parameter * [OAuthProvider::reportProblem](oauthprovider.reportproblem) — Report a problem * [OAuthProvider::setParam](oauthprovider.setparam) — Set a parameter * [OAuthProvider::setRequestTokenPath](oauthprovider.setrequesttokenpath) — Set request token path * [OAuthProvider::timestampNonceHandler](oauthprovider.timestampnoncehandler) — Set the timestampNonceHandler handler callback * [OAuthProvider::tokenHandler](oauthprovider.tokenhandler) — Set the tokenHandler handler callback
programming_docs
php SoapParam::__construct SoapParam::\_\_construct ======================== (PHP 5, PHP 7, PHP 8) SoapParam::\_\_construct — SoapParam constructor ### Description public **SoapParam::\_\_construct**([mixed](language.types.declarations#language.types.declarations.mixed) `$data`, string `$name`) Constructs a new [SoapParam](class.soapparam) object. ### Parameters `data` The data to pass or return. This parameter can be passed directly as PHP value, but in this case it will be named as `paramN` and the SOAP service may not understand it. `name` The parameter name. ### Examples **Example #1 **SoapParam::\_\_construct()** example** ``` <?php $client = new SoapClient(null,array('location' => "http://localhost/soap.php",                                     'uri'      => "http://test-uri/")); $client->SomeFunction(new SoapParam($a, "a"),                       new SoapParam($b, "b"),                       new SoapParam($c, "c")); ?> ``` ### See Also * [SoapClient::\_\_soapCall()](soapclient.soapcall) - Calls a SOAP function * [SoapVar::\_\_construct()](soapvar.construct) - SoapVar constructor php EventBufferEvent::free EventBufferEvent::free ====================== (PECL event >= 1.2.6-beta) EventBufferEvent::free — Free a buffer event ### Description ``` public EventBufferEvent::free(): void ``` Free resources allocated by buffer event. Usually there is no need to call this method, since normally it is done within internal object destructors. However, sometimes we have a long-time script allocating lots of instances, or a script with a heavy memory usage, where we need to free resources as soon as possible. In such cases **EventBufferEvent::free()** may be used to protect the script against running up to the `memory_limit` . ### Parameters This function has no parameters. ### Return Values No value is returned. php EvWatcher::stop EvWatcher::stop =============== (PECL ev >= 0.2.0) EvWatcher::stop — Stops the watcher ### Description ``` public EvWatcher::stop(): void ``` Marks the watcher as inactive. Note that only active watchers will receive events. ### Parameters This function has no parameters. ### Return Values No value is returned. ### See Also * [EvWatcher::start()](evwatcher.start) - Starts the watcher php gnupg_geterror gnupg\_geterror =============== (PECL gnupg >= 0.1) gnupg\_geterror — Returns the errortext, if a function fails ### Description ``` gnupg_geterror(resource $identifier): string ``` ### Parameters `identifier` The gnupg identifier, from a call to [gnupg\_init()](function.gnupg-init) or **gnupg**. ### Return Values Returns an errortext, if an error has occurred, otherwise **`false`**. ### Examples **Example #1 Procedural **gnupg\_geterror()** example** ``` <?php $res = gnupg_init(); echo gnupg_geterror($res); ?> ``` **Example #2 OO **gnupg\_geterror()** example** ``` <?php $gpg = new gnupg(); echo $gpg->geterror(); ?> ``` php GearmanTask::sendData GearmanTask::sendData ===================== (PECL gearman <= 0.5.0) GearmanTask::sendData — Send data for a task (deprecated) ### Description ``` public GearmanTask::sendData(string $data): int ``` **Warning**This function is *EXPERIMENTAL*. The behaviour of this function, its name, and surrounding documentation may change without notice in a future release of PHP. This function should be used at your own risk. ### Parameters `data` Data to send to the worker. ### Return Values The length of data sent, or **`false`** if the send failed. ### See Also * [GearmanTask::recvData()](gearmantask.recvdata) - Read work or result data into a buffer for a task php eio_set_max_poll_reqs eio\_set\_max\_poll\_reqs ========================= (PECL eio >= 0.0.1dev) eio\_set\_max\_poll\_reqs — Set maximum number of requests processed in a poll ### Description ``` eio_set_max_poll_reqs(int $nreqs): void ``` ### Parameters `nreqs` Number of requests ### Return Values No value is returned. php fbird_close fbird\_close ============ (PHP 5, PHP 7 < 7.4.0) fbird\_close — Alias of [ibase\_close()](function.ibase-close) ### Description This function is an alias of: [ibase\_close()](function.ibase-close). ### See Also * [fbird\_connect()](function.fbird-connect) - Alias of ibase\_connect * [fbird\_pconnect()](function.fbird-pconnect) - Alias of ibase\_pconnect php The Queue class The Queue class =============== Introduction ------------ (No version information available, might only be in Git) A Queue is a “first in, first out” or “FIFO” collection that only allows access to the value at the front of the queue and iterates in that order, destructively. Class synopsis -------------- class **Ds\Queue** implements **Ds\Collection**, [ArrayAccess](class.arrayaccess) { /\* Constants \*/ const int [MIN\_CAPACITY](class.ds-queue#ds-queue.constants.min-capacity) = 8; /\* Methods \*/ ``` public allocate(int $capacity): void ``` ``` public capacity(): int ``` ``` public clear(): void ``` ``` public copy(): Ds\Queue ``` ``` public isEmpty(): bool ``` ``` public peek(): mixed ``` ``` public pop(): mixed ``` ``` public push(mixed ...$values): void ``` ``` public toArray(): array ``` } Predefined Constants -------------------- **`Ds\Queue::MIN_CAPACITY`** Changelog --------- | Version | Description | | --- | --- | | PECL ds 1.3.0 | The class now implements [ArrayAccess](class.arrayaccess). | Table of Contents ----------------- * [Ds\Queue::allocate](ds-queue.allocate) — Allocates enough memory for a required capacity * [Ds\Queue::capacity](ds-queue.capacity) — Returns the current capacity * [Ds\Queue::clear](ds-queue.clear) — Removes all values * [Ds\Queue::\_\_construct](ds-queue.construct) — Creates a new instance * [Ds\Queue::copy](ds-queue.copy) — Returns a shallow copy of the queue * [Ds\Queue::count](ds-queue.count) — Returns the number of values in the queue * [Ds\Queue::isEmpty](ds-queue.isempty) — Returns whether the queue is empty * [Ds\Queue::jsonSerialize](ds-queue.jsonserialize) — Returns a representation that can be converted to JSON * [Ds\Queue::peek](ds-queue.peek) — Returns the value at the front of the queue * [Ds\Queue::pop](ds-queue.pop) — Removes and returns the value at the front of the queue * [Ds\Queue::push](ds-queue.push) — Pushes values into the queue * [Ds\Queue::toArray](ds-queue.toarray) — Converts the queue to an array php Gmagick::rotateimage Gmagick::rotateimage ==================== (PECL gmagick >= Unknown) Gmagick::rotateimage — Rotates an image ### Description ``` public Gmagick::rotateimage(mixed $color, float $degrees): Gmagick ``` Rotates an image the specified number of degrees. Empty triangles left over from rotating the image are filled with the background color. ### Parameters `color` The background pixel. `degrees` The number of degrees to rotate the image. ### Return Values The Gmagick object on success ### Errors/Exceptions Throws an **GmagickException** on error. php substr_replace substr\_replace =============== (PHP 4, PHP 5, PHP 7, PHP 8) substr\_replace — Replace text within a portion of a string ### Description ``` substr_replace( array|string $string, array|string $replace, array|int $offset, array|int|null $length = null ): string|array ``` **substr\_replace()** replaces a copy of `string` delimited by the `offset` and (optionally) `length` parameters with the string given in `replace`. ### Parameters `string` The input string. An array of strings can be provided, in which case the replacements will occur on each string in turn. In this case, the `replace`, `offset` and `length` parameters may be provided either as scalar values to be applied to each input string in turn, or as arrays, in which case the corresponding array element will be used for each input string. `replace` The replacement string. `offset` If `offset` is non-negative, the replacing will begin at the `offset`'th offset into `string`. If `offset` is negative, the replacing will begin at the `offset`'th character from the end of `string`. `length` If given and is positive, it represents the length of the portion of `string` which is to be replaced. If it is negative, it represents the number of characters from the end of `string` at which to stop replacing. If it is not given, then it will default to strlen( `string` ); i.e. end the replacing at the end of `string`. Of course, if `length` is zero then this function will have the effect of inserting `replace` into `string` at the given `offset` offset. ### Return Values The result string is returned. If `string` is an array then array is returned. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | `length` is nullable now. | ### Examples **Example #1 Simple **substr\_replace()** examples** ``` <?php $var = 'ABCDEFGH:/MNRPQR/'; echo "Original: $var<hr />\n"; /* These two examples replace all of $var with 'bob'. */ echo substr_replace($var, 'bob', 0) . "<br />\n"; echo substr_replace($var, 'bob', 0, strlen($var)) . "<br />\n"; /* Insert 'bob' right at the beginning of $var. */ echo substr_replace($var, 'bob', 0, 0) . "<br />\n"; /* These next two replace 'MNRPQR' in $var with 'bob'. */ echo substr_replace($var, 'bob', 10, -1) . "<br />\n"; echo substr_replace($var, 'bob', -7, -1) . "<br />\n"; /* Delete 'MNRPQR' from $var. */ echo substr_replace($var, '', 10, -1) . "<br />\n"; ?> ``` **Example #2 Using **substr\_replace()** to replace multiple strings at once** ``` <?php $input = array('A: XXX', 'B: XXX', 'C: XXX'); // A simple case: replace XXX in each string with YYY. echo implode('; ', substr_replace($input, 'YYY', 3, 3))."\n"; // A more complicated case where each replacement is different. $replace = array('AAA', 'BBB', 'CCC'); echo implode('; ', substr_replace($input, $replace, 3, 3))."\n"; // Replace a different number of characters each time. $length = array(1, 2, 3); echo implode('; ', substr_replace($input, $replace, 3, $length))."\n"; ?> ``` The above example will output: ``` A: YYY; B: YYY; C: YYY A: AAA; B: BBB; C: CCC A: AAAXX; B: BBBX; C: CCC ``` ### Notes > **Note**: This function is binary-safe. > > ### See Also * [str\_replace()](function.str-replace) - Replace all occurrences of the search string with the replacement string * [substr()](function.substr) - Return part of a string * [String access and modification by character](language.types.string#language.types.string.substr) php Pool::__construct Pool::\_\_construct =================== (PECL pthreads >= 2.0.0) Pool::\_\_construct — Creates a new Pool of Workers ### Description public **Pool::\_\_construct**(int `$size`, string `$class` = ?, array `$ctor` = ?) Construct a new pool of workers. Pools lazily create their threads, which means new threads will only be spawned when they are required to execute tasks. ### Parameters `size` The maximum number of workers for this pool to create `class` The class for new Workers. If no class is given, then it defaults to the [Worker](class.worker) class. `ctor` An array of arguments to be passed to new workers' constructors ### Examples **Example #1 Creating Pools** ``` <?php class MyWorker extends Worker {          public function __construct(Something $something) {         $this->something = $something;     }          public function run() {         /** ... **/     } } $pool = new Pool(8, \MyWorker::class, [new Something()]); var_dump($pool); ?> ``` The above example will output: ``` object(Pool)#1 (6) { ["size":protected]=> int(8) ["class":protected]=> string(8) "MyWorker" ["workers":protected]=> NULL ["work":protected]=> NULL ["ctor":protected]=> array(1) { [0]=> object(Something)#2 (0) { } } ["last":protected]=> int(0) } ``` php SolrDocument::__isset SolrDocument::\_\_isset ======================= (PECL solr >= 0.9.2) SolrDocument::\_\_isset — Checks if a field exists ### Description ``` public SolrDocument::__isset(string $fieldName): bool ``` Checks if a field exists ### Parameters `fieldName` Name of the field. ### Return Values Returns **`true`** on success or **`false`** on failure. php EvPrepare::createStopped EvPrepare::createStopped ======================== (PECL ev >= 0.2.0) EvPrepare::createStopped — Creates a stopped instance of EvPrepare watcher ### Description ``` final public static EvPrepare::createStopped( callable $callback , mixed $data = null , int $priority = 0 ): EvPrepare ``` Creates a stopped instance of EvPrepare watcher. Unlike [EvPrepare::\_\_construct()](evprepare.construct) , this method doesn' start the watcher automatically. ### Parameters `callback` See [Watcher callbacks](https://www.php.net/manual/en/ev.watcher-callbacks.php) . `data` Custom data associated with the watcher. `priority` [Watcher priority](class.ev#ev.constants.watcher-pri) ### Return Values Return EvPrepare object on success. ### See Also * [EvPrepare::\_\_construct()](evprepare.construct) - Constructs EvPrepare watcher object * [EvWatcher::start()](evwatcher.start) - Starts the watcher php SplFileObject::getCsvControl SplFileObject::getCsvControl ============================ (PHP 5 >= 5.2.0, PHP 7, PHP 8) SplFileObject::getCsvControl — Get the delimiter, enclosure and escape character for CSV ### Description ``` public SplFileObject::getCsvControl(): array ``` Gets the delimiter, enclosure and escape character used for parsing CSV fields. ### Parameters This function has no parameters. ### Return Values Returns an indexed array containing the delimiter, enclosure and escape character. ### Changelog | Version | Description | | --- | --- | | 7.4.0 | The escape character can now be an empty string. | | 7.0.10 | Added the escape character to the returned array. | ### Examples **Example #1 **SplFileObject::getCsvControl()** example** ``` <?php $file = new SplFileObject("data.txt"); print_r($file->getCsvControl()); ?> ``` The above example will output something similar to: ``` Array ( [0] => , [1] => " [2] => \ ) ``` ### See Also * [SplFileObject::setCsvControl()](splfileobject.setcsvcontrol) - Set the delimiter, enclosure and escape character for CSV * [SplFileObject::fgetcsv()](splfileobject.fgetcsv) - Gets line from file and parse as CSV fields php sqlsrv_num_fields sqlsrv\_num\_fields =================== (No version information available, might only be in Git) sqlsrv\_num\_fields — Retrieves the number of fields (columns) on a statement ### Description ``` sqlsrv_num_fields(resource $stmt): mixed ``` Retrieves the number of fields (columns) on a statement. ### Parameters `stmt` The statement for which the number of fields is returned. **sqlsrv\_num\_fields()** can be called on a statement before or after statement execution. ### Return Values Returns the number of fields on success. Returns **`false`** otherwise. ### Examples **Example #1 **sqlsrv\_num\_fields()** example** ``` <?php $serverName = "serverName\sqlexpress"; $connectionInfo = array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password"); $conn = sqlsrv_connect( $serverName, $connectionInfo); if( $conn === false ) {    die( print_r( sqlsrv_errors(), true)); } $sql = "SELECT * FROM Table_1"; $stmt = sqlsrv_query($conn, $sql); if( $stmt === false) {    die( print_r( sqlsrv_errors(), true)); } $numFields = sqlsrv_num_fields( $stmt ); while( sqlsrv_fetch( $stmt )) {    // Iterate through the fields of each row.    for($i = 0; $i < $numFields; $i++) {        echo sqlsrv_get_field($stmt, $i)." ";    }    echo "<br />"; } ?> ``` ### See Also * [sqlsrv\_field\_metadata()](function.sqlsrv-field-metadata) - Retrieves metadata for the fields of a statement prepared by sqlsrv\_prepare or sqlsrv\_query * [sqlsrv\_fetch()](function.sqlsrv-fetch) - Makes the next row in a result set available for reading * [sqlsrv\_get\_field()](function.sqlsrv-get-field) - Gets field data from the currently selected row php The SolrParams class The SolrParams class ==================== Introduction ------------ (PECL solr >= 0.9.2) Represents a collection of name-value pairs sent to the Solr server during a request. Class synopsis -------------- abstract class **SolrParams** implements [Serializable](class.serializable) { /\* Methods \*/ ``` final public add(string $name, string $value): SolrParams ``` ``` public addParam(string $name, string $value): SolrParams ``` ``` final public get(string $param_name): mixed ``` ``` final public getParam(string $param_name = ?): mixed ``` ``` final public getParams(): array ``` ``` final public getPreparedParams(): array ``` ``` final public serialize(): string ``` ``` final public set(string $name, string $value): void ``` ``` public setParam(string $name, string $value): SolrParams ``` ``` final public toString(bool $url_encode = false): string ``` ``` final public unserialize(string $serialized): void ``` } Table of Contents ----------------- * [SolrParams::add](solrparams.add) — Alias of SolrParams::addParam * [SolrParams::addParam](solrparams.addparam) — Adds a parameter to the object * [SolrParams::get](solrparams.get) — Alias of SolrParams::getParam * [SolrParams::getParam](solrparams.getparam) — Returns a parameter value * [SolrParams::getParams](solrparams.getparams) — Returns an array of non URL-encoded parameters * [SolrParams::getPreparedParams](solrparams.getpreparedparams) — Returns an array of URL-encoded parameters * [SolrParams::serialize](solrparams.serialize) — Used for custom serialization * [SolrParams::set](solrparams.set) — Alias of SolrParams::setParam * [SolrParams::setParam](solrparams.setparam) — Sets the parameter to the specified value * [SolrParams::toString](solrparams.tostring) — Returns all the name-value pair parameters in the object * [SolrParams::unserialize](solrparams.unserialize) — Used for custom serialization php gmdate gmdate ====== (PHP 4, PHP 5, PHP 7, PHP 8) gmdate — Format a GMT/UTC date/time ### Description ``` gmdate(string $format, ?int $timestamp = null): string ``` Identical to the [date()](function.date) function except that the time returned is Greenwich Mean Time (GMT). ### Parameters `format` The format of the outputted date string. See the formatting options for the [date()](function.date) function. `timestamp` The optional `timestamp` parameter is an int Unix timestamp that defaults to the current local time if `timestamp` is omitted or **`null`**. In other words, it defaults to the value of [time()](function.time). ### Return Values Returns a formatted date string. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | `timestamp` is nullable now. | ### Examples **Example #1 **gmdate()** example** When run in Finland (GMT +0200), the first line below prints "Jan 01 1998 00:00:00", while the second prints "Dec 31 1997 22:00:00". ``` <?php echo date("M d Y H:i:s", mktime(0, 0, 0, 1, 1, 1998)); echo gmdate("M d Y H:i:s", mktime(0, 0, 0, 1, 1, 1998)); ?> ``` ### See Also * [DateTimeImmutable::\_\_construct()](datetimeimmutable.construct) - Returns new DateTimeImmutable object * [DateTimeInterface::format()](datetime.format) - Returns date formatted according to given format * [date()](function.date) - Format a Unix timestamp * [mktime()](function.mktime) - Get Unix timestamp for a date * [gmmktime()](function.gmmktime) - Get Unix timestamp for a GMT date * [IntlDateFormatter::format()](intldateformatter.format) - Format the date/time value as a string
programming_docs
php Imagick::flopImage Imagick::flopImage ================== (PECL imagick 2, PECL imagick 3) Imagick::flopImage — Creates a horizontal mirror image ### Description ``` public Imagick::flopImage(): bool ``` Creates a horizontal mirror image by reflecting the pixels around the central y-axis. ### Parameters This function has no parameters. ### Return Values Returns **`true`** on success. ### Errors/Exceptions Throws ImagickException on error. ### Examples **Example #1 **Imagick::flopImage()**** ``` <?php function flopImage($imagePath) {     $imagick = new \Imagick(realpath($imagePath));     $imagick->flopImage();     header("Content-Type: image/jpg");     echo $imagick->getImageBlob(); } ?> ``` ### See Also * [Imagick::flipimage()](imagick.flipimage) - Creates a vertical mirror image php GearmanClient::setFailCallback GearmanClient::setFailCallback ============================== (PECL gearman >= 0.5.0) GearmanClient::setFailCallback — Set callback for job failure ### Description ``` public GearmanClient::setFailCallback(callable $callback): bool ``` Sets the callback function to be used when a task does not complete successfully. The function should accept a single argument, a [GearmanTask](class.gearmantask) object. ### Parameters `callback` A function to call ### Return Values Returns **`true`** on success or **`false`** on failure. ### See Also * [GearmanClient::setDataCallback()](gearmanclient.setdatacallback) - Callback function when there is a data packet for a task * [GearmanClient::setCompleteCallback()](gearmanclient.setcompletecallback) - Set a function to be called on task completion * [GearmanClient::setCreatedCallback()](gearmanclient.setcreatedcallback) - Set a callback for when a task is queued * [GearmanClient::setExceptionCallback()](gearmanclient.setexceptioncallback) - Set a callback for worker exceptions * [GearmanClient::setStatusCallback()](gearmanclient.setstatuscallback) - Set a callback for collecting task status * [GearmanClient::setWarningCallback()](gearmanclient.setwarningcallback) - Set a callback for worker warnings * [GearmanClient::setWorkloadCallback()](gearmanclient.setworkloadcallback) - Set a callback for accepting incremental data updates php Ds\Set::contains Ds\Set::contains ================ (PECL ds >= 1.0.0) Ds\Set::contains — Determines if the set contains all values ### Description ``` public Ds\Set::contains(mixed ...$values): bool ``` Determines if the set contains all values. > > **Note**: > > > Values of type object are supported. If an object implements **Ds\Hashable**, equality will be determined by the object's `equals` function. If an object does not implement **Ds\Hashable**, objects must be references to the same instance to be considered equal. > > **Caution** All comparisons are strict (type and value). ### Parameters `values` Values to check. ### Return Values **`false`** if any of the provided `values` are not in the set, **`true`** otherwise. ### Examples **Example #1 **Ds\Set::contains()** example** ``` <?php $set = new \Ds\Set([1, 2, 3]); var_dump($set->contains(1));                // true var_dump($set->contains(1, 2));             // true var_dump($set->contains(...[1, 2]));        // true var_dump($set->contains("1"));              // false var_dump($set->contains(...[1, 2, 3, 4]));  // false var_dump($set->contains(...[]));            // true ?> ``` The above example will output something similar to: ``` bool(true) bool(true) bool(true) bool(false) bool(false) bool(true) ``` php XMLReader::readString XMLReader::readString ===================== (PHP 5 >= 5.2.0, PHP 7, PHP 8) XMLReader::readString — Reads the contents of the current node as a string ### Description ``` public XMLReader::readString(): string ``` Reads the contents of the current node as a string. ### Parameters This function has no parameters. ### Return Values Returns the content of the current node as a string. Empty string on failure. ### Notes **Caution**This function is only available when PHP is compiled against libxml 20620 or later. ### See Also * [XMLReader::readOuterXml()](xmlreader.readouterxml) - Retrieve XML from current node, including itself * [XMLReader::readInnerXml()](xmlreader.readinnerxml) - Retrieve XML from current node * [XMLReader::expand()](xmlreader.expand) - Returns a copy of the current node as a DOM object php Memcached::getOption Memcached::getOption ==================== (PECL memcached >= 0.1.0) Memcached::getOption — Retrieve a Memcached option value ### Description ``` public Memcached::getOption(int $option): mixed ``` This method returns the value of a Memcached `option`. Some options correspond to the ones defined by libmemcached, and some are specific to the extension. See [Memcached Constants](https://www.php.net/manual/en/memcached.constants.php) for more information. ### Parameters `option` One of the `Memcached::OPT_*` constants. ### Return Values Returns the value of the requested option, or **`false`** on error. ### Examples **Example #1 Retrieving Memcached options** ``` <?php $m = new Memcached(); var_dump($m->getOption(Memcached::OPT_COMPRESSION)); var_dump($m->getOption(Memcached::OPT_POLL_TIMEOUT)); ?> ``` The above example will output something similar to: ``` bool(true) int(1000) ``` ### See Also * **Memcached::getOption()** * [Memcached::setOption()](memcached.setoption) - Set a Memcached option * [Memcached Constants](https://www.php.net/manual/en/memcached.constants.php) php fsockopen fsockopen ========= (PHP 4, PHP 5, PHP 7, PHP 8) fsockopen — Open Internet or Unix domain socket connection ### Description ``` fsockopen( string $hostname, int $port = -1, int &$error_code = null, string &$error_message = null, ?float $timeout = null ): resource|false ``` Initiates a socket connection to the resource specified by `hostname`. PHP supports targets in the Internet and Unix domains as described in [List of Supported Socket Transports](https://www.php.net/manual/en/transports.php). A list of supported transports can also be retrieved using [stream\_get\_transports()](function.stream-get-transports). The socket will by default be opened in blocking mode. You can switch it to non-blocking mode by using [stream\_set\_blocking()](function.stream-set-blocking). The function [stream\_socket\_client()](function.stream-socket-client) is similar but provides a richer set of options, including non-blocking connection and the ability to provide a stream context. ### Parameters `hostname` If OpenSSL support [is installed](https://www.php.net/manual/en/openssl.installation.php), you may prefix the `hostname` with either `ssl://` or `tls://` to use an SSL or TLS client connection over TCP/IP to connect to the remote host. `port` The port number. This can be omitted and skipped with `-1` for transports that do not use ports, such as `unix://`. `error_code` If provided, holds the system level error number that occurred in the system-level `connect()` call. If the value returned in `error_code` is `0` and the function returned **`false`**, it is an indication that the error occurred before the `connect()` call. This is most likely due to a problem initializing the socket. `error_message` The error message as a string. `timeout` The connection timeout, in seconds. When **`null`**, the [default\_socket\_timeout](https://www.php.net/manual/en/filesystem.configuration.php#ini.default-socket-timeout) php.ini setting is used. > > **Note**: > > > If you need to set a timeout for reading/writing data over the socket, use [stream\_set\_timeout()](function.stream-set-timeout), as the `timeout` parameter to **fsockopen()** only applies while connecting the socket. > > ### Return Values **fsockopen()** returns a file pointer which may be used together with the other file functions (such as [fgets()](function.fgets), [fgetss()](function.fgetss), [fwrite()](function.fwrite), [fclose()](function.fclose), and [feof()](function.feof)). If the call fails, it will return **`false`** ### Errors/Exceptions Throws **`E_WARNING`** if `hostname` is not a valid domain. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | `timeout` is nullable now. | ### Examples **Example #1 **fsockopen()** Example** ``` <?php $fp = fsockopen("www.example.com", 80, $errno, $errstr, 30); if (!$fp) {     echo "$errstr ($errno)<br />\n"; } else {     $out = "GET / HTTP/1.1\r\n";     $out .= "Host: www.example.com\r\n";     $out .= "Connection: Close\r\n\r\n";     fwrite($fp, $out);     while (!feof($fp)) {         echo fgets($fp, 128);     }     fclose($fp); } ?> ``` **Example #2 Using UDP connection** The example below shows how to retrieve the day and time from the UDP service "daytime" (port 13) in your own machine. ``` <?php $fp = fsockopen("udp://127.0.0.1", 13, $errno, $errstr); if (!$fp) {     echo "ERROR: $errno - $errstr<br />\n"; } else {     fwrite($fp, "\n");     echo fread($fp, 26);     fclose($fp); } ?> ``` ### Notes > > **Note**: > > > Depending on the environment, the Unix domain or the optional connect timeout may not be available. > > **Warning** UDP sockets will sometimes appear to have opened without an error, even if the remote host is unreachable. The error will only become apparent when you read or write data to/from the socket. The reason for this is because UDP is a "connectionless" protocol, which means that the operating system does not try to establish a link for the socket until it actually needs to send or receive data. > **Note**: When specifying a numerical IPv6 address (e.g. `fe80::1`), you must enclose the IP in square brackets—for example, `tcp://[fe80::1]:80`. > > ### See Also * [pfsockopen()](function.pfsockopen) - Open persistent Internet or Unix domain socket connection * [stream\_socket\_client()](function.stream-socket-client) - Open Internet or Unix domain socket connection * [stream\_set\_blocking()](function.stream-set-blocking) - Set blocking/non-blocking mode on a stream * [stream\_set\_timeout()](function.stream-set-timeout) - Set timeout period on a stream * [fgets()](function.fgets) - Gets line from file pointer * [fgetss()](function.fgetss) - Gets line from file pointer and strip HTML tags * [fwrite()](function.fwrite) - Binary-safe file write * [fclose()](function.fclose) - Closes an open file pointer * [feof()](function.feof) - Tests for end-of-file on a file pointer * [socket\_connect()](function.socket-connect) - Initiates a connection on a socket * The [Curl extension](https://www.php.net/manual/en/ref.curl.php) php Ds\Vector::insert Ds\Vector::insert ================= (PECL ds >= 1.0.0) Ds\Vector::insert — Inserts values at a given index ### Description ``` public Ds\Vector::insert(int $index, mixed ...$values): void ``` Inserts values into the vector at a given index. ### Parameters `index` The index at which to insert. `0 <= index <= count` > > **Note**: > > > You can insert at the index equal to the number of values. > > `values` The value or values to insert. ### Return Values No value is returned. ### Errors/Exceptions [OutOfRangeException](class.outofrangeexception) if the index is not valid. ### Examples **Example #1 **Ds\Vector::insert()** example** ``` <?php $vector = new \Ds\Vector(); $vector->insert(0, "e");             // [e] $vector->insert(1, "f");             // [e, f] $vector->insert(2, "g");             // [e, f, g] $vector->insert(0, "a", "b");        // [a, b, e, f, g] $vector->insert(2, ...["c", "d"]);   // [a, b, c, d, e, f, g] var_dump($vector); ?> ``` The above example will output something similar to: ``` object(Ds\Vector)#1 (7) { [0]=> string(1) "a" [1]=> string(1) "b" [2]=> string(1) "c" [3]=> string(1) "d" [4]=> string(1) "e" [5]=> string(1) "f" [6]=> string(1) "g" } ``` php str_starts_with str\_starts\_with ================= (PHP 8) str\_starts\_with — Checks if a string starts with a given substring ### Description ``` str_starts_with(string $haystack, string $needle): bool ``` Performs a case-sensitive check indicating if `haystack` begins with `needle`. ### Parameters `haystack` The string to search in. `needle` The substring to search for in the `haystack`. ### Return Values Returns **`true`** if `haystack` begins with `needle`, **`false`** otherwise. ### Examples **Example #1 Using the empty string `''`** ``` <?php if (str_starts_with('abc', '')) {     echo "All strings start with the empty string"; } ?> ``` The above example will output: ``` All strings start with the empty string ``` **Example #2 Showing case-sensitivity** ``` <?php $string = 'The lazy fox jumped over the fence'; if (str_starts_with($string, 'The')) {     echo "The string starts with 'The'\n"; } if (str_starts_with($string, 'the')) {     echo 'The string starts with "the"'; } else {     echo '"the" was not found because the case does not match'; } ?> ``` The above example will output: ``` The string starts with 'The' "the" was not found because the case does not match ``` ### Notes > **Note**: This function is binary-safe. > > ### See Also * [str\_contains()](function.str-contains) - Determine if a string contains a given substring * [str\_ends\_with()](function.str-ends-with) - Checks if a string ends with a given substring * [stripos()](function.stripos) - Find the position of the first occurrence of a case-insensitive substring in a string * [strrpos()](function.strrpos) - Find the position of the last occurrence of a substring in a string * [strripos()](function.strripos) - Find the position of the last occurrence of a case-insensitive substring in a string * [strstr()](function.strstr) - Find the first occurrence of a string * [strpbrk()](function.strpbrk) - Search a string for any of a set of characters * [substr()](function.substr) - Return part of a string * [preg\_match()](function.preg-match) - Perform a regular expression match php APCUIterator::getTotalHits APCUIterator::getTotalHits ========================== (PECL apcu >= 5.0.0) APCUIterator::getTotalHits — Get total cache hits ### Description ``` public APCUIterator::getTotalHits(): int ``` Gets the total number of cache hits. **Warning**This function is currently not documented; only its argument list is available. ### Parameters This function has no parameters. ### Return Values The number of hits on success, or **`false`** on failure. ### See Also * [APCUIterator::getTotalCount()](apcuiterator.gettotalcount) - Get total count * [APCUIterator::getTotalSize()](apcuiterator.gettotalsize) - Get total cache size * [apcu\_cache\_info()](function.apcu-cache-info) - Retrieves cached information from APCu's data store php openal_source_get openal\_source\_get =================== (PECL openal >= 0.1.0) openal\_source\_get — Retrieve an OpenAL source property ### Description ``` openal_source_get(resource $source, int $property): mixed ``` ### Parameters `source` An [Open AL(Source)](https://www.php.net/manual/en/openal.resources.php) resource (previously created by [openal\_source\_create()](function.openal-source-create)). `property` Property to get, one of: **`AL_SOURCE_RELATIVE`** (int), **`AL_SOURCE_STATE`** (int), **`AL_PITCH`** (float), **`AL_GAIN`** (float), **`AL_MIN_GAIN`** (float), **`AL_MAX_GAIN`** (float), **`AL_MAX_DISTANCE`** (float), **`AL_ROLLOFF_FACTOR`** (float), **`AL_CONE_OUTER_GAIN`** (float), **`AL_CONE_INNER_ANGLE`** (float), **`AL_CONE_OUTER_ANGLE`** (float), **`AL_REFERENCE_DISTANCE`** (float), **`AL_POSITION`** (array(float,float,float)), **`AL_VELOCITY`** (array(float,float,float)), **`AL_DIRECTION`** (array(float,float,float)). ### Return Values Returns the type associated with the property being retrieved or **`false`** on failure. ### See Also * [openal\_source\_create()](function.openal-source-create) - Generate a source resource * [openal\_source\_set()](function.openal-source-set) - Set source property * [openal\_source\_play()](function.openal-source-play) - Start playing the source php mcrypt_enc_is_block_algorithm_mode mcrypt\_enc\_is\_block\_algorithm\_mode ======================================= (PHP 4 >= 4.0.2, PHP 5, PHP 7 < 7.2.0, PECL mcrypt >= 1.0.0) mcrypt\_enc\_is\_block\_algorithm\_mode — Checks whether the encryption of the opened mode works on blocks **Warning**This function has been *DEPRECATED* as of PHP 7.1.0 and *REMOVED* as of PHP 7.2.0. Relying on this function is highly discouraged. ### Description ``` mcrypt_enc_is_block_algorithm_mode(resource $td): bool ``` Tells whether the algorithm of the opened mode works on blocks (e.g. **`false`** for stream, and **`true`** for cbc, cfb, ofb).. ### Parameters `td` The encryption descriptor. ### Return Values Returns **`true`** if the mode is for use with block algorithms, otherwise it returns **`false`**. php Ds\Map::sum Ds\Map::sum =========== (No version information available, might only be in Git) Ds\Map::sum — Returns the sum of all values in the map ### Description ``` public Ds\Map::sum(): int|float ``` Returns the sum of all values in the map. > > **Note**: > > > Arrays and objects are considered equal to zero when calculating the sum. > > ### Parameters This function has no parameters. ### Return Values The sum of all the values in the map as either a float or int depending on the values in the map. ### Examples **Example #1 **Ds\Map::sum()** integer example** ``` <?php $map = new \Ds\Map(["a" => 1, "b" => 2, "c" => 3]); var_dump($map->sum()); ?> ``` The above example will output something similar to: ``` int(6) ``` **Example #2 **Ds\Map::sum()** float example** ``` <?php $map = new \Ds\Map(["a" => 1, "b" => 2.5, "c" => 3]); var_dump($map->sum()); ?> ``` The above example will output something similar to: ``` float(6.5) ``` php SolrQuery::getFacetDateGap SolrQuery::getFacetDateGap ========================== (PECL solr >= 0.9.2) SolrQuery::getFacetDateGap — Returns the value of the facet.date.gap parameter ### Description ``` public SolrQuery::getFacetDateGap(string $field_override = ?): string ``` Returns the value of the facet.date.gap parameter. It accepts an optional field override ### Parameters `field_override` The name of the field ### Return Values Returns a string on success and **`null`** if not set php SolrQuery::getStatsFields SolrQuery::getStatsFields ========================= (PECL solr >= 0.9.2) SolrQuery::getStatsFields — Returns all the statistics fields ### Description ``` public SolrQuery::getStatsFields(): array ``` Returns all the statistics fields ### Parameters This function has no parameters. ### Return Values Returns an array on success and **`null`** if not set. php The OverflowException class The OverflowException class =========================== Introduction ------------ (PHP 5 >= 5.1.0, PHP 7, PHP 8) Exception thrown when adding an element to a full container. Class synopsis -------------- class **OverflowException** extends [RuntimeException](class.runtimeexception) { /\* Inherited properties \*/ protected string [$message](class.exception#exception.props.message) = ""; private string [$string](class.exception#exception.props.string) = ""; protected int [$code](class.exception#exception.props.code); protected string [$file](class.exception#exception.props.file) = ""; protected int [$line](class.exception#exception.props.line); private array [$trace](class.exception#exception.props.trace) = []; private ?[Throwable](class.throwable) [$previous](class.exception#exception.props.previous) = null; /\* Inherited methods \*/ ``` final public Exception::getMessage(): string ``` ``` final public Exception::getPrevious(): ?Throwable ``` ``` final public Exception::getCode(): int ``` ``` final public Exception::getFile(): string ``` ``` final public Exception::getLine(): int ``` ``` final public Exception::getTrace(): array ``` ``` final public Exception::getTraceAsString(): string ``` ``` public Exception::__toString(): string ``` ``` private Exception::__clone(): void ``` }
programming_docs
php pcntl_get_last_error pcntl\_get\_last\_error ======================= (PHP 5 >= 5.3.4, PHP 7, PHP 8) pcntl\_get\_last\_error — Retrieve the error number set by the last pcntl function which failed ### Description ``` pcntl_get_last_error(): int ``` **Warning**This function is currently not documented; only its argument list is available. ### Parameters This function has no parameters. ### Return Values Returns error code. ### See Also * [pcntl\_strerror()](function.pcntl-strerror) - Retrieve the system error message associated with the given errno php jewishtojd jewishtojd ========== (PHP 4, PHP 5, PHP 7, PHP 8) jewishtojd — Converts a date in the Jewish Calendar to Julian Day Count ### Description ``` jewishtojd(int $month, int $day, int $year): int ``` Although this function can handle dates all the way back to the year 1 (3761 B.C.), such use may not be meaningful. The Jewish calendar has been in use for several thousand years, but in the early days there was no formula to determine the start of a month. A new month was started when the new moon was first observed. ### Parameters `month` The month as a number from `1` to `13`, where `1` means `Tishri`, `13` means `Elul`, and `6` *and* `7` mean `Adar` in regular years, but `Adar I` and `Adar II`, respectively, in leap years. `day` The day as a number from `1` to `30`. If the month has only 29 days, the first day of the following month is assumed. `year` The year as a number between 1 and 9999 ### Return Values The julian day for the given jewish date as an integer. ### See Also * [jdtojewish()](function.jdtojewish) - Converts a Julian day count to a Jewish calendar date * [cal\_to\_jd()](function.cal-to-jd) - Converts from a supported calendar to Julian Day Count php openssl_pkey_free openssl\_pkey\_free =================== (PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8) openssl\_pkey\_free — Frees a private key **Warning**This function has been *DEPRECATED* as of PHP 8.0.0. Relying on this function is highly discouraged. ### Description ``` openssl_pkey_free(OpenSSLAsymmetricKey $key): void ``` > > **Note**: > > > This function has no effect. Prior to PHP 8.0.0, this function was used to close the resource. > > This function frees a private key created by [openssl\_pkey\_new()](function.openssl-pkey-new). ### Parameters `key` Resource holding the key. ### Return Values No value is returned. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | This function is now deprecated as it doesn't have an effect anymore. | | 8.0.0 | `key` accepts an [OpenSSLAsymmetricKey](class.opensslasymmetrickey) now; previously, a [resource](language.types.resource) of type `OpenSSL key` was accepted. | php ImagickDraw::polygon ImagickDraw::polygon ==================== (PECL imagick 2, PECL imagick 3) ImagickDraw::polygon — Draws a polygon ### Description ``` public ImagickDraw::polygon(array $coordinates): bool ``` **Warning**This function is currently not documented; only its argument list is available. Draws a polygon using the current stroke, stroke width, and fill color or texture, using the specified array of coordinates. ### Parameters `coordinates` multidimensional array like array( array( 'x' => 3, 'y' => 4 ), array( 'x' => 2, 'y' => 6 ) ); ### Return Values Returns **`true`** on success. ### Examples **Example #1 **ImagickDraw::polygon()** example** ``` <?php function polygon($strokeColor, $fillColor, $backgroundColor) {     $draw = new \ImagickDraw();     $draw->setStrokeOpacity(1);     $draw->setStrokeColor($strokeColor);     $draw->setStrokeWidth(4);     $draw->setFillColor($fillColor);     $points = [         ['x' => 40 * 5, 'y' => 10 * 5],         ['x' => 20 * 5, 'y' => 20 * 5],          ['x' => 70 * 5, 'y' => 50 * 5],          ['x' => 60 * 5, 'y' => 15 * 5],     ];     $draw->polygon($points);     $image = new \Imagick();     $image->newImage(500, 300, $backgroundColor);     $image->setImageFormat("png");     $image->drawImage($draw);     header("Content-Type: image/png");     echo $image->getImageBlob(); } ?> ``` php fbird_modify_user fbird\_modify\_user =================== (PHP 5, PHP 7 < 7.4.0) fbird\_modify\_user — Alias of [ibase\_modify\_user()](function.ibase-modify-user) ### Description This function is an alias of: [ibase\_modify\_user()](function.ibase-modify-user). ### See Also * [fbird\_add\_user()](function.fbird-add-user) - Alias of ibase\_add\_user * [fbird\_delete\_user()](function.fbird-delete-user) - Alias of ibase\_delete\_user php stats_absolute_deviation stats\_absolute\_deviation ========================== (PECL stats >= 1.0.0) stats\_absolute\_deviation — Returns the absolute deviation of an array of values ### Description ``` stats_absolute_deviation(array $a): float ``` Returns the absolute deviation of the values in `a`. ### Parameters `a` The input array ### Return Values Returns the absolute deviation of the values in `a`, or **`false`** if `a` is empty or is not an array. php The Pool class The Pool class ============== Introduction ------------ (PECL pthreads >= 2.0.0) A Pool is a container for, and controller of, an adjustable number of Workers. Pooling provides a higher level abstraction of the Worker functionality, including the management of references in the way required by pthreads. Class synopsis -------------- class **Pool** { /\* Properties \*/ protected [$size](class.pool#pool.props.size); protected [$class](class.pool#pool.props.class); protected [$workers](class.pool#pool.props.workers); protected [$ctor](class.pool#pool.props.ctor); protected [$last](class.pool#pool.props.last); /\* Methods \*/ public [\_\_construct](pool.construct)(int `$size`, string `$class` = ?, array `$ctor` = ?) ``` public collect(Callable $collector = ?): int ``` ``` public resize(int $size): void ``` ``` public shutdown(): void ``` ``` public submit(Threaded $task): int ``` ``` public submitTo(int $worker, Threaded $task): int ``` } Properties ---------- size maximum number of Workers this Pool can use class the class of the Worker workers references to Workers ctor the arguments for constructor of new Workers last offset in workers of the last Worker used Table of Contents ----------------- * [Pool::collect](pool.collect) — Collect references to completed tasks * [Pool::\_\_construct](pool.construct) — Creates a new Pool of Workers * [Pool::resize](pool.resize) — Resize the Pool * [Pool::shutdown](pool.shutdown) — Shutdown all workers * [Pool::submit](pool.submit) — Submits an object for execution * [Pool::submitTo](pool.submitto) — Submits a task to a specific worker for execution php posix_getpid posix\_getpid ============= (PHP 4, PHP 5, PHP 7, PHP 8) posix\_getpid — Return the current process identifier ### Description ``` posix_getpid(): int ``` Return the process identifier of the current process. ### Parameters This function has no parameters. ### Return Values Returns the identifier, as an int. ### Examples **Example #1 Example use of **posix\_getpid()**** ``` <?php echo posix_getpid(); //8805 ?> ``` ### See Also * [posix\_kill()](function.posix-kill) - Send a signal to a process * POSIX man page GETPID(2) php Yaf_View_Simple::setScriptPath Yaf\_View\_Simple::setScriptPath ================================ (Yaf >=1.0.0) Yaf\_View\_Simple::setScriptPath — Set tempaltes directory ### Description ``` public Yaf_View_Simple::setScriptPath(string $template_dir): bool ``` ### Parameters `template_dir` ### Return Values php Yaf_Route_Rewrite::assemble Yaf\_Route\_Rewrite::assemble ============================= (Yaf >=2.3.0) Yaf\_Route\_Rewrite::assemble — Assemble a url ### Description ``` public Yaf_Route_Rewrite::assemble(array $info, array $query = ?): string ``` Assemble a url. ### Parameters `info` `query` ### Return Values Returns string. ### Examples **Example #1 **Yaf\_Route\_Rewrite::assemble()**example** ``` router = new Yaf_Router(); $route  = new Yaf_Route_Rewrite(                 "/product/:name/:id/*",                 array(                         'controller' => "product",                 ),                 array() ); $router->addRoute("rewrite", $route); var_dump($router->getRoute('rewrite')->assemble(                         array(                                 ':name' => 'foo',                                 ':id' => 'bar',                                 ':tmpkey1' => 'tmpval1'                         ),                         array(                                 'tkey1' => 'tval1',                                 'tkey2' => 'tval2'                              )                         ) ); ``` The above example will output something similar to: ``` string(57) "/product/foo/bar/tmpkey1/tmpval1/?tkey1=tval1&tkey2=tval2" ``` php fdf_save_string fdf\_save\_string ================= (PHP 4 >= 4.3.0, PHP 5 < 5.3.0, PECL fdf SVN) fdf\_save\_string — Returns the FDF document as a string ### Description ``` fdf_save_string(resource $fdf_document): string ``` Returns the FDF document as a string. ### Parameters `fdf_document` The FDF document handle, returned by [fdf\_create()](function.fdf-create), [fdf\_open()](function.fdf-open) or [fdf\_open\_string()](function.fdf-open-string). ### Return Values Returns the document as a string, or **`false`** on error. ### Examples **Example #1 Retrieving FDF as a string** ``` <?php $fdf = fdf_create(); fdf_set_value($fdf, "foo", "bar"); $str = fdf_save_string($fdf); fdf_close($fdf); echo $str; ?> ``` The above example will output: ``` %FDF-1.2 %âãÏÓ 1 0 obj << /FDF << /Fields 2 0 R >> >> endobj 2 0 obj [ << /T (foo)/V (bar)>> ] endobj trailer << /Root 1 0 R >> %%EOF ``` ### See Also * [fdf\_open\_string()](function.fdf-open-string) - Read a FDF document from a string * [fdf\_close()](function.fdf-close) - Close an FDF document * [fdf\_create()](function.fdf-create) - Create a new FDF document * [fdf\_save()](function.fdf-save) - Save a FDF document php EventBufferEvent::enable EventBufferEvent::enable ======================== (PECL event >= 1.2.6-beta) EventBufferEvent::enable — Enable events read, write, or both on a buffer event ### Description ``` public EventBufferEvent::enable( int $events ): bool ``` Enable events **`Event::READ`** , **`Event::WRITE`** , or **`Event::READ`** `|` **`Event::WRITE`** on a buffer event. ### Parameters `events` **`Event::READ`** , **`Event::WRITE`** , or **`Event::READ`** `|` **`Event::WRITE`** on a buffer event. ### Return Values Returns **`true`** on success or **`false`** on failure. ### See Also * [EventBufferEvent::disable()](eventbufferevent.disable) - Disable events read, write, or both on a buffer event php decbin decbin ====== (PHP 4, PHP 5, PHP 7, PHP 8) decbin — Decimal to binary ### Description ``` decbin(int $num): string ``` Returns a string containing a binary representation of the given `num` argument. ### Parameters `num` Decimal value to convert **Range of inputs on 32-bit machines** | positive `num` | negative `num` | return value | | --- | --- | --- | | 0 | | 0 | | 1 | | 1 | | 2 | | 10 | | ... normal progression ... | | 2147483646 | | 1111111111111111111111111111110 | | 2147483647 (largest signed integer) | | 1111111111111111111111111111111 (31 1's) | | 2147483648 | -2147483648 | 10000000000000000000000000000000 | | ... normal progression ... | | 4294967294 | -2 | 11111111111111111111111111111110 | | 4294967295 (largest unsigned integer) | -1 | 11111111111111111111111111111111 (32 1's) | **Range of inputs on 64-bit machines** | positive `num` | negative `num` | return value | | --- | --- | --- | | 0 | | 0 | | 1 | | 1 | | 2 | | 10 | | ... normal progression ... | | 9223372036854775806 | | 111111111111111111111111111111111111111111111111111111111111110 | | 9223372036854775807 (largest signed integer) | | 111111111111111111111111111111111111111111111111111111111111111 (63 1's) | | | -9223372036854775808 | 1000000000000000000000000000000000000000000000000000000000000000 | | ... normal progression ... | | | -2 | 1111111111111111111111111111111111111111111111111111111111111110 | | | -1 | 1111111111111111111111111111111111111111111111111111111111111111 (64 1's) | ### Return Values Binary string representation of `num` ### Examples **Example #1 **decbin()** example** ``` <?php echo decbin(12) . "\n"; echo decbin(26); ?> ``` The above example will output: ``` 1100 11010 ``` ### See Also * [bindec()](function.bindec) - Binary to decimal * [decoct()](function.decoct) - Decimal to octal * [dechex()](function.dechex) - Decimal to hexadecimal * [base\_convert()](function.base-convert) - Convert a number between arbitrary bases * [printf()](function.printf) - Output a formatted string, using `%b`, `%032b` or `%064b` as the format * [sprintf()](function.sprintf), using `%b`, `%032b` or `%064b` as the format php AppendIterator::next AppendIterator::next ==================== (PHP 5 >= 5.1.0, PHP 7, PHP 8) AppendIterator::next — Moves to the next element ### Description ``` public AppendIterator::next(): void ``` Moves to the next element. If this means to another Iterator then it rewinds that Iterator. ### Parameters This function has no parameters. ### Return Values No value is returned. ### See Also * [Iterator::next()](iterator.next) - Move forward to next element * [AppendIterator::current()](appenditerator.current) - Gets the current value * [AppendIterator::key()](appenditerator.key) - Gets the current key * [AppendIterator::valid()](appenditerator.valid) - Checks validity of the current element * [AppendIterator::rewind()](appenditerator.rewind) - Rewinds the Iterator php Imagick::displayImage Imagick::displayImage ===================== (PECL imagick 2, PECL imagick 3) Imagick::displayImage — Displays an image ### Description ``` public Imagick::displayImage(string $servername): bool ``` This method displays an image on a X server. ### Parameters `servername` The X server name ### Return Values Returns **`true`** on success. ### Errors/Exceptions Throws ImagickException on error. php mb_scrub mb\_scrub ========= (PHP 7 >= 7.2.0, PHP 8) mb\_scrub — Description ### Description ``` mb_scrub(string $string, ?string $encoding = null): string ``` **Warning**This function is currently not documented; only its argument list is available. ### Parameters `string` `encoding` ### Return Values ### Changelog | Version | Description | | --- | --- | | 8.0.0 | `encoding` is nullable now. | php Imagick::swirlImage Imagick::swirlImage =================== (PECL imagick 2, PECL imagick 3) Imagick::swirlImage — Swirls the pixels about the center of the image ### Description ``` Imagick::swirlImage(float $degrees): bool ``` Swirls the pixels about the center of the image, where degrees indicates the sweep of the arc through which each pixel is moved. You get a more dramatic effect as the degrees move from 1 to 360. ### Parameters `degrees` ### Return Values Returns **`true`** on success. ### Errors/Exceptions Throws ImagickException on error. ### Examples **Example #1 **Imagick::swirlImage()**** ``` <?php function swirlImage($imagePath, $swirl) {     $imagick = new \Imagick(realpath($imagePath));     $imagick->swirlImage($swirl);     header("Content-Type: image/jpg");     echo $imagick->getImageBlob(); } ?> ``` php SplFileObject::setMaxLineLen SplFileObject::setMaxLineLen ============================ (PHP 5 >= 5.1.0, PHP 7, PHP 8) SplFileObject::setMaxLineLen — Set maximum line length ### Description ``` public SplFileObject::setMaxLineLen(int $maxLength): void ``` Sets the maximum length of a line to be read. ### Parameters `maxLength` The maximum length of a line. ### Return Values No value is returned. ### Errors/Exceptions Throws [DomainException](class.domainexception) when `maxLength` is less than zero. ### Examples **Example #1 **SplFileObject::setMaxLineLen()** example** ``` <?php $file = new SplFileObject("lipsum.txt"); $file->setMaxLineLen(20); foreach ($file as $line) {     echo $line . "\n"; } ?> ``` Contents of lipsum.txt ``` Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis nec sapien felis, ac sodales nisl. Nulla vitae magna vitae purus aliquet consequat. ``` The above example will output something similar to: ``` Lorem ipsum dolor s it amet, consectetu r adipiscing elit. Duis nec sapien fel is, ac sodales nisl . Nulla vitae magna v itae purus aliquet consequat. ``` ### See Also * [SplFileObject::getMaxLineLen()](splfileobject.getmaxlinelen) - Get maximum line length php DOMElement::setAttributeNode DOMElement::setAttributeNode ============================ (PHP 5, PHP 7, PHP 8) DOMElement::setAttributeNode — Adds new attribute node to element ### Description ``` public DOMElement::setAttributeNode(DOMAttr $attr): DOMAttr|null|false ``` Adds new attribute node `attr` to element. ### Parameters `attr` The attribute node. ### Return Values Returns old node if the attribute has been replaced or **`null`**. ### Errors/Exceptions **`DOM_NO_MODIFICATION_ALLOWED_ERR`** Raised if the node is readonly. ### See Also * [DOMElement::hasAttribute()](domelement.hasattribute) - Checks to see if attribute exists * [DOMElement::getAttributeNode()](domelement.getattributenode) - Returns attribute node * [DOMElement::removeAttributeNode()](domelement.removeattributenode) - Removes attribute php curl_pause curl\_pause =========== (PHP 5 >= 5.5.0, PHP 7, PHP 8) curl\_pause — Pause and unpause a connection ### Description ``` curl_pause(CurlHandle $handle, int $flags): int ``` **Warning**This function is currently not documented; only its argument list is available. ### Parameters `handle` A cURL handle returned by [curl\_init()](function.curl-init). `flags` One of **`CURLPAUSE_*`** constants. ### Return Values Returns an error code (**`CURLE_OK`** for no error). ### Changelog | Version | Description | | --- | --- | | 8.0.0 | `handle` expects a [CurlHandle](class.curlhandle) instance now; previously, a resource was expected. | php Imagick::setImageCompression Imagick::setImageCompression ============================ (PECL imagick 2, PECL imagick 3) Imagick::setImageCompression — Sets the image compression ### Description ``` public Imagick::setImageCompression(int $compression): bool ``` ### Parameters `compression` One of the **`COMPRESSION`** constants ### Return Values Returns **`true`** on success. ### Errors/Exceptions Throws ImagickException on error. php The EnchantDictionary class The EnchantDictionary class =========================== Introduction ------------ (PHP 8) A fully opaque class which replaces `enchant_dict` resources as of PHP 8.0.0. Class synopsis -------------- final class **EnchantDictionary** { } php imagestring imagestring =========== (PHP 4, PHP 5, PHP 7, PHP 8) imagestring — Draw a string horizontally ### Description ``` imagestring( GdImage $image, GdFont|int $font, int $x, int $y, string $string, int $color ): bool ``` Draws a `string` at the given coordinates. ### Parameters `image` A [GdImage](class.gdimage) object, returned by one of the image creation functions, such as [imagecreatetruecolor()](function.imagecreatetruecolor). `font` Can be 1, 2, 3, 4, 5 for built-in fonts in latin2 encoding (where higher numbers corresponding to larger fonts) or [GdFont](class.gdfont) instance, returned by [imageloadfont()](function.imageloadfont). `x` x-coordinate of the upper left corner. `y` y-coordinate of the upper left corner. `string` The string to be written. `color` A color identifier created with [imagecolorallocate()](function.imagecolorallocate). ### Return Values Returns **`true`** on success or **`false`** on failure. ### Changelog | Version | Description | | --- | --- | | 8.1.0 | The `font` parameter now accepts both an [GdFont](class.gdfont) instance and an int; previously only int was accepted. | | 8.0.0 | `image` expects a [GdImage](class.gdimage) instance now; previously, a resource was expected. | ### Examples **Example #1 **imagestring()** example** ``` <?php // Create a 100*30 image $im = imagecreate(100, 30); // White background and blue text $bg = imagecolorallocate($im, 255, 255, 255); $textcolor = imagecolorallocate($im, 0, 0, 255); // Write the string at the top left imagestring($im, 5, 0, 0, 'Hello world!', $textcolor); // Output the image header('Content-type: image/png'); imagepng($im); imagedestroy($im); ?> ``` The above example will output something similar to: ### See Also * [imagestringup()](function.imagestringup) - Draw a string vertically * [imageloadfont()](function.imageloadfont) - Load a new font * [imagettftext()](function.imagettftext) - Write text to the image using TrueType fonts
programming_docs
php GearmanTask::taskNumerator GearmanTask::taskNumerator ========================== (PECL gearman >= 0.5.0) GearmanTask::taskNumerator — Get completion percentage numerator ### Description ``` public GearmanTask::taskNumerator(): int ``` Returns the numerator of the percentage of the task that is complete expressed as a fraction. ### Parameters This function has no parameters. ### Return Values A number between 0 and 100, or **`false`** if cannot be determined. ### See Also * [GearmanTask::taskDenominator()](gearmantask.taskdenominator) - Get completion percentage denominator php SolrQuery::getFacetMethod SolrQuery::getFacetMethod ========================= (PECL solr >= 0.9.2) SolrQuery::getFacetMethod — Returns the value of the facet.method parameter ### Description ``` public SolrQuery::getFacetMethod(string $field_override = ?): string ``` Returns the value of the facet.method parameter. This accepts an optional field override. ### Parameters `field_override` The name of the field ### Return Values Returns a string on success and **`null`** if not set php gmp_rootrem gmp\_rootrem ============ (PHP 5 >= 5.6.0, PHP 7, PHP 8) gmp\_rootrem — Take the integer part and remainder of nth root ### Description ``` gmp_rootrem(GMP|int|string $num, int $nth): array ``` Takes the `nth` root of `num` and returns the integer component and remainder of the result. ### Parameters `num` A [GMP](class.gmp) object, an int or a numeric string. `nth` The positive root to take of `num`. ### Return Values A two element array, where the first element is the integer component of the root, and the second element is the remainder, both represented as GMP numbers. php similar_text similar\_text ============= (PHP 4, PHP 5, PHP 7, PHP 8) similar\_text — Calculate the similarity between two strings ### Description ``` similar_text(string $string1, string $string2, float &$percent = null): int ``` This calculates the similarity between two strings as described in Programming Classics: Implementing the World's Best Algorithms by Oliver (ISBN 0-131-00413-1). Note that this implementation does not use a stack as in Oliver's pseudo code, but recursive calls which may or may not speed up the whole process. Note also that the complexity of this algorithm is O(N\*\*3) where N is the length of the longest string. ### Parameters `string1` The first string. `string2` The second string. > > **Note**: > > > Swapping the `string1` and `string2` may yield a different result; see the example below. > > `percent` By passing a reference as third argument, **similar\_text()** will calculate the similarity in percent, by dividing the result of **similar\_text()** by the average of the lengths of the given strings times `100`. ### Return Values Returns the number of matching chars in both strings. The number of matching characters is calculated by finding the longest first common substring, and then doing this for the prefixes and the suffixes, recursively. The lengths of all found common substrings are added. ### Examples **Example #1 **similar\_text()** argument swapping example** This example shows that swapping the `string1` and `string2` argument may yield different results. ``` <?php $sim = similar_text('bafoobar', 'barfoo', $perc); echo "similarity: $sim ($perc %)\n"; $sim = similar_text('barfoo', 'bafoobar', $perc); echo "similarity: $sim ($perc %)\n"; ``` The above example will output something similar to: ``` similarity: 5 (71.428571428571 %) similarity: 3 (42.857142857143 %) ``` ### See Also * [levenshtein()](function.levenshtein) - Calculate Levenshtein distance between two strings * [soundex()](function.soundex) - Calculate the soundex key of a string php pspell_config_personal pspell\_config\_personal ======================== (PHP 4 >= 4.0.2, PHP 5, PHP 7, PHP 8) pspell\_config\_personal — Set a file that contains personal wordlist ### Description ``` pspell_config_personal(PSpell\Config $config, string $filename): bool ``` Set a file that contains personal wordlist. The personal wordlist will be loaded and used in addition to the standard one after you call [pspell\_new\_config()](function.pspell-new-config). The file is also the file where [pspell\_save\_wordlist()](function.pspell-save-wordlist) will save personal wordlist to. **pspell\_config\_personal()** should be used on a config before calling [pspell\_new\_config()](function.pspell-new-config). ### Parameters `config` An [PSpell\Config](class.pspell-config) instance. `filename` The personal wordlist. If the file does not exist, it will be created. The file should be writable by whoever PHP runs as (e.g. nobody). ### Return Values Returns **`true`** on success or **`false`** on failure. ### Changelog | Version | Description | | --- | --- | | 8.1.0 | The `config` parameter expects an [PSpell\Config](class.pspell-config) instance now; previously, a [resource](language.types.resource) was expected. | ### Examples **Example #1 **pspell\_config\_personal()**** ``` <?php $pspell_config = pspell_config_create("en"); pspell_config_personal($pspell_config, "/var/dictionaries/custom.pws"); $pspell = pspell_new_config($pspell_config); pspell_check($pspell, "thecat"); ?> ``` ### Notes > > **Note**: > > > This function will not work unless you have pspell .11.2 and aspell .32.5 or later. > > php tidy_warning_count tidy\_warning\_count ==================== (PHP 5, PHP 7, PHP 8, PECL tidy >= 0.5.2) tidy\_warning\_count — Returns the Number of Tidy warnings encountered for specified document ### Description ``` tidy_warning_count(tidy $tidy): int ``` Returns the number of Tidy warnings encountered for the specified document. ### Parameters `tidy` The [Tidy](class.tidy) object. ### Return Values Returns the number of warnings. ### Examples **Example #1 **tidy\_warning\_count()** example** ``` <?php $html = '<p>test</i> <bogustag>bogus</bogustag>'; $tidy = tidy_parse_string($html); echo tidy_error_count($tidy) . "\n"; //1 echo tidy_warning_count($tidy) . "\n"; //5 ?> ``` ### See Also * [tidy\_error\_count()](function.tidy-error-count) - Returns the Number of Tidy errors encountered for specified document * [tidy\_access\_count()](function.tidy-access-count) - Returns the Number of Tidy accessibility warnings encountered for specified document php Phar::setDefaultStub Phar::setDefaultStub ==================== (PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 2.0.0) Phar::setDefaultStub — Used to set the PHP loader or bootstrap stub of a Phar archive to the default loader ### Description ``` public Phar::setDefaultStub(?string $index = null, ?string $webIndex = null): bool ``` > > **Note**: > > > This method requires the php.ini setting `phar.readonly` to be set to `0` in order to work for [Phar](class.phar) objects. Otherwise, a [PharException](class.pharexception) will be thrown. > > > This method is a convenience method that combines the functionality of [Phar::createDefaultStub()](phar.createdefaultstub) and [Phar::setStub()](phar.setstub). ### Parameters `index` Relative path within the phar archive to run if accessed on the command-line `webIndex` Relative path within the phar archive to run if accessed through a web browser ### Return Values Returns **`true`** on success or **`false`** on failure. ### Errors/Exceptions [UnexpectedValueException](class.unexpectedvalueexception) is thrown if [phar.readonly](https://www.php.net/manual/en/phar.configuration.php#ini.phar.readonly) is enabled in php.ini. [PharException](class.pharexception) is thrown if any problems are encountered flushing changes to disk. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | `webIndex` is nullable now. | ### Examples **Example #1 A **Phar::setDefaultStub()** example** ``` <?php try {     $phar = new Phar('myphar.phar');     $phar->setDefaultStub('cli.php', 'web/index.php');     // this is the same as:     // $phar->setStub($phar->createDefaultStub('cli.php', 'web/index.php')); } catch (Exception $e) {     // handle errors } ?> ``` ### See Also * [Phar::setStub()](phar.setstub) - Used to set the PHP loader or bootstrap stub of a Phar archive * [Phar::createDefaultStub()](phar.createdefaultstub) - Create a phar-file format specific stub php ArrayIterator::getArrayCopy ArrayIterator::getArrayCopy =========================== (PHP 5, PHP 7, PHP 8) ArrayIterator::getArrayCopy — Get array copy ### Description ``` public ArrayIterator::getArrayCopy(): array ``` Get a copy of an array. **Warning**This function is currently not documented; only its argument list is available. ### Parameters This function has no parameters. ### Return Values A copy of the array, or array of public properties if ArrayIterator refers to an object. ### See Also * [ArrayIterator::valid()](arrayiterator.valid) - Check whether array contains more entries php ssh2_sftp_rename ssh2\_sftp\_rename ================== (PECL ssh2 >= 0.9.0) ssh2\_sftp\_rename — Rename a remote file ### Description ``` ssh2_sftp_rename(resource $sftp, string $from, string $to): bool ``` Renames a file on the remote filesystem. ### Parameters `sftp` An SSH2 SFTP resource opened by [ssh2\_sftp()](function.ssh2-sftp). `from` The current file that is being renamed. `to` The new file name that replaces `from`. ### Return Values Returns **`true`** on success or **`false`** on failure. ### Examples **Example #1 Renaming a file via sftp** ``` <?php $connection = ssh2_connect('shell.example.com', 22); ssh2_auth_password($connection, 'username', 'password'); $sftp = ssh2_sftp($connection); ssh2_sftp_rename($sftp, '/home/username/oldname', '/home/username/newname'); ?> ``` ### See Also * [rename()](function.rename) - Renames a file or directory php Imagick::statisticImage Imagick::statisticImage ======================= (PECL imagick 3 >= 3.3.0) Imagick::statisticImage — Description ### Description ``` public Imagick::statisticImage( int $type, int $width, int $height, int $channel = Imagick::CHANNEL_DEFAULT ): bool ``` Replace each pixel with corresponding statistic from the neighborhood of the specified width and height. ### Parameters `type` `width` `height` `channel` ### Return Values Returns **`true`** on success. ### Examples **Example #1 **Imagick::statisticImage()**** ``` <?php function statisticImage($imagePath, $statisticType, $width, $height, $channel) {     $imagick = new \Imagick(realpath($imagePath));     $imagick->statisticImage(         $statisticType,         $width,         $height,         $channel     );     header("Content-Type: image/jpg");     echo $imagick->getImageBlob(); } statisticImage($imagePath, \Imagick::STATISTIC_MEDIAN, 5, 5, \Imagick::CHANNEL_DEFAULT); ?> ``` php Transliterator::__construct Transliterator::\_\_construct ============================= (PHP 5 >= 5.4.0, PHP 7, PHP 8, PECL intl >= 2.0.0) Transliterator::\_\_construct — Private constructor to deny instantiation ### Description final private **Transliterator::\_\_construct**() This method should not be called. Its only purpose is to deny instantiation with the [new](language.oop5.basic#language.oop5.basic.new) operator. Use the factory methods [Transliterator::create()](transliterator.create) or [Transliterator::createFromRules()](transliterator.createfromrules) instead. ### Parameters This function has no parameters. ### See Also * [Transliterator::create()](transliterator.create) - Create a transliterator * [Transliterator::createFromRules()](transliterator.createfromrules) - Create transliterator from rules php Threaded::isTerminated Threaded::isTerminated ====================== (PECL pthreads >= 2.0.0) Threaded::isTerminated — State Detection ### Description ``` public Threaded::isTerminated(): bool ``` Tell if the referenced object was terminated during execution; suffered fatal errors, or threw uncaught exceptions ### Parameters This function has no parameters. ### Return Values A boolean indication of state ### Examples **Example #1 Detect the state of the referenced object** ``` <?php class My extends Thread {     public function run() {         i_do_not_exist();     } } $my = new My(); $my->start(); $my->join(); var_dump($my->isTerminated()); ?> ``` The above example will output: ``` bool(true) ``` php Gmagick::edgeimage Gmagick::edgeimage ================== (PECL gmagick >= Unknown) Gmagick::edgeimage — Enhance edges within the image ### Description ``` public Gmagick::edgeimage(float $radius): Gmagick ``` Enhance edges within the image with a convolution filter of the given radius. Use radius 0 and it will be auto-selected. ### Parameters `radius` The radius of the operation. ### Return Values The [Gmagick](class.gmagick) object with edges enhanced. ### Errors/Exceptions Throws an **GmagickException** on error. php rewind rewind ====== (PHP 4, PHP 5, PHP 7, PHP 8) rewind — Rewind the position of a file pointer ### Description ``` rewind(resource $stream): bool ``` Sets the file position indicator for `stream` to the beginning of the file stream. > > **Note**: > > > If you have opened the file in append ("a" or "a+") mode, any data you write to the file will always be appended, regardless of the file pointer position. > > ### Parameters `stream` The file pointer must be valid, and must point to a file successfully opened by [fopen()](function.fopen). ### Return Values Returns **`true`** on success or **`false`** on failure. ### Examples **Example #1 **rewind()** overwriting example** ``` <?php $handle = fopen('output.txt', 'r+'); fwrite($handle, 'Really long sentence.'); rewind($handle); fwrite($handle, 'Foo'); rewind($handle); echo fread($handle, filesize('output.txt')); fclose($handle); ?> ``` The above example will output something similar to: ``` Foolly long sentence. ``` ### See Also * [fread()](function.fread) - Binary-safe file read * [fseek()](function.fseek) - Seeks on a file pointer * [ftell()](function.ftell) - Returns the current position of the file read/write pointer * [fwrite()](function.fwrite) - Binary-safe file write php odbc_field_num odbc\_field\_num ================ (PHP 4, PHP 5, PHP 7, PHP 8) odbc\_field\_num — Return column number ### Description ``` odbc_field_num(resource $statement, string $field): int|false ``` Gets the number of the column slot that corresponds to the named field in the given result identifier. ### Parameters `statement` The result identifier. `field` The field name. ### Return Values Returns the field number as a integer, or **`false`** on error. Field numbering starts at 1. php ldap_escape ldap\_escape ============ (PHP 5 >= 5.6.0, PHP 7, PHP 8) ldap\_escape — Escape a string for use in an LDAP filter or DN ### Description ``` ldap_escape(string $value, string $ignore = "", int $flags = 0): string ``` Escapes `value` for use in the context implied by `flags`. ### Parameters `value` The value to escape. `ignore` Characters to ignore when escaping. `flags` The context the escaped string will be used in: **`LDAP_ESCAPE_FILTER`** for filters to be used with [ldap\_search()](function.ldap-search), or **`LDAP_ESCAPE_DN`** for DNs. If neither flag is passed, all chars are escaped. ### Return Values Returns the escaped string. ### Examples When building an LDAP filter, you should use ldap\_escape with LDAP\_ESCAPE\_FILTER flag. **Example #1 Searching for an email address** ``` <?php // $ds is a valid LDAP\Connection instance for a directory server // $mail is an email address provided by the user in a form $base   = "o=My Company, c=US"; $filter = "(mail=".ldap_escape($mail, "", LDAP_ESCAPE_FILTER).")"; $sr = ldap_search($ds, $base, $filter, array("sn", "givenname", "mail")); $info = ldap_get_entries($ds, $sr); echo $info["count"]." entries returned\n"; ?> ``` php Exception::getCode Exception::getCode ================== (PHP 5, PHP 7, PHP 8) Exception::getCode — Gets the Exception code ### Description ``` final public Exception::getCode(): int ``` Returns the Exception code. ### Parameters This function has no parameters. ### Return Values Returns the exception code as int in [Exception](class.exception) but possibly as other type in [Exception](class.exception) descendants (for example as string in [PDOException](class.pdoexception)). ### Examples **Example #1 **Exception::getCode()** example** ``` <?php try {     throw new Exception("Some error message", 30); } catch(Exception $e) {     echo "The exception code is: " . $e->getCode(); } ?> ``` The above example will output something similar to: ``` The exception code is: 30 ``` ### See Also * [Throwable::getCode()](throwable.getcode) - Gets the exception code php ReflectionMethod::__construct ReflectionMethod::\_\_construct =============================== (PHP 5, PHP 7, PHP 8) ReflectionMethod::\_\_construct — Constructs a ReflectionMethod ### Description public **ReflectionMethod::\_\_construct**(object|string `$objectOrMethod`, string `$method`) Alternative signature (not supported with named arguments): public **ReflectionMethod::\_\_construct**(string `$classMethod`) Constructs a new [ReflectionMethod](class.reflectionmethod). ### Parameters `objectOrMethod` Classname or object (instance of the class) that contains the method. `method` Name of the method. `classMethod` Class name and method name delimited by `::`. ### Errors/Exceptions A [ReflectionException](class.reflectionexception) is thrown if the given method does not exist. ### Examples **Example #1 **ReflectionMethod::\_\_construct()** example** ``` <?php class Counter {     private static $c = 0;     /**      * Increment counter      *      * @final      * @static      * @access  public      * @return  int      */     final public static function increment()     {         return ++self::$c;     } } // Create an instance of the ReflectionMethod class $method = new ReflectionMethod('Counter', 'increment'); // Print out basic information printf(     "===> The %s%s%s%s%s%s%s method '%s' (which is %s)\n" .     "     declared in %s\n" .     "     lines %d to %d\n" .     "     having the modifiers %d[%s]\n",         $method->isInternal() ? 'internal' : 'user-defined',         $method->isAbstract() ? ' abstract' : '',         $method->isFinal() ? ' final' : '',         $method->isPublic() ? ' public' : '',         $method->isPrivate() ? ' private' : '',         $method->isProtected() ? ' protected' : '',         $method->isStatic() ? ' static' : '',         $method->getName(),         $method->isConstructor() ? 'the constructor' : 'a regular method',         $method->getFileName(),         $method->getStartLine(),         $method->getEndline(),         $method->getModifiers(),         implode(' ', Reflection::getModifierNames($method->getModifiers())) ); // Print documentation comment printf("---> Documentation:\n %s\n", var_export($method->getDocComment(), true)); // Print static variables if existant if ($statics= $method->getStaticVariables()) {     printf("---> Static variables: %s\n", var_export($statics, true)); } // Invoke the method printf("---> Invocation results in: "); var_dump($method->invoke(NULL)); ?> ``` The above example will output something similar to: ``` ===> The user-defined final public static method 'increment' (which is a regular method) declared in /Users/philip/cvs/phpdoc/test.php lines 14 to 17 having the modifiers 261[final public static] ---> Documentation: '/** * Increment counter * * @final * @static * @access public * @return int */' ---> Invocation results in: int(1) ``` ### See Also * [ReflectionMethod::export()](reflectionmethod.export) - Export a reflection method * [Constructors](language.oop5.decon#language.oop5.decon.constructor)
programming_docs
php SolrCollapseFunction::setSize SolrCollapseFunction::setSize ============================= (PECL solr >= 2.2.0) SolrCollapseFunction::setSize — Sets the initial size of the collapse data structures when collapsing on a numeric field only ### Description ``` public SolrCollapseFunction::setSize(int $size): SolrCollapseFunction ``` Sets the initial size of the collapse data structures when collapsing on a numeric field only. ### Parameters `size` ### Return Values [SolrCollapseFunction](class.solrcollapsefunction) php SplFileObject::fgetss SplFileObject::fgetss ===================== (PHP 5 >= 5.1.0, PHP 7) SplFileObject::fgetss — Gets line from file and strip HTML tags **Warning**This function has been *DEPRECATED* as of PHP 7.3.0, and *REMOVED* as of PHP 8.0.0. Relying on this function is highly discouraged. ### Description ``` public SplFileObject::fgetss(string $allowable_tags = ?): string ``` Identical to [SplFileObject::fgets()](splfileobject.fgets), except that **SplFileObject::fgetss()** attempts to strip any HTML and PHP tags from the text it reads. The function retains the parsing state from call to call, and as such is not equivalent to calling [strip\_tags()](function.strip-tags) on the return value of [SplFileObject::fgets()](splfileobject.fgets). ### Parameters `allowable_tags` Optional parameter to specify tags which should not be stripped. ### Return Values Returns a string containing the next line of the file with HTML and PHP code stripped, or **`false`** on error. ### Examples **Example #1 **SplFileObject::fgetss()** example** ``` <?php $str = <<<EOD <html><body>  <p>Welcome! Today is the <?php echo(date('jS')); ?> of <?= date('F'); ?>.</p> </body></html> Text outside of the HTML block. EOD; file_put_contents("sample.php", $str); $file = new SplFileObject("sample.php"); while (!$file->eof()) {     echo $file->fgetss(); } ?> ``` The above example will output something similar to: ``` Welcome! Today is the of . Text outside of the HTML block. ``` ### See Also * [fgetss()](function.fgetss) - Gets line from file pointer and strip HTML tags * [SplFileObject::fgets()](splfileobject.fgets) - Gets line from file * [SplFileObject::fgetc()](splfileobject.fgetc) - Gets character from file * [SplFileObject::current()](splfileobject.current) - Retrieve current line of file * The [string.strip\_tags](https://www.php.net/manual/en/filters.string.php#filters.string.strip_tags) filter php Ds\Deque::filter Ds\Deque::filter ================ (PECL ds >= 1.0.0) Ds\Deque::filter — Creates a new deque using a [callable](language.types.callable) to determine which values to include ### Description ``` public Ds\Deque::filter(callable $callback = ?): Ds\Deque ``` Creates a new deque using a [callable](language.types.callable) to determine which values to include. ### Parameters `callback` ``` callback(mixed $value): bool ``` Optional [callable](language.types.callable) which returns **`true`** if the value should be included, **`false`** otherwise. If a callback is not provided, only values which are **`true`** (see [converting to boolean](language.types.boolean#language.types.boolean.casting)) will be included. ### Return Values A new deque containing all the values for which either the `callback` returned **`true`**, or all values that convert to **`true`** if a `callback` was not provided. ### Examples **Example #1 **Ds\Deque::filter()** example using callback function** ``` <?php $deque = new \Ds\Deque([1, 2, 3, 4, 5]); var_dump($deque->filter(function($value) {     return $value % 2 == 0; })); ?> ``` The above example will output something similar to: ``` object(Ds\Deque)#3 (2) { [0]=> int(2) [1]=> int(4) } ``` **Example #2 **Ds\Deque::filter()** example without a callback function** ``` <?php $deque = new \Ds\Deque([0, 1, 'a', true, false]); var_dump($deque->filter()); ?> ``` The above example will output something similar to: ``` object(Ds\Deque)#2 (3) { [0]=> int(1) [1]=> string(1) "a" [2]=> bool(true) } ``` php InfiniteIterator::__construct InfiniteIterator::\_\_construct =============================== (PHP 5 >= 5.1.0, PHP 7, PHP 8) InfiniteIterator::\_\_construct — Constructs an InfiniteIterator ### Description public **InfiniteIterator::\_\_construct**([Iterator](class.iterator) `$iterator`) Constructs an [InfiniteIterator](class.infiniteiterator) from an [Iterator](class.iterator). ### Parameters `iterator` The iterator to infinitely iterate over. ### Examples **Example #1 **InfiniteIterator::\_\_construct()** example** ``` <?php $arrayit  = new ArrayIterator(array('cat','dog')); $infinite = new InfiniteIterator($arrayit); $limit    = new LimitIterator($infinite, 0, 7); foreach($limit as $value) {     echo "$value\n"; } ?> ``` The above example will output: ``` cat dog cat dog cat dog cat ``` ### See Also * [InfiniteIterator::next()](infiniteiterator.next) - Moves the inner Iterator forward or rewinds it php Parle\RParser::push Parle\RParser::push =================== (PECL parle >= 0.7.0) Parle\RParser::push — Add a grammar rule ### Description ``` public Parle\RParser::push(string $name, string $rule): int ``` Push a grammar rule. The production id returned can be used later in the parsing process to identify the rule matched. ### Parameters `name` Rule name. `rule` The rule to be added. The syntax is Bison compatible. ### Return Values Returns int representing the rule index. php ssh2_publickey_list ssh2\_publickey\_list ===================== (PECL ssh2 >= 0.10) ssh2\_publickey\_list — List currently authorized publickeys ### Description ``` ssh2_publickey_list(resource $pkey): array ``` List currently authorized publickeys. ### Parameters `pkey` Publickey Subsystem resource ### Return Values Returns a numerically indexed array of keys, each of which is an associative array containing: name, blob, and attrs elements. **Publickey elements**| Array Key | Meaning | | --- | --- | | name | Name of algorithm used by this publickey, for example: `ssh-dss` or `ssh-rsa`. | | blob | Publickey blob as raw binary data. | | attrs | Attributes assigned to this publickey. The most common attribute, and the only one supported by publickey version 1 servers, is `comment`, which may be any freeform string. | ### Examples **Example #1 Listing authorized keys with **ssh2\_publickey\_list()**** ``` <?php $ssh2 = ssh2_connect('shell.example.com', 22); ssh2_auth_password($ssh2, 'jdoe', 'secret'); $pkey = ssh2_publickey_init($ssh2); $list = ssh2_publickey_list($pkey); foreach($list as $key) {   echo "Key: {$key['name']}\n";   echo "Blob: " . chunk_split(base64_encode($key['blob']), 40, "\n") . "\n";   echo "Comment: {$key['attrs']['comment']}\n\n"; } ?> ``` The above example will output: ``` Key: ssh-rsa Blob: AAAAB3NzaC1yc2EAAAABIwAAAIEA5HVt6VqSGd5P TrLRdjNONxXH1tVFGn0Bd26BF0aCP9qyJRlvdJ3j 4WBeX4ZmrveGrjMgkseSYc4xZ26sDHwfL351xjza Lpipu\BGRrw17mWVBhuCExo476ri5tQFzbTc54VE HYckxQ16CjSTibI5X69GmnYC9PNqEYq/1TP+HF10 Comment: John's Key Key: ssh-rsa Blob: AAAAB3NzaHVt6VqSGd5C1yc2EAAAABIwA232dnJA AIEA5HVt6VqSGd5PTrLRdjNONxX/1TP+HF1HVt6V qSGd50H1tVFGn0BB3NzaC1yc2EAd26BF0aCP9qyJ RlvdJ3j4WBeX4ZmrveGrjMgkseSYc4xZ26HVt6Vq SGd5sDHwfL351xjzaLpipu\BGB3NzaC1yc2EA/1T Comment: Alice's Key ``` ### Notes > **Note**: The public key subsystem is used for managing public keys on a server to which the client is *already* authenticated. To authenticate to a remote system using public key authentication, use the [ssh2\_auth\_pubkey\_file()](function.ssh2-auth-pubkey-file) function instead. > > ### See Also * [ssh2\_publickey\_init()](function.ssh2-publickey-init) - Initialize Publickey subsystem * [ssh2\_publickey\_add()](function.ssh2-publickey-add) - Add an authorized publickey * [ssh2\_publickey\_remove()](function.ssh2-publickey-remove) - Remove an authorized publickey php ldap_parse_reference ldap\_parse\_reference ====================== (PHP 4 >= 4.0.5, PHP 5, PHP 7, PHP 8) ldap\_parse\_reference — Extract information from reference entry ### Description ``` ldap_parse_reference(LDAP\Connection $ldap, LDAP\ResultEntry $entry, array &$referrals): bool ``` **Warning**This function is currently not documented; only its argument list is available. php sodium_crypto_box_publickey_from_secretkey sodium\_crypto\_box\_publickey\_from\_secretkey =============================================== (PHP 7 >= 7.2.0, PHP 8) sodium\_crypto\_box\_publickey\_from\_secretkey — Calculate the public key from a secret key ### Description ``` sodium_crypto_box_publickey_from_secretkey(string $secret_key): string ``` Given a secret key, calculate the corresponding public key. This only works with the type of keys intended for use with **crypto\_box()** (which uses Elliptic Curve Diffie-Hellman over the Montgomery curve, Curve25519; abbreviated as X25519), not **crypto\_sign()** (which uses Edwards Digital Signature Algorithm over the Edwards Curve with the corresponding paramaters; abbreviated Ed25519). ### Parameters `secret_key` X25519 secret key ### Return Values X25519 public key. php SolrDocument::clear SolrDocument::clear =================== (PECL solr >= 0.9.2) SolrDocument::clear — Drops all the fields in the document ### Description ``` public SolrDocument::clear(): bool ``` Resets the current object. Discards all the fields and resets the document boost to zero. ### Parameters This function has no parameters. ### Return Values Returns **`true`** on success or **`false`** on failure. php RarEntry::getHostOs RarEntry::getHostOs =================== (PECL rar >= 0.1) RarEntry::getHostOs — Get entry host OS ### Description ``` public RarEntry::getHostOs(): int ``` Returns the code of the host OS of the archive entry. ### Parameters This function has no parameters. ### Return Values Returns the code of the host OS, or **`false`** on error. ### Examples **Example #1 **RarEntry::getHostOs()** example (version >= 2.0.0)** ``` <?php $rar_file = rar_open('example.rar') or die("Failed to open Rar archive"); $entry = rar_entry_get($rar_file, 'Dir/file.txt') or die("Failed to find such entry"); switch ($entry->getHostOs()) {     case RarEntry::HOST_MSDOS:         echo "MS-DOS\n";         break;     case RarEntry::HOST_OS2:         echo "OS2\n";         break;     case RarEntry::HOST_WIN32:         echo "Win32\n";         break;     case RarEntry::HOST_MACOS:         echo "MacOS\n";         break;     case RarEntry::HOST_UNIX:         echo "Unix/Linux\n";         break;     case RarEntry::HOST_BEOS:         echo "BeOS\n";         break; } ?> ``` **Example #2 **RarEntry::getHostOs()** example (version <= 1.0.0)** ``` <?php $rar_file = rar_open('example.rar') or die("Failed to open Rar archive"); $entry = rar_entry_get($rar_file, 'Dir/file.txt') or die("Failed to find such entry"); switch ($entry->getHostOs()) {     case RAR_HOST_MSDOS:         echo "MS-DOS\n";         break;     case RAR_HOST_OS2:         echo "OS2\n";         break;     case RAR_HOST_WIN32:         echo "Win32\n";         break;     case RAR_HOST_MACOS:         echo "MacOS\n";         break;     case RAR_HOST_UNIX:         echo "Unix/Linux\n";         break;     case RAR_HOST_BEOS:         echo "BeOS\n";         break; } ?> ``` ### See Also * [RarEntry::extract()](rarentry.extract) - Extract entry from the archive php GearmanWorker::addOptions GearmanWorker::addOptions ========================= (PECL gearman >= 0.6.0) GearmanWorker::addOptions — Add worker options ### Description ``` public GearmanWorker::addOptions(int $option): bool ``` Adds one or more options to the options previously set. ### Parameters `option` The options to be added ### Return Values Always returns **`true`**. ### See Also * [GearmanWorker::options()](gearmanworker.options) - Get worker options * [GearmanClient::setOptions()](gearmanclient.setoptions) - Set client options * [GearmanClient::removeOptions()](gearmanclient.removeoptions) - Remove client options php ftp_mlsd ftp\_mlsd ========= (PHP 7 >= 7.2.0, PHP 8) ftp\_mlsd — Returns a list of files in the given directory ### Description ``` ftp_mlsd(FTP\Connection $ftp, string $directory): array|false ``` ### Parameters `ftp` An [FTP\Connection](class.ftp-connection) instance. `directory` The directory to be listed. ### Return Values Returns an array of arrays with file infos from the specified directory on success or **`false`** on error. ### Changelog | Version | Description | | --- | --- | | 8.1.0 | The `ftp` parameter expects an [FTP\Connection](class.ftp-connection) instance now; previously, a [resource](language.types.resource) was expected. | ### Examples **Example #1 **ftp\_mlsd()** example** ``` <?php // set up basic connection $ftp = ftp_connect($ftp_server); // login with username and password $login_result = ftp_login($ftp, $ftp_user_name, $ftp_user_pass); // get contents of the current directory $contents = ftp_mlsd($ftp, "."); // output $contents var_dump($contents); ?> ``` The above example will output something similar to: ``` array(5) { [0]=> array(8) { ["name"]=> string(1) "." ["modify"]=> string(14) "20171212154511" ["perm"]=> string(7) "flcdmpe" ["type"]=> string(4) "cdir" ["unique"]=> string(11) "811U5740002" ["UNIX.group"]=> string(2) "33" ["UNIX.mode"]=> string(4) "0755" ["UNIX.owner"]=> string(2) "33" } [1]=> array(8) { ["name"]=> string(2) ".." ["modify"]=> string(14) "20171212154511" ["perm"]=> string(7) "flcdmpe" ["type"]=> string(4) "pdir" ["unique"]=> string(11) "811U5740002" ["UNIX.group"]=> string(2) "33" ["UNIX.mode"]=> string(4) "0755" ["UNIX.owner"]=> string(2) "33" } [2]=> array(8) { ["name"]=> string(11) "public_html" ["modify"]=> string(14) "20171211171525" ["perm"]=> string(7) "flcdmpe" ["type"]=> string(3) "dir" ["unique"]=> string(11) "811U5740525" ["UNIX.group"]=> string(2) "33" ["UNIX.mode"]=> string(4) "0755" ["UNIX.owner"]=> string(2) "33" } [3]=> array(8) { ["name"]=> string(10) "public_ftp" ["modify"]=> string(14) "20171211174536" ["perm"]=> string(7) "flcdmpe" ["type"]=> string(3) "dir" ["unique"]=> string(11) "811U57405EE" ["UNIX.group"]=> string(2) "33" ["UNIX.mode"]=> string(4) "0755" ["UNIX.owner"]=> string(2) "33" } [4]=> array(8) { ["name"]=> string(3) "www" ["modify"]=> string(14) "www" ["perm"]=> string(7) "flcdmpe" ["type"]=> string(3) "dir" ["unique"]=> string(11) "811U5740780" ["UNIX.group"]=> string(2) "33" ["UNIX.mode"]=> string(4) "0755" ["UNIX.owner"]=> string(2) "33" } } ``` ### See Also * [ftp\_rawlist()](function.ftp-rawlist) - Returns a detailed list of files in the given directory * [ftp\_nlist()](function.ftp-nlist) - Returns a list of files in the given directory php GearmanClient::addServer GearmanClient::addServer ======================== (PECL gearman >= 0.5.0) GearmanClient::addServer — Add a job server to the client ### Description ``` public GearmanClient::addServer(string $host = 127.0.0.1, int $port = 4730): bool ``` Adds a job server to a list of servers that can be used to run a task. No socket I/O happens here; the server is simply added to the list. ### Parameters `host` The job server host name. `port` The job server port. ### Return Values Returns **`true`** on success or **`false`** on failure. ### Examples **Example #1 Adding two job servers** ``` <?php # Create our client object. $gmclient= new GearmanClient(); # Add two job servers, the first on the default 4730 port $gmclient->addServer("10.0.0.1");  $gmclient->addServer("10.0.0.2", 7003); ?> ``` ### See Also * [GearmanClient::addServers()](gearmanclient.addservers) - Add a list of job servers to the client php SolrQuery::getFacetPrefix SolrQuery::getFacetPrefix ========================= (PECL solr >= 0.9.2) SolrQuery::getFacetPrefix — Returns the facet prefix ### Description ``` public SolrQuery::getFacetPrefix(string $field_override = ?): string ``` Returns the facet prefix ### Parameters `field_override` The name of the field ### Return Values Returns a string on success and **`null`** if not set. php DOMImplementation::createDocumentType DOMImplementation::createDocumentType ===================================== (PHP 5, PHP 7, PHP 8) DOMImplementation::createDocumentType — Creates an empty DOMDocumentType object ### Description ``` public DOMImplementation::createDocumentType(string $qualifiedName, string $publicId = "", string $systemId = ""): DOMDocumentType|false ``` Creates an empty [DOMDocumentType](class.domdocumenttype) object. Entity declarations and notations are not made available. Entity reference expansions and default attribute additions do not occur. ### Parameters `qualifiedName` The qualified name of the document type to create. `publicId` The external subset public identifier. `systemId` The external subset system identifier. ### Return Values A new [DOMDocumentType](class.domdocumenttype) node with its `ownerDocument` set to **`null`**. ### Errors/Exceptions **`DOM_NAMESPACE_ERR`** Raised if there is an error with the namespace, as determined by `qualifiedName`. Prior to PHP 8.0.0 this method *could* be called statically, but would issue an **`E_DEPRECATED`** error. As of PHP 8.0.0 calling this method statically throws an [Error](class.error) exception ### Examples **Example #1 Creating a document with an attached DTD** ``` <?php // Creates an instance of the DOMImplementation class $imp = new DOMImplementation; // Creates a DOMDocumentType instance $dtd = $imp->createDocumentType('graph', '', 'graph.dtd'); // Creates a DOMDocument instance $dom = $imp->createDocument("", "", $dtd); // Set other properties $dom->encoding = 'UTF-8'; $dom->standalone = false; // Create an empty element $element = $dom->createElement('graph'); // Append the element $dom->appendChild($element); // Retrieve and print the document echo $dom->saveXML(); ?> ``` The above example will output: ``` <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE graph SYSTEM "graph.dtd"> <graph/> ``` ### See Also * [DOMImplementation::createDocument()](domimplementation.createdocument) - Creates a DOMDocument object of the specified type with its document element php Stomp::readFrame Stomp::readFrame ================ stomp\_read\_frame ================== (PECL stomp >= 0.1.0) Stomp::readFrame -- stomp\_read\_frame — Reads the next frame ### Description Object-oriented style (method): ``` public Stomp::readFrame(string $class_name = "stompFrame"): stompframe ``` Procedural style: ``` stomp_read_frame(resource $link): array ``` Reads the next frame. It is possible to instantiate an object of a specific class, and pass parameters to that class's constructor. ### Parameters `link` Procedural style only: The stomp link identifier returned by [stomp\_connect()](stomp.construct). `class_name` The name of the class to instantiate. If not specified, a stompFrame object is returned. ### Return Values > > **Note**: > > > A transaction header may be specified, indicating that the message acknowledgment should be part of the named transaction. > > > ### Changelog | Version | Description | | --- | --- | | Stomp 0.4.0 | `class_name` parameter was added. | ### Examples **Example #1 Object-oriented style** ``` <?php /* connection */ try {     $stomp = new Stomp('tcp://localhost:61613'); } catch(StompException $e) {     die('Connection failed: ' . $e->getMessage()); } /* subscribe to messages from the queue 'foo' */ $stomp->subscribe('/queue/foo'); /* read a frame */ var_dump($stomp->readFrame()); /* close connection */ unset($stomp); ?> ``` The above example will output something similar to: ``` object(StompFrame)#2 (3) { ["command"]=> string(7) "MESSAGE" ["headers"]=> array(5) { ["message-id"]=> string(41) "ID:php.net-55293-1257226743606-4:2:-1:1:1" ["destination"]=> string(10) "/queue/foo" ["timestamp"]=> string(13) "1257226805828" ["expires"]=> string(1) "0" ["priority"]=> string(1) "0" } ["body"]=> string(3) "bar" } ``` **Example #2 Procedural style** ``` <?php /* connection */ $link = stomp_connect('ssl://localhost:61612'); /* check connection */ if (!$link) {     die('Connection failed: ' . stomp_connect_error()); } /* subscribe to messages from the queue 'foo' */ stomp_subscribe($link, '/queue/foo'); /* read a frame */ $frame = stomp_read_frame($link); /* close connection */ stomp_close($link); ?> ``` The above example will output something similar to: ``` array(3) { ["command"]=> string(7) "MESSAGE" ["body"]=> string(3) "bar" ["headers"]=> array(6) { ["transaction"]=> string(2) "t1" ["message-id"]=> string(41) "ID:php.net-55293-1257226743606-4:3:-1:1:1" ["destination"]=> string(10) "/queue/foo" ["timestamp"]=> string(13) "1257227037059" ["expires"]=> string(1) "0" ["priority"]=> string(1) "0" } } ```
programming_docs
php ReflectionClass::newInstanceWithoutConstructor ReflectionClass::newInstanceWithoutConstructor ============================================== (PHP 5 >= 5.4.0, PHP 7, PHP 8) ReflectionClass::newInstanceWithoutConstructor — Creates a new class instance without invoking the constructor ### Description ``` public ReflectionClass::newInstanceWithoutConstructor(): object ``` Creates a new instance of the class without invoking the constructor. ### Parameters ### Return Values ### Errors/Exceptions A [ReflectionException](class.reflectionexception) if the class is an internal class that cannot be instantiated without invoking the constructor. This exception is limited only to internal classes that are [final](language.oop5.final). ### See Also * [ReflectionClass::newInstance()](reflectionclass.newinstance) - Creates a new class instance from given arguments * [ReflectionClass::newInstanceArgs()](reflectionclass.newinstanceargs) - Creates a new class instance from given arguments php GearmanClient::addTaskStatus GearmanClient::addTaskStatus ============================ (PECL gearman >= 0.5.0) GearmanClient::addTaskStatus — Add a task to get status ### Description ``` public GearmanClient::addTaskStatus(string $job_handle, string &$context = ?): GearmanTask ``` Used to request status information from the Gearman server, which will call the specified status callback (set using [GearmanClient::setStatusCallback()](gearmanclient.setstatuscallback)). ### Parameters `job_handle` The job handle for the task to get status for `context` Data to be passed to the status callback, generally a reference to an array or object ### Return Values A [GearmanTask](class.gearmantask) object. ### Examples **Example #1 Monitor completion of multiple background tasks** An artificial delay is introduced in the worker in this example to simulate a long running process. There is only one worker running for this example. ``` <?php /* create our object */ $gmclient= new GearmanClient(); /* add the default server */ $gmclient->addServer(); /* start some background jobs and save the handles */ $handles = array(); $handles[0] = $gmclient->doBackground("reverse", "Hello World!"); $handles[1] = $gmclient->doBackground("reverse", "!dlroW olleH"); $gmclient->setStatusCallback("reverse_status"); /* Poll the server to see when those background jobs finish; */ /* a better method would be to use event callbacks */ do {    /* Use the context variable to track how many tasks have completed */    $done = 0;    $gmclient->addTaskStatus($handles[0], &$done);    $gmclient->addTaskStatus($handles[1], &$done);    $gmclient->runTasks();    echo "Done: $done\n";    sleep(1); } while ($done != 2); function reverse_status($task, $done) {    if (!$task->isKnown())       $done++; } ?> ``` The above example will output something similar to: ``` Done: 0 Done: 0 Done: 0 Done: 0 Done: 0 Done: 0 Done: 0 Done: 0 Done: 0 Done: 0 Done: 0 Done: 0 Done: 1 Done: 1 Done: 1 Done: 1 Done: 1 Done: 1 Done: 1 Done: 1 Done: 1 Done: 1 Done: 1 Done: 1 Done: 2 ``` ### See Also * [GearmanClient::setStatusCallback()](gearmanclient.setstatuscallback) - Set a callback for collecting task status php textdomain textdomain ========== (PHP 4, PHP 5, PHP 7, PHP 8) textdomain — Sets the default domain ### Description ``` textdomain(?string $domain): string ``` This function sets the domain to search within when calls are made to [gettext()](function.gettext), usually the named after an application. ### Parameters `domain` The new message domain, or **`null`** to get the current setting without changing it ### Return Values If successful, this function returns the current message domain, after possibly changing it. ### Notes > > **Note**: > > > The **textdomain()** information is maintained per process, not per thread. > > php Exception::getPrevious Exception::getPrevious ====================== (PHP 5 >= 5.3.0, PHP 7, PHP 8) Exception::getPrevious — Returns previous Throwable ### Description ``` final public Exception::getPrevious(): ?Throwable ``` Returns previous [Throwable](class.throwable) (which had been passed as the third parameter of [Exception::\_\_construct()](exception.construct)). ### Parameters This function has no parameters. ### Return Values Returns the previous [Throwable](class.throwable) if available or **`null`** otherwise. ### Examples **Example #1 **Exception::getPrevious()** example** Looping over, and printing out, exception trace. ``` <?php class MyCustomException extends Exception {} function doStuff() {     try {         throw new InvalidArgumentException("You are doing it wrong!", 112);     } catch(Exception $e) {         throw new MyCustomException("Something happened", 911, $e);     } } try {     doStuff(); } catch(Exception $e) {     do {         printf("%s:%d %s (%d) [%s]\n", $e->getFile(), $e->getLine(), $e->getMessage(), $e->getCode(), get_class($e));     } while($e = $e->getPrevious()); } ?> ``` The above example will output something similar to: ``` /home/bjori/ex.php:8 Something happened (911) [MyCustomException] /home/bjori/ex.php:6 You are doing it wrong! (112) [InvalidArgumentException] ``` ### See Also * [Throwable::getPrevious()](throwable.getprevious) - Returns the previous Throwable php stats_cdf_laplace stats\_cdf\_laplace =================== (PECL stats >= 1.0.0) stats\_cdf\_laplace — Calculates any one parameter of the Laplace distribution given values for the others ### Description ``` stats_cdf_laplace( float $par1, float $par2, float $par3, int $which ): float ``` Returns the cumulative distribution function, its inverse, or one of its parameters, of the Laplace distribution. The kind of the return value and parameters (`par1`, `par2`, and `par3`) are determined by `which`. The following table lists the return value and parameters by `which`. CDF, x, mu, and b denotes cumulative distribution function, the value of the random variable, and the location and the scale parameter of the Laplace distribution, respectively. **Return value and parameters**| `which` | Return value | `par1` | `par2` | `par3` | | --- | --- | --- | --- | --- | | 1 | CDF | x | mu | b | | 2 | x | CDF | mu | b | | 3 | mu | x | CDF | b | | 4 | b | x | CDF | mu | ### Parameters `par1` The first parameter `par2` The second parameter `par3` The third parameter `which` The flag to determine what to be calculated ### Return Values Returns CDF, x, mu, or b, determined by `which`. php ignore_user_abort ignore\_user\_abort =================== (PHP 4, PHP 5, PHP 7, PHP 8) ignore\_user\_abort — Set whether a client disconnect should abort script execution ### Description ``` ignore_user_abort(?bool $enable = null): int ``` Sets whether a client disconnect should cause a script to be aborted. When running PHP as a command line script, and the script's tty goes away without the script being terminated then the script will die the next time it tries to write anything, unless `enable` is set to **`true`** ### Parameters `enable` If set and not **`null`**, this function will set the [ignore\_user\_abort](https://www.php.net/manual/en/misc.configuration.php#ini.ignore-user-abort) ini setting to the given `enable`. Otherwise, this function will only return the previous setting without changing it. ### Return Values Returns the previous setting, as an integer. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | `enable` is nullable now. | ### Examples **Example #1 A **ignore\_user\_abort()** example** ``` <?php // Ignore user aborts and allow the script // to run forever ignore_user_abort(true); set_time_limit(0); echo 'Testing connection handling in PHP'; // Run a pointless loop that sometime  // hopefully will make us click away from  // page or click the "Stop" button. while(1) {     // Did the connection fail?     if(connection_status() != CONNECTION_NORMAL)     {         break;     }     // Sleep for 10 seconds     sleep(10); } // If this is reached, then the 'break'  // was triggered from inside the while loop // So here we can log, or perform any other tasks // we need without actually being dependent on the  // browser. ?> ``` ### Notes PHP will not detect that the user has aborted the connection until an attempt is made to send information to the client. Simply using an echo statement does not guarantee that information is sent, see [flush()](function.flush). ### See Also * [connection\_aborted()](function.connection-aborted) - Check whether client disconnected * [connection\_status()](function.connection-status) - Returns connection status bitfield * [Connection Handling](https://www.php.net/manual/en/features.connection-handling.php) for a complete description of connection handling in PHP. php session_save_path session\_save\_path =================== (PHP 4, PHP 5, PHP 7, PHP 8) session\_save\_path — Get and/or set the current session save path ### Description ``` session_save_path(?string $path = null): string|false ``` **session\_save\_path()** returns the path of the current directory used to save session data. ### Parameters `path` Session data path. If specified and not **`null`**, the path to which data is saved will be changed. **session\_save\_path()** needs to be called before [session\_start()](function.session-start) for that purpose. > > **Note**: > > > On some operating systems, you may want to specify a path on a filesystem that handles lots of small files efficiently. For example, on Linux, reiserfs may provide better performance than ext2fs. > > ### Return Values Returns the path of the current directory used for data storage, or **`false`** on failure. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | `path` is nullable now. | ### See Also * The [session.save\_path](https://www.php.net/manual/en/session.configuration.php#ini.session.save-path) configuration directive php shuffle shuffle ======= (PHP 4, PHP 5, PHP 7, PHP 8) shuffle — Shuffle an array ### Description ``` shuffle(array &$array): bool ``` This function shuffles (randomizes the order of the elements in) an array. **Caution** This function does not generate cryptographically secure values, and *must not* be used for cryptographic purposes, or purposes that require returned values to be unguessable. If cryptographically secure randomness is required, the [Random\Randomizer](https://www.php.net/manual/en/class.random-randomizer.php) may be used with the [Random\Engine\Secure](https://www.php.net/manual/en/class.random-engine-secure.php) engine. For simple use cases, the [random\_int()](https://www.php.net/manual/en/function.random-int.php) and [random\_bytes()](https://www.php.net/manual/en/function.random-bytes.php) functions provide a convenient and secure API that is backed by the operating system’s CSPRNG. ### Parameters `array` The array. ### Return Values Returns **`true`** on success or **`false`** on failure. ### Changelog | Version | Description | | --- | --- | | 7.1.0 | The internal randomization algorithm [has been changed](https://www.php.net/manual/en/migration71.incompatible.php#migration71.incompatible.rand-srand-aliases) to use the [» Mersenne Twister](http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html) Random Number Generator instead of the libc rand function. | ### Examples **Example #1 **shuffle()** example** ``` <?php $numbers = range(1, 20); shuffle($numbers); foreach ($numbers as $number) {     echo "$number "; } ?> ``` ### Notes > **Note**: This function assigns new keys to the elements in `array`. It will remove any existing keys that may have been assigned, rather than just reordering the keys. > > > > **Note**: > > > Resets array's internal pointer to the first element. > > ### See Also * [Random\Randomizer::shuffleArray()](https://www.php.net/manual/en/random-randomizer.shufflearray.php) - Get a permutation of an array * [Random\Randomizer::shuffleBytes()](https://www.php.net/manual/en/random-randomizer.shufflebytes.php) - Get a byte-wise permutation of a string * [Random\Randomizer::pickArrayKeys()](https://www.php.net/manual/en/random-randomizer.pickarraykeys.php) - Select random array keys * The [comparison of array sorting functions](https://www.php.net/manual/en/array.sorting.php) php EventBufferEvent::disable EventBufferEvent::disable ========================= (PECL event >= 1.2.6-beta) EventBufferEvent::disable — Disable events read, write, or both on a buffer event ### Description ``` public EventBufferEvent::disable( int $events ): bool ``` Disable events **`Event::READ`** , **`Event::WRITE`** , or **`Event::READ`** `|` **`Event::WRITE`** on a buffer event. ### Parameters `events` ### Return Values Returns **`true`** on success or **`false`** on failure. ### See Also * [EventBufferEvent::enable()](eventbufferevent.enable) - Enable events read, write, or both on a buffer event php IntlTimeZone::createTimeZoneIDEnumeration IntlTimeZone::createTimeZoneIDEnumeration ========================================= intltz\_create\_time\_zone\_id\_enumeration =========================================== (PHP 5 >= 5.5.0, PHP 7, PHP 8) IntlTimeZone::createTimeZoneIDEnumeration -- intltz\_create\_time\_zone\_id\_enumeration — Get an enumeration over system time zone IDs with the given filter conditions ### Description Object-oriented style (method): ``` public static IntlTimeZone::createTimeZoneIDEnumeration(int $type, ?string $region = null, ?int $rawOffset = null): IntlIterator|false ``` Procedural style: ``` intltz_create_time_zone_id_enumeration(int $type, ?string $region = null, ?int $rawOffset = null): IntlIterator|false ``` **Warning**This function is currently not documented; only its argument list is available. ### Parameters `type` `region` `rawOffset` ### Return Values Returns [IntlIterator](class.intliterator) or **`false`** on failure. php Ds\PriorityQueue::pop Ds\PriorityQueue::pop ===================== (PECL ds >= 1.0.0) Ds\PriorityQueue::pop — Removes and returns the value with the highest priority ### Description ``` public Ds\PriorityQueue::pop(): mixed ``` Removes and returns the value at the front of the queue, ie. the value with the highest priority. > > **Note**: > > > Values with equal priority fall back to FIFO (first in first out). > > ### Parameters This function has no parameters. ### Return Values The removed value which was at the front of the queue. ### Errors/Exceptions [UnderflowException](class.underflowexception) if empty. ### Examples **Example #1 **Ds\PriorityQueue::pop()** example** ``` <?php $queue = new \Ds\PriorityQueue(); $queue->push("a",  5); $queue->push("b", 15); $queue->push("c", 10); print_r($queue->pop()); print_r($queue->pop()); print_r($queue->pop()); ?> ``` The above example will output something similar to: ``` string(1) "a" string(1) "b" string(1) "c" ``` php The Yaf_Plugin_Abstract class The Yaf\_Plugin\_Abstract class =============================== Introduction ------------ (Yaf >=1.0.0) Plugins allow for easy extensibility and customization of the framework. Plugins are classes. The actual class definition will vary based on the component -- you may need to implement this interface, but the fact remains that the plugin is itself a class. A plugin could be loaded into Yaf by using [Yaf\_Dispatcher::registerPlugin()](yaf-dispatcher.registerplugin), after registering, All the methods which the plugin implemented according to this interface, will be called at the proper time. Examples -------- **Example #1 Plugin example** ``` <?php    /* bootstrap class should be defined under ./application/Bootstrap.php */    class Bootstrap extends Yaf_Bootstrap_Abstract {         public function _initPlugin(Yaf_Dispatcher $dispatcher) {             /* register a plugin */             $dispatcher->registerPlugin(new TestPlugin());         }    }    /* plugin class should be placed under ./application/plugins/ */    class TestPlugin extends Yaf_Plugin_Abstract {         public function routerStartup(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response) {             /* before router                 in this hook,  user can do some url rewrite */             var_dump("routerStartup");         }         public function routerShutdown(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response) {             /* router complete                 in this hook, user can do login check */             var_dump("routerShutdown");         }         public function dispatchLoopStartup(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response) {             var_dump("dispatchLoopStartup");         }         public function preDispatch(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response) {             var_dump("preDispatch");         }         public function postDispatch(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response) {             var_dump("postDispatch");         }         public function dispatchLoopShutdown(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response) {             /* final hook                in this hook user can do logging or implement layout */             var_dump("dispatchLoopShutdown");         }    }    Class IndexController extends Yaf_Controller_Abstract {         public function indexAction() {             return FALSE; //prevent rendering         }    }    $config = array(        "application" => array(            "directory" => dirname(__FILE__) . "/application/",        ),    );      $app = new Yaf_Application($config);    $app->bootstrap()->run(); ?> ``` The above example will output something similar to: ``` string(13) "routerStartup" string(14) "routerShutdown" string(19) "dispatchLoopStartup" string(11) "preDispatch" string(12) "postDispatch" string(20) "dispatchLoopShutdown" ``` Class synopsis -------------- class **Yaf\_Plugin\_Abstract** { /\* Methods \*/ ``` public dispatchLoopShutdown(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response): void ``` ``` public dispatchLoopStartup(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response): void ``` ``` public postDispatch(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response): void ``` ``` public preDispatch(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response): void ``` ``` public preResponse(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response): void ``` ``` public routerShutdown(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response): void ``` ``` public routerStartup(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response): void ``` } Table of Contents ----------------- * [Yaf\_Plugin\_Abstract::dispatchLoopShutdown](yaf-plugin-abstract.dispatchloopshutdown) — The dispatchLoopShutdown purpose * [Yaf\_Plugin\_Abstract::dispatchLoopStartup](yaf-plugin-abstract.dispatchloopstartup) — Hook before dispatch loop * [Yaf\_Plugin\_Abstract::postDispatch](yaf-plugin-abstract.postdispatch) — The postDispatch purpose * [Yaf\_Plugin\_Abstract::preDispatch](yaf-plugin-abstract.predispatch) — The preDispatch purpose * [Yaf\_Plugin\_Abstract::preResponse](yaf-plugin-abstract.preresponse) — The preResponse purpose * [Yaf\_Plugin\_Abstract::routerShutdown](yaf-plugin-abstract.routershutdown) — The routerShutdown purpose * [Yaf\_Plugin\_Abstract::routerStartup](yaf-plugin-abstract.routerstartup) — RouterStartup hook
programming_docs
php Yaf_Route_Simple::assemble Yaf\_Route\_Simple::assemble ============================ (Yaf >=2.3.0) Yaf\_Route\_Simple::assemble — Assemble a url ### Description ``` public Yaf_Route_Simple::assemble(array $info, array $query = ?): string ``` Assemble a url. ### Parameters `info` `query` ### Return Values Returns a string. ### Errors/Exceptions Throws [Yaf\_Exception\_TypeError](class.yaf-exception-typeerror) if `info` keys `':c'` or `':a'` are not set. ### Examples **Example #1 **Yaf\_Route\_Simple::assemble()**example** ``` <?php $router = new Yaf_Router(); $route  = new Yaf_Route_Simple('m', 'c', 'a'); $router->addRoute("simple", $route); var_dump($router->getRoute('simple')->assemble(             array(                 ':a' => 'yafaction',                 'tkey' => 'tval',                 ':c' => 'yafcontroller',                 ':m' => 'yafmodule'                 ),             array(                 'tkey1' => 'tval1',                 'tkey2' => 'tval2'                 )             )); ``` The above example will output something similar to: ``` string(64) "?m=yafmodule&c=yafcontroller&a=yafaction&tkey1=tval1&tkey2=tval2" ``` php Parle\RParser::nonassoc Parle\RParser::nonassoc ======================= (PECL parle >= 0.7.0) Parle\RParser::nonassoc — Declare a token with no associativity ### Description ``` public Parle\RParser::nonassoc(string $tok): void ``` Declare a terminal, that cannot appear more than once in the row. ### Parameters `tok` Token name. ### Return Values No value is returned. php SplPriorityQueue::recoverFromCorruption SplPriorityQueue::recoverFromCorruption ======================================= (PHP 5 >= 5.3.0, PHP 7, PHP 8) SplPriorityQueue::recoverFromCorruption — Recover from the corrupted state and allow further actions on the queue ### Description ``` public SplPriorityQueue::recoverFromCorruption(): bool ``` ### Parameters This function has no parameters. ### Return Values Always returns **`true`**. php openssl_get_publickey openssl\_get\_publickey ======================= (PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8) openssl\_get\_publickey — Alias of [openssl\_pkey\_get\_public()](function.openssl-pkey-get-public) ### Description This function is an alias of: [openssl\_pkey\_get\_public()](function.openssl-pkey-get-public). php gc_status gc\_status ========== (PHP 7 >= 7.3.0, PHP 8) gc\_status — Gets information about the garbage collector ### Description ``` gc_status(): array ``` Gets information about the current state of the garbage collector. ### Parameters This function has no parameters. ### Return Values Returns an associative array with the following elements: * `"runs"` * `"collected"` * `"threshold"` * `"roots"` ### Examples **Example #1 **gc\_status()** Usage** ``` <?php // create object tree that needs gc collection $a = new stdClass(); $a->b = []; for ($i = 0; $i < 100000; $i++) {     $b = new stdClass();     $b->a = $a;     $a->b[] = $b; } unset($a); unset($b); gc_collect_cycles(); var_dump(gc_status()); ``` The above example will output something similar to: ``` array(4) { ["runs"]=> int(5) ["collected"]=> int(100002) ["threshold"]=> int(50001) ["roots"]=> int(0) } ``` ### See Also * [Garbage Collection](https://www.php.net/manual/en/features.gc.php) php sodium_crypto_core_ristretto255_scalar_sub sodium\_crypto\_core\_ristretto255\_scalar\_sub =============================================== (PHP 8 >= 8.1.0) sodium\_crypto\_core\_ristretto255\_scalar\_sub — Subtracts a scalar value ### Description ``` sodium_crypto_core_ristretto255_scalar_sub(string $x, string $y): string ``` Subtracts a scalar `y` from `x`. Available as of libsodium 1.0.18. **Warning**This function is currently not documented; only its argument list is available. ### Parameters `x` Scalar, representing the X coordinate. `y` Scalar, representing the Y coordinate. ### Return Values Returns a 32-byte random string. ### Examples **Example #1 **sodium\_crypto\_core\_ristretto255\_scalar\_sub()** example** ``` <?php $foo = sodium_crypto_core_ristretto255_scalar_random(); $bar = sodium_crypto_core_ristretto255_scalar_random(); $value = sodium_crypto_core_ristretto255_scalar_add($foo, $bar); $value = sodium_crypto_core_ristretto255_scalar_sub($value, $bar); var_dump(hash_equals($foo, $value)); ?> ``` The above example will output: ``` bool(true) ``` ### See Also * [sodium\_crypto\_core\_ristretto255\_scalar\_random()](function.sodium-crypto-core-ristretto255-scalar-random) - Generates a random key * [sodium\_crypto\_core\_ristretto255\_scalar\_add()](function.sodium-crypto-core-ristretto255-scalar-add) - Adds a scalar value php Yaf_Request_Http::get Yaf\_Request\_Http::get ======================= (Yaf >=1.0.0) Yaf\_Request\_Http::get — Retrieve variable from client ### Description ``` public Yaf_Request_Http::get(string $name, string $default = ?): mixed ``` Retrieve variable from client, this method will search the `name` in request pramas, if the name is not found, then will search in POST, GET, Cookie, Server ### Parameters `name` the variable name `default` if this parameter is provide, this will be returned if the varialbe can not be found ### Return Values ### See Also * [Yaf\_Request\_Http::getQuery()](yaf-request-http.getquery) - Fetch a query parameter * [Yaf\_Request\_Http::getPost()](yaf-request-http.getpost) - Retrieve POST variable * [Yaf\_Request\_Http::getCookie()](yaf-request-http.getcookie) - Retrieve Cookie variable * [Yaf\_Request\_Http::getRaw()](yaf-request-http.getraw) - Retrieve Raw request body * [Yaf\_Request\_Abstract::getServer()](yaf-request-abstract.getserver) - Retrieve SERVER variable * [Yaf\_Request\_Abstract::getParam()](yaf-request-abstract.getparam) - Retrieve calling parameter php date_diff date\_diff ========== (PHP 5 >= 5.3.0, PHP 7, PHP 8) date\_diff — Alias of [DateTime::diff()](datetime.diff) ### Description This function is an alias of: [DateTime::diff()](datetime.diff) php microtime microtime ========= (PHP 4, PHP 5, PHP 7, PHP 8) microtime — Return current Unix timestamp with microseconds ### Description ``` microtime(bool $as_float = false): string|float ``` **microtime()** returns the current Unix timestamp with microseconds. This function is only available on operating systems that support the gettimeofday() system call. For performance measurements, using [hrtime()](function.hrtime) is recommended. ### Parameters `as_float` If used and set to **`true`**, **microtime()** will return a float instead of a string, as described in the return values section below. ### Return Values By default, **microtime()** returns a string in the form "msec sec", where `sec` is the number of seconds since the Unix epoch (0:00:00 January 1,1970 GMT), and `msec` measures microseconds that have elapsed since `sec` and is also expressed in seconds as a decimal fraction. If `as_float` is set to **`true`**, then **microtime()** returns a float, which represents the current time in seconds since the Unix epoch accurate to the nearest microsecond. ### Examples **Example #1 Timing script execution** ``` <?php $time_start = microtime(true); // Sleep for a while usleep(100); $time_end = microtime(true); $time = $time_end - $time_start; echo "Did nothing in $time seconds\n"; ?> ``` **Example #2 **microtime()** and `REQUEST_TIME_FLOAT`** ``` <?php // Randomize sleeping time usleep(mt_rand(100, 10000)); // REQUEST_TIME_FLOAT is available in the $_SERVER superglobal array. // It contains the timestamp of the start of the request with microsecond precision. $time = microtime(true) - $_SERVER["REQUEST_TIME_FLOAT"]; echo "Did nothing in $time seconds\n"; ?> ``` ### See Also * [time()](function.time) - Return current Unix timestamp * [hrtime()](function.hrtime) - Get the system's high resolution time php mysqli_result::fetch_row mysqli\_result::fetch\_row ========================== mysqli\_fetch\_row ================== (PHP 5, PHP 7, PHP 8) mysqli\_result::fetch\_row -- mysqli\_fetch\_row — Fetch the next row of a result set as an enumerated array ### Description Object-oriented style ``` public mysqli_result::fetch_row(): array|null|false ``` Procedural style ``` mysqli_fetch_row(mysqli_result $result): array|null|false ``` Fetches one row of data from the result set and returns it as an enumerated array, where each column is stored in an array offset starting from 0 (zero). Each subsequent call to this function will return the next row within the result set, or **`null`** if there are no more rows. > **Note**: This function sets NULL fields to the PHP **`null`** value. > > ### Parameters `result` Procedural style only: A [mysqli\_result](class.mysqli-result) object returned by [mysqli\_query()](mysqli.query), [mysqli\_store\_result()](mysqli.store-result), [mysqli\_use\_result()](mysqli.use-result) or [mysqli\_stmt\_get\_result()](mysqli-stmt.get-result). ### Return Values Returns an enumerated array representing the fetched row, **`null`** if there are no more rows in the result set, or **`false`** on failure. ### Examples **Example #1 **mysqli\_result::fetch\_row()** example** Object-oriented style ``` <?php mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); $mysqli = new mysqli("localhost", "my_user", "my_password", "world"); $query = "SELECT Name, CountryCode FROM City ORDER BY ID DESC"; $result = $mysqli->query($query); /* fetch object array */ while ($row = $result->fetch_row()) {     printf("%s (%s)\n", $row[0], $row[1]); } ``` Procedural style ``` <?php mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); $mysqli = mysqli_connect("localhost", "my_user", "my_password", "world"); $query = "SELECT Name, CountryCode FROM City ORDER BY ID DESC"; $result = mysqli_query($mysqli, $query); /* fetch associative array */ while ($row = mysqli_fetch_row($result)) {     printf("%s (%s)\n", $row[0], $row[1]); } ``` The above examples will output something similar to: ``` Pueblo (USA) Arvada (USA) Cape Coral (USA) Green Bay (USA) Santa Clara (USA) ``` ### See Also * [mysqli\_fetch\_array()](mysqli-result.fetch-array) - Fetch the next row of a result set as an associative, a numeric array, or both * [mysqli\_fetch\_assoc()](mysqli-result.fetch-assoc) - Fetch the next row of a result set as an associative array * [mysqli\_fetch\_column()](mysqli-result.fetch-column) - Fetch a single column from the next row of a result set * [mysqli\_fetch\_object()](mysqli-result.fetch-object) - Fetch the next row of a result set as an object * [mysqli\_query()](mysqli.query) - Performs a query on the database * [mysqli\_data\_seek()](mysqli-result.data-seek) - Adjusts the result pointer to an arbitrary row in the result php Threaded::merge Threaded::merge =============== (PECL pthreads >= 2.0.0) Threaded::merge — Manipulation ### Description ``` public Threaded::merge(mixed $from, bool $overwrite = ?): bool ``` Merges data into the current object ### Parameters `from` The data to merge `overwrite` Overwrite existing keys, by default true ### Return Values Returns **`true`** on success or **`false`** on failure. ### Examples **Example #1 Merging into the property table of a threaded object** ``` <?php $array = []; while (count($array) < 10)     $array[] = count($array); $stdClass = new stdClass(); $stdClass->foo = "foo"; $stdClass->bar = "bar"; $stdClass->baz = "baz"; $safe = new Threaded(); $safe->merge($array); $safe->foo = "bar"; $safe->merge($stdClass, false); var_dump($safe); ?> ``` The above example will output: ``` object(Threaded)#2 (13) { ["0"]=> int(0) ["1"]=> int(1) ["2"]=> int(2) ["3"]=> int(3) ["4"]=> int(4) ["5"]=> int(5) ["6"]=> int(6) ["7"]=> int(7) ["8"]=> int(8) ["9"]=> int(9) ["foo"]=> string(3) "bar" ["bar"]=> string(3) "bar" ["baz"]=> string(3) "baz" } ``` php imap_utf8 imap\_utf8 ========== (PHP 4, PHP 5, PHP 7, PHP 8) imap\_utf8 — Converts MIME-encoded text to UTF-8 ### Description ``` imap_utf8(string $mime_encoded_text): string ``` Converts the given `mime_encoded_text` to UTF-8, if the declared charset is known to libc-client. Otherwise the given text is decoded, but not converted to UTF-8. ### Parameters `mime_encoded_text` A MIME encoded string. MIME encoding method and the UTF-8 specification are described in [» RFC2047](http://www.faqs.org/rfcs/rfc2047) and [» RFC2044](http://www.faqs.org/rfcs/rfc2044) respectively. ### Return Values Returns the decoded string, if possible converted to UTF-8. ### Examples **Example #1 Basic **imap\_utf8()** Usage** ``` <?php echo imap_utf8("Johannes =?ISO-8859-1?Q?Schl=FCter?="); ?> ``` The above example will output something similar to: ``` Johannes Schlüter ``` ### See Also * [imap\_mime\_header\_decode()](function.imap-mime-header-decode) - Decode MIME header elements php Fiber::suspend Fiber::suspend ============== (PHP 8 >= 8.1.0) Fiber::suspend — Suspends execution of the current fiber ### Description ``` public static Fiber::suspend(mixed $value = null): mixed ``` Suspends execution of the current fiber. The value provided to this method will be returned from the call to [Fiber::start()](fiber.start), [Fiber::resume()](fiber.resume), or [Fiber::throw()](fiber.throw) that switched execution into the current fiber. When the fiber is resumed, this method returns the value provided to [Fiber::resume()](fiber.resume). If the fiber is resumed using [Fiber::throw()](fiber.throw), the exception given to that method will be thrown from the call to this method. If this method is called from outside a fiber, a [FiberError](class.fibererror) will be thrown. ### Parameters `value` The value to return from the call to [Fiber::start()](fiber.start), [Fiber::resume()](fiber.resume), or [Fiber::throw()](fiber.throw) that switched execution into the current fiber. ### Return Values The value provided to [Fiber::resume()](fiber.resume). php PDO::beginTransaction PDO::beginTransaction ===================== (PHP 5 >= 5.1.0, PHP 7, PHP 8, PECL pdo >= 0.1.0) PDO::beginTransaction — Initiates a transaction ### Description ``` public PDO::beginTransaction(): bool ``` Turns off autocommit mode. While autocommit mode is turned off, changes made to the database via the PDO object instance are not committed until you end the transaction by calling [PDO::commit()](pdo.commit). Calling [PDO::rollBack()](pdo.rollback) will roll back all changes to the database and return the connection to autocommit mode. Some databases, including MySQL, automatically issue an implicit COMMIT when a database definition language (DDL) statement such as DROP TABLE or CREATE TABLE is issued within a transaction. The implicit COMMIT will prevent you from rolling back any other changes within the transaction boundary. ### Parameters This function has no parameters. ### Return Values Returns **`true`** on success or **`false`** on failure. ### Errors/Exceptions Throws a [PDOException](class.pdoexception) if there is already a transaction started or the driver does not support transactions. > **Note**: An exception is raised even when the **`PDO::ATTR_ERRMODE`** attribute is not **`PDO::ERRMODE_EXCEPTION`**. > > ### Examples **Example #1 Roll back a transaction** The following example begins a transaction and issues two statements that modify the database before rolling back the changes. On MySQL, however, the DROP TABLE statement automatically commits the transaction so that none of the changes in the transaction are rolled back. ``` <?php /* Begin a transaction, turning off autocommit */ $dbh->beginTransaction(); /* Change the database schema and data */ $sth = $dbh->exec("DROP TABLE fruit"); $sth = $dbh->exec("UPDATE dessert     SET name = 'hamburger'"); /* Recognize mistake and roll back changes */ $dbh->rollBack(); /* Database connection is now back in autocommit mode */ ?> ``` ### See Also * [PDO::commit()](pdo.commit) - Commits a transaction * [PDO::rollBack()](pdo.rollback) - Rolls back a transaction * [Transactions and auto-commit](https://www.php.net/manual/en/pdo.transactions.php) php SplFileObject::current SplFileObject::current ====================== (PHP 5 >= 5.1.0, PHP 7, PHP 8) SplFileObject::current — Retrieve current line of file ### Description ``` public SplFileObject::current(): string|array|false ``` Retrieves the current line of the file. ### Parameters This function has no parameters. ### Return Values Retrieves the current line of the file. If the **`SplFileObject::READ_CSV`** flag is set, this method returns an array containing the current line parsed as CSV data. If the end of the file is reached, **`false`** is returned. ### Examples **Example #1 **SplFileObject::current()** example** ``` <?php $file = new SplFileObject(__FILE__); foreach ($file as $k => $line) {    echo ($file->key() + 1) . ': ' . $file->current(); } ?> ``` The above example will output something similar to: ``` 1: <?php 2: $file = new SplFileObject(__FILE__); 3: foreach ($file as $line) { 4: echo ($file->key() + 1) . ': ' . $file->current(); 5: } 6: ?> ``` ### See Also * [SplFileObject::key()](splfileobject.key) - Get line number * [SplFileObject::seek()](splfileobject.seek) - Seek to specified line * [SplFileObject::next()](splfileobject.next) - Read next line * [SplFileObject::rewind()](splfileobject.rewind) - Rewind the file to the first line * [SplFileObject::valid()](splfileobject.valid) - Not at EOF php chgrp chgrp ===== (PHP 4, PHP 5, PHP 7, PHP 8) chgrp — Changes file group ### Description ``` chgrp(string $filename, string|int $group): bool ``` Attempts to change the group of the file `filename` to `group`. Only the superuser may change the group of a file arbitrarily; other users may change the group of a file to any group of which that user is a member. ### Parameters `filename` Path to the file. `group` A group name or number. ### Return Values Returns **`true`** on success or **`false`** on failure. ### Examples **Example #1 Changing a file's group** ``` <?php $filename = 'shared_file.txt'; $format = "%s's Group ID @ %s: %d\n"; printf($format, $filename, date('r'), filegroup($filename)); chgrp($filename, 8); clearstatcache(); // do not cache filegroup() results printf($format, $filename, date('r'), filegroup($filename)); ?> ``` ### Notes > **Note**: This function will not work on [remote files](https://www.php.net/manual/en/features.remote-files.php) as the file to be examined must be accessible via the server's filesystem. > > > **Note**: On Windows, this function fails silently when applied on a regular file. > > ### See Also * [chown()](function.chown) - Changes file owner * [chmod()](function.chmod) - Changes file mode php SplFileObject::getMaxLineLen SplFileObject::getMaxLineLen ============================ (PHP 5 >= 5.1.0, PHP 7, PHP 8) SplFileObject::getMaxLineLen — Get maximum line length ### Description ``` public SplFileObject::getMaxLineLen(): int ``` Gets the maximum line length as set by [SplFileObject::setMaxLineLen()](splfileobject.setmaxlinelen). ### Parameters This function has no parameters. ### Return Values Returns the maximum line length if one has been set with [SplFileObject::setMaxLineLen()](splfileobject.setmaxlinelen), default is `0`. ### Examples **Example #1 **SplFileObject::getMaxLineLen()** example** ``` <?php $file = new SplFileObject("file.txt"); var_dump($file->getMaxLineLen()); $file->setMaxLineLen(20); var_dump($file->getMaxLineLen()); ?> ``` The above example will output something similar to: ``` int(0) int(20) ``` ### See Also * [SplFileObject::setMaxLineLen()](splfileobject.setmaxlinelen) - Set maximum line length
programming_docs
php ReflectionExtension::getINIEntries ReflectionExtension::getINIEntries ================================== (PHP 5, PHP 7, PHP 8) ReflectionExtension::getINIEntries — Gets extension ini entries ### Description ``` public ReflectionExtension::getINIEntries(): array ``` Get the ini entries for an extension. ### Parameters This function has no parameters. ### Return Values An associative array with the ini entries as keys, with their defined values as values. ### Examples **Example #1 **ReflectionExtension::getINIEntries()** example** ``` <?php $ext = new ReflectionExtension('mysql'); print_r($ext->getINIEntries()); ?> ``` The above example will output something similar to: ``` Array ( [mysql.allow_persistent] => 1 [mysql.max_persistent] => -1 [mysql.max_links] => -1 [mysql.default_host] => [mysql.default_user] => [mysql.default_password] => [mysql.default_port] => [mysql.default_socket] => [mysql.connect_timeout] => 60 [mysql.trace_mode] => [mysql.allow_local_infile] => 1 [mysql.cache_size] => 2000 ) ``` ### See Also * [ini\_get\_all()](function.ini-get-all) - Gets all configuration options * [ReflectionExtension::getConstants()](reflectionextension.getconstants) - Gets constants php gnupg_seterrormode gnupg\_seterrormode =================== (PECL gnupg >= 0.6) gnupg\_seterrormode — Sets the mode for error\_reporting ### Description ``` gnupg_seterrormode(resource $identifier, int $errormode): void ``` Sets the mode for [error\_reporting](https://www.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting). ### Parameters `identifier` The gnupg identifier, from a call to [gnupg\_init()](function.gnupg-init) or **gnupg**. `errormode` The error mode. `errormode` takes a constant indicating what type of error\_reporting should be used. The possible values are **`GNUPG_ERROR_WARNING`**, **`GNUPG_ERROR_EXCEPTION`** and **`GNUPG_ERROR_SILENT`**. By default **`GNUPG_ERROR_SILENT`** is used. ### Return Values No value is returned. ### Examples **Example #1 Procedural **gnupg\_seterrormode()** example** ``` <?php $res = gnupg_init(); gnupg_seterrormode($res,GNUPG_ERROR_WARNING); // raise a PHP-Warning in case of an error ?> ``` **Example #2 OO **gnupg\_seterrormode()** example** ``` <?php $gpg = new gnupg(); $gpg->seterrormode(gnupg::ERROR_EXCEPTION); // throw an exception in case of an error ?> ``` php Zookeeper::getConfig Zookeeper::getConfig ==================== (PECL zookeeper >= 0.6.0, ZooKeeper >= 3.5.0) Zookeeper::getConfig — Get instance of ZookeeperConfig ### Description ``` public Zookeeper::getConfig(): ZookeeperConfig ``` ### Parameters This function has no parameters. ### Return Values Returns instance of [ZookeeperConfig](class.zookeeperconfig). ### See Also * [ZookeeperConfig](class.zookeeperconfig) php set_error_handler set\_error\_handler =================== (PHP 4 >= 4.0.1, PHP 5, PHP 7, PHP 8) set\_error\_handler — Sets a user-defined error handler function ### Description ``` set_error_handler(?callable $callback, int $error_levels = E_ALL): ?callable ``` Sets a user function (`callback`) to handle errors in a script. This function can be used for defining your own way of handling errors during runtime, for example in applications in which you need to do cleanup of data/files when a critical error happens, or when you need to trigger an error under certain conditions (using [trigger\_error()](function.trigger-error)). It is important to remember that the standard PHP error handler is completely bypassed for the error types specified by `error_levels` unless the callback function returns **`false`**. [error\_reporting()](function.error-reporting) settings will have no effect and your error handler will be called regardless - however you are still able to read the current value of [error\_reporting](https://www.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting) and act appropriately. Also note that it is your responsibility to [die()](function.die) if necessary. If the error-handler function returns, script execution will continue with the next statement after the one that caused an error. The following error types cannot be handled with a user defined function: **`E_ERROR`**, **`E_PARSE`**, **`E_CORE_ERROR`**, **`E_CORE_WARNING`**, **`E_COMPILE_ERROR`**, **`E_COMPILE_WARNING`** independent of where they were raised, and most of **`E_STRICT`** raised in the file where **set\_error\_handler()** is called. If errors occur before the script is executed (e.g. on file uploads) the custom error handler cannot be called since it is not registered at that time. ### Parameters `callback` If **`null`** is passed, the handler is reset to its default state. Otherwise, the handler is a callback with the following signature: ``` handler( int $errno, string $errstr, string $errfile = ?, int $errline = ?, array $errcontext = ? ): bool ``` `errno` The first parameter, `errno`, will be passed the level of the error raised, as an integer. `errstr` The second parameter, `errstr`, will be passed the error message, as a string. `errfile` If the callback accepts a third parameter, `errfile`, it will be passed the filename that the error was raised in, as a string. `errline` If the callback accepts a fourth parameter, `errline`, it will be passed the line number where the error was raised, as an integer. `errcontext` If the callback accepts a fifth parameter, `errcontext`, it will be passed an array that points to the active symbol table at the point the error occurred. In other words, `errcontext` will contain an array of every variable that existed in the scope the error was triggered in. User error handlers must not modify the error context. **Warning** This parameter has been *DEPRECATED* as of PHP 7.2.0, and *REMOVED* as of PHP 8.0.0. If your function defines this parameter without a default, an error of "too few arguments" will be raised when it is called. If the function returns **`false`** then the normal error handler continues. `error_levels` Can be used to mask the triggering of the `callback` function just like the [error\_reporting](https://www.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting) ini setting controls which errors are shown. Without this mask set the `callback` will be called for every error regardless to the setting of the [error\_reporting](https://www.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting) setting. ### Return Values Returns the previously defined error handler (if any). If the built-in error handler is used **`null`** is returned. If the previous error handler was a class method, this function will return an indexed array with the class and the method name. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | `errcontext` was removed, and will no longer be passed to user callbacks. | | 7.2.0 | `errcontext` became deprecated. Usage of this parameter now emits an **`E_DEPRECATED`** notice. | ### Examples **Example #1 Error handling with **set\_error\_handler()** and [trigger\_error()](function.trigger-error)** The example below shows the handling of internal exceptions by triggering errors and handling them with a user defined function: ``` <?php // error handler function function myErrorHandler($errno, $errstr, $errfile, $errline) {     if (!(error_reporting() & $errno)) {         // This error code is not included in error_reporting, so let it fall         // through to the standard PHP error handler         return false;     }     // $errstr may need to be escaped:     $errstr = htmlspecialchars($errstr);     switch ($errno) {     case E_USER_ERROR:         echo "<b>My ERROR</b> [$errno] $errstr<br />\n";         echo "  Fatal error on line $errline in file $errfile";         echo ", PHP " . PHP_VERSION . " (" . PHP_OS . ")<br />\n";         echo "Aborting...<br />\n";         exit(1);     case E_USER_WARNING:         echo "<b>My WARNING</b> [$errno] $errstr<br />\n";         break;     case E_USER_NOTICE:         echo "<b>My NOTICE</b> [$errno] $errstr<br />\n";         break;     default:         echo "Unknown error type: [$errno] $errstr<br />\n";         break;     }     /* Don't execute PHP internal error handler */     return true; } // function to test the error handling function scale_by_log($vect, $scale) {     if (!is_numeric($scale) || $scale <= 0) {         trigger_error("log(x) for x <= 0 is undefined, you used: scale = $scale", E_USER_ERROR);     }     if (!is_array($vect)) {         trigger_error("Incorrect input vector, array of values expected", E_USER_WARNING);         return null;     }     $temp = array();     foreach($vect as $pos => $value) {         if (!is_numeric($value)) {             trigger_error("Value at position $pos is not a number, using 0 (zero)", E_USER_NOTICE);             $value = 0;         }         $temp[$pos] = log($scale) * $value;     }     return $temp; } // set to the user defined error handler $old_error_handler = set_error_handler("myErrorHandler"); // trigger some errors, first define a mixed array with a non-numeric item echo "vector a\n"; $a = array(2, 3, "foo", 5.5, 43.3, 21.11); print_r($a); // now generate second array echo "----\nvector b - a notice (b = log(PI) * a)\n"; /* Value at position $pos is not a number, using 0 (zero) */ $b = scale_by_log($a, M_PI); print_r($b); // this is trouble, we pass a string instead of an array echo "----\nvector c - a warning\n"; /* Incorrect input vector, array of values expected */ $c = scale_by_log("not array", 2.3); var_dump($c); // NULL // this is a critical error, log of zero or negative number is undefined echo "----\nvector d - fatal error\n"; /* log(x) for x <= 0 is undefined, you used: scale = $scale" */ $d = scale_by_log($a, -2.5); var_dump($d); // Never reached ?> ``` The above example will output something similar to: ``` vector a Array ( [0] => 2 [1] => 3 [2] => foo [3] => 5.5 [4] => 43.3 [5] => 21.11 ) ---- vector b - a notice (b = log(PI) * a) <b>My NOTICE</b> [1024] Value at position 2 is not a number, using 0 (zero)<br /> Array ( [0] => 2.2894597716988 [1] => 3.4341896575482 [2] => 0 [3] => 6.2960143721717 [4] => 49.566804057279 [5] => 24.165247890281 ) ---- vector c - a warning <b>My WARNING</b> [512] Incorrect input vector, array of values expected<br /> NULL ---- vector d - fatal error <b>My ERROR</b> [256] log(x) for x <= 0 is undefined, you used: scale = -2.5<br /> Fatal error on line 35 in file trigger_error.php, PHP 5.2.1 (FreeBSD)<br /> Aborting...<br /> ``` ### See Also * [ErrorException](class.errorexception) * [error\_reporting()](function.error-reporting) - Sets which PHP errors are reported * [restore\_error\_handler()](function.restore-error-handler) - Restores the previous error handler function * [trigger\_error()](function.trigger-error) - Generates a user-level error/warning/notice message * [error level constants](https://www.php.net/manual/en/errorfunc.constants.php) php SolrQuery::setExpand SolrQuery::setExpand ==================== (PECL solr >= 2.2.0) SolrQuery::setExpand — Enables/Disables the Expand Component ### Description ``` public SolrQuery::setExpand(bool $value): SolrQuery ``` Enables/Disables the Expand Component. ### Parameters `value` Bool flag ### Return Values [SolrQuery](class.solrquery) ### Examples **Example #1 **SolrQuery::setExpand()** example** ``` <?php $query = new SolrQuery('lucene'); $query     ->setExpand(true)     ->setExpandRows(50)     ->setExpandQuery('text:product')     ->addExpandFilterQuery('manu:apple')     ->addExpandFilterQuery('inStock:true')     ->addExpandSortField('score', SolrQuery::ORDER_DESC)     ->addExpandSortField('title', SolrQuery::ORDER_ASC); echo $query.PHP_EOL; ?> ``` The above example will output something similar to: ``` q=lucene&expand=true&expand.rows=50&expand.q=text:product&expand.fq=manu:apple&expand.fq=inStock:true&expand.sort=score desc,title asc ``` ### See Also * [SolrQuery::addExpandSortField()](solrquery.addexpandsortfield) - Orders the documents within the expanded groups (expand.sort parameter) * [SolrQuery::removeExpandSortField()](solrquery.removeexpandsortfield) - Removes an expand sort field from the expand.sort parameter * [SolrQuery::setExpandRows()](solrquery.setexpandrows) - Sets the number of rows to display in each group (expand.rows). Server Default 5 * [SolrQuery::setExpandQuery()](solrquery.setexpandquery) - Sets the expand.q parameter * [SolrQuery::addExpandFilterQuery()](solrquery.addexpandfilterquery) - Overrides main filter query, determines which documents to include in the main group * [SolrQuery::removeExpandFilterQuery()](solrquery.removeexpandfilterquery) - Removes an expand filter query php QuickHashIntSet::saveToString QuickHashIntSet::saveToString ============================= (PECL quickhash >= Unknown) QuickHashIntSet::saveToString — This method returns a serialized version of the set ### Description ``` public QuickHashIntSet::saveToString(): string ``` This method returns a serialized version of the set in the same format that [QuickHashIntSet::loadFromString()](quickhashintset.loadfromstring) can read. ### Parameters This function has no parameters. ### Return Values This method returns a string containing a serialized format of the set. Each element is stored as a four byte value in the Endianness that the current system uses. ### Examples **Example #1 **QuickHashIntSet::saveToString()** example** ``` <?php $set = new QuickHashIntSet( 1024 ); var_dump( $set->exists( 4 ) ); var_dump( $set->add( 4 ) ); var_dump( $set->exists( 4 ) ); var_dump( $set->add( 4 ) ); var_dump( $set->saveToString() ); ?> ``` php V8Js::getPendingException V8Js::getPendingException ========================= (PECL v8js >= 0.1.0) V8Js::getPendingException — Return pending uncaught Javascript exception ### Description ``` public V8Js::getPendingException(): V8JsException ``` Returns any pending uncaught Javascript exception as [V8JsException](class.v8jsexception) left from earlier [V8Js::executeString()](v8js.executestring) call(s). ### Parameters This function has no parameters. ### Return Values Either [V8JsException](class.v8jsexception) or **`null`**. php Imagick::forwardFourierTransformImage Imagick::forwardFourierTransformImage ===================================== (PECL imagick 3 >= 3.3.0) Imagick::forwardFourierTransformImage — Description ### Description ``` public Imagick::forwardFourierTransformimage(bool $magnitude): bool ``` Implements the discrete Fourier transform (DFT) of the image either as a magnitude / phase or real / imaginary image pair. ### Parameters `magnitude` If true, return as magnitude / phase pair otherwise a real / imaginary image pair. ### Return Values Returns **`true`** on success. ### Examples **Example #1 **Imagick::forwardFourierTransformImage()**** ``` <?php //Utility function for forwardTransformImage function createMask() {     $draw = new \ImagickDraw();     $draw->setStrokeOpacity(0);     $draw->setStrokeColor('rgb(255, 255, 255)');     $draw->setFillColor('rgb(255, 255, 255)');     //Draw a circle on the y-axis, with it's centre     //at x, y that touches the origin     $draw->circle(250, 250, 220, 250);     $imagick = new \Imagick();     $imagick->newImage(512, 512, "black");     $imagick->drawImage($draw);     $imagick->gaussianBlurImage(20, 20);     $imagick->autoLevelImage();     return $imagick; } function forwardFourierTransformImage($imagePath) {     $imagick = new \Imagick(realpath($imagePath));     $imagick->resizeimage(512, 512, \Imagick::FILTER_LANCZOS, 1);     $mask = createMask();     $imagick->forwardFourierTransformImage(true);     @$imagick->setimageindex(0);     $magnitude = $imagick->getimage();     @$imagick->setimageindex(1);     $imagickPhase = $imagick->getimage();     if (true) {         $imagickPhase->compositeImage($mask, \Imagick::COMPOSITE_MULTIPLY, 0, 0);     }     if (false) {         $output = clone $imagickPhase;         $output->setimageformat('png');         header("Content-Type: image/png");         echo $output->getImageBlob();     }     $magnitude->inverseFourierTransformImage($imagickPhase, true);     $magnitude->setimageformat('png');     header("Content-Type: image/png");     echo $magnitude->getImageBlob(); } ?> ``` php pg_cancel_query pg\_cancel\_query ================= (PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8) pg\_cancel\_query — Cancel an asynchronous query ### Description ``` pg_cancel_query(PgSql\Connection $connection): bool ``` **pg\_cancel\_query()** cancels an asynchronous query sent with [pg\_send\_query()](function.pg-send-query), [pg\_send\_query\_params()](function.pg-send-query-params) or [pg\_send\_execute()](function.pg-send-execute). You cannot cancel a query executed using [pg\_query()](function.pg-query). ### Parameters `connection` An [PgSql\Connection](class.pgsql-connection) instance. ### Return Values Returns **`true`** on success or **`false`** on failure. ### Changelog | Version | Description | | --- | --- | | 8.1.0 | The `connection` parameter expects an [PgSql\Connection](class.pgsql-connection) instance now; previously, a [resource](language.types.resource) was expected. | ### Examples **Example #1 **pg\_cancel\_query()** example** ``` <?php   $dbconn = pg_connect("dbname=publisher") or die("Could not connect");   if (!pg_connection_busy($dbconn)) {       pg_send_query($dbconn, "select * from authors; select count(*) from authors;");   }      $res1 = pg_get_result($dbconn);   echo "First call to pg_get_result(): $res1\n";   $rows1 = pg_num_rows($res1);   echo "$res1 has $rows1 records\n\n";      // Cancel the currently running query.  Will be the second query if it is   // still running.   pg_cancel_query($dbconn); ?> ``` The above example will output: ``` First call to pg_get_result(): Resource id #3 Resource id #3 has 3 records ``` ### See Also * [pg\_send\_query()](function.pg-send-query) - Sends asynchronous query * [pg\_connection\_busy()](function.pg-connection-busy) - Get connection is busy or not php Yaf_View_Simple::getScriptPath Yaf\_View\_Simple::getScriptPath ================================ (Yaf >=1.0.0) Yaf\_View\_Simple::getScriptPath — Get templates directory ### Description ``` public Yaf_View_Simple::getScriptPath(): string ``` ### Parameters This function has no parameters. ### Return Values php sapi_windows_set_ctrl_handler sapi\_windows\_set\_ctrl\_handler ================================= (PHP 7 >= 7.4.0, PHP 8) sapi\_windows\_set\_ctrl\_handler — Set or remove a CTRL event handler ### Description ``` sapi_windows_set_ctrl_handler(?callable $handler, bool $add = true): bool ``` Sets or removes a `CTRL` event handler, which allows Windows CLI processes to intercept or ignore `CTRL+C` and `CTRL+BREAK` events. Note that in multithreaded environments, this is only possible when called from the main thread. ### Parameters `handler` A callback function to set or remove. If set, this function will be called whenever a `CTRL+C` or `CTRL+BREAK` event occurs. The function is supposed to have the following signature: ``` handler(int $event): void ``` `event` The `CTRL` event which has been received; either **`PHP_WINDOWS_EVENT_CTRL_C`** or **`PHP_WINDOWS_EVENT_CTRL_BREAK`**. Setting a **`null`** `handler` causes the process to ignore `CTRL+C` events, but not `CTRL+BREAK` events. `add` If **`true`**, the handler is set. If **`false`**, the handler is removed. ### Return Values Returns **`true`** on success or **`false`** on failure. ### Examples **Example #1 Basic **sapi\_windows\_set\_ctrl\_handler()** Usage** This example shows how to intercept `CTRL` events. ``` <?php function ctrl_handler(int $event) {     switch ($event) {         case PHP_WINDOWS_EVENT_CTRL_C:             echo "You have pressed CTRL+C\n";             break;         case PHP_WINDOWS_EVENT_CTRL_BREAK:             echo "You have pressed CTRL+BREAK\n";             break;     } } sapi_windows_set_ctrl_handler('ctrl_handler'); while (true); // infinite loop, so the handler can be triggered ?> ``` ### See Also * [sapi\_windows\_generate\_ctrl\_event()](function.sapi-windows-generate-ctrl-event) - Send a CTRL event to another process
programming_docs
php Yaf_View_Simple::assign Yaf\_View\_Simple::assign ========================= (Yaf >=1.0.0) Yaf\_View\_Simple::assign — Assign values ### Description ``` public Yaf_View_Simple::assign(string $name, mixed $value = ?): bool ``` assign variable to view engine ### Parameters `name` A string or an array. if is string, then the next argument $value is required. `value` mixed value ### Return Values ### Examples **Example #1 **Yaf\_View\_Simple::assign()**example** ``` <?php class IndexController extends Yaf_Controller_Abstract {     public function indexAction() {         $this->getView()->assign("foo", "bar");         $this->_view->assign( array( "key" => "value", "name" => "value"));     } } ?> ``` **Example #2 **template()**example** ``` <html>  <head>   <title><?php echo $foo; ?></title>  </head>   <body>   <?php      foreach ($this->_tpl_vars as $name => $value) {          echo $$name; // or echo $this->_tpl_vars[$name];     }   ?> </body> </html> ``` ### See Also * [Yaf\_View\_Simple::assignRef()](yaf-view-simple.assignref) - The assignRef purpose * **Yaf\_View\_Interface::clear()** * [Yaf\_View\_Simple::\_\_set()](yaf-view-simple.set) - Set value to engine php SolrQuery::getFacetMissing SolrQuery::getFacetMissing ========================== (PECL solr >= 0.9.2) SolrQuery::getFacetMissing — Returns the current state of the facet.missing parameter ### Description ``` public SolrQuery::getFacetMissing(string $field_override = ?): bool ``` Returns the current state of the facet.missing parameter. This accepts an optional field override ### Parameters `field_override` The name of the field ### Return Values Returns a boolean on success and **`null`** if not set php GearmanTask::dataSize GearmanTask::dataSize ===================== (PECL gearman >= 0.5.0) GearmanTask::dataSize — Get the size of returned data ### Description ``` public GearmanTask::dataSize(): int ``` Returns the size of the data being returned for a task. ### Parameters This function has no parameters. ### Return Values The data size, or **`false`** if there is no data. ### See Also * [GearmanTask::data()](gearmantask.data) - Get data returned for a task php spl_autoload_register spl\_autoload\_register ======================= (PHP 5 >= 5.1.0, PHP 7, PHP 8) spl\_autoload\_register — Register given function as \_\_autoload() implementation ### Description ``` spl_autoload_register(?callable $callback = null, bool $throw = true, bool $prepend = false): bool ``` Register a function with the spl provided \_\_autoload queue. If the queue is not yet activated it will be activated. If your code has an existing [\_\_autoload()](function.autoload) function then this function must be explicitly registered on the \_\_autoload queue. This is because **spl\_autoload\_register()** will effectively replace the engine cache for the [\_\_autoload()](function.autoload) function by either [spl\_autoload()](function.spl-autoload) or [spl\_autoload\_call()](function.spl-autoload-call). If there must be multiple autoload functions, **spl\_autoload\_register()** allows for this. It effectively creates a queue of autoload functions, and runs through each of them in the order they are defined. By contrast, [\_\_autoload()](function.autoload) may only be defined once. ### Parameters `callback` The autoload function being registered. If **`null`**, then the default implementation of [spl\_autoload()](function.spl-autoload) will be registered. ``` callback(string $class_name): void ``` `throw` This parameter specifies whether **spl\_autoload\_register()** should throw exceptions when the `callback` cannot be registered. `prepend` If true, **spl\_autoload\_register()** will prepend the autoloader on the autoload queue instead of appending it. ### Return Values Returns **`true`** on success or **`false`** on failure. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | `callback` is now nullable. | ### Examples **Example #1 **spl\_autoload\_register()** as a replacement for an [\_\_autoload()](function.autoload) function** ``` <?php // function __autoload($class) { //     include 'classes/' . $class . '.class.php'; // } function my_autoloader($class) {     include 'classes/' . $class . '.class.php'; } spl_autoload_register('my_autoloader'); // Or, using an anonymous function spl_autoload_register(function ($class) {     include 'classes/' . $class . '.class.php'; }); ?> ``` **Example #2 **spl\_autoload\_register()** example where the class is not loaded** ``` <?php namespace Foobar; class Foo {     static public function test($name) {         print '[['. $name .']]';     } } spl_autoload_register(__NAMESPACE__ .'\Foo::test'); new InexistentClass; ?> ``` The above example will output something similar to: ``` [[Foobar\InexistentClass]] Fatal error: Class 'Foobar\InexistentClass' not found in ... ``` ### See Also * [\_\_autoload()](function.autoload) - Attempt to load undefined class php fbird_errmsg fbird\_errmsg ============= (PHP 5, PHP 7 < 7.4.0) fbird\_errmsg — Alias of [ibase\_errmsg()](function.ibase-errmsg) ### Description This function is an alias of: [ibase\_errmsg()](function.ibase-errmsg). ### See Also * [fbird\_errcode()](function.fbird-errcode) - Alias of ibase\_errcode php xmlrpc_encode_request xmlrpc\_encode\_request ======================= (PHP 4 >= 4.1.0, PHP 5, PHP 7) xmlrpc\_encode\_request — Generates XML for a method request ### Description ``` xmlrpc_encode_request(string $method, mixed $params, array $output_options = ?): string ``` **Warning**This function is *EXPERIMENTAL*. The behaviour of this function, its name, and surrounding documentation may change without notice in a future release of PHP. This function should be used at your own risk. ### Parameters `method` Name of the method to call. `params` Method parameters compatible with method signature. `output_options` Array specifying output options may contain (default values are emphasised): * output\_type: php, *xml* * verbosity: no\_white\_space, newlines\_only, *pretty* * escaping: cdata, *non-ascii, non-print, markup* (may be a string with one value or an array with multiple values) * version: simple, *xmlrpc*, soap 1.1, auto * encoding: *iso-8859-1*, other character set supported by iconv ### Return Values Returns a string containing the XML representation of the request. ### Examples **Example #1 XMLRPC client functions example** ``` <?php $request = xmlrpc_encode_request("method", array(1, 2, 3)); $context = stream_context_create(array('http' => array(     'method' => "POST",     'header' => "Content-Type: text/xml",     'content' => $request ))); $file = file_get_contents("http://www.example.com/xmlrpc", false, $context); $response = xmlrpc_decode($file); if ($response && xmlrpc_is_fault($response)) {     trigger_error("xmlrpc: $response[faultString] ($response[faultCode])"); } else {     print_r($response); } ?> ``` ### See Also * [stream\_context\_create()](function.stream-context-create) - Creates a stream context * [file\_get\_contents()](function.file-get-contents) - Reads entire file into a string * [xmlrpc\_decode()](function.xmlrpc-decode) - Decodes XML into native PHP types php The DateTime class The DateTime class ================== Introduction ------------ (PHP 5 >= 5.2.0, PHP 7, PHP 8) Representation of date and time. This class behaves the same as [DateTimeImmutable](class.datetimeimmutable) except objects are modified itself when modification methods such as [DateTime::modify()](datetime.modify) are called. **Warning** Calling methods on objects of the class **DateTime** will change the information encapsulated in these objects, if you want to prevent that you will have to use `clone` operator to create a new object. Use [DateTimeImmutable](class.datetimeimmutable) instead of **DateTime** to obtain this recommended behaviour by default. Class synopsis -------------- class **DateTime** implements [DateTimeInterface](class.datetimeinterface) { /\* Inherited constants \*/ public const string [DateTimeInterface::ATOM](class.datetimeinterface#datetimeinterface.constants.atom) = "Y-m-d\\TH:i:sP"; public const string [DateTimeInterface::COOKIE](class.datetimeinterface#datetimeinterface.constants.cookie) = "l, d-M-Y H:i:s T"; public const string [DateTimeInterface::ISO8601](class.datetimeinterface#datetimeinterface.constants.iso8601) = "Y-m-d\\TH:i:sO"; public const string [DateTimeInterface::ISO8601\_EXPANDED](class.datetimeinterface#datetimeinterface.constants.iso8601-expanded) = "X-m-d\\TH:i:sP"; public const string [DateTimeInterface::RFC822](class.datetimeinterface#datetimeinterface.constants.rfc822) = "D, d M y H:i:s O"; public const string [DateTimeInterface::RFC850](class.datetimeinterface#datetimeinterface.constants.rfc850) = "l, d-M-y H:i:s T"; public const string [DateTimeInterface::RFC1036](class.datetimeinterface#datetimeinterface.constants.rfc1036) = "D, d M y H:i:s O"; public const string [DateTimeInterface::RFC1123](class.datetimeinterface#datetimeinterface.constants.rfc1123) = "D, d M Y H:i:s O"; public const string [DateTimeInterface::RFC7231](class.datetimeinterface#datetimeinterface.constants.rfc7231) = "D, d M Y H:i:s \\G\\M\\T"; public const string [DateTimeInterface::RFC2822](class.datetimeinterface#datetimeinterface.constants.rfc2822) = "D, d M Y H:i:s O"; public const string [DateTimeInterface::RFC3339](class.datetimeinterface#datetimeinterface.constants.rfc3339) = "Y-m-d\\TH:i:sP"; public const string [DateTimeInterface::RFC3339\_EXTENDED](class.datetimeinterface#datetimeinterface.constants.rfc3339-extended) = "Y-m-d\\TH:i:s.vP"; public const string [DateTimeInterface::RSS](class.datetimeinterface#datetimeinterface.constants.rss) = "D, d M Y H:i:s O"; public const string [DateTimeInterface::W3C](class.datetimeinterface#datetimeinterface.constants.w3c) = "Y-m-d\\TH:i:sP"; /\* Methods \*/ public [\_\_construct](datetime.construct)(string `$datetime` = "now", ?[DateTimeZone](class.datetimezone) `$timezone` = **`null`**) ``` public add(DateInterval $interval): DateTime ``` ``` public static createFromFormat(string $format, string $datetime, ?DateTimeZone $timezone = null): DateTime|false ``` ``` public static createFromImmutable(DateTimeImmutable $object): static ``` ``` public static createFromInterface(DateTimeInterface $object): DateTime ``` ``` public static getLastErrors(): array|false ``` ``` public modify(string $modifier): DateTime|false ``` ``` public static __set_state(array $array): DateTime ``` ``` public setDate(int $year, int $month, int $day): DateTime ``` ``` public setISODate(int $year, int $week, int $dayOfWeek = 1): DateTime ``` ``` public setTime( int $hour, int $minute, int $second = 0, int $microsecond = 0 ): DateTime ``` ``` public setTimestamp(int $timestamp): DateTime ``` ``` public setTimezone(DateTimeZone $timezone): DateTime ``` ``` public sub(DateInterval $interval): DateTime ``` ``` public diff(DateTimeInterface $targetObject, bool $absolute = false): DateInterval ``` ``` public format(string $format): string ``` ``` public getOffset(): int ``` ``` public getTimestamp(): int ``` ``` public getTimezone(): DateTimeZone|false ``` ``` public __wakeup(): void ``` } Changelog --------- | Version | Description | | --- | --- | | 7.2.0 | The class constants of **DateTime** are now defined on [DateTimeInterface](class.datetimeinterface). | | 7.1.0 | The **DateTime** constructor now includes the current microseconds in the constructed value. Before this, it would always initialise the microseconds to `0`. | Table of Contents ----------------- * [DateTime::add](datetime.add) — Modifies a DateTime object, with added amount of days, months, years, hours, minutes and seconds * [DateTime::\_\_construct](datetime.construct) — Returns new DateTime object * [DateTime::createFromFormat](datetime.createfromformat) — Parses a time string according to a specified format * [DateTime::createFromImmutable](datetime.createfromimmutable) — Returns new DateTime instance encapsulating the given DateTimeImmutable object * [DateTime::createFromInterface](datetime.createfrominterface) — Returns new DateTime object encapsulating the given DateTimeInterface object * [DateTime::getLastErrors](datetime.getlasterrors) — Returns the warnings and errors * [DateTime::modify](datetime.modify) — Alters the timestamp * [DateTime::\_\_set\_state](datetime.set-state) — The \_\_set\_state handler * [DateTime::setDate](datetime.setdate) — Sets the date * [DateTime::setISODate](datetime.setisodate) — Sets the ISO date * [DateTime::setTime](datetime.settime) — Sets the time * [DateTime::setTimestamp](datetime.settimestamp) — Sets the date and time based on an Unix timestamp * [DateTime::setTimezone](datetime.settimezone) — Sets the time zone for the DateTime object * [DateTime::sub](datetime.sub) — Subtracts an amount of days, months, years, hours, minutes and seconds from a DateTime object php QuickHashIntSet::delete QuickHashIntSet::delete ======================= (PECL quickhash >= Unknown) QuickHashIntSet::delete — This method deletes an entry from the set ### Description ``` public QuickHashIntSet::delete(int $key): bool ``` This method deletes an entry from the set, and returns whether the entry was deleted or not. Associated memory structures will not be freed immediately, but rather when the set itself is freed. ### Parameters `key` The key of the entry to delete. ### Return Values **`true`** when the entry was deleted, and **`false`** if the entry was not deleted. ### Examples **Example #1 **QuickHashIntSet::delete()** example** ``` <?php $set = new QuickHashIntSet( 1024 ); var_dump( $set->exists( 4 ) ); var_dump( $set->add( 4 ) ); var_dump( $set->delete( 4 ) ); var_dump( $set->exists( 4 ) ); var_dump( $set->delete( 4 ) ); ?> ``` The above example will output something similar to: ``` bool(false) bool(true) bool(true) bool(false) bool(false) ``` php gmp_strval gmp\_strval =========== (PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8) gmp\_strval — Convert GMP number to string ### Description ``` gmp_strval(GMP|int|string $num, int $base = 10): string ``` Convert GMP number to string representation in base `base`. The default base is 10. ### Parameters `num` The GMP number that will be converted to a string. A [GMP](class.gmp) object, an int or a numeric string. `base` The base of the returned number. The default base is 10. Allowed values for the base are from 2 to 62 and -2 to -36. ### Return Values The number, as a string. ### Examples **Example #1 Converting a GMP number to a string** ``` <?php $a = gmp_init("0x41682179fbf5"); printf("Decimal: %s, 36-based: %s", gmp_strval($a), gmp_strval($a,36)); ?> ``` php ReflectionMethod::getModifiers ReflectionMethod::getModifiers ============================== (PHP 5, PHP 7, PHP 8) ReflectionMethod::getModifiers — Gets the method modifiers ### Description ``` public ReflectionMethod::getModifiers(): int ``` Returns a bitfield of the access modifiers for this method. ### Parameters This function has no parameters. ### Return Values A numeric representation of the modifiers. The actual meaning of these modifiers are described under [predefined constants](class.reflectionmethod#reflectionmethod.constants.modifiers). ### Examples **Example #1 **ReflectionMethod::getModifiers()** example** ``` <?php class Testing {     final public static function foo()     {         return;     }     public function bar()     {         return;     } } $foo = new ReflectionMethod('Testing', 'foo'); echo "Modifiers for method foo():\n"; echo $foo->getModifiers() . "\n"; echo implode(' ', Reflection::getModifierNames($foo->getModifiers())) . "\n"; $bar = new ReflectionMethod('Testing', 'bar'); echo "Modifiers for method bar():\n"; echo $bar->getModifiers() . "\n"; echo implode(' ', Reflection::getModifierNames($bar->getModifiers())); ?> ``` The above example will output something similar to: ``` Modifiers for method foo(): 49 final public static Modifiers for method bar(): 1 public ``` ### See Also * [Reflection::getModifierNames()](reflection.getmodifiernames) - Gets modifier names php ReflectionClass::getAttributes ReflectionClass::getAttributes ============================== (PHP 8) ReflectionClass::getAttributes — Gets Attributes ### Description ``` public ReflectionClass::getAttributes(?string $name = null, int $flags = 0): array ``` Returns all attributes declared on this class as an array of [ReflectionAttribute](class.reflectionattribute). ### Parameters `name` Filter the results to include only [ReflectionAttribute](class.reflectionattribute) instances for attributes matching this class name. `flags` Flags for determining how to filter the results, if `name` is provided. Default is `0` which will only return results for attributes that are of the class `name`. The only other option available, is to use **`ReflectionAttribute::IS_INSTANCEOF`**, which will instead use `instanceof` for filtering. ### Return Values Array of attributes, as a [ReflectionAttribute](class.reflectionattribute) object. ### Examples **Example #1 Basic usage** ``` <?php #[Attribute] class Fruit { } #[Attribute] class Red { } #[Fruit] #[Red] class Apple { } $class = new ReflectionClass('Apple'); $attributes = $class->getAttributes(); print_r(array_map(fn($attribute) => $attribute->getName(), $attributes)); ?> ``` The above example will output: ``` Array ( [0] => Fruit [1] => Red ) ``` **Example #2 Filtering results by class name** ``` <?php #[Attribute] class Fruit { } #[Attribute] class Red { } #[Fruit] #[Red] class Apple { } $class = new ReflectionClass('Apple'); $attributes = $class->getAttributes('Fruit'); print_r(array_map(fn($attribute) => $attribute->getName(), $attributes)); ?> ``` The above example will output: ``` Array ( [0] => Fruit ) ``` **Example #3 Filtering results by class name, with inheritance** ``` <?php interface Color { } #[Attribute] class Fruit { } #[Attribute] class Red implements Color { } #[Fruit] #[Red] class Apple { } $class = new ReflectionClass('Apple'); $attributes = $class->getAttributes(Color::class, ReflectionAttribute::IS_INSTANCEOF); print_r(array_map(fn($attribute) => $attribute->getName(), $attributes)); ?> ``` The above example will output: ``` Array ( [0] => Red ) ``` ### See Also * [ReflectionClassConstant::getAttributes()](reflectionclassconstant.getattributes) - Gets Attributes * [ReflectionFunctionAbstract::getAttributes()](reflectionfunctionabstract.getattributes) - Gets Attributes * [ReflectionParameter::getAttributes()](reflectionparameter.getattributes) - Gets Attributes * [ReflectionProperty::getAttributes()](reflectionproperty.getattributes) - Gets Attributes php SolrQuery::removeExpandFilterQuery SolrQuery::removeExpandFilterQuery ================================== (PECL solr >= 2.2.0) SolrQuery::removeExpandFilterQuery — Removes an expand filter query ### Description ``` public SolrQuery::removeExpandFilterQuery(string $fq): SolrQuery ``` Removes an expand filter query. ### Parameters `fq` ### Return Values [SolrQuery](class.solrquery) ### See Also * [SolrQuery::setExpand()](solrquery.setexpand) - Enables/Disables the Expand Component * [SolrQuery::addExpandSortField()](solrquery.addexpandsortfield) - Orders the documents within the expanded groups (expand.sort parameter) * [SolrQuery::removeExpandSortField()](solrquery.removeexpandsortfield) - Removes an expand sort field from the expand.sort parameter * [SolrQuery::setExpandRows()](solrquery.setexpandrows) - Sets the number of rows to display in each group (expand.rows). Server Default 5 * [SolrQuery::setExpandQuery()](solrquery.setexpandquery) - Sets the expand.q parameter * [SolrQuery::addExpandFilterQuery()](solrquery.addexpandfilterquery) - Overrides main filter query, determines which documents to include in the main group
programming_docs
php Event::add Event::add ========== (PECL event >= 1.2.6-beta) Event::add — Makes event pending ### Description ``` public Event::add( float $timeout = ?): bool ``` Marks event pending. Non-pending event will never occur, and the event callback will never be called. In conjunction with [Event::del()](event.del) an event could be re-scheduled by user at any time. If **Event::add()** is called on an already pending event, libevent will leave it pending and re-schedule it with the given timeout(if specified). If in this case timeout is not specified, **Event::add()** has no effect. ### Parameters `timeout` Timeout in seconds. ### Return Values Returns **`true`** on success or **`false`** on failure. ### Examples **Example #1 Adding a custom signal** ``` <?php /* Launch it in a terminal window: $ php examples/signal.php In another terminal window find out the pid and send SIGTERM, e.g.: $ ps aux | grep examp ruslan    3976  0.2  0.0 139896 11256 pts/1    S+   10:25   0:00 php examples/signal.php ruslan    3978  0.0  0.0   9572   864 pts/2    S+   10:26   0:00 grep --color=auto examp $ kill -TERM 3976 At the first terminal window you should catch the following: Caught signal 15 */ class MyEventSignal {     private $base, $ev;     public function __construct($base) {         $this->base = $base;         $this->ev = Event::signal($base, SIGTERM, array($this, 'eventSighandler'));         $this->ev->add();     }     public function eventSighandler($no, $c) {         echo "Caught signal $no\n";         $this->base->exit();     } } $base = new EventBase(); $c    = new MyEventSignal($base); $base->loop(); ?> ``` The above example will output something similar to: ``` Caught signal 15 ``` **Example #2 Adding a timer** ``` <?php $base = new EventBase(); $n = 2; $e = Event::timer($base, function($n) use (&$e) {     echo "$n seconds elapsed\n";     $e->delTimer(); }, $n); $e->add($n); $base->loop(); ?> ``` The above example will output something similar to: ``` 2 seconds elapsed ``` ### See Also * **Event::add()** * [Event::del()](event.del) - Makes event non-pending * [Event::signal()](event.signal) - Constructs signal event object * [Event::timer()](event.timer) - Constructs timer event object php Imagick::getPixelRegionIterator Imagick::getPixelRegionIterator =============================== (PECL imagick 2, PECL imagick 3) Imagick::getPixelRegionIterator — Get an ImagickPixelIterator for an image section ### Description ``` public Imagick::getPixelRegionIterator( int $x, int $y, int $columns, int $rows ): ImagickPixelIterator ``` Get an ImagickPixelIterator for an image section. ### Parameters `x` The x-coordinate of the region. `y` The y-coordinate of the region. `columns` The width of the region. `rows` The height of the region. ### Return Values Returns an ImagickPixelIterator for an image section. ### Errors/Exceptions Throws ImagickException on error. ### Examples **Example #1 **Imagick::getPixelRegionIterator()** example** Iterate over the pixels in the top left of the image, changing them to be black. ``` <?php $im = new Imagick(realpath("./testImage.png")); $areaIterator = $im->getPixelRegionIterator(0, 0, 10, 10); foreach ($areaIterator as $rowIterator) {     foreach ($rowIterator as $pixel) {         // Paint every pixel black         $pixel->setColor("rgba(0, 0, 0, 0)");     }     $areaIterator->syncIterator(); } $im->writeImage("./output.png"); ?> ``` php deflate_init deflate\_init ============= (PHP 7, PHP 8) deflate\_init — Initialize an incremental deflate context ### Description ``` deflate_init(int $encoding, array $options = []): DeflateContext|false ``` Initializes an incremental deflate context using the specified `encoding`. Note that the `window` option here only sets the window size of the algorithm, differently from the zlib filters where the same parameter also sets the encoding to use; the encoding must be set with the `encoding` parameter. Limitation: there is currently no way to set the header information on a GZIP compressed stream, which are set as follows: GZIP signature (`\x1f\x8B`); compression method (`\x08` == DEFLATE); 6 zero bytes; the operating system set to the current system (`\x00` = Windows, `\x03` = Unix, etc.) ### Parameters `encoding` One of the **`ZLIB_ENCODING_*`** constants. `options` An associative array which may contain the following elements: level The compression level in range -1..9; defaults to -1. memory The compression memory level in range 1..9; defaults to 8. window The zlib window size (logarithmic) in range `8`..`15`; defaults to `15`. zlib changes a window size of `8` to `9`, and as of zlib 1.2.8 fails with a warning, if a window size of `8` is requested for **`ZLIB_ENCODING_RAW`** or **`ZLIB_ENCODING_GZIP`**. strategy One of **`ZLIB_FILTERED`**, **`ZLIB_HUFFMAN_ONLY`**, **`ZLIB_RLE`**, **`ZLIB_FIXED`** or **`ZLIB_DEFAULT_STRATEGY`** (the default). dictionary A string or an array of strings of the preset dictionary (default: no preset dictionary). ### Return Values Returns a deflate context resource (`zlib.deflate`) on success, or **`false`** on failure. ### Errors/Exceptions If an invalid option is passed to `options` or the context couldn't be created, an error of level **`E_WARNING`** is generated. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | On success, this function returns a [DeflateContext](class.deflatecontext) instance now; previously, a resource was returned. | ### See Also * [deflate\_add()](function.deflate-add) - Incrementally deflate data * [inflate\_init()](function.inflate-init) - Initialize an incremental inflate context php pspell_new_personal pspell\_new\_personal ===================== (PHP 4 >= 4.0.2, PHP 5, PHP 7, PHP 8) pspell\_new\_personal — Load a new dictionary with personal wordlist ### Description ``` pspell_new_personal( string $filename, string $language, string $spelling = "", string $jargon = "", string $encoding = "", int $mode = 0 ): PSpell\Dictionary|false ``` **pspell\_new\_personal()** opens up a new dictionary with a personal wordlist. The wordlist can be modified and saved with [pspell\_save\_wordlist()](function.pspell-save-wordlist), if desired. However, the replacement pairs are not saved. In order to save replacement pairs, you should create a config using [pspell\_config\_create()](function.pspell-config-create), set the personal wordlist file with [pspell\_config\_personal()](function.pspell-config-personal), set the file for replacement pairs with [pspell\_config\_repl()](function.pspell-config-repl), and open a new dictionary with [pspell\_new\_config()](function.pspell-new-config). For more information and examples, check out inline manual pspell website:[» http://aspell.net/](http://aspell.net/). ### Parameters `filename` The file where words added to the personal list will be stored. It should be an absolute filename beginning with '/' because otherwise it will be relative to $HOME, which is "/root" for most systems, and is probably not what you want. `language` The language code which consists of the two letter ISO 639 language code and an optional two letter ISO 3166 country code after a dash or underscore. `spelling` The requested spelling for languages with more than one spelling such as English. Known values are 'american', 'british', and 'canadian'. `jargon` Extra information to distinguish two different words lists that have the same language and spelling parameters. `encoding` The encoding that words are expected to be in. Valid values are `utf-8`, `iso8859-*`, `koi8-r`, `viscii`, `cp1252`, `machine unsigned 16`, `machine unsigned 32`. `mode` The mode in which spellchecker will work. There are several modes available: * **`PSPELL_FAST`** - Fast mode (least number of suggestions) * **`PSPELL_NORMAL`** - Normal mode (more suggestions) * **`PSPELL_BAD_SPELLERS`** - Slow mode (a lot of suggestions) * **`PSPELL_RUN_TOGETHER`** - Consider run-together words as legal compounds. That is, "thecat" will be a legal compound, although there should be a space between the two words. Changing this setting only affects the results returned by [pspell\_check()](function.pspell-check); [pspell\_suggest()](function.pspell-suggest) will still return suggestions. Mode is a bitmask constructed from different constants listed above. However, **`PSPELL_FAST`**, **`PSPELL_NORMAL`** and **`PSPELL_BAD_SPELLERS`** are mutually exclusive, so you should select only one of them. ### Return Values Returns an [PSpell\Dictionary](class.pspell-dictionary) instance on success, or **`false`** on failure. ### Changelog | Version | Description | | --- | --- | | 8.1.0 | Returns an [PSpell\Dictionary](class.pspell-dictionary) instance now; previously, a [resource](language.types.resource) was returned. | ### Examples **Example #1 **pspell\_new\_personal()**** ``` <?php $pspell = pspell_new_personal ("/var/dictionaries/custom.pws",         "en", "", "", "", PSPELL_FAST|PSPELL_RUN_TOGETHER); ?> ``` php Yaf_Config_Ini::count Yaf\_Config\_Ini::count ======================= (Yaf >=1.0.0) Yaf\_Config\_Ini::count — Count all elements in Yaf\_Config.ini ### Description ``` public Yaf_Config_Ini::count(): void ``` **Warning**This function is currently not documented; only its argument list is available. ### Parameters This function has no parameters. ### Return Values php Throwable::getCode Throwable::getCode ================== (PHP 7, PHP 8) Throwable::getCode — Gets the exception code ### Description ``` public Throwable::getCode(): int ``` Returns the error code associated with the thrown object. ### Parameters This function has no parameters. ### Return Values Returns the exception code as int in [Exception](class.exception) but possibly as other type in [Exception](class.exception) descendants (for example as string in [PDOException](class.pdoexception)). ### See Also * [Exception::getCode()](exception.getcode) - Gets the Exception code php Imagick::posterizeImage Imagick::posterizeImage ======================= (PECL imagick 2, PECL imagick 3) Imagick::posterizeImage — Reduces the image to a limited number of color level ### Description ``` public Imagick::posterizeImage(int $levels, bool $dither): bool ``` Reduces the image to a limited number of color level. ### Parameters `levels` `dither` ### Return Values Returns **`true`** on success. ### Examples **Example #1 **Imagick::posterizeImage()**** ``` <?php function posterizeImage($imagePath, $posterizeType, $numberLevels) {     $imagick = new \Imagick(realpath($imagePath));     $imagick->posterizeImage($numberLevels, $posterizeType);     $imagick->setImageFormat('png');     header("Content-Type: image/png");     echo $imagick->getImageBlob(); } posterizeImage($imagePath, \Imagick::DITHERMETHOD_RIEMERSMA, 8); ?> ``` php Ds\Map::last Ds\Map::last ============ (PECL ds >= 1.0.0) Ds\Map::last — Returns the last pair of the map ### Description ``` public Ds\Map::last(): Ds\Pair ``` Returns the last pair of the map. ### Parameters This function has no parameters. ### Return Values The last pair of the map. ### Errors/Exceptions [UnderflowException](class.underflowexception) if empty. ### Examples **Example #1 **Ds\Map::last()** example** ``` <?php $map = new \Ds\Map(["a" => 1, "b" => 2, "c" => 3]); var_dump($map->last()); ?> ``` The above example will output something similar to: ``` object(Ds\Pair)#2 (2) { ["key"]=> string(1) "c" ["value"]=> int(3) } ``` php error_log error\_log ========== (PHP 4, PHP 5, PHP 7, PHP 8) error\_log — Send an error message to the defined error handling routines ### Description ``` error_log( string $message, int $message_type = 0, ?string $destination = null, ?string $additional_headers = null ): bool ``` Sends an error message to the web server's error log or to a file. ### Parameters `message` The error message that should be logged. `message_type` Says where the error should go. The possible message types are as follows: ****error\_log()** log types**| 0 | `message` is sent to PHP's system logger, using the Operating System's system logging mechanism or a file, depending on what the [error\_log](https://www.php.net/manual/en/errorfunc.configuration.php#ini.error-log) configuration directive is set to. This is the default option. | | 1 | `message` is sent by email to the address in the `destination` parameter. This is the only message type where the fourth parameter, `additional_headers` is used. | | 2 | No longer an option. | | 3 | `message` is appended to the file `destination`. A newline is not automatically added to the end of the `message` string. | | 4 | `message` is sent directly to the SAPI logging handler. | `destination` The destination. Its meaning depends on the `message_type` parameter as described above. `additional_headers` The extra headers. It's used when the `message_type` parameter is set to `1`. This message type uses the same internal function as [mail()](function.mail) does. ### Return Values Returns **`true`** on success or **`false`** on failure. If `message_type` is zero, this function always returns **`true`**, regardless of whether the error could be logged or not. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | `destination` and `additional_headers` are now nullable. | ### Examples **Example #1 **error\_log()** examples** ``` <?php // Send notification through the server log if we can not // connect to the database. if (!Ora_Logon($username, $password)) {     error_log("Oracle database not available!", 0); } // Notify administrator by email if we run out of FOO if (!($foo = allocate_new_foo())) {     error_log("Big trouble, we're all out of FOOs!", 1,                "[email protected]"); } // another way to call error_log(): error_log("You messed up!", 3, "/var/tmp/my-errors.log"); ?> ``` ### Notes **Warning** **error\_log()** is not binary safe. `message` will be truncated by null character. **Tip** `message` should not contain null character. Note that `message` may be sent to file, mail, syslog, etc. Use appropriate conversion/escape function, [base64\_encode()](function.base64-encode), [rawurlencode()](function.rawurlencode) or [addslashes()](function.addslashes) before calling **error\_log()**. php XMLReader::lookupNamespace XMLReader::lookupNamespace ========================== (PHP 5 >= 5.1.0, PHP 7, PHP 8) XMLReader::lookupNamespace — Lookup namespace for a prefix ### Description ``` public XMLReader::lookupNamespace(string $prefix): ?string ``` Lookup in scope namespace for a given prefix. ### Parameters `prefix` String containing the prefix. ### Return Values The value of the namespace, or **`null`** if no namespace exists. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | This function can no longer return **`false`**. | php gc_enabled gc\_enabled =========== (PHP 5 >= 5.3.0, PHP 7, PHP 8) gc\_enabled — Returns status of the circular reference collector ### Description ``` gc_enabled(): bool ``` Returns status of the circular reference collector. ### Parameters This function has no parameters. ### Return Values Returns **`true`** if the garbage collector is enabled, **`false`** otherwise. ### Examples **Example #1 A **gc\_enabled()** example** ``` <?php if(gc_enabled()) gc_collect_cycles(); ?> ``` ### See Also * [Garbage Collection](https://www.php.net/manual/en/features.gc.php) php fdf_get_version fdf\_get\_version ================= (PHP 4 >= 4.3.0, PHP 5 < 5.3.0, PECL fdf SVN) fdf\_get\_version — Gets version number for FDF API or file ### Description ``` fdf_get_version(resource $fdf_document = ?): string ``` Return the FDF version for the given document, or the toolkit API version number if no parameter is given. ### Parameters `fdf_document` The FDF document handle, returned by [fdf\_create()](function.fdf-create), [fdf\_open()](function.fdf-open) or [fdf\_open\_string()](function.fdf-open-string). ### Return Values Returns the version as a string. For the current FDF toolkit 5.0 the API version number is `5.0` and the document version number is either `1.2`, `1.3` or `1.4`. ### See Also * [fdf\_set\_version()](function.fdf-set-version) - Sets version number for a FDF file php Yaf_Plugin_Abstract::routerStartup Yaf\_Plugin\_Abstract::routerStartup ==================================== (Yaf >=1.0.0) Yaf\_Plugin\_Abstract::routerStartup — RouterStartup hook ### Description ``` public Yaf_Plugin_Abstract::routerStartup(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response): void ``` This is the earliest hook in Yaf plugin hook system, if a custom plugin implement this method, then it will be called before routing a request. **Warning**This function is currently not documented; only its argument list is available. ### Parameters `request` `response` ### Return Values ### See Also * [Yaf\_Plugin\_Abstract::routerShutdown()](yaf-plugin-abstract.routershutdown) - The routerShutdown purpose * [Yaf\_Plugin\_Abstract::dispatchLoopStartup()](yaf-plugin-abstract.dispatchloopstartup) - Hook before dispatch loop * [Yaf\_Plugin\_Abstract::preDispatch()](yaf-plugin-abstract.predispatch) - The preDispatch purpose * [Yaf\_Plugin\_Abstract::postDispatch()](yaf-plugin-abstract.postdispatch) - The postDispatch purpose * [Yaf\_Plugin\_Abstract::dispatchLoopShutdown()](yaf-plugin-abstract.dispatchloopshutdown) - The dispatchLoopShutdown purpose php Yaf_View_Simple::__construct Yaf\_View\_Simple::\_\_construct ================================ (Yaf >=1.0.0) Yaf\_View\_Simple::\_\_construct — Constructor of Yaf\_View\_Simple ### Description final public **Yaf\_View\_Simple::\_\_construct**(string `$template_dir`, array `$options` = ?) ### Parameters `template_dir` The base directory of the templates, by default, it is APPLICATOIN . "/views" for Yaf. `options` ``` Options for the engine, as of Yaf 2.1.13, you can use short tag "<?=$var?>" in your template(regardless of "short_open_tag"), so comes a option named "short_tag", you can switch this off to prevent use short_tag in template. ``` ### Examples **Example #1 **Yaf\_View\_Simple::\_\_constructor()**example** ``` <?php    define ("TEMPLATE_DIRECTORY", APPLICATOIN_PATH . '/views');    $view = new Yaf_View_Simple(TEMPLATE_DIRECTORY, array(                            'short_tag' => false //doesn't allow use short tag in template    )); ?> ``` php hash_algos hash\_algos =========== (PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL hash >= 1.1) hash\_algos — Return a list of registered hashing algorithms ### Description ``` hash_algos(): array ``` ### Parameters This function has no parameters. ### Return Values Returns a numerically indexed array containing the list of supported hashing algorithms. ### Changelog | Version | Description | | --- | --- | | 8.1.0 | Support for MurmurHash3 and xxHash algorithms has been added. | | 7.4.0 | Support for crc32c has been added. | | 7.1.0 | Support for sha512/224, sha512/256, sha3-224, sha3-256, sha3-384 and sha3-512 has been added. | ### Examples **Example #1 **hash\_algos()** example** As of PHP 8.1.0, **hash\_algos()** will return the following list of algorithm names. ``` <?php print_r(hash_algos()); ?> ``` The above example will output something similar to: ``` Array ( [0] => md2 [1] => md4 [2] => md5 [3] => sha1 [4] => sha224 [5] => sha256 [6] => sha384 [7] => sha512/224 [8] => sha512/256 [9] => sha512 [10] => sha3-224 [11] => sha3-256 [12] => sha3-384 [13] => sha3-512 [14] => ripemd128 [15] => ripemd160 [16] => ripemd256 [17] => ripemd320 [18] => whirlpool [19] => tiger128,3 [20] => tiger160,3 [21] => tiger192,3 [22] => tiger128,4 [23] => tiger160,4 [24] => tiger192,4 [25] => snefru [26] => snefru256 [27] => gost [28] => gost-crypto [29] => adler32 [30] => crc32 [31] => crc32b [32] => crc32c [33] => fnv132 [34] => fnv1a32 [35] => fnv164 [36] => fnv1a64 [37] => joaat [38] => murmur3a [39] => murmur3c [40] => murmur3f [41] => xxh32 [42] => xxh64 [43] => xxh3 [44] => xxh128 [45] => haval128,3 [46] => haval160,3 [47] => haval192,3 [48] => haval224,3 [49] => haval256,3 [50] => haval128,4 [51] => haval160,4 [52] => haval192,4 [53] => haval224,4 [54] => haval256,4 [55] => haval128,5 [56] => haval160,5 [57] => haval192,5 [58] => haval224,5 [59] => haval256,5 ) ``` ### See Also * [hash\_hmac\_algos()](function.hash-hmac-algos) - Return a list of registered hashing algorithms suitable for hash\_hmac
programming_docs
php ReflectionFiber::getTrace ReflectionFiber::getTrace ========================= (PHP 8 >= 8.1.0) ReflectionFiber::getTrace — Get the backtrace of the current execution point ### Description ``` public ReflectionFiber::getTrace(int $options = DEBUG_BACKTRACE_PROVIDE_OBJECT): array ``` Get the backtrace of the current execution point in the reflected [Fiber](class.fiber). ### Parameters `options` The value of `options` can be any of the following flags. **Available options**| Option | Description | | --- | --- | | **`DEBUG_BACKTRACE_PROVIDE_OBJECT`** | Default. | | **`DEBUG_BACKTRACE_IGNORE_ARGS`** | Don't include the argument information for functions in the stack trace. | ### Return Values The backtrace of the current execution point in the fiber. php The RarException class The RarException class ====================== Introduction ------------ (PECL rar >= 2.0.0) This class serves two purposes: it is the type of the exceptions thrown by the RAR extension functions and methods and it allows, through static methods to query and define the error behaviour of the extension, i.e., whether exceptions are thrown or only warnings are emitted. The following error codes are used: * -1 - error outside UnRAR library * 11 - insufficient memory * 12 - bad data * 13 - bad archive * 14 - unknown format * 15 - file open error * 16 - file create error * 17 - file close error * 18 - read error * 19 - write error * 20 - buffer too small * 21 - unknown RAR error * 22 - password required but not given Class synopsis -------------- final class **RarException** extends [Exception](class.exception) { /\* Methods \*/ ``` public static isUsingExceptions(): bool ``` ``` public static setUsingExceptions(bool $using_exceptions): void ``` /\* Inherited methods \*/ ``` final public Exception::getMessage(): string ``` ``` final public Exception::getPrevious(): ?Throwable ``` ``` final public Exception::getCode(): int ``` ``` final public Exception::getFile(): string ``` ``` final public Exception::getLine(): int ``` ``` final public Exception::getTrace(): array ``` ``` final public Exception::getTraceAsString(): string ``` ``` public Exception::__toString(): string ``` ``` private Exception::__clone(): void ``` } Table of Contents ----------------- * [RarException::isUsingExceptions](rarexception.isusingexceptions) — Check whether error handling with exceptions is in use * [RarException::setUsingExceptions](rarexception.setusingexceptions) — Activate and deactivate error handling with exceptions php ImagickDraw::getStrokeLineJoin ImagickDraw::getStrokeLineJoin ============================== (PECL imagick 2, PECL imagick 3) ImagickDraw::getStrokeLineJoin — Returns the shape to be used at the corners of paths when they are stroked ### Description ``` public ImagickDraw::getStrokeLineJoin(): int ``` **Warning**This function is currently not documented; only its argument list is available. Returns the shape to be used at the corners of paths (or other vector shapes) when they are stroked. ### Return Values Returns a [LINEJOIN](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.linejoin) constant (`imagick::LINEJOIN_*`), or 0 if stroke line join is not set. php Parle\Parser::token Parle\Parser::token =================== (PECL parle >= 0.5.1) Parle\Parser::token — Declare a token ### Description ``` public Parle\Parser::token(string $tok): void ``` Declare a terminal to be used in the grammar. ### Parameters `tok` Token name. ### Return Values No value is returned. php SplFileObject::setCsvControl SplFileObject::setCsvControl ============================ (PHP 5 >= 5.2.0, PHP 7, PHP 8) SplFileObject::setCsvControl — Set the delimiter, enclosure and escape character for CSV ### Description ``` public SplFileObject::setCsvControl(string $separator = ",", string $enclosure = "\"", string $escape = "\\"): void ``` Sets the delimiter, enclosure and escape character for parsing CSV fields. ### Parameters `separator` The field delimiter (one single-byte character only). `enclosure` The field enclosure character (one single-byte character only). `escape` The field escape character (at most one single-byte character). An empty string (`""`) disables the proprietary escape mechanism. ### Return Values No value is returned. ### Changelog | Version | Description | | --- | --- | | 7.4.0 | The `escape` parameter now also accepts an empty string to disable the proprietary escape mechanism. | ### Examples **Example #1 **SplFileObject::setCsvControl()** example** ``` <?php $file = new SplFileObject("data.csv"); $file->setFlags(SplFileObject::READ_CSV); $file->setCsvControl('|'); foreach ($file as $row) {     list ($fruit, $quantity) = $row;     // Do something with values } ?> ``` Contents of data.csv ``` <?php apples|20 bananas|14 cherries|87 ?> ``` ### See Also * [SplFileObject::getCsvControl()](splfileobject.getcsvcontrol) - Get the delimiter, enclosure and escape character for CSV * [SplFileObject::fgetcsv()](splfileobject.fgetcsv) - Gets line from file and parse as CSV fields php EvLoop::__construct EvLoop::\_\_construct ===================== (PECL ev >= 0.2.0) EvLoop::\_\_construct — Constructs the event loop object ### Description public **EvLoop::\_\_construct**( int `$flags` = ?, [mixed](language.types.declarations#language.types.declarations.mixed) `$data` = NULL , float `$io_interval` = 0.0 , float `$timeout_interval` = 0.0 ) Constructs the event loop object. ### Parameters `flags` One of the [event loop flags](class.ev#ev.constants.loop-flags) `data` Custom data associated with the loop. `io_interval` See [io\_interval](class.evloop#evloop.props.io-interval) `timeout_interval` See [timeout\_interval](class.evloop#evloop.props.timeout-interval) ### See Also * [EvLoop::defaultLoop()](evloop.defaultloop) - Returns or creates the default event loop php EvLoop::stop EvLoop::stop ============ (PECL ev >= 0.2.0) EvLoop::stop — Stops the event loop ### Description ``` public EvLoop::stop( int $how = ?): void ``` Stops the event loop ### Parameters `how` One of *Ev::BREAK\_\** [constants](class.ev#ev.constants.break-flags) . ### Return Values No value is returned. ### See Also * [EvLoop::run()](evloop.run) - Begin checking for events and calling callbacks for the loop * [Ev::stop()](ev.stop) - Stops the default event loop php SolrDisMaxQuery::setQueryPhraseSlop SolrDisMaxQuery::setQueryPhraseSlop =================================== (No version information available, might only be in Git) SolrDisMaxQuery::setQueryPhraseSlop — Specifies the amount of slop permitted on phrase queries explicitly included in the user's query string (qf parameter) ### Description ``` public SolrDisMaxQuery::setQueryPhraseSlop(string $slop): SolrDisMaxQuery ``` The Query Phrase Slop is the amount of slop permitted on phrase queries explicitly included in the user's query string with the *qf* parameter. slop refers to the number of positions one token needs to be moved in relation to another token in order to match a phrase specified in a query. ### Parameters `slop` Amount of slop ### Return Values [SolrDisMaxQuery](class.solrdismaxquery) ### Examples **Example #1 **SolrDisMaxQuery::setQueryPhraseSlop()** example** ``` <?php $dismaxQuery = new SolrDisMaxQuery(); $dismaxQuery->setQueryPhraseSlop(3); echo $dismaxQuery; ?> ``` The above example will output something similar to: ``` defType=edismax&qs=3 ``` php IntlChar::isUUppercase IntlChar::isUUppercase ====================== (PHP 7, PHP 8) IntlChar::isUUppercase — Check if code point has the Uppercase Unicode property ### Description ``` public static IntlChar::isUUppercase(int|string $codepoint): ?bool ``` Check if a code point has the Uppercase Unicode property. This is the same as `IntlChar::hasBinaryProperty($codepoint, IntlChar::PROPERTY_UPPERCASE)` > > **Note**: > > > This is different than [IntlChar::isupper()](intlchar.isupper) and will return **`true`** for more characters. > > ### Parameters `codepoint` The int codepoint value (e.g. `0x2603` for *U+2603 SNOWMAN*), or the character encoded as a UTF-8 string (e.g. `"\u{2603}"`) ### Return Values Returns **`true`** if `codepoint` has the Uppercase Unicode property, **`false`** if not. Returns **`null`** on failure. ### Examples **Example #1 Testing different code points** ``` <?php var_dump(IntlChar::isUUppercase("A")); var_dump(IntlChar::isUUppercase("a")); var_dump(IntlChar::isUUppercase("Φ")); var_dump(IntlChar::isUUppercase("φ")); var_dump(IntlChar::isUUppercase("1")); ?> ``` The above example will output: ``` bool(true) bool(false) bool(true) bool(false) bool(false) ``` ### See Also * [IntlChar::isupper()](intlchar.isupper) - Check if code point has the general category "Lu" (uppercase letter) * [IntlChar::hasBinaryProperty()](intlchar.hasbinaryproperty) - Check a binary Unicode property for a code point * **`IntlChar::PROPERTY_UPPERCASE`** php xmlrpc_is_fault xmlrpc\_is\_fault ================= (PHP 4 >= 4.3.0, PHP 5, PHP 7) xmlrpc\_is\_fault — Determines if an array value represents an XMLRPC fault ### Description ``` xmlrpc_is_fault(array $arg): bool ``` **Warning**This function is *EXPERIMENTAL*. The behaviour of this function, its name, and surrounding documentation may change without notice in a future release of PHP. This function should be used at your own risk. ### Parameters `arg` Array returned by [xmlrpc\_decode()](function.xmlrpc-decode). ### Return Values Returns **`true`** if the argument means fault, **`false`** otherwise. Fault description is available in `$arg["faultString"]`, fault code is in `$arg["faultCode"]`. ### Examples See example by [xmlrpc\_encode\_request()](function.xmlrpc-encode-request). ### See Also * [xmlrpc\_decode()](function.xmlrpc-decode) - Decodes XML into native PHP types php DateTimeImmutable::setTime DateTimeImmutable::setTime ========================== (PHP 5 >= 5.5.0, PHP 7, PHP 8) DateTimeImmutable::setTime — Sets the time ### Description ``` public DateTimeImmutable::setTime( int $hour, int $minute, int $second = 0, int $microsecond = 0 ): DateTimeImmutable ``` Returns a new DateTimeImmutable object with the time set to the given time. ### Parameters `hour` Hour of the time. `minute` Minute of the time. `second` Second of the time. `microsecond` Microsecond of the time. ### Return Values Returns a new [DateTimeImmutable](class.datetimeimmutable) object with the modified data. ### Changelog | Version | Description | | --- | --- | | 8.1.0 | The behaviour with double existing hours (during the fall-back DST transition) changed. Previously PHP would pick the second occurrence (after the DST transition), instead of the first occurrence (before DST transition). | | 7.1.0 | The `microsecond` parameter was added. | ### Examples **Example #1 **DateTimeImmutable::setTime()** example** Object-oriented style ``` <?php $date = new DateTimeImmutable('2001-01-01'); $newDate = $date->setTime(14, 55); echo $newDate->format('Y-m-d H:i:s') . "\n"; $newDate = $date->setTime(14, 55, 24); echo $newDate->format('Y-m-d H:i:s') . "\n"; ?> ``` The above examples will output something similar to: ``` 2001-01-01 14:55:00 2001-01-01 14:55:24 ``` **Example #2 Values exceeding ranges are added to their parent values** ``` <?php $date = new DateTimeImmutable('2001-01-01'); $newDate = $date->setTime(14, 55, 24); echo $newDate->format('Y-m-d H:i:s') . "\n"; $newDate = $date->setTime(14, 55, 65); echo $newDate->format('Y-m-d H:i:s') . "\n"; $newDate = $date->setTime(14, 65, 24); echo $newDate->format('Y-m-d H:i:s') . "\n"; $newDate = $date->setTime(25, 55, 24); echo $newDate->format('Y-m-d H:i:s') . "\n"; ?> ``` The above example will output: ``` 2001-01-01 14:55:24 2001-01-01 14:56:05 2001-01-01 15:05:24 2001-01-02 01:55:24 ``` ### See Also * [DateTimeImmutable::setDate()](datetimeimmutable.setdate) - Sets the date * [DateTimeImmutable::setISODate()](datetimeimmutable.setisodate) - Sets the ISO date php is_link is\_link ======== (PHP 4, PHP 5, PHP 7, PHP 8) is\_link — Tells whether the filename is a symbolic link ### Description ``` is_link(string $filename): bool ``` Tells whether the given file is a symbolic link. ### Parameters `filename` Path to the file. ### Return Values Returns **`true`** if the filename exists and is a symbolic link, **`false`** otherwise. ### Errors/Exceptions Upon failure, an **`E_WARNING`** is emitted. ### Examples **Example #1 Create and confirm if a file is a symbolic link** ``` <?php $link = 'uploads'; if (is_link($link)) {     echo(readlink($link)); } else {     symlink('uploads.php', $link); } ?> ``` ### Notes > **Note**: The results of this function are cached. See [clearstatcache()](function.clearstatcache) for more details. > > **Tip**As of PHP 5.0.0, this function can also be used with *some* URL wrappers. Refer to [Supported Protocols and Wrappers](https://www.php.net/manual/en/wrappers.php) to determine which wrappers support [stat()](function.stat) family of functionality. ### See Also * [is\_dir()](function.is-dir) - Tells whether the filename is a directory * [is\_file()](function.is-file) - Tells whether the filename is a regular file * [readlink()](function.readlink) - Returns the target of a symbolic link php mb_eregi mb\_eregi ========= (PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8) mb\_eregi — Regular expression match ignoring case with multibyte support ### Description ``` mb_eregi(string $pattern, string $string, array &$matches = null): bool ``` Executes the case insensitive regular expression match with multibyte support. ### Parameters `pattern` The regular expression pattern. `string` The string being searched. `matches` If matches are found for parenthesized substrings of `pattern` and the function is called with the third argument `matches`, the matches will be stored in the elements of the array `matches`. If no matches are found, `matches` is set to an empty array. $matches[1] will contain the substring which starts at the first left parenthesis; $matches[2] will contain the substring starting at the second, and so on. $matches[0] will contain a copy of the complete string matched. ### Return Values Returns whether `pattern` matches `string`. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | This function returns **`true`** on success now. Previously, it returned the byte length of the matched string if a match for `pattern` was found in `string` and `matches` was passed. If the optional parameter `matches` was not passed or the length of the matched string was `0`, this function returned `1`. | | 7.1.0 | **mb\_eregi()** will now set `matches` to an empty array, if nothing matched. Formerly, `matches` was not modified in that case. | ### Notes > > **Note**: > > > The internal encoding or the character encoding specified by [mb\_regex\_encoding()](function.mb-regex-encoding) will be used as the character encoding for this function. > > > ### See Also * [mb\_regex\_encoding()](function.mb-regex-encoding) - Set/Get character encoding for multibyte regex * [mb\_ereg()](function.mb-ereg) - Regular expression match with multibyte support php svn_repos_fs_commit_txn svn\_repos\_fs\_commit\_txn =========================== (PECL svn >= 0.2.0) svn\_repos\_fs\_commit\_txn — Commits a transaction and returns the new revision ### Description ``` svn_repos_fs_commit_txn(resource $txn): int ``` **Warning**This function is currently not documented; only its argument list is available. Commits a transaction and returns the new revision ### Notes **Warning**This function is *EXPERIMENTAL*. The behaviour of this function, its name, and surrounding documentation may change without notice in a future release of PHP. This function should be used at your own risk. php ImagickDraw::pushClipPath ImagickDraw::pushClipPath ========================= (PECL imagick 2, PECL imagick 3) ImagickDraw::pushClipPath — Starts a clip path definition ### Description ``` public ImagickDraw::pushClipPath(string $clip_mask_id): bool ``` **Warning**This function is currently not documented; only its argument list is available. Starts a clip path definition which is comprised of any number of drawing commands and terminated by a [ImagickDraw::popClipPath()](imagickdraw.popclippath) command. ### Parameters `clip_mask_id` Clip mask Id ### Return Values No value is returned. php Yaf_Router::__construct Yaf\_Router::\_\_construct ========================== (Yaf >=1.0.0) Yaf\_Router::\_\_construct — Yaf\_Router constructor ### Description public **Yaf\_Router::\_\_construct**() ### Parameters This function has no parameters. ### Return Values php Imagick::medianFilterImage Imagick::medianFilterImage ========================== (PECL imagick 2, PECL imagick 3) Imagick::medianFilterImage — Applies a digital filter **Warning**This function has been *DEPRECATED* as of Imagick 3.4.4. Relying on this function is highly discouraged. ### Description ``` public Imagick::medianFilterImage(float $radius): bool ``` Applies a digital filter that improves the quality of a noisy image. Each pixel is replaced by the median in a set of neighboring pixels as defined by radius. ### Parameters `radius` The radius of the pixel neighborhood. ### Return Values Returns **`true`** on success. ### Errors/Exceptions Throws ImagickException on error. ### Examples **Example #1 **Imagick::medianFilterImage()**** ``` <?php function medianFilterImage($radius, $imagePath) {     $imagick = new \Imagick(realpath($imagePath));     @$imagick->medianFilterImage($radius);     header("Content-Type: image/jpg");     echo $imagick->getImageBlob(); } ?> ``` php ldap_search ldap\_search ============ (PHP 4, PHP 5, PHP 7, PHP 8) ldap\_search — Search LDAP tree ### Description ``` ldap_search( LDAP\Connection|array $ldap, array|string $base, array|string $filter, array $attributes = [], int $attributes_only = 0, int $sizelimit = -1, int $timelimit = -1, int $deref = LDAP_DEREF_NEVER, ?array $controls = null ): LDAP\Result|array|false ``` Performs the search for a specified filter on the directory with the scope of **`LDAP_SCOPE_SUBTREE`**. This is equivalent to searching the entire directory. It is also possible to perform parallel searches. In this case, the first argument should be an array of [LDAP\Connection](class.ldap-connection) instances, rather than a single one. If the searches should not all use the same base DN and filter, an array of base DNs and/or an array of filters can be passed as arguments instead. These arrays must be of the same size as the [LDAP\Connection](class.ldap-connection) instances array, since the first entries of the arrays are used for one search, the second entries are used for another, and so on. When doing parallel searches an array of [LDAP\Result](class.ldap-result) instances is returned, except in case of error, when the return value will be **`false`**. ### Parameters `ldap` An [LDAP\Connection](class.ldap-connection) instance, returned by [ldap\_connect()](function.ldap-connect). `base` The base DN for the directory. `filter` The search filter can be simple or advanced, using boolean operators in the format described in the LDAP documentation (see the [» Netscape Directory SDK](https://wiki.mozilla.org/Mozilla_LDAP_SDK_Programmer%27s_Guide/Searching_the_Directory_With_LDAP_C_SDK) or [» RFC4515](http://www.faqs.org/rfcs/rfc4515) for full information on filters). `attributes` An array of the required attributes, e.g. `array("mail", "sn", "cn")`. Note that the "dn" is always returned irrespective of which attributes types are requested. Using this parameter is much more efficient than the default action (which is to return all attributes and their associated values). The use of this parameter should therefore be considered good practice. `attributes_only` Should be set to 1 if only attribute types are wanted. If set to 0 both attributes types and attribute values are fetched which is the default behaviour. `sizelimit` Enables you to limit the count of entries fetched. Setting this to 0 means no limit. > > **Note**: > > > This parameter can NOT override server-side preset sizelimit. You can set it lower though. > > Some directory server hosts will be configured to return no more than a preset number of entries. If this occurs, the server will indicate that it has only returned a partial results set. This also occurs if you use this parameter to limit the count of fetched entries. > > `timelimit` Sets the number of seconds how long is spend on the search. Setting this to 0 means no limit. > > **Note**: > > > This parameter can NOT override server-side preset timelimit. You can set it lower though. > > `deref` Specifies how aliases should be handled during the search. It can be one of the following: * **`LDAP_DEREF_NEVER`** - (default) aliases are never dereferenced. * **`LDAP_DEREF_SEARCHING`** - aliases should be dereferenced during the search but not when locating the base object of the search. * **`LDAP_DEREF_FINDING`** - aliases should be dereferenced when locating the base object but not during the search. * **`LDAP_DEREF_ALWAYS`** - aliases should be dereferenced always. `controls` Array of [LDAP Controls](https://www.php.net/manual/en/ldap.controls.php) to send with the request. ### Return Values Returns an [LDAP\Result](class.ldap-result) instance, an array of [LDAP\Result](class.ldap-result) instances, or **`false`** on failure. ### Changelog | Version | Description | | --- | --- | | 8.1.0 | The `ldap` parameter expects an [LDAP\Connection](class.ldap-connection) instance now; previously, a [resource](language.types.resource) was expected. | | 8.1.0 | Returns an [LDAP\Result](class.ldap-result) instance now; previously, a [resource](language.types.resource) was returned. | | 8.0.0 | `controls` is nullable now; previously, it defaulted to `[]`. | | 7.3.0 | Support for `controls` added | ### Examples The example below retrieves the organizational unit, surname, given name and email address for all people in "My Company" where the surname or given name contains the substring $person. This example uses a boolean filter to tell the server to look for information in more than one attribute. **Example #1 LDAP search** ``` <?php // $ds is a valid LDAP\Connection instance for a directory server // $person is all or part of a person's name, eg "Jo" $dn = "o=My Company, c=US"; $filter="(|(sn=$person*)(givenname=$person*))"; $justthese = array("ou", "sn", "givenname", "mail"); $sr=ldap_search($ds, $dn, $filter, $justthese); $info = ldap_get_entries($ds, $sr); echo $info["count"]." entries returned\n"; ?> ```
programming_docs
php SoapClient::__getTypes SoapClient::\_\_getTypes ======================== (PHP 5, PHP 7, PHP 8) SoapClient::\_\_getTypes — Returns a list of SOAP types ### Description ``` public SoapClient::__getTypes(): ?array ``` Returns an array of types described in the WSDL for the Web service. > > **Note**: > > > This function only works in WSDL mode. > > > ### Parameters This function has no parameters. ### Return Values The array of SOAP types, detailing all structures and types. ### Examples **Example #1 **SoapClient::\_\_getTypes()** example** ``` <?php $client = new SoapClient('http://soap.amazon.com/schemas3/AmazonWebServices.wsdl'); var_dump($client->__getTypes()); ?> ``` The above example will output: ``` array(88) { [0]=> string(30) "ProductLine ProductLineArray[]" [1]=> string(85) "struct ProductLine { string Mode; string RelevanceRank; ProductInfo ProductInfo; }" [2]=> string(105) "struct ProductInfo { string TotalResults; string TotalPages; string ListName; DetailsArray Details; }" ... [85]=> string(32) "ShortSummary ShortSummaryArray[]" [86]=> string(121) "struct GetTransactionDetailsRequest { string tag; string devtag; string key; OrderIdArray OrderIds; string locale; }" [87]=> string(75) "struct GetTransactionDetailsResponse { ShortSummaryArray ShortSummaries; }" } ``` ### See Also * [SoapClient::\_\_construct()](soapclient.construct) - SoapClient constructor php The mysqli_driver class The mysqli\_driver class ======================== Introduction ------------ (PHP 5, PHP 7, PHP 8) The **mysqli\_driver** class is an instance of the monostate pattern, i.e. there is only one driver which can be accessed though an arbitrary amount of **mysqli\_driver** instances. Class synopsis -------------- final class **mysqli\_driver** { /\* Properties \*/ public readonly string [$client\_info](class.mysqli-driver#mysqli-driver.props.client-info); public readonly int [$client\_version](class.mysqli-driver#mysqli-driver.props.client-version); public readonly int [$driver\_version](class.mysqli-driver#mysqli-driver.props.driver-version); public readonly bool [$embedded](class.mysqli-driver#mysqli-driver.props.embedded); public bool [$reconnect](class.mysqli-driver#mysqli-driver.props.reconnect) = false; public int [$report\_mode](class.mysqli-driver#mysqli-driver.props.report-mode); /\* Methods \*/ ``` public embedded_server_end(): void ``` ``` public embedded_server_start(int $start, array $arguments, array $groups): bool ``` } Properties ---------- client\_info The Client API header version client\_version The Client version driver\_version The MySQLi Driver version **Warning**This property has been *deprecated* as of PHP 8.1.0. Relying on this property is highly discouraged. embedded Whether MySQLi Embedded support is enabled **Warning**This property has been *removed* as of PHP 8.0.0. reconnect Allow or prevent reconnect (see the mysqli.reconnect INI directive) report\_mode Set to **`MYSQLI_REPORT_OFF`**, **`MYSQLI_REPORT_ALL`** or any combination of **`MYSQLI_REPORT_STRICT`** (throw Exceptions for errors), **`MYSQLI_REPORT_ERROR`** (report errors) and **`MYSQLI_REPORT_INDEX`** (errors regarding indexes). See also [mysqli\_report()](function.mysqli-report). Table of Contents ----------------- * [mysqli\_driver::embedded\_server\_end](mysqli-driver.embedded-server-end) — Stop embedded server * [mysqli\_driver::embedded\_server\_start](mysqli-driver.embedded-server-start) — Initialize and start embedded server * [mysqli\_driver::$report\_mode](mysqli-driver.report-mode) — Sets mysqli error reporting mode php iterator_to_array iterator\_to\_array =================== (PHP 5 >= 5.1.0, PHP 7, PHP 8) iterator\_to\_array — Copy the iterator into an array ### Description ``` iterator_to_array(Traversable|array $iterator, bool $preserve_keys = true): array ``` Copy the elements of an iterator into an array. ### Parameters `iterator` The iterator being copied. `preserve_keys` Whether to use the iterator element keys as index. If a key is an array or object, a warning will be generated. **`null`** keys will be converted to an empty string, float keys will be truncated to their int counterpart, resource keys will generate a warning and be converted to their resource ID, and bool keys will be converted to integers. > > **Note**: > > > If this parameter is not set or set to **`true`**, duplicate keys will be overwritten. The last value with a given key will be in the returned array. Set this parameter to **`false`** to get all the values in any case. > > ### Return Values An array containing the elements of the `iterator`. ### Changelog | Version | Description | | --- | --- | | 8.2.0 | The type of `iterator` has been widened from [Traversable](class.traversable) to [Traversable](class.traversable)|array. | ### Examples **Example #1 **iterator\_to\_array()** example** ``` <?php $iterator = new ArrayIterator(array('recipe'=>'pancakes', 'egg', 'milk', 'flour')); var_dump(iterator_to_array($iterator, true)); var_dump(iterator_to_array($iterator, false)); ?> ``` The above example will output: ``` array(4) { ["recipe"]=> string(8) "pancakes" [0]=> string(3) "egg" [1]=> string(4) "milk" [2]=> string(5) "flour" } array(4) { [0]=> string(8) "pancakes" [1]=> string(3) "egg" [2]=> string(4) "milk" [3]=> string(5) "flour" } ``` php GearmanWorker::setId GearmanWorker::setId ==================== (No version information available, might only be in Git) GearmanWorker::setId — Give the worker an identifier so it can be tracked when asking gearmand for the list of available workers ### Description ``` public GearmanWorker::setId(string $id): bool ``` Assigns the worker an identifier. ### Parameters `id` A string identifier. ### Return Values Returns **`true`** on success or **`false`** on failure. ### Examples **Example #1 **GearmanWorker::setId()** example** Set an identifier for a simple worker. ``` <?php $worker= new GearmanWorker(); $worker->setId('test'); ?> ``` The above example will output something similar to: ``` Run the following command: gearadmin --workers Output: 30 ::3a3a:3361:3361:3a33%976303667 - : test ``` php The MessageFormatter class The MessageFormatter class ========================== Introduction ------------ (PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0) MessageFormatter is a concrete class that enables users to produce concatenated, language-neutral messages. The methods supplied in this class are used to build all the messages that are seen by end users. The MessageFormatter class assembles messages from various fragments (such as text fragments, numbers, and dates) supplied by the program. Because of the MessageFormatter class, the program does not need to know the order of the fragments. The class uses the formatting specifications for the fragments to assemble them into a message that is contained in a single string within a resource bundle. For example, MessageFormatter enables you to print the phrase "Finished printing x out of y files..." in a manner that still allows for flexibility in translation. Previously, an end user message was created as a sentence and handled as a string. This procedure created problems for localizers because the sentence structure, word order, number format and so on are very different from language to language. The language-neutral way to create messages keeps each part of the message separate and provides keys to the data. Using these keys, the MessageFormatter class can concatenate the parts of the message, localize them, and display a well-formed string to the end user. MessageFormatter takes a set of objects, formats them, and then inserts the formatted strings into the pattern at the appropriate places. Choice formats can be used in conjunction with MessageFormatter to handle plurals, match numbers, and select from an array of items. Typically, the message format will come from resources and the arguments will be dynamically set at runtime. Class synopsis -------------- class **MessageFormatter** { /\* Methods \*/ public [\_\_construct](messageformatter.create)(string `$locale`, string `$pattern`) ``` public static create(string $locale, string $pattern): ?MessageFormatter ``` ``` public static formatMessage(string $locale, string $pattern, array $values): string|false ``` ``` public format(array $values): string|false ``` ``` public getErrorCode(): int ``` ``` public getErrorMessage(): string ``` ``` public getLocale(): string ``` ``` public getPattern(): string|false ``` ``` public static parseMessage(string $locale, string $pattern, string $message): array|false ``` ``` public parse(string $string): array|false ``` ``` public setPattern(string $pattern): bool ``` } See Also -------- * [» ICU formatting documentation](https://unicode-org.github.io/icu/userguide/format_parse/) * [» ICU message formatting description](https://unicode-org.github.io/icu/userguide/format_parse/messages/) * [» ICU message formatters](https://unicode-org.github.io/icu/userguide/format_parse/messages/) * [» ICU choice formatters](http://icu-project.org/apiref/icu4c/classChoiceFormat.html#details) Table of Contents ----------------- * [MessageFormatter::create](messageformatter.create) — Constructs a new Message Formatter * [MessageFormatter::formatMessage](messageformatter.formatmessage) — Quick format message * [MessageFormatter::format](messageformatter.format) — Format the message * [MessageFormatter::getErrorCode](messageformatter.geterrorcode) — Get the error code from last operation * [MessageFormatter::getErrorMessage](messageformatter.geterrormessage) — Get the error text from the last operation * [MessageFormatter::getLocale](messageformatter.getlocale) — Get the locale for which the formatter was created * [MessageFormatter::getPattern](messageformatter.getpattern) — Get the pattern used by the formatter * [MessageFormatter::parseMessage](messageformatter.parsemessage) — Quick parse input string * [MessageFormatter::parse](messageformatter.parse) — Parse input string according to pattern * [MessageFormatter::setPattern](messageformatter.setpattern) — Set the pattern used by the formatter php session_create_id session\_create\_id =================== (PHP 7 >= 7.1.0, PHP 8) session\_create\_id — Create new session id ### Description ``` session_create_id(string $prefix = ""): string|false ``` **session\_create\_id()** is used to create new session id for the current session. It returns collision free session id. If session is not active, collision check is omitted. Session ID is created according to php.ini settings. It is important to use the same user ID of your web server for GC task script. Otherwise, you may have permission problems especially with files save handler. ### Parameters `prefix` If `prefix` is specified, new session id is prefixed by `prefix`. Not all characters are allowed within the session id. Characters in the range `a-z A-Z 0-9 , (comma) and - (minus)` are allowed. ### Return Values **session\_create\_id()** returns new collision free session id for the current session. If it is used without active session, it omits collision check. On failure, **`false`** is returned. ### Examples **Example #1 **session\_create\_id()** example with [session\_regenerate\_id()](function.session-regenerate-id)** ``` <?php // My session start function support timestamp management function my_session_start() {     session_start();     // Do not allow to use too old session ID     if (!empty($_SESSION['deleted_time']) && $_SESSION['deleted_time'] < time() - 180) {         session_destroy();         session_start();     } } // My session regenerate id function function my_session_regenerate_id() {     // Call session_create_id() while session is active to      // make sure collision free.     if (session_status() != PHP_SESSION_ACTIVE) {         session_start();     }     // WARNING: Never use confidential strings for prefix!     $newid = session_create_id('myprefix-');     // Set deleted timestamp. Session data must not be deleted immediately for reasons.     $_SESSION['deleted_time'] = time();     // Finish session     session_commit();     // Make sure to accept user defined session ID     // NOTE: You must enable use_strict_mode for normal operations.     ini_set('session.use_strict_mode', 0);     // Set new custom session ID     session_id($newid);     // Start with custom session ID     session_start(); } // Make sure use_strict_mode is enabled. // use_strict_mode is mandatory for security reasons. ini_set('session.use_strict_mode', 1); my_session_start(); // Session ID must be regenerated when //  - User logged in //  - User logged out //  - Certain period has passed my_session_regenerate_id(); // Write useful codes ?> ``` ### See Also * [session\_regenerate\_id()](function.session-regenerate-id) - Update the current session id with a newly generated one * [session\_start()](function.session-start) - Start new or resume existing session * [session.use\_strict\_mode](https://www.php.net/manual/en/session.configuration.php#ini.session.use-strict-mode) * [SessionHandler::create\_sid()](sessionhandler.create-sid) - Return a new session ID php Generator::getReturn Generator::getReturn ==================== (PHP 7, PHP 8) Generator::getReturn — Get the return value of a generator ### Description ``` public Generator::getReturn(): mixed ``` ### Parameters This function has no parameters. ### Return Values Returns the generator's return value once it has finished executing. ### Examples **Example #1 **Generator::getReturn()** example** ``` <?php $gen = (function() {     yield 1;     yield 2;     return 3; })(); foreach ($gen as $val) {     echo $val, PHP_EOL; } echo $gen->getReturn(), PHP_EOL; ``` The above example will output: ``` 1 2 3 ``` php asin asin ==== (PHP 4, PHP 5, PHP 7, PHP 8) asin — Arc sine ### Description ``` asin(float $num): float ``` Returns the arc sine of `num` in radians. **asin()** is the inverse function of [sin()](function.sin), which means that `a==sin(asin(a))` for every value of a that is within **asin()**'s range. ### Parameters `num` The argument to process ### Return Values The arc sine of `num` in radians ### See Also * [sin()](function.sin) - Sine * [asinh()](function.asinh) - Inverse hyperbolic sine * [acos()](function.acos) - Arc cosine * [atan()](function.atan) - Arc tangent php None Booleans -------- The bool type only has two values, and is used to express a truth value. It can be either **`true`** or **`false`**. ### Syntax To specify a bool literal, use the constants **`true`** or **`false`**. Both are case-insensitive. ``` <?php $foo = True; // assign the value TRUE to $foo ?> ``` Typically, the result of an [operator](language.operators) which returns a bool value is passed on to a [control structure](https://www.php.net/manual/en/language.control-structures.php). ``` <?php // == is an operator which tests // equality and returns a boolean if ($action == "show_version") {     echo "The version is 1.23"; } // this is not necessary... if ($show_separators == TRUE) {     echo "<hr>\n"; } // ...because this can be used with exactly the same meaning: if ($show_separators) {     echo "<hr>\n"; } ?> ``` ### Converting to boolean To explicitly convert a value to bool, use the `(bool)` cast. Generally this is not necessary because when a value is used in a logical context it will be automatically interpreted as a value of type bool. For more information see the [Type Juggling](language.types.type-juggling) page. When converting to bool, the following values are considered **`false`**: * the [boolean](language.types.boolean) **`false`** itself * the [integer](language.types.integer) `0` (zero) * the [float](language.types.float)s `0.0` and `-0.0` (zero) * the empty [string](language.types.string) `""`, and the [string](language.types.string) `"0"` * an [array](language.types.array) with zero elements * the unit type [NULL](language.types.null) (including unset variables) * Internal objects that overload their casting behaviour to bool. For example: [SimpleXML](https://www.php.net/manual/en/ref.simplexml.php) objects created from empty elements without attributes. Every other value is considered **`true`** (including [resource](language.types.resource) and **`NAN`**). **Warning** `-1` is considered **`true`**, like any other non-zero (whether negative or positive) number! ``` <?php var_dump((bool) "");        // bool(false) var_dump((bool) "0");       // bool(false) var_dump((bool) 1);         // bool(true) var_dump((bool) -2);        // bool(true) var_dump((bool) "foo");     // bool(true) var_dump((bool) 2.3e5);     // bool(true) var_dump((bool) array(12)); // bool(true) var_dump((bool) array());   // bool(false) var_dump((bool) "false");   // bool(true) ?> ``` php ReflectionParameter::allowsNull ReflectionParameter::allowsNull =============================== (PHP 5, PHP 7, PHP 8) ReflectionParameter::allowsNull — Checks if null is allowed ### Description ``` public ReflectionParameter::allowsNull(): bool ``` Checks whether the parameter allows **`null`**. ### Parameters This function has no parameters. ### Return Values **`true`** if **`null`** is allowed, otherwise **`false`** ### See Also * [ReflectionParameter::isOptional()](reflectionparameter.isoptional) - Checks if optional php XMLReader::read XMLReader::read =============== (PHP 5 >= 5.1.0, PHP 7, PHP 8) XMLReader::read — Move to next node in document ### Description ``` public XMLReader::read(): bool ``` Moves cursor to the next node in the document. ### Parameters This function has no parameters. ### Return Values Returns **`true`** on success or **`false`** on failure. ### See Also * [XMLReader::moveToElement()](xmlreader.movetoelement) - Position cursor on the parent Element of current Attribute * [XMLReader::moveToAttribute()](xmlreader.movetoattribute) - Move cursor to a named attribute * [XMLReader::next()](xmlreader.next) - Move cursor to next node skipping all subtrees php cosh cosh ==== (PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8) cosh — Hyperbolic cosine ### Description ``` cosh(float $num): float ``` Returns the hyperbolic cosine of `num`, defined as `(exp($num) + exp(-$num))/2`. ### Parameters `num` The argument to process ### Return Values The hyperbolic cosine of `num` ### See Also * [cos()](function.cos) - Cosine * [acosh()](function.acosh) - Inverse hyperbolic cosine * [sinh()](function.sinh) - Hyperbolic sine * [tanh()](function.tanh) - Hyperbolic tangent php fdf_get_file fdf\_get\_file ============== (PHP 4, PHP 5 < 5.3.0, PECL fdf SVN) fdf\_get\_file — Get the value of the /F key ### Description ``` fdf_get_file(resource $fdf_document): string ``` Gets the value of the `/F` key. ### Parameters `fdf_document` The FDF document handle, returned by [fdf\_create()](function.fdf-create), [fdf\_open()](function.fdf-open) or [fdf\_open\_string()](function.fdf-open-string). ### Return Values Returns the key value, as a string. ### See Also * [fdf\_set\_file()](function.fdf-set-file) - Set PDF document to display FDF data in php apcu_enabled apcu\_enabled ============= (PECL apcu >= 4.0.3) apcu\_enabled — Whether APCu is usable in the current environment ### Description ``` apcu_enabled(): bool ``` Returns whether APCu is usable in the current environment. ### Parameters This function has no parameters. ### Return Values Returns **`true`** when APCu is usable in the current environment, **`false`** otherwise.
programming_docs
php DateTime::__set_state DateTime::\_\_set\_state ======================== (PHP 5 >= 5.3.0, PHP 7, PHP 8) DateTime::\_\_set\_state — The \_\_set\_state handler ### Description ``` public static DateTime::__set_state(array $array): DateTime ``` The [\_\_set\_state()](language.oop5.magic#object.set-state) handler. Like [DateTimeImmutable::\_\_set\_state()](datetimeimmutable.set-state) but works with [DateTime](class.datetime). ### Parameters `array` Initialization array. ### Return Values Returns a new instance of a DateTime object. php dirname dirname ======= (PHP 4, PHP 5, PHP 7, PHP 8) dirname — Returns a parent directory's path ### Description ``` dirname(string $path, int $levels = 1): string ``` Given a string containing the path of a file or directory, this function will return the parent directory's path that is `levels` up from the current directory. > > **Note**: > > > **dirname()** operates naively on the input string, and is not aware of the actual filesystem, or path components such as "`..`". > > **Caution** On Windows, **dirname()** assumes the currently set codepage, so for it to see the correct directory name with multibyte character paths, the matching codepage must be set. If `path` contains characters which are invalid for the current codepage, the behavior of **dirname()** is undefined. On other systems, **dirname()** assumes `path` to be encoded in an ASCII compatible encoding. Otherwise the behavior of the the function is undefined. ### Parameters `path` A path. On Windows, both slash (`/`) and backslash (`\`) are used as directory separator character. In other environments, it is the forward slash (`/`). `levels` The number of parent directories to go up. This must be an integer greater than 0. ### Return Values Returns the path of a parent directory. If there are no slashes in `path`, a dot ('`.`') is returned, indicating the current directory. Otherwise, the returned string is `path` with any trailing `/component` removed. **Caution** Be careful when using this function in a loop that can reach the top-level directory as this can result in an infinite loop. ``` <?php dirname('.');    // Will return '.'. dirname('/');    // Will return `\` on Windows and '/' on *nix systems. dirname('\\');   // Will return `\` on Windows and '.' on *nix systems. dirname('C:\\'); // Will return 'C:\' on Windows and '.' on *nix systems. ?> ``` ### Changelog | Version | Description | | --- | --- | | 7.0.0 | Added the optional `levels` parameter. | ### Examples **Example #1 **dirname()** example** ``` <?php echo dirname("/etc/passwd") . PHP_EOL; echo dirname("/etc/") . PHP_EOL; echo dirname(".") . PHP_EOL; echo dirname("C:\\") . PHP_EOL; echo dirname("/usr/local/lib", 2); ``` The above example will output something similar to: ``` /etc / (or \ on Windows) . C:\ /usr ``` ### See Also * [basename()](function.basename) - Returns trailing name component of path * [pathinfo()](function.pathinfo) - Returns information about a file path * [realpath()](function.realpath) - Returns canonicalized absolute pathname php ReflectionProperty::isInitialized ReflectionProperty::isInitialized ================================= (PHP 7 >= 7.4.0, PHP 8) ReflectionProperty::isInitialized — Checks whether a property is initialized ### Description ``` public ReflectionProperty::isInitialized(?object $object = null): bool ``` Checks whether a property is initialized. ### Parameters `object` If the property is non-static an object must be provided to fetch the property from. ### Return Values Returns **`false`** for typed properties prior to initialization, and for properties that have been explicitly [unset()](function.unset). For all other properties **`true`** will be returned. ### Errors/Exceptions Throws a [ReflectionException](class.reflectionexception) if the property is inaccessible. You can make a protected or private property accessible using [ReflectionProperty::setAccessible()](reflectionproperty.setaccessible). ### Changelog | Version | Description | | --- | --- | | 8.0.0 | `object` is nullable now. | ### Examples **Example #1 **ReflectionProperty::isInitialized()** example** ``` <?php class User {     public string $name; } $rp = new ReflectionProperty('User', 'name'); $user = new User; var_dump($rp->isInitialized($user)); $user->name = 'Nikita'; var_dump($rp->isInitialized($user)); ?> ``` The above example will output: ``` bool(false) bool(true) ``` ### See Also * [ReflectionProperty::hasType()](reflectionproperty.hastype) - Checks if property has a type php curl_reset curl\_reset =========== (PHP 5 >= 5.5.0, PHP 7, PHP 8) curl\_reset — Reset all options of a libcurl session handle ### Description ``` curl_reset(CurlHandle $handle): void ``` This function re-initializes all options set on the given cURL handle to the default values. ### Parameters `handle` A cURL handle returned by [curl\_init()](function.curl-init). ### Return Values No value is returned. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | `handle` expects a [CurlHandle](class.curlhandle) instance now; previously, a resource was expected. | ### Examples **Example #1 **curl\_reset()** example** ``` <?php // Create a curl handle $ch = curl_init(); // Set CURLOPT_USERAGENT option curl_setopt($ch, CURLOPT_USERAGENT, "My test user-agent"); // Reset all previously set options curl_reset($ch); // Send HTTP request curl_setopt($ch, CURLOPT_URL, 'http://example.com/'); curl_exec($ch); // the previously set user-agent will be not sent, it has been reset by curl_reset // Close the handle curl_close($ch); ?> ``` ### Notes > > **Note**: > > > **curl\_reset()** also resets the URL given as the [curl\_init()](function.curl-init) parameter. > > ### See Also * [curl\_setopt()](function.curl-setopt) - Set an option for a cURL transfer php Locale::getRegion Locale::getRegion ================= locale\_get\_region =================== (PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0) Locale::getRegion -- locale\_get\_region — Gets the region for the input locale ### Description Object-oriented style ``` public static Locale::getRegion(string $locale): ?string ``` Procedural style ``` locale_get_region(string $locale): ?string ``` Gets the region for the input locale. ### Parameters `locale` The locale to extract the region code from ### Return Values The region subtag for the locale or **`null`** if not present Returns **`null`** when the length of `locale` exceeds **`INTL_MAX_LOCALE_LEN`**. ### Examples **Example #1 **locale\_get\_region()** example** ``` <?php echo locale_get_region('de-CH-1901'); ?> ``` **Example #2 OO example** ``` <?php echo Locale::getRegion('de-CH-1901'); ?> ``` The above example will output: ``` CH ``` ### See Also * [locale\_get\_primary\_language()](locale.getprimarylanguage) - Gets the primary language for the input locale * [locale\_get\_script()](locale.getscript) - Gets the script for the input locale * [locale\_get\_all\_variants()](locale.getallvariants) - Gets the variants for the input locale php ReflectionZendExtension::getName ReflectionZendExtension::getName ================================ (PHP 5 >= 5.4.0, PHP 7, PHP 8) ReflectionZendExtension::getName — Gets name ### Description ``` public ReflectionZendExtension::getName(): string ``` **Warning**This function is currently not documented; only its argument list is available. ### Parameters This function has no parameters. ### Return Values php fileowner fileowner ========= (PHP 4, PHP 5, PHP 7, PHP 8) fileowner — Gets file owner ### Description ``` fileowner(string $filename): int|false ``` Gets the file owner. ### Parameters `filename` Path to the file. ### Return Values Returns the user ID of the owner of the file, or **`false`** on failure. The user ID is returned in numerical format, use [posix\_getpwuid()](function.posix-getpwuid) to resolve it to a username. ### Errors/Exceptions Upon failure, an **`E_WARNING`** is emitted. ### Examples **Example #1 Finding the owner of a file** ``` <?php $filename = 'index.php'; print_r(posix_getpwuid(fileowner($filename))); ?> ``` ### Notes > **Note**: The results of this function are cached. See [clearstatcache()](function.clearstatcache) for more details. > > **Tip**As of PHP 5.0.0, this function can also be used with *some* URL wrappers. Refer to [Supported Protocols and Wrappers](https://www.php.net/manual/en/wrappers.php) to determine which wrappers support [stat()](function.stat) family of functionality. ### See Also * [filegroup()](function.filegroup) - Gets file group * [stat()](function.stat) - Gives information about a file * [posix\_getpwuid()](function.posix-getpwuid) - Return info about a user by user id php Gmagick::setsamplingfactors Gmagick::setsamplingfactors =========================== (PECL gmagick >= Unknown) Gmagick::setsamplingfactors — Sets the image sampling factors ### Description ``` public Gmagick::setsamplingfactors(array $factors): Gmagick ``` Sets the image sampling factors. ### Parameters `factors` An array of floats representing the sampling factor for each color component (in RGB order). ### Return Values The [Gmagick](class.gmagick) object. ### Errors/Exceptions Throws an **GmagickException** on error. php zip_entry_open zip\_entry\_open ================ (PHP 4 >= 4.1.0, PHP 5 >= 5.2.0, PHP 7, PHP 8, PECL zip >= 1.0.0) zip\_entry\_open — Open a directory entry for reading **Warning**This function has been *DEPRECATED* as of PHP 8.0.0. Relying on this function is highly discouraged. ### Description ``` zip_entry_open(resource $zip_dp, resource $zip_entry, string $mode = "rb"): bool ``` Opens a directory entry in a zip file for reading. ### Parameters `zip_dp` A valid resource handle returned by [zip\_open()](function.zip-open). `zip_entry` A directory entry returned by [zip\_read()](function.zip-read). `mode` Any of the modes specified in the documentation of [fopen()](function.fopen). > > **Note**: > > > Currently, `mode` is ignored and is always `"rb"`. This is due to the fact that zip support in PHP is read only access. > > ### Return Values Returns **`true`** on success or **`false`** on failure. > > **Note**: > > > Unlike [fopen()](function.fopen) and other similar functions, the return value of **zip\_entry\_open()** only indicates the result of the operation and is not needed for reading or closing the directory entry. > > ### Changelog | Version | Description | | --- | --- | | 8.0.0 | This function is deprecated in favor of the Object API. | ### See Also * [zip\_entry\_close()](function.zip-entry-close) - Close a directory entry * [zip\_entry\_read()](function.zip-entry-read) - Read from an open directory entry php Imagick::setImageChannelDepth Imagick::setImageChannelDepth ============================= (PECL imagick 2, PECL imagick 3) Imagick::setImageChannelDepth — Sets the depth of a particular image channel ### Description ``` public Imagick::setImageChannelDepth(int $channel, int $depth): bool ``` Sets the depth of a particular image channel. ### Parameters `channel` `depth` ### Return Values Returns **`true`** on success. ### Errors/Exceptions Throws ImagickException on error. php SolrQuery::getMltQueryFields SolrQuery::getMltQueryFields ============================ (PECL solr >= 0.9.2) SolrQuery::getMltQueryFields — Returns the query fields and their boosts ### Description ``` public SolrQuery::getMltQueryFields(): array ``` Returns the query fields and their boosts ### Parameters This function has no parameters. ### Return Values Returns an array on success and **`null`** if not set. php pg_fetch_all_columns pg\_fetch\_all\_columns ======================= (PHP 5 >= 5.1.0, PHP 7, PHP 8) pg\_fetch\_all\_columns — Fetches all rows in a particular result column as an array ### Description ``` pg_fetch_all_columns(PgSql\Result $result, int $field = 0): array ``` **pg\_fetch\_all\_columns()** returns an array that contains all rows (records) in a particular column of the [PgSql\Result](class.pgsql-result) instance. > **Note**: This function sets NULL fields to the PHP **`null`** value. > > ### Parameters `result` An [PgSql\Result](class.pgsql-result) instance, returned by [pg\_query()](function.pg-query), [pg\_query\_params()](function.pg-query-params) or [pg\_execute()](function.pg-execute)(among others). `field` Column number. Defaults to the first column if not specified. ### Return Values An array with all values in the result column. ### Changelog | Version | Description | | --- | --- | | 8.1.0 | The `result` parameter expects an [PgSql\Result](class.pgsql-result) instance now; previously, a [resource](language.types.resource) was expected. | ### Examples **Example #1 **pg\_fetch\_all\_columns()** example** ``` <?php  $conn = pg_pconnect("dbname=publisher"); if (!$conn) {   echo "An error occurred.\n";   exit; } $result = pg_query($conn, "SELECT title, name, address FROM authors"); if (!$result) {   echo "An error occurred.\n";   exit; } // Get an array of all author names $arr = pg_fetch_all_columns($result, 1); var_dump($arr); ?> ``` ### See Also * [pg\_fetch\_all()](function.pg-fetch-all) - Fetches all rows from a result as an array php None Spotting References ------------------- Many syntax constructs in PHP are implemented via referencing mechanisms, so everything mentioned herein about reference binding also applies to these constructs. Some constructs, like passing and returning by reference, are mentioned above. Other constructs that use references are: ### global References When you declare a variable as **global $var** you are in fact creating reference to a global variable. That means, this is the same as: ``` <?php $var =& $GLOBALS["var"]; ?> ``` This also means that unsetting $var won't unset the global variable. php EventHttpRequest::getInputBuffer EventHttpRequest::getInputBuffer ================================ (PECL event >= 1.4.0-beta) EventHttpRequest::getInputBuffer — Returns the input buffer ### Description ``` public EventHttpRequest::getInputBuffer(): EventBuffer ``` Returns the input buffer. ### Parameters This function has no parameters. ### Return Values Returns the input buffer. ### See Also * [EventHttpRequest::getOutputBuffer()](eventhttprequest.getoutputbuffer) - Returns the output buffer of the request php Parle\Lexer::callout Parle\Lexer::callout ==================== (PECL parle >= 0.7.2) Parle\Lexer::callout — Define token callback ### Description ``` public Parle\Lexer::callout(int $id, callable $callback): void ``` Define a callback to be invoked once lexer encounters a particular token. ### Parameters `id` Token id. `callback` Callable to be invoked. The callable doesn't receive any arguments and its return value is ignored. ### Return Values No value is returned. php opendir opendir ======= (PHP 4, PHP 5, PHP 7, PHP 8) opendir — Open directory handle ### Description ``` opendir(string $directory, ?resource $context = null): resource|false ``` Opens up a directory handle to be used in subsequent [closedir()](function.closedir), [readdir()](function.readdir), and [rewinddir()](function.rewinddir) calls. ### Parameters `directory` The directory path that is to be opened `context` For a description of the `context` parameter, refer to [the streams section](https://www.php.net/manual/en/ref.stream.php) of the manual. ### Return Values Returns a directory handle resource on success, or **`false`** on failure ### Errors/Exceptions Upon failure, an **`E_WARNING`** is emitted. This may happen if `directory` is not a valid directory, the directory can not be opened due to permission restrictions, or due to filesystem errors. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | `context` is now nullable. | ### Examples **Example #1 **opendir()** example** ``` <?php $dir = "/etc/php5/"; // Open a known directory, and proceed to read its contents if (is_dir($dir)) {     if ($dh = opendir($dir)) {         while (($file = readdir($dh)) !== false) {             echo "filename: $file : filetype: " . filetype($dir . $file) . "\n";         }         closedir($dh);     } } ?> ``` The above example will output something similar to: ``` filename: . : filetype: dir filename: .. : filetype: dir filename: apache : filetype: dir filename: cgi : filetype: dir filename: cli : filetype: dir ``` ### See Also * [is\_dir()](function.is-dir) - Tells whether the filename is a directory * [readdir()](function.readdir) - Read entry from directory handle * [dir()](function.dir) - Return an instance of the Directory class php ReflectionParameter::isDefaultValueConstant ReflectionParameter::isDefaultValueConstant =========================================== (PHP 5 >= 5.4.6, PHP 7, PHP 8) ReflectionParameter::isDefaultValueConstant — Returns whether the default value of this parameter is a constant ### Description ``` public ReflectionParameter::isDefaultValueConstant(): bool ``` Returns whether the default value of this parameter is a constant. ### Parameters This function has no parameters. ### Return Values Returns **`true`** if the default value is constant, and **`false`** otherwise. ### See Also * [ReflectionParameter::getDefaultValueConstantName()](reflectionparameter.getdefaultvalueconstantname) - Returns the default value's constant name if default value is constant or null * [ReflectionParameter::isDefaultValueAvailable()](reflectionparameter.isdefaultvalueavailable) - Checks if a default value is available php PharData::decompressFiles PharData::decompressFiles ========================= (PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 2.0.0) PharData::decompressFiles — Decompresses all files in the current zip archive ### Description ``` public PharData::decompressFiles(): bool ``` > > **Note**: > > > This method requires the php.ini setting `phar.readonly` to be set to `0` in order to work for [Phar](class.phar) objects. Otherwise, a [PharException](class.pharexception) will be thrown. > > > For tar-based archives, this method throws a [BadMethodCallException](class.badmethodcallexception), as compression of individual files within a tar archive is not supported by the file format. Use [PharData::compress()](phardata.compress) to compress an entire tar-based archive. For Zip-based archives, this method decompresses all files in the archive. The [zlib](https://www.php.net/manual/en/ref.zlib.php) or [bzip2](https://www.php.net/manual/en/ref.bzip2.php) extensions must be enabled to take advantage of this feature if any files are compressed using bzip2/zlib compression. ### Parameters This function has no parameters. ### Return Values Returns **`true`** on success or **`false`** on failure. ### Errors/Exceptions Throws [BadMethodCallException](class.badmethodcallexception) if the [zlib](https://www.php.net/manual/en/ref.zlib.php) extension is not available, or if any files are compressed using bzip2 compression and the [bzip2](https://www.php.net/manual/en/ref.bzip2.php) extension is not enabled. ### Examples **Example #1 A **PharData::decompressFiles()** example** ``` <?php $p = new PharData('/path/to/my.zip'); $p['myfile.txt'] = 'hi'; $p['myfile2.txt'] = 'hi'; $p->compressFiles(Phar::GZ); foreach ($p as $file) {     var_dump($file->getFileName());     var_dump($file->isCompressed());     var_dump($file->isCompressed(Phar::BZ2));     var_dump($file->isCompressed(Phar::GZ)); } $p->decompressFiles(); foreach ($p as $file) {     var_dump($file->getFileName());     var_dump($file->isCompressed());     var_dump($file->isCompressed(Phar::BZ2));     var_dump($file->isCompressed(Phar::GZ)); } ?> ``` The above example will output: ``` string(10) "myfile.txt" int(4096) bool(false) bool(true) string(11) "myfile2.txt" int(4096) bool(false) bool(true) string(10) "myfile.txt" bool(false) bool(false) bool(false) string(11) "myfile2.txt" bool(false) bool(false) bool(false) ``` ### See Also * [PharFileInfo::getCompressedSize()](pharfileinfo.getcompressedsize) - Returns the actual size of the file (with compression) inside the Phar archive * [PharFileInfo::isCompressed()](pharfileinfo.iscompressed) - Returns whether the entry is compressed * [PharFileInfo::compress()](pharfileinfo.compress) - Compresses the current Phar entry with either zlib or bzip2 compression * [PharFileInfo::decompress()](pharfileinfo.decompress) - Decompresses the current Phar entry within the phar * [Phar::canCompress()](phar.cancompress) - Returns whether phar extension supports compression using either zlib or bzip2 * [Phar::isCompressed()](phar.iscompressed) - Returns Phar::GZ or PHAR::BZ2 if the entire phar archive is compressed (.tar.gz/tar.bz and so on) * [PharData::compressFiles()](phardata.compressfiles) - Compresses all files in the current tar/zip archive * [Phar::getSupportedCompression()](phar.getsupportedcompression) - Return array of supported compression algorithms * [PharData::compress()](phardata.compress) - Compresses the entire tar/zip archive using Gzip or Bzip2 compression * [PharData::decompress()](phardata.decompress) - Decompresses the entire Phar archive
programming_docs
php fbird_blob_info fbird\_blob\_info ================= (PHP 5, PHP 7 < 7.4.0) fbird\_blob\_info — Alias of [ibase\_blob\_info()](function.ibase-blob-info) ### Description This function is an alias of: [ibase\_blob\_info()](function.ibase-blob-info). php Yaf_Request_Simple::getFiles Yaf\_Request\_Simple::getFiles ============================== (Yaf >=1.0.0) Yaf\_Request\_Simple::getFiles — The getFiles purpose ### Description ``` public Yaf_Request_Simple::getFiles(): void ``` **Warning**This function is currently not documented; only its argument list is available. ### Parameters This function has no parameters. ### Return Values php Gmagick::medianfilterimage Gmagick::medianfilterimage ========================== (PECL gmagick >= Unknown) Gmagick::medianfilterimage — Applies a digital filter ### Description ``` public Gmagick::medianfilterimage(float $radius): void ``` Applies a digital filter that improves the quality of a noisy image. Each pixel is replaced by the median in a set of neighboring pixels as defined by radius. ### Parameters `radius` The radius of the pixel neighborhood. ### Return Values [Gmagick](class.gmagick) object with median filter applied. ### Errors/Exceptions Throws an **GmagickException** on error. php RecursiveArrayIterator::getChildren RecursiveArrayIterator::getChildren =================================== (PHP 5 >= 5.1.0, PHP 7, PHP 8) RecursiveArrayIterator::getChildren — Returns an iterator for the current entry if it is an array or an object ### Description ``` public RecursiveArrayIterator::getChildren(): ?RecursiveArrayIterator ``` Returns an iterator for the current iterator entry. ### Parameters This function has no parameters. ### Return Values An iterator for the current entry, if it is an array or object; or **`null`** on failure. ### Errors/Exceptions An [InvalidArgumentException](class.invalidargumentexception) will be thrown if the current entry does not contain an array or an object. ### Examples **Example #1 **RecursiveArrayIterator::getChildren()** example** ``` <?php $fruits = array("a" => "lemon", "b" => "orange", array("a" => "apple", "p" => "pear")); $iterator = new RecursiveArrayIterator($fruits); while ($iterator->valid()) {     if ($iterator->hasChildren()) {         // print all children         foreach ($iterator->getChildren() as $key => $value) {             echo $key . ' : ' . $value . "\n";         }     } else {         echo "No children.\n";     }     $iterator->next(); } ?> ``` The above example will output: ``` No children. No children. a : apple p : pear ``` ### See Also * [RecursiveArrayIterator::hasChildren()](recursivearrayiterator.haschildren) - Returns whether current entry is an array or an object php WeakReference::__construct WeakReference::\_\_construct ============================ (PHP 7 >= 7.4.0, PHP 8) WeakReference::\_\_construct — Constructor that disallows instantiation ### Description public **WeakReference::\_\_construct**() This method exists only to disallow instantiation of the [WeakReference](class.weakreference) class. Weak references are to be instantiated with the factory method [WeakReference::create()](weakreference.create). ### Parameters This function has no parameters. ### See Also * [WeakReference::create()](weakreference.create) - Create a new weak reference php QuickHashIntHash::loadFromString QuickHashIntHash::loadFromString ================================ (PECL quickhash >= Unknown) QuickHashIntHash::loadFromString — This factory method creates a hash from a string ### Description ``` public static QuickHashIntHash::loadFromString(string $contents, int $options = ?): QuickHashIntHash ``` This factory method creates a new hash from a definition in a string. The file format consists of 32 bit signed integers packed together in the Endianness that the system that the code runs on uses. For each element there are two 32 bit signed integers stored. The first of each element is the key, and the second is the value belonging to the key. ### Parameters `contents` The string containing a serialized format of the hash. `options` The same options that the class' constructor takes; except that the size option is ignored. It is automatically calculated to be the same as the number of entries in the hash, rounded up to the nearest power of two with a maximum limit of `4194304`. ### Return Values Returns a new [QuickHashIntHash](class.quickhashinthash). ### Examples **Example #1 **QuickHashIntHash::loadFromString()** example** ``` <?php $contents = file_get_contents( dirname( __FILE__ ) . "/simple.hash" ); $hash = QuickHashIntHash::loadFromString(     $contents,     QuickHashIntHash::DO_NOT_USE_ZEND_ALLOC ); foreach( range( 0, 0x0f ) as $key ) {     printf( "Key %3d (%2x) is %s\n",         $key, $key,         $hash->exists( $key ) ? 'set' : 'unset'     ); } ?> ``` The above example will output something similar to: ``` Key 0 ( 0) is unset Key 1 ( 1) is set Key 2 ( 2) is set Key 3 ( 3) is set Key 4 ( 4) is unset Key 5 ( 5) is set Key 6 ( 6) is unset Key 7 ( 7) is set Key 8 ( 8) is unset Key 9 ( 9) is unset Key 10 ( a) is unset Key 11 ( b) is set Key 12 ( c) is unset Key 13 ( d) is set Key 14 ( e) is unset Key 15 ( f) is unset ``` php mb_http_output mb\_http\_output ================ (PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8) mb\_http\_output — Set/Get HTTP output character encoding ### Description ``` mb_http_output(?string $encoding = null): string|bool ``` Set/Get the HTTP output character encoding. Output after this function is called will be converted from the set internal encoding to `encoding`. ### Parameters `encoding` If `encoding` is set, **mb\_http\_output()** sets the HTTP output character encoding to `encoding`. If `encoding` is omitted, **mb\_http\_output()** returns the current HTTP output character encoding. ### Return Values If `encoding` is omitted, **mb\_http\_output()** returns the current HTTP output character encoding. Otherwise, Returns **`true`** on success or **`false`** on failure. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | `encoding` is nullable now. | ### See Also * [mb\_internal\_encoding()](function.mb-internal-encoding) - Set/Get internal character encoding * [mb\_http\_input()](function.mb-http-input) - Detect HTTP input character encoding * [mb\_detect\_order()](function.mb-detect-order) - Set/Get character encoding detection order php IntlBreakIterator::current IntlBreakIterator::current ========================== (PHP 5 >= 5.5.0, PHP 7, PHP 8) IntlBreakIterator::current — Get index of current position ### Description ``` public IntlBreakIterator::current(): int ``` **Warning**This function is currently not documented; only its argument list is available. ### Parameters This function has no parameters. ### Return Values php The LengthException class The LengthException class ========================= Introduction ------------ (PHP 5 >= 5.1.0, PHP 7, PHP 8) Exception thrown if a length is invalid. Class synopsis -------------- class **LengthException** extends [LogicException](class.logicexception) { /\* Inherited properties \*/ protected string [$message](class.exception#exception.props.message) = ""; private string [$string](class.exception#exception.props.string) = ""; protected int [$code](class.exception#exception.props.code); protected string [$file](class.exception#exception.props.file) = ""; protected int [$line](class.exception#exception.props.line); private array [$trace](class.exception#exception.props.trace) = []; private ?[Throwable](class.throwable) [$previous](class.exception#exception.props.previous) = null; /\* Inherited methods \*/ ``` final public Exception::getMessage(): string ``` ``` final public Exception::getPrevious(): ?Throwable ``` ``` final public Exception::getCode(): int ``` ``` final public Exception::getFile(): string ``` ``` final public Exception::getLine(): int ``` ``` final public Exception::getTrace(): array ``` ``` final public Exception::getTraceAsString(): string ``` ``` public Exception::__toString(): string ``` ``` private Exception::__clone(): void ``` } php iterator_count iterator\_count =============== (PHP 5 >= 5.1.0, PHP 7, PHP 8) iterator\_count — Count the elements in an iterator ### Description ``` iterator_count(Traversable|array $iterator): int ``` Count the elements in an iterator. **iterator\_count()** is not guaranteed to retain the current position of the `iterator`. ### Parameters `iterator` The iterator being counted. ### Return Values The number of elements in `iterator`. ### Changelog | Version | Description | | --- | --- | | 8.2.0 | The type of `iterator` has been widened from [Traversable](class.traversable) to [Traversable](class.traversable)|array. | ### Examples **Example #1 **iterator\_count()** example** ``` <?php $iterator = new ArrayIterator(array('recipe'=>'pancakes', 'egg', 'milk', 'flour')); var_dump(iterator_count($iterator)); ?> ``` The above example will output: ``` int(4) ``` **Example #2 **iterator\_count()** modifies position** ``` <?php $iterator = new ArrayIterator(['one', 'two', 'three']); var_dump($iterator->current()); var_dump(iterator_count($iterator)); var_dump($iterator->current()); ?> ``` The above example will output: ``` string(3) "one" int(3) NULL ``` **Example #3 **iterator\_count()** in [foreach](control-structures.foreach) loops** ``` <?php $iterator = new ArrayIterator(['one', 'two', 'three']); foreach ($iterator as $key => $value) {     echo "$key: $value (", iterator_count($iterator), ")\n"; }?> ``` The above example will output: ``` 0: one (3) ``` php None Variable scope -------------- The scope of a variable is the context within which it is defined. For the most part all PHP variables only have a single scope. This single scope spans included and required files as well. For example: ``` <?php $a = 1; include 'b.inc'; ?> ``` Here the $a variable will be available within the included b.inc script. However, within user-defined functions a local function scope is introduced. Any variable used inside a function is by default limited to the local function scope. For example: ``` <?php $a = 1; /* global scope */  function test() {      echo $a; /* reference to local scope variable */  }  test(); ?> ``` This script will not produce any output because the echo statement refers to a local version of the $a variable, and it has not been assigned a value within this scope. You may notice that this is a little bit different from the C language in that global variables in C are automatically available to functions unless specifically overridden by a local definition. This can cause some problems in that people may inadvertently change a global variable. In PHP global variables must be declared global inside a function if they are going to be used in that function. ### The `global` keyword First, an example use of `global`: **Example #1 Using `global`** ``` <?php $a = 1; $b = 2; function Sum() {     global $a, $b;     $b = $a + $b; }  Sum(); echo $b; ?> ``` The above script will output `3`. By declaring $a and $b global within the function, all references to either variable will refer to the global version. There is no limit to the number of global variables that can be manipulated by a function. A second way to access variables from the global scope is to use the special PHP-defined [$GLOBALS](reserved.variables.globals) array. The previous example can be rewritten as: **Example #2 Using [$GLOBALS](reserved.variables.globals) instead of global** ``` <?php $a = 1; $b = 2; function Sum() {     $GLOBALS['b'] = $GLOBALS['a'] + $GLOBALS['b']; }  Sum(); echo $b; ?> ``` The [$GLOBALS](reserved.variables.globals) array is an associative array with the name of the global variable being the key and the contents of that variable being the value of the array element. Notice how [$GLOBALS](reserved.variables.globals) exists in any scope, this is because [$GLOBALS](reserved.variables.globals) is a [superglobal](language.variables.superglobals). Here's an example demonstrating the power of superglobals: **Example #3 Example demonstrating superglobals and scope** ``` <?php function test_superglobal() {     echo $_POST['name']; } ?> ``` > > **Note**: > > > Using `global` keyword outside a function is not an error. It can be used if the file is included from inside a function. > > ### Using `static` variables Another important feature of variable scoping is the *static* variable. A static variable exists only in a local function scope, but it does not lose its value when program execution leaves this scope. Consider the following example: **Example #4 Example demonstrating need for static variables** ``` <?php function test() {     $a = 0;     echo $a;     $a++; } ?> ``` This function is quite useless since every time it is called it sets $a to `0` and prints `0`. The $a++ which increments the variable serves no purpose since as soon as the function exits the $a variable disappears. To make a useful counting function which will not lose track of the current count, the $a variable is declared static: **Example #5 Example use of static variables** ``` <?php function test() {     static $a = 0;     echo $a;     $a++; } ?> ``` Now, $a is initialized only in first call of function and every time the `test()` function is called it will print the value of $a and increment it. Static variables also provide one way to deal with recursive functions. A recursive function is one which calls itself. Care must be taken when writing a recursive function because it is possible to make it recurse indefinitely. You must make sure you have an adequate way of terminating the recursion. The following simple function recursively counts to 10, using the static variable $count to know when to stop: **Example #6 Static variables with recursive functions** ``` <?php function test() {     static $count = 0;     $count++;     echo $count;     if ($count < 10) {         test();     }     $count--; } ?> ``` Static variables can be assigned values which are the result of constant expressions, but dynamic expressions, such as function calls, will cause a parse error. **Example #7 Declaring static variables** ``` <?php function foo(){     static $int = 0;          // correct      static $int = 1+2;        // correct     static $int = sqrt(121);  // wrong  (as it is a function)     $int++;     echo $int; } ?> ``` As of PHP 8.1.0, when a method using static variables is inherited (but not overridden), the inherited method will now share static variables with the parent method. This means that static variables in methods now behave the same way as static properties. **Example #8 Usage of static Variables in Inherited Methods** ``` <?php class Foo {     public static function counter() {         static $counter = 0;         $counter++;         return $counter;     } } class Bar extends Foo {} var_dump(Foo::counter()); // int(1) var_dump(Foo::counter()); // int(2) var_dump(Bar::counter()); // int(3), prior to PHP 8.1.0 int(1) var_dump(Bar::counter()); // int(4), prior to PHP 8.1.0 int(2) ?> ``` > > **Note**: > > > Static declarations are resolved in compile-time. > > ### References with `global` and `static` variables PHP implements the [static](language.variables.scope#language.variables.scope.static) and [global](language.variables.scope#language.variables.scope.global) modifier for variables in terms of [references](https://www.php.net/manual/en/language.references.php). For example, a true global variable imported inside a function scope with the `global` statement actually creates a reference to the global variable. This can lead to unexpected behaviour which the following example addresses: ``` <?php function test_global_ref() {     global $obj;     $new = new stdclass;     $obj = &$new; } function test_global_noref() {     global $obj;     $new = new stdclass;     $obj = $new; } test_global_ref(); var_dump($obj); test_global_noref(); var_dump($obj); ?> ``` The above example will output: ``` NULL object(stdClass)#1 (0) { } ``` A similar behaviour applies to the `static` statement. References are not stored statically: ``` <?php function &get_instance_ref() {     static $obj;     echo 'Static object: ';     var_dump($obj);     if (!isset($obj)) {         $new = new stdclass;         // Assign a reference to the static variable         $obj = &$new;     }     if (!isset($obj->property)) {         $obj->property = 1;     } else {         $obj->property++;     }     return $obj; } function &get_instance_noref() {     static $obj;     echo 'Static object: ';     var_dump($obj);     if (!isset($obj)) {         $new = new stdclass;         // Assign the object to the static variable         $obj = $new;     }     if (!isset($obj->property)) {         $obj->property = 1;     } else {         $obj->property++;     }     return $obj; } $obj1 = get_instance_ref(); $still_obj1 = get_instance_ref(); echo "\n"; $obj2 = get_instance_noref(); $still_obj2 = get_instance_noref(); ?> ``` The above example will output: ``` Static object: NULL Static object: NULL Static object: NULL Static object: object(stdClass)#3 (1) { ["property"]=> int(1) } ``` This example demonstrates that when assigning a reference to a static variable, it's not *remembered* when you call the `&get_instance_ref()` function a second time. php sodium_crypto_aead_aes256gcm_keygen sodium\_crypto\_aead\_aes256gcm\_keygen ======================================= (PHP 7 >= 7.2.0, PHP 8) sodium\_crypto\_aead\_aes256gcm\_keygen — Generate a random AES-256-GCM key ### Description ``` sodium_crypto_aead_aes256gcm_keygen(): string ``` Generate a random key for use with [sodium\_crypto\_aead\_aes256gcm\_encrypt()](function.sodium-crypto-aead-aes256gcm-encrypt) and [sodium\_crypto\_aead\_aes256gcm\_decrypt()](function.sodium-crypto-aead-aes256gcm-decrypt). ### Parameters This function has no parameters. ### Return Values Returns a 256-bit random key. php apcu_key_info apcu\_key\_info =============== (No version information available, might only be in Git) apcu\_key\_info — Get detailed information about the cache key ### Description ``` apcu_key_info(string $key): ?array ``` Get detailed information about the cache key ### Parameters `key` Get detailed information about the cache key ### Return Values An array containing the detailed information about the cache key, or **`null`** if the key does not exist. ### Examples **Example #1 A **apcu\_key\_info()** example** ``` <?php apcu_add('a','b'); var_dump(apcu_key_info('a')); ?> ``` The above example will output: ``` array(7) { ["hits"]=> int(0) ["access_time"]=> int(1606701783) ["mtime"]=> int(1606701783) ["creation_time"]=> int(1606701783) ["deletion_time"]=> int(0) ["ttl"]=> int(0) ["refs"]=> int(0) } ``` ### See Also * [apcu\_store()](function.apcu-store) - Cache a variable in the data store * [apcu\_fetch()](function.apcu-fetch) - Fetch a stored variable from the cache * [apcu\_delete()](function.apcu-delete) - Removes a stored variable from the cache php imap_bodystruct imap\_bodystruct ================ (PHP 4, PHP 5, PHP 7, PHP 8) imap\_bodystruct — Read the structure of a specified body section of a specific message ### Description ``` imap_bodystruct(IMAP\Connection $imap, int $message_num, string $section): stdClass|false ``` Read the structure of a specified body section of a specific message. ### Parameters `imap` An [IMAP\Connection](class.imap-connection) instance. `message_num` The message number `section` The body section to read ### Return Values Returns the information in an object, or **`false`** on failure. For a detailed description of the object structure and properties see [imap\_fetchstructure()](function.imap-fetchstructure). ### Changelog | Version | Description | | --- | --- | | 8.1.0 | The `imap` parameter expects an [IMAP\Connection](class.imap-connection) instance now; previously, a [resource](language.types.resource) was expected. | ### See Also * [imap\_fetchstructure()](function.imap-fetchstructure) - Read the structure of a particular message
programming_docs
php The PSpell\Config class The PSpell\Config class ======================= Introduction ------------ (PHP 8 >= 8.1.0) A fully opaque class which replaces a `pspell config` resource as of PHP 8.1.0. Class synopsis -------------- final class **PSpell\Config** { } php The Transliterator class The Transliterator class ======================== Introduction ------------ (PHP 5 >= 5.4.0, PHP 7, PHP 8, PECL intl >= 2.0.0) Transliterator provides transliteration of strings. Class synopsis -------------- class **Transliterator** { /\* Constants \*/ public const int [FORWARD](class.transliterator#transliterator.constants.forward); public const int [REVERSE](class.transliterator#transliterator.constants.reverse); /\* Properties \*/ public readonly string [$id](class.transliterator#transliterator.props.id); /\* Methods \*/ final private [\_\_construct](transliterator.construct)() ``` public static create(string $id, int $direction = Transliterator::FORWARD): ?Transliterator ``` ``` public static createFromRules(string $rules, int $direction = Transliterator::FORWARD): ?Transliterator ``` ``` public createInverse(): ?Transliterator ``` ``` public getErrorCode(): int|false ``` ``` public getErrorMessage(): string|false ``` ``` public static listIDs(): array|false ``` ``` public transliterate(string $string, int $start = 0, int $end = -1): string|false ``` } Properties ---------- id Predefined Constants -------------------- **`Transliterator::FORWARD`** **`Transliterator::REVERSE`** Changelog --------- | Version | Description | | --- | --- | | 8.2.0 | The id property is now readonly. | Table of Contents ----------------- * [Transliterator::\_\_construct](transliterator.construct) — Private constructor to deny instantiation * [Transliterator::create](transliterator.create) — Create a transliterator * [Transliterator::createFromRules](transliterator.createfromrules) — Create transliterator from rules * [Transliterator::createInverse](transliterator.createinverse) — Create an inverse transliterator * [Transliterator::getErrorCode](transliterator.geterrorcode) — Get last error code * [Transliterator::getErrorMessage](transliterator.geterrormessage) — Get last error message * [Transliterator::listIDs](transliterator.listids) — Get transliterator IDs * [Transliterator::transliterate](transliterator.transliterate) — Transliterate a string php PharFileInfo::getContent PharFileInfo::getContent ======================== (PHP 5 >= 5.3.0, PHP 7, PHP 8) PharFileInfo::getContent — Get the complete file contents of the entry ### Description ``` public PharFileInfo::getContent(): string ``` This function behaves like [file\_get\_contents()](function.file-get-contents) but for Phar. ### Parameters This function has no parameters. ### Return Values Returns the file contents. php ImagickDraw::getStrokeColor ImagickDraw::getStrokeColor =========================== (PECL imagick 2, PECL imagick 3) ImagickDraw::getStrokeColor — Returns the color used for stroking object outlines ### Description ``` public ImagickDraw::getStrokeColor(): ImagickPixel ``` **Warning**This function is currently not documented; only its argument list is available. Returns the color used for stroking object outlines. ### Parameters `stroke_color` ### Return Values Returns an [ImagickPixel](class.imagickpixel) object which describes the color. php EventBuffer::freeze EventBuffer::freeze =================== (PECL event >= 1.2.6-beta) EventBuffer::freeze — Prevent calls that modify an event buffer from succeeding ### Description ``` public EventBuffer::freeze( bool $at_front ): bool ``` Prevent calls that modify an event buffer from succeeding ### Parameters `at_front` Whether to disable changes to the front or end of the buffer. ### Return Values Returns **`true`** on success or **`false`** on failure. ### See Also * [EventBuffer::unfreeze()](eventbuffer.unfreeze) - Re-enable calls that modify an event buffer php Gmagick::setfilename Gmagick::setfilename ==================== (PECL gmagick >= Unknown) Gmagick::setfilename — Sets the filename before you read or write the image ### Description ``` public Gmagick::setfilename(string $filename): Gmagick ``` Sets the filename before you read or write an image file. ### Parameters `filename` The image filename. ### Return Values The [Gmagick](class.gmagick) object. ### Errors/Exceptions Throws an **GmagickException** on error. php imap_mail_compose imap\_mail\_compose =================== (PHP 4, PHP 5, PHP 7, PHP 8) imap\_mail\_compose — Create a MIME message based on given envelope and body sections ### Description ``` imap_mail_compose(array $envelope, array $bodies): string|false ``` Create a MIME message based on the given `envelope` and `bodies` sections. ### Parameters `envelope` An associative array of header fields. Valid keys are: `"remail"`, `"return_path"`, `"date"`, `"from"`, `"reply_to"`, `"in_reply_to"`, `"subject"`, `"to"`, `"cc"`, `"bcc"` and `"message_id"`, which set the respective message headers to the given string. To set additional headers, the key `"custom_headers"` is supported, which expects an array of those headers, e.g. `["User-Agent: My Mail Client"]`. `bodies` An indexed array of bodies. The first body is the main body of the message; only if it has a type of **`TYPEMULTIPART`**, further bodies are processed; these bodies constitute the bodies of the parts. **Body Array Structure**| Key | Type | Description | | --- | --- | --- | | `type` | int | The MIME type. One of **`TYPETEXT`** (default), **`TYPEMULTIPART`**, **`TYPEMESSAGE`**, **`TYPEAPPLICATION`**, **`TYPEAUDIO`**, **`TYPEIMAGE`**, **`TYPEMODEL`** or **`TYPEOTHER`**. | | `encoding` | int | The `Content-Transfer-Encoding`. One of **`ENC7BIT`** (default), **`ENC8BIT`**, **`ENCBINARY`**, **`ENCBASE64`**, **`ENCQUOTEDPRINTABLE`** or **`ENCOTHER`**. | | `charset` | string | The charset parameter of the MIME type. | | `type.parameters` | array | An associative array of `Content-Type` parameter names and their values. | | `subtype` | string | The MIME subtype, e.g. `'jpeg'` for **`TYPEIMAGE`**. | | `id` | string | The `Content-ID`. | | `description` | string | The `Content-Description`. | | `disposition.type` | string | The `Content-Disposition`, e.g. `'attachment'`. | | `disposition` | array | An associative array of `Content-Disposition` parameter names and values. | | `contents.data` | string | The payload. | | `lines` | int | The size of the payload in lines. | | `bytes` | int | The size of the payload in bytes. | | `md5` | string | The MD5 checksum of the payload. | ### Return Values Returns the MIME message as string, or **`false`** on failure. ### Examples **Example #1 **imap\_mail\_compose()** example** ``` <?php $envelope["from"]= "[email protected]"; $envelope["to"]  = "[email protected]"; $envelope["cc"]  = "[email protected]"; $part1["type"] = TYPEMULTIPART; $part1["subtype"] = "mixed"; $filename = "/tmp/imap.c.gz"; $fp = fopen($filename, "r"); $contents = fread($fp, filesize($filename)); fclose($fp); $part2["type"] = TYPEAPPLICATION; $part2["encoding"] = ENCBINARY; $part2["subtype"] = "octet-stream"; $part2["description"] = basename($filename); $part2["contents.data"] = $contents; $part3["type"] = TYPETEXT; $part3["subtype"] = "plain"; $part3["description"] = "description3"; $part3["contents.data"] = "contents.data3\n\n\n\t"; $body[1] = $part1; $body[2] = $part2; $body[3] = $part3; echo nl2br(imap_mail_compose($envelope, $body)); ?> ``` php SolrDocument::offsetSet SolrDocument::offsetSet ======================= (PECL solr >= 0.9.2) SolrDocument::offsetSet — Adds a field to the document ### Description ``` public SolrDocument::offsetSet(string $fieldName, string $fieldValue): void ``` Used when the object is treated as an array to add a field to the document. ### Parameters `fieldName` The name of the field. `fieldValue` The value for this field. ### Return Values Returns **`true`** on success or **`false`** on failure. php IntlChar::isalnum IntlChar::isalnum ================= (PHP 7, PHP 8) IntlChar::isalnum — Check if code point is an alphanumeric character ### Description ``` public static IntlChar::isalnum(int|string $codepoint): ?bool ``` Determines whether the specified code point is an alphanumeric character (letter or digit). **`true`** for characters with general categories "L" (letters) and "Nd" (decimal digit numbers). ### Parameters `codepoint` The int codepoint value (e.g. `0x2603` for *U+2603 SNOWMAN*), or the character encoded as a UTF-8 string (e.g. `"\u{2603}"`) ### Return Values Returns **`true`** if `codepoint` is an alphanumeric character, **`false`** if not. Returns **`null`** on failure. ### Examples **Example #1 Testing different code points** ``` <?php var_dump(IntlChar::isalnum("A")); var_dump(IntlChar::isalnum("1")); var_dump(IntlChar::isalnum("\u{2603}")); ?> ``` The above example will output: ``` bool(true) bool(true) bool(false) ``` ### See Also * [IntlChar::isalpha()](intlchar.isalpha) - Check if code point is a letter character * [IntlChar::isdigit()](intlchar.isdigit) - Check if code point is a digit character php SoapClient::__setCookie SoapClient::\_\_setCookie ========================= (PHP 5 >= 5.0.4, PHP 7, PHP 8) SoapClient::\_\_setCookie — Defines a cookie for SOAP requests ### Description ``` public SoapClient::__setCookie(string $name, ?string $value = null): void ``` Defines a cookie to be sent along with the SOAP requests. > > **Note**: > > > Calling this method will affect all following calls to [SoapClient](class.soapclient) methods. > > ### Parameters `name` The name of the cookie. `value` The value of the cookie. If not specified, the cookie will be deleted. ### Return Values No value is returned. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | `value` is now nullable. | php ImagickDraw::polyline ImagickDraw::polyline ===================== (PECL imagick 2, PECL imagick 3) ImagickDraw::polyline — Draws a polyline ### Description ``` public ImagickDraw::polyline(array $coordinates): bool ``` **Warning**This function is currently not documented; only its argument list is available. Draws a polyline using the current stroke, stroke width, and fill color or texture, using the specified array of coordinates. ### Parameters `coordinates` array of x and y coordinates: array( array( 'x' => 4, 'y' => 6 ), array( 'x' => 8, 'y' => 10 ) ) ### Return Values Returns **`true`** on success. ### Examples **Example #1 **ImagickDraw::polyline()** example** ``` <?php function polyline($strokeColor, $fillColor, $backgroundColor) {     $draw = new \ImagickDraw();     $draw->setStrokeOpacity(1);     $draw->setStrokeColor($strokeColor);     $draw->setFillColor($fillColor);     $draw->setStrokeWidth(5);     $points = [         ['x' => 40 * 5, 'y' => 10 * 5],         ['x' => 20 * 5, 'y' => 20 * 5],         ['x' => 70 * 5, 'y' => 50 * 5],         ['x' => 60 * 5, 'y' => 15 * 5]     ];     $draw->polyline($points);     $image = new \Imagick();     $image->newImage(500, 300, $backgroundColor);     $image->setImageFormat("png");     $image->drawImage($draw);     header("Content-Type: image/png");     echo $image->getImageBlob(); } ?> ``` php Throwable::getTraceAsString Throwable::getTraceAsString =========================== (PHP 7, PHP 8) Throwable::getTraceAsString — Gets the stack trace as a string ### Description ``` public Throwable::getTraceAsString(): string ``` ### Parameters This function has no parameters. ### Return Values Returns the stack trace as a string. ### See Also * [Exception::getTraceAsString()](exception.gettraceasstring) - Gets the stack trace as a string php GmagickDraw::getfont GmagickDraw::getfont ==================== (PECL gmagick >= Unknown) GmagickDraw::getfont — Returns the font ### Description ``` public GmagickDraw::getfont(): mixed ``` Returns a string specifying the font used when annotating with text. ### Parameters This function has no parameters. ### Return Values Returns a string on success and **`false`** if no font is set. php stats_rand_gen_ibinomial_negative stats\_rand\_gen\_ibinomial\_negative ===================================== (PECL stats >= 1.0.0) stats\_rand\_gen\_ibinomial\_negative — Generates a random deviate from the negative binomial distribution ### Description ``` stats_rand_gen_ibinomial_negative(int $n, float $p): int ``` Returns a random deviate from a negative binomial distribution where the number of success is `n` and the success rate is `p`. ### Parameters `n` The number of success `p` The success rate ### Return Values A random deviate, which is the number of failure. php The EvIdle class The EvIdle class ================ Introduction ------------ (PECL ev >= 0.2.0) **EvIdle** watchers trigger events when no other events of the same or higher priority are pending ( [EvPrepare](class.evprepare) , [EvCheck](class.evcheck) and other **EvIdle** watchers do not count as receiving *events* ). Thus, as long as the process is busy handling sockets or timeouts(or even signals) of the same or higher priority it will not be triggered. But when the process is in idle(or only lower-priority watchers are pending), the **EvIdle** watchers are being called once per event loop iteration - until stopped, that is, or the process receives more events and becomes busy again with higher priority stuff. Apart from keeping the process non-blocking(which is a useful on its own sometimes), **EvIdle** watchers are a good place to do *"pseudo-background processing"* , or delay processing stuff to after the event loop has handled all outstanding events. The most noticeable effect is that as long as any *idle* watchers are active, the process will *not* block when waiting for new events. Class synopsis -------------- class **EvIdle** extends [EvWatcher](class.evwatcher) { /\* Inherited properties \*/ public [$is\_active](class.evwatcher#evwatcher.props.is-active); public [$data](class.evwatcher#evwatcher.props.data); public [$is\_pending](class.evwatcher#evwatcher.props.is-pending); public [$priority](class.evwatcher#evwatcher.props.priority); /\* Methods \*/ public [\_\_construct](evidle.construct)( [callable](language.types.callable) `$callback` , [mixed](language.types.declarations#language.types.declarations.mixed) `$data` = ?, int `$priority` = ?) ``` final public static createStopped( string $callback , mixed $data = ?, int $priority = ?): object ``` /\* Inherited methods \*/ ``` public EvWatcher::clear(): int ``` ``` public EvWatcher::feed( int $revents ): void ``` ``` public EvWatcher::getLoop(): EvLoop ``` ``` public EvWatcher::invoke( int $revents ): void ``` ``` public EvWatcher::keepalive( bool $value = ?): bool ``` ``` public EvWatcher::setCallback( callable $callback ): void ``` ``` public EvWatcher::start(): void ``` ``` public EvWatcher::stop(): void ``` } Table of Contents ----------------- * [EvIdle::\_\_construct](evidle.construct) — Constructs the EvIdle watcher object * [EvIdle::createStopped](evidle.createstopped) — Creates instance of a stopped EvIdle watcher object php class_parents class\_parents ============== (PHP 5, PHP 7, PHP 8) class\_parents — Return the parent classes of the given class ### Description ``` class_parents(object|string $object_or_class, bool $autoload = true): array|false ``` This function returns an array with the name of the parent classes of the given `object_or_class`. ### Parameters `object_or_class` An object (class instance) or a string (class name). `autoload` Whether to call [\_\_autoload](language.oop5.autoload) by default. ### Return Values An array on success, or **`false`** when the given class doesn't exist. ### Examples **Example #1 **class\_parents()** example** ``` <?php class foo { } class bar extends foo {} print_r(class_parents(new bar)); // you may also specify the parameter as a string print_r(class_parents('bar')); spl_autoload_register(); // use autoloading to load the 'not_loaded' class print_r(class_parents('not_loaded', true)); ?> ``` The above example will output something similar to: ``` Array ( [foo] => foo ) Array ( [foo] => foo ) Array ( [parent_of_not_loaded] => parent_of_not_loaded ) ``` ### See Also * [class\_implements()](function.class-implements) - Return the interfaces which are implemented by the given class or interface php SolrQuery::setTermsField SolrQuery::setTermsField ======================== (PECL solr >= 0.9.2) SolrQuery::setTermsField — Sets the name of the field to get the Terms from ### Description ``` public SolrQuery::setTermsField(string $fieldname): SolrQuery ``` Sets the name of the field to get the terms from ### Parameters `fieldname` The field name ### Return Values Returns the current SolrQuery object, if the return value is used. php The SplFileInfo class The SplFileInfo class ===================== Introduction ------------ (PHP 5 >= 5.1.2, PHP 7, PHP 8) The SplFileInfo class offers a high-level object-oriented interface to information for an individual file. Class synopsis -------------- class **SplFileInfo** implements [Stringable](class.stringable) { /\* Methods \*/ public [\_\_construct](splfileinfo.construct)(string `$filename`) ``` public getATime(): int|false ``` ``` public getBasename(string $suffix = ""): string ``` ``` public getCTime(): int|false ``` ``` public getExtension(): string ``` ``` public getFileInfo(?string $class = null): SplFileInfo ``` ``` public getFilename(): string ``` ``` public getGroup(): int|false ``` ``` public getInode(): int|false ``` ``` public getLinkTarget(): string|false ``` ``` public getMTime(): int|false ``` ``` public getOwner(): int|false ``` ``` public getPath(): string ``` ``` public getPathInfo(?string $class = null): ?SplFileInfo ``` ``` public getPathname(): string ``` ``` public getPerms(): int|false ``` ``` public getRealPath(): string|false ``` ``` public getSize(): int|false ``` ``` public getType(): string|false ``` ``` public isDir(): bool ``` ``` public isExecutable(): bool ``` ``` public isFile(): bool ``` ``` public isLink(): bool ``` ``` public isReadable(): bool ``` ``` public isWritable(): bool ``` ``` public openFile(string $mode = "r", bool $useIncludePath = false, ?resource $context = null): SplFileObject ``` ``` public setFileClass(string $class = SplFileObject::class): void ``` ``` public setInfoClass(string $class = SplFileInfo::class): void ``` ``` public __toString(): string ``` } Changelog --------- | Version | Description | | --- | --- | | 8.0.0 | **SplFileInfo** implements [Stringable](class.stringable) now. | Table of Contents ----------------- * [SplFileInfo::\_\_construct](splfileinfo.construct) — Construct a new SplFileInfo object * [SplFileInfo::getATime](splfileinfo.getatime) — Gets last access time of the file * [SplFileInfo::getBasename](splfileinfo.getbasename) — Gets the base name of the file * [SplFileInfo::getCTime](splfileinfo.getctime) — Gets the inode change time * [SplFileInfo::getExtension](splfileinfo.getextension) — Gets the file extension * [SplFileInfo::getFileInfo](splfileinfo.getfileinfo) — Gets an SplFileInfo object for the file * [SplFileInfo::getFilename](splfileinfo.getfilename) — Gets the filename * [SplFileInfo::getGroup](splfileinfo.getgroup) — Gets the file group * [SplFileInfo::getInode](splfileinfo.getinode) — Gets the inode for the file * [SplFileInfo::getLinkTarget](splfileinfo.getlinktarget) — Gets the target of a link * [SplFileInfo::getMTime](splfileinfo.getmtime) — Gets the last modified time * [SplFileInfo::getOwner](splfileinfo.getowner) — Gets the owner of the file * [SplFileInfo::getPath](splfileinfo.getpath) — Gets the path without filename * [SplFileInfo::getPathInfo](splfileinfo.getpathinfo) — Gets an SplFileInfo object for the path * [SplFileInfo::getPathname](splfileinfo.getpathname) — Gets the path to the file * [SplFileInfo::getPerms](splfileinfo.getperms) — Gets file permissions * [SplFileInfo::getRealPath](splfileinfo.getrealpath) — Gets absolute path to file * [SplFileInfo::getSize](splfileinfo.getsize) — Gets file size * [SplFileInfo::getType](splfileinfo.gettype) — Gets file type * [SplFileInfo::isDir](splfileinfo.isdir) — Tells if the file is a directory * [SplFileInfo::isExecutable](splfileinfo.isexecutable) — Tells if the file is executable * [SplFileInfo::isFile](splfileinfo.isfile) — Tells if the object references a regular file * [SplFileInfo::isLink](splfileinfo.islink) — Tells if the file is a link * [SplFileInfo::isReadable](splfileinfo.isreadable) — Tells if file is readable * [SplFileInfo::isWritable](splfileinfo.iswritable) — Tells if the entry is writable * [SplFileInfo::openFile](splfileinfo.openfile) — Gets an SplFileObject object for the file * [SplFileInfo::setFileClass](splfileinfo.setfileclass) — Sets the class used with SplFileInfo::openFile * [SplFileInfo::setInfoClass](splfileinfo.setinfoclass) — Sets the class used with SplFileInfo::getFileInfo and SplFileInfo::getPathInfo * [SplFileInfo::\_\_toString](splfileinfo.tostring) — Returns the path to the file as a string
programming_docs
php tidy::head tidy::head ========== tidy\_get\_head =============== (PHP 5, PHP 7, PHP 8, PECL tidy 0.5.2-1.0.0) tidy::head -- tidy\_get\_head — Returns a [tidyNode](class.tidynode) object starting from the <head> tag of the tidy parse tree ### Description Object-oriented style ``` public tidy::head(): ?tidyNode ``` Procedural style ``` tidy_get_head(tidy $tidy): ?tidyNode ``` Returns a [tidyNode](class.tidynode) object starting from the <head> tag of the tidy parse tree. ### Parameters `tidy` The [Tidy](class.tidy) object. ### Return Values Returns the [tidyNode](class.tidynode) object. ### Examples **Example #1 **tidy::head()** example** ``` <?php $html = ' <html>   <head>     <title>test</title>   </head>   <body>     <p>paragraph</p>   </body> </html>'; $tidy = tidy_parse_string($html); $head = $tidy->head(); echo $head->value; ?> ``` The above example will output: ``` <head> <title>test</title> </head> ``` ### See Also * [tidy::body()](tidy.body) - Returns a tidyNode object starting from the <body> tag of the tidy parse tree * [tidy::html()](tidy.html) - Returns a tidyNode object starting from the <html> tag of the tidy parse tree php ldap_mod_del ldap\_mod\_del ============== (PHP 4, PHP 5, PHP 7, PHP 8) ldap\_mod\_del — Delete attribute values from current attributes ### Description ``` ldap_mod_del( LDAP\Connection $ldap, string $dn, array $entry, ?array $controls = null ): bool ``` Removes one or more attribute values from the specified `dn`. Object deletions are done by the [ldap\_delete()](function.ldap-delete) function. ### Parameters `ldap` An [LDAP\Connection](class.ldap-connection) instance, returned by [ldap\_connect()](function.ldap-connect). `dn` The distinguished name of an LDAP entity. `entry` `controls` Array of [LDAP Controls](https://www.php.net/manual/en/ldap.controls.php) to send with the request. ### Return Values Returns **`true`** on success or **`false`** on failure. ### Changelog | Version | Description | | --- | --- | | 8.1.0 | The `ldap` parameter expects an [LDAP\Connection](class.ldap-connection) instance now; previously, a [resource](language.types.resource) was expected. | | 8.0.0 | `controls` is nullable now; previously, it defaulted to `[]`. | | 7.3.0 | Support for `controls` added | ### See Also * [ldap\_mod\_del\_ext()](function.ldap-mod_del-ext) - Delete attribute values from current attributes * [ldap\_mod\_add()](function.ldap-mod-add) - Add attribute values to current attributes * [ldap\_mod\_replace()](function.ldap-mod-replace) - Replace attribute values with new ones * [ldap\_modify\_batch()](function.ldap-modify-batch) - Batch and execute modifications on an LDAP entry php Stomp::send Stomp::send =========== stomp\_send =========== (PECL stomp >= 0.1.0) Stomp::send -- stomp\_send — Sends a message ### Description Object-oriented style (method): ``` public Stomp::send(string $destination, mixed $msg, array $headers = ?): bool ``` Procedural style: ``` stomp_send( resource $link, string $destination, mixed $msg, array $headers = ? ): bool ``` Sends a message to the Message Broker. ### Parameters `link` Procedural style only: The stomp link identifier returned by [stomp\_connect()](stomp.construct). `destination` Where to send the message `msg` Message to send. `headers` Associative array containing the additional headers (example: receipt). ### Return Values Returns **`true`** on success or **`false`** on failure. ### Examples See [stomp\_ack()](stomp.ack). ### Notes > > **Note**: > > > A transaction header may be specified, indicating that the message acknowledgment should be part of the named transaction. > > > **Tip**Stomp is inherently asynchronous. Synchronous communication can be implemented adding a receipt header. This will cause methods to not return anything until the server has acknowledged receipt of the message or until read timeout was reached. php Ev::iteration Ev::iteration ============= (PECL ev >= 0.2.0) Ev::iteration — Return the number of times the default event loop has polled for new events ### Description ``` final public static Ev::iteration(): int ``` Return the number of times the event loop has polled for new events. Sometimes useful as a generation counter. ### Parameters This function has no parameters. ### Return Values Returns number of polls of the default event loop. ### See Also * [Ev::depth()](ev.depth) - Returns recursion depth php MultipleIterator::getFlags MultipleIterator::getFlags ========================== (PHP 5 >= 5.3.0, PHP 7, PHP 8) MultipleIterator::getFlags — Gets the flag information ### Description ``` public MultipleIterator::getFlags(): int ``` Gets information about the flags. **Warning**This function is currently not documented; only its argument list is available. ### Parameters This function has no parameters. ### Return Values Information about the flags, as an int. ### See Also * [Flag Constants](class.multipleiterator#multipleiterator.constants) * [MultipleIterator::\_\_construct()](multipleiterator.construct) - Constructs a new MultipleIterator * [MultipleIterator::setFlags()](multipleiterator.setflags) - Sets flags php UConverter::convert UConverter::convert =================== (PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1) UConverter::convert — Convert string from one charset to another ### Description ``` public UConverter::convert(string $str, bool $reverse = false): string|false ``` **Warning**This function is currently not documented; only its argument list is available. ### Parameters `str` `reverse` ### Return Values php Zookeeper::setDebugLevel Zookeeper::setDebugLevel ======================== (PECL zookeeper >= 0.1.0) Zookeeper::setDebugLevel — Sets the debugging level for the library ### Description ``` public static Zookeeper::setDebugLevel(int $logLevel): bool ``` ### Parameters `logLevel` ZooKeeper log level constants. ### Return Values Returns **`true`** on success or **`false`** on failure. ### Errors/Exceptions This method emits PHP error/warning when parameters count or types are wrong or fail to set debug level. **Caution** Since version 0.3.0, this method emits [ZookeeperException](class.zookeeperexception) and it's derivatives. ### Examples **Example #1 **Zookeeper::setDebugLevel()** example** Set debugl level. ``` <?php $r = Zookeeper::setDebugLevel(Zookeeper::LOG_LEVEL_WARN); if ($r)   echo 'SUCCESS'; else   echo 'ERR'; ?> ?> ``` The above example will output: ``` SUCCESS ``` ### See Also * [ZooKeeper Log Levels](class.zookeeper#zookeeper.class.constants.log-levels) * [ZookeeperException](class.zookeeperexception) php odbc_free_result odbc\_free\_result ================== (PHP 4, PHP 5, PHP 7, PHP 8) odbc\_free\_result — Free resources associated with a result ### Description ``` odbc_free_result(resource $statement): bool ``` Free resources associated with a result. **odbc\_free\_result()** only needs to be called if you are worried about using too much memory while your script is running. All result memory will automatically be freed when the script is finished. ### Parameters `statement` The result identifier. ### Return Values Always returns **`true`**. ### Notes > > **Note**: > > > If auto-commit is disabled (see [odbc\_autocommit()](function.odbc-autocommit)) and you call **odbc\_free\_result()** before committing, all pending transactions are rolled back. > > php Imagick::shearImage Imagick::shearImage =================== (PECL imagick 2, PECL imagick 3) Imagick::shearImage — Creating a parallelogram ### Description ``` public Imagick::shearImage(mixed $background, float $x_shear, float $y_shear): bool ``` Slides one edge of an image along the X or Y axis, creating a parallelogram. An X direction shear slides an edge along the X axis, while a Y direction shear slides an edge along the Y axis. The amount of the shear is controlled by a shear angle. For X direction shears, x\_shear is measured relative to the Y axis, and similarly, for Y direction shears y\_shear is measured relative to the X axis. Empty triangles left over from shearing the image are filled with the background color. ### Parameters `background` The background color `x_shear` The number of degrees to shear on the x axis `y_shear` The number of degrees to shear on the y axis ### Return Values Returns **`true`** on success. ### Changelog | Version | Description | | --- | --- | | PECL imagick 2.1.0 | Now allows a string representing the color as the first parameter. Previous versions allow only an ImagickPixel object. | ### Examples **Example #1 **Imagick::shearImage()**** ``` <?php function shearImage($imagePath, $color, $shearX, $shearY) {     $imagick = new \Imagick(realpath($imagePath));     $imagick->shearimage($color, $shearX, $shearY);     header("Content-Type: image/jpg");     echo $imagick->getImageBlob(); } ?> ``` php SessionHandler::read SessionHandler::read ==================== (PHP 5 >= 5.4.0, PHP 7, PHP 8) SessionHandler::read — Read session data ### Description ``` public SessionHandler::read(string $id): string|false ``` Reads the session data from the session storage, and returns the result back to PHP for internal processing. This method is called automatically by PHP when a session is started (either automatically or explicitly with [session\_start()](function.session-start) and is preceded by an internal call to the [SessionHandler::open()](sessionhandler.open). This method wraps the internal PHP save handler defined in the [session.save\_handler](https://www.php.net/manual/en/session.configuration.php#ini.session.save-handler) ini setting that was set before this handler was set by [session\_set\_save\_handler()](function.session-set-save-handler). If this class is extended by inheritance, calling the parent `read` method will invoke the wrapper for this method and therefore invoke the associated internal callback. This allows the method to be overridden and or intercepted and filtered (for example, decrypting the `$data` value returned by the parent `read` method). For more information on what this method is expected to do, please refer to the documentation at [SessionHandlerInterface::read()](sessionhandlerinterface.read). ### Parameters `id` The session id to read data for. ### Return Values Returns an encoded string of the read data. If nothing was read, it must return **`false`**. Note this value is returned internally to PHP for processing. ### See Also * The [session.serialize\_handler](https://www.php.net/manual/en/session.configuration.php#ini.session.serialize-handler) configuration directive. php finfo_open finfo\_open =========== finfo::\_\_construct ==================== (PHP >= 5.3.0, PHP 7, PHP 8, PECL fileinfo >= 0.1.0) finfo\_open -- finfo::\_\_construct — Create a new finfo instance ### Description Procedural style ``` finfo_open(int $flags = FILEINFO_NONE, ?string $magic_database = null): finfo|false ``` Object-oriented style (constructor): public [finfo::\_\_construct](finfo.construct)(int `$flags` = **`FILEINFO_NONE`**, ?string `$magic_database` = **`null`**) This function opens a magic database and returns its instance. ### Parameters `flags` One or disjunction of more [Fileinfo constants](https://www.php.net/manual/en/fileinfo.constants.php). `magic_database` Name of a magic database file, usually something like /path/to/magic.mime. If not specified, the `MAGIC` environment variable is used. If the environment variable isn't set, then PHP's bundled magic database will be used. Passing **`null`** or an empty string will be equivalent to the default value. ### Return Values (Procedural style only) Returns an [finfo](class.finfo) instance on success, or **`false`** on failure. ### Changelog | Version | Description | | --- | --- | | 8.1.0 | Returns an [finfo](class.finfo) instance now; previously, a [resource](language.types.resource) was returned. | | 8.0.3 | `magic_database` is nullable now. | ### Examples **Example #1 Object-oriented style** ``` <?php $finfo = new finfo(FILEINFO_MIME, "/usr/share/misc/magic"); // return mime type ala mimetype extension /* get mime-type for a specific file */ $filename = "/usr/local/something.txt"; echo $finfo->file($filename); ?> ``` **Example #2 Procedural style** ``` <?php $finfo = finfo_open(FILEINFO_MIME, "/usr/share/misc/magic"); // return mime type ala mimetype extension if (!$finfo) {     echo "Opening fileinfo database failed";     exit(); } /* get mime-type for a specific file */ $filename = "/usr/local/something.txt"; echo finfo_file($finfo, $filename); /* close connection */ finfo_close($finfo); ?> ``` The above example will output: ``` text/plain; charset=us-ascii ``` ### Notes > > **Note**: > > > Generally, using the bundled magic database (by leaving `magic_database` and the `MAGIC` environment variables unset) is the best course of action unless you specifically need a custom magic database. > > ### See Also * [finfo\_close()](function.finfo-close) - Close finfo instance php Memcached::fetchAll Memcached::fetchAll =================== (PECL memcached >= 0.1.0) Memcached::fetchAll — Fetch all the remaining results ### Description ``` public Memcached::fetchAll(): array|false ``` **Memcached::fetchAll()** retrieves all the remaining results from the last request. ### Parameters This function has no parameters. ### Return Values Returns the results or **`false`** on failure. Use [Memcached::getResultCode()](memcached.getresultcode) if necessary. ### Examples **Example #1 [Memcached::getDelayed()](memcached.getdelayed) example** ``` <?php $m = new Memcached(); $m->addServer('localhost', 11211); $m->set('int', 99); $m->set('string', 'a simple string'); $m->set('array', array(11, 12)); $m->getDelayed(array('int', 'array'), true); var_dump($m->fetchAll()); ?> ``` The above example will output: ``` array(2) { [0]=> array(3) { ["key"]=> string(3) "int" ["value"]=> int(99) ["cas"]=> float(2363) } [1]=> array(3) { ["key"]=> string(5) "array" ["value"]=> array(2) { [0]=> int(11) [1]=> int(12) } ["cas"]=> float(2365) } } ``` ### See Also * [Memcached::fetch()](memcached.fetch) - Fetch the next result * [Memcached::getDelayed()](memcached.getdelayed) - Request multiple items php GearmanJob::sendException GearmanJob::sendException ========================= (PECL gearman >= 0.6.0) GearmanJob::sendException — Send exception for running job (exception) ### Description ``` public GearmanJob::sendException(string $exception): bool ``` Sends the supplied exception when this job is running. ### Parameters `exception` An exception description. ### Return Values Returns **`true`** on success or **`false`** on failure. ### See Also * [GearmanJob::setReturn()](gearmanjob.setreturn) - Set a return value * [GearmanJob::sendStatus()](gearmanjob.sendstatus) - Send status * [GearmanJob::sendWarning()](gearmanjob.sendwarning) - Send a warning php CachingIterator::offsetGet CachingIterator::offsetGet ========================== (PHP 5 >= 5.2.0, PHP 7, PHP 8) CachingIterator::offsetGet — The offsetGet purpose ### Description ``` public CachingIterator::offsetGet(string $key): mixed ``` **Warning**This function is currently not documented; only its argument list is available. ### Parameters `key` Description... ### Return Values Description... php SNMP::__construct SNMP::\_\_construct =================== (PHP 5 >= 5.4.0, PHP 7, PHP 8) SNMP::\_\_construct — Creates SNMP instance representing session to remote SNMP agent ### Description public **SNMP::\_\_construct**( int `$version`, string `$hostname`, string `$community`, int `$timeout` = -1, int `$retries` = -1 ) The function description goes here. ### Parameters `version` SNMP protocol version: **`SNMP::VERSION_1`**, **`SNMP::VERSION_2C`**, **`SNMP::VERSION_3`**. `hostname` The SNMP agent. `hostname` may be suffixed with optional SNMP agent port after colon. IPv6 addresses must be enclosed in square brackets if used with port. If FQDN is used for `hostname` it will be resolved by php-snmp library, not by Net-SNMP engine. Usage of IPv6 addresses when specifying FQDN may be forced by enclosing FQDN into square brackets. Here it is some examples: | | | | --- | --- | | IPv4 with default port | 127.0.0.1 | | IPv6 with default port | ::1 or [::1] | | IPv4 with specific port | 127.0.0.1:1161 | | IPv6 with specific port | [::1]:1161 | | FQDN with default port | host.domain | | FQDN with specific port | host.domain:1161 | | FQDN with default port, force usage of IPv6 address | [host.domain] | | FQDN with specific port, force usage of IPv6 address | [host.domain]:1161 | `community` The purpuse of `community` is SNMP version specific: | | | | --- | --- | | SNMP::VERSION\_1 | SNMP community | | SNMP::VERSION\_2C | SNMP community | | SNMP::VERSION\_3 | SNMPv3 securityName | `timeout` The number of microseconds until the first timeout. `retries` The number of retries in case timeout occurs. ### Errors/Exceptions **SNMP::\_\_construct()** throws an exception when parameters count or types are wrong or unknown SNMP protocol version specified. ### Examples **Example #1 Fetching sysLocation** ``` <?php   $session = new SNMP(SNMP::VERSION_1, "127.0.0.1", "public");   $sysdescr = $session->get("sysDescr.0");   echo "$sysdescr\n"; ?> ``` The above example will output something similar to: ``` STRING: Test server ``` ### See Also * [SNMP::close()](snmp.close) - Close SNMP session php getcwd getcwd ====== (PHP 4, PHP 5, PHP 7, PHP 8) getcwd — Gets the current working directory ### Description ``` getcwd(): string|false ``` Gets the current working directory. ### Parameters This function has no parameters. ### Return Values Returns the current working directory on success, or **`false`** on failure. On some Unix variants, **getcwd()** will return **`false`** if any one of the parent directories does not have the readable or search mode set, even if the current directory does. See [chmod()](function.chmod) for more information on modes and permissions. ### Examples **Example #1 **getcwd()** example** ``` <?php // current directory echo getcwd() . "\n"; chdir('cvs'); // current directory echo getcwd() . "\n"; ?> ``` The above example will output something similar to: ``` /home/didou /home/didou/cvs ``` **Caution** If the PHP interpreter has been built with ZTS (Zend Thread Safety) enabled, the current working directory returned by **getcwd()** may be different from that returned by operating system interfaces. External libraries (invoked through [FFI](https://www.php.net/manual/en/book.ffi.php)) which depend on the current working directory will be affected. ### See Also * [chdir()](function.chdir) - Change directory * [chmod()](function.chmod) - Changes file mode php PharData::__destruct PharData::\_\_destruct ====================== (PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 2.0.0) PharData::\_\_destruct — Destructs a non-executable tar or zip archive object ### Description public **PharData::\_\_destruct**() ### Parameters This function has no parameters.
programming_docs
php pg_select pg\_select ========== (PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8) pg\_select — Select records ### Description ``` pg_select( PgSql\Connection $connection, string $table_name, array $conditions, int $flags = PGSQL_DML_EXEC, int $mode = PGSQL_ASSOC ): array|string|false ``` **pg\_select()** selects records specified by `conditions` which has `field=>value`. For a successful query, it returns an array containing all records and fields that match the condition specified by `conditions`. If `flags` is specified, [pg\_convert()](function.pg-convert) is applied to `conditions` with the specified flags. By default **pg\_select()** passes raw values. Values must be escaped or PGSQL\_DML\_ESCAPE option must be specified. PGSQL\_DML\_ESCAPE quotes and escapes parameters/identifiers. Therefore, table/column names became case sensitive. Note that neither escape nor prepared query can protect LIKE query, JSON, Array, Regex, etc. These parameters should be handled according to their contexts. i.e. Escape/validate values. ### Parameters `connection` An [PgSql\Connection](class.pgsql-connection) instance. `table_name` Name of the table from which to select rows. `conditions` An array whose keys are field names in the table `table_name`, and whose values are the conditions that a row must meet to be retrieved. `flags` Any number of **`PGSQL_CONV_FORCE_NULL`**, **`PGSQL_DML_NO_CONV`**, **`PGSQL_DML_ESCAPE`**, **`PGSQL_DML_EXEC`**, **`PGSQL_DML_ASYNC`** or **`PGSQL_DML_STRING`** combined. If **`PGSQL_DML_STRING`** is part of the `flags` then query string is returned. When **`PGSQL_DML_NO_CONV`** or **`PGSQL_DML_ESCAPE`** is set, it does not call [pg\_convert()](function.pg-convert) internally. ### Return Values Returns string if **`PGSQL_DML_STRING`** is passed via `flags`, otherwise it returns an array on success, or **`false`** on failure. ### Changelog | Version | Description | | --- | --- | | 8.1.0 | The `connection` parameter expects an [PgSql\Connection](class.pgsql-connection) instance now; previously, a [resource](language.types.resource) was expected. | | 7.1.0 | The `mode` parameter was added. | ### Examples **Example #1 **pg\_select()** example** ``` <?php    $db = pg_connect('dbname=foo');   // This is safe somewhat, since all values are escaped.   // However PostgreSQL supports JSON/Array. These are not   // safe by neither escape nor prepared query.   $rec = pg_select($db, 'post_log', $_POST, PG_DML_ESCAPE);   if ($rec) {       echo "Records selected\n";       var_dump($rec);   } else {       echo "User must have sent wrong inputs\n";   } ?> ``` ### See Also * [pg\_convert()](function.pg-convert) - Convert associative array values into forms suitable for SQL statements php Imagick::setImageInterpolateMethod Imagick::setImageInterpolateMethod ================================== (PECL imagick 2, PECL imagick 3) Imagick::setImageInterpolateMethod — Sets the image interpolate pixel method ### Description ``` public Imagick::setImageInterpolateMethod(int $method): bool ``` Sets the image interpolate pixel method. ### Parameters `method` The method is one of the **`Imagick::INTERPOLATE_*`** constants ### Return Values Returns **`true`** on success. php Yaf_Router::addConfig Yaf\_Router::addConfig ====================== (Yaf >=1.0.0) Yaf\_Router::addConfig — Add config-defined routes into Router ### Description ``` public Yaf_Router::addConfig(Yaf_Config_Abstract $config): bool ``` Add routes defined by configs into [Yaf\_Router](class.yaf-router)'s route stack ### Parameters This function has no parameters. ### Return Values An [Yaf\_Config\_Abstract](class.yaf-config-abstract) instance, which should contains one or more valid route configs ### Examples **Example #1 **application.ini()**example** ``` ;the order is very important, the prior one will be called first ;a rewrite route match request /product/*/* routes.route_name.type="rewrite" routes.route_name.match="/product/:name/:value" routes.route_name.route.controller=product routes.route_name.route.action=info ;a regex route match request /list/*/* routes.route_name1.type="regex" routes.route_name1.match="#^list/([^/]*)/([^/]*)#" routes.route_name1.route.controller=Index routes.route_name1.route.action=action routes.route_name1.map.1=name routes.route_name1.map.2=value ;a simple route match /**?c=controller&a=action&m=module routes.route_name2.type="simple" routes.route_name2.controller=c routes.route_name2.module=m routes.route_name2.action=a ;a simple router match /**?r=PATH_INFO routes.route_name3.type="supervar" routes.route_name3.varname=r ;a map route match any request to controller routes.route_name4.type="map" routes.route_name4.controllerPrefer=TRUE routes.route_namer.delimiter="#!" ``` **Example #2 **Yaf\_Dispatcher::autoConfig()**example** ``` <?php class Bootstrap extends Yaf_Bootstrap_Abstract{     public function _initConfig() {         $config = Yaf_Application::app()->getConfig();         Yaf_Registry::set("config", $config);     }     public function _initRoute(Yaf_Dispatcher $dispatcher) {         $router = $dispatcher->getRouter();         /**          * we can add some pre-defined routes in application.ini          */         $router->addConfig(Yaf_Registry::get("config")->routes);     } ?> ``` ### See Also * [Yaf\_Router::addRoute()](yaf-router.addroute) - Add new Route into Router * [Yaf\_Route\_Static](class.yaf-route-static) * [Yaf\_Route\_Supervar](class.yaf-route-supervar) * [Yaf\_Route\_Simple](class.yaf-route-simple) * [Yaf\_Route\_Regex](class.yaf-route-regex) * [Yaf\_Route\_Rewrite](class.yaf-route-rewrite) * [Yaf\_Route\_Map](class.yaf-route-map) php gnupg_getengineinfo gnupg\_getengineinfo ==================== (PECL gnupg >= 1.5) gnupg\_getengineinfo — Returns the engine info ### Description ``` gnupg_getengineinfo(resource $identifier): array ``` ### Parameters `identifier` The gnupg identifier, from a call to [gnupg\_init()](function.gnupg-init) or **gnupg**. ### Return Values Returns an array with engine info consting of `protocol`, `file_name` and `home_dir`. ### Examples **Example #1 Procedural **gnupg\_getengineinfo()** example** ``` <?php $res = gnupg_init(); print_r(gnupg_getengineinfo($res)); ?> ``` The above example will output: ``` array(3) { ["protocol"]=> int(0) ["file_name"]=> string(12) "/usr/bin/gpg" ["home_dir"]=> string(0) "" } ``` **Example #2 OO **gnupg\_getengineinfo()** example** ``` <?php $gpg = new gnupg(["file_name" => "/usr/bin/gpg2", "home_dir" => "/var/www/.gnupg"]); print_r($gpg->getengineinfo()); ?> ``` The above example will output: ``` array(3) { ["protocol"]=> int(0) ["file_name"]=> string(13) "/usr/bin/gpg2" ["home_dir"]=> string(15) "/var/www/.gnupg" } ``` php Imagick::getImageChannelStatistics Imagick::getImageChannelStatistics ================================== (PECL imagick 2, PECL imagick 3) Imagick::getImageChannelStatistics — Returns statistics for each channel in the image ### Description ``` public Imagick::getImageChannelStatistics(): array ``` Returns statistics for each channel in the image. The statistics include the channel depth, its minima and maxima, the mean, and the standard deviation. ### Parameters This function has no parameters. ### Return Values Returns **`true`** on success. php Ds\Deque::reverse Ds\Deque::reverse ================= (PECL ds >= 1.0.0) Ds\Deque::reverse — Reverses the deque in-place ### Description ``` public Ds\Deque::reverse(): void ``` Reverses the deque in-place. ### Parameters This function has no parameters. ### Return Values No value is returned. ### Examples **Example #1 **Ds\Deque::reverse()** example** ``` <?php $deque = new \Ds\Deque(["a", "b", "c"]); $deque->reverse(); print_r($deque); ?> ``` The above example will output something similar to: ``` Ds\Deque Object ( [0] => c [1] => b [2] => a ) ``` php The DOMNotation class The DOMNotation class ===================== Class synopsis -------------- (PHP 5, PHP 7, PHP 8) class **DOMNotation** extends [DOMNode](class.domnode) { /\* Properties \*/ public readonly string [$publicId](class.domnotation#domnotation.props.publicid); public readonly string [$systemId](class.domnotation#domnotation.props.systemid); /\* Inherited properties \*/ public readonly string [$nodeName](class.domnode#domnode.props.nodename); public ?string [$nodeValue](class.domnode#domnode.props.nodevalue); public readonly int [$nodeType](class.domnode#domnode.props.nodetype); public readonly ?[DOMNode](class.domnode) [$parentNode](class.domnode#domnode.props.parentnode); public readonly [DOMNodeList](class.domnodelist) [$childNodes](class.domnode#domnode.props.childnodes); public readonly ?[DOMNode](class.domnode) [$firstChild](class.domnode#domnode.props.firstchild); public readonly ?[DOMNode](class.domnode) [$lastChild](class.domnode#domnode.props.lastchild); public readonly ?[DOMNode](class.domnode) [$previousSibling](class.domnode#domnode.props.previoussibling); public readonly ?[DOMNode](class.domnode) [$nextSibling](class.domnode#domnode.props.nextsibling); public readonly ?[DOMNamedNodeMap](class.domnamednodemap) [$attributes](class.domnode#domnode.props.attributes); public readonly ?[DOMDocument](class.domdocument) [$ownerDocument](class.domnode#domnode.props.ownerdocument); public readonly ?string [$namespaceURI](class.domnode#domnode.props.namespaceuri); public string [$prefix](class.domnode#domnode.props.prefix); public readonly ?string [$localName](class.domnode#domnode.props.localname); public readonly ?string [$baseURI](class.domnode#domnode.props.baseuri); public string [$textContent](class.domnode#domnode.props.textcontent); /\* Inherited methods \*/ ``` public DOMNode::appendChild(DOMNode $node): DOMNode|false ``` ``` public DOMNode::C14N( bool $exclusive = false, bool $withComments = false, ?array $xpath = null, ?array $nsPrefixes = null ): string|false ``` ``` public DOMNode::C14NFile( string $uri, bool $exclusive = false, bool $withComments = false, ?array $xpath = null, ?array $nsPrefixes = null ): int|false ``` ``` public DOMNode::cloneNode(bool $deep = false): DOMNode|false ``` ``` public DOMNode::getLineNo(): int ``` ``` public DOMNode::getNodePath(): ?string ``` ``` public DOMNode::hasAttributes(): bool ``` ``` public DOMNode::hasChildNodes(): bool ``` ``` public DOMNode::insertBefore(DOMNode $node, ?DOMNode $child = null): DOMNode|false ``` ``` public DOMNode::isDefaultNamespace(string $namespace): bool ``` ``` public DOMNode::isSameNode(DOMNode $otherNode): bool ``` ``` public DOMNode::isSupported(string $feature, string $version): bool ``` ``` public DOMNode::lookupNamespaceUri(string $prefix): string ``` ``` public DOMNode::lookupPrefix(string $namespace): ?string ``` ``` public DOMNode::normalize(): void ``` ``` public DOMNode::removeChild(DOMNode $child): DOMNode|false ``` ``` public DOMNode::replaceChild(DOMNode $node, DOMNode $child): DOMNode|false ``` } Properties ---------- publicId systemId php IntlChar::isbase IntlChar::isbase ================ (PHP 7, PHP 8) IntlChar::isbase — Check if code point is a base character ### Description ``` public static IntlChar::isbase(int|string $codepoint): ?bool ``` Determines whether the specified code point is a base character. **`true`** for general categories "L" (letters), "N" (numbers), "Mc" (spacing combining marks), and "Me" (enclosing marks). > > **Note**: > > > This is different from the Unicode definition in chapter 3.5, conformance clause D13, which defines base characters to be all characters (not Cn) that do not graphically combine with preceding characters (M) and that are neither control (Cc) or format (Cf) characters. > > ### Parameters `codepoint` The int codepoint value (e.g. `0x2603` for *U+2603 SNOWMAN*), or the character encoded as a UTF-8 string (e.g. `"\u{2603}"`) ### Return Values Returns **`true`** if `codepoint` is a base character, **`false`** if not. Returns **`null`** on failure. ### Examples **Example #1 Testing different code points** ``` <?php var_dump(IntlChar::isbase("A")); var_dump(IntlChar::isbase("1")); var_dump(IntlChar::isbase("\u{2603}")); ?> ``` The above example will output: ``` bool(true) bool(true) bool(false) ``` ### See Also * [IntlChar::isalpha()](intlchar.isalpha) - Check if code point is a letter character * [IntlChar::isdigit()](intlchar.isdigit) - Check if code point is a digit character php SoapServer::fault SoapServer::fault ================= (PHP 5, PHP 7, PHP 8) SoapServer::fault — Issue SoapServer fault indicating an error ### Description ``` public SoapServer::fault( string $code, string $string, string $actor = "", mixed $details = null, string $name = "" ): void ``` Sends a response to the client of the current request indicating an error. > > **Note**: > > > This can only be called when handling a request. > > ### Parameters `code` The error code to return `string` A brief description of the error `actor` A string identifying the actor that caused the fault. `details` More details of the fault `name` The name of the fault. This can be used to select a name from a WSDL file. ### Return Values No value is returned. ### See Also * [SoapFault::\_\_construct()](soapfault.construct) - SoapFault constructor php ibase_service_attach ibase\_service\_attach ====================== (PHP 5, PHP 7 < 7.4.0) ibase\_service\_attach — Connect to the service manager ### Description ``` ibase_service_attach(string $host, string $dba_username, string $dba_password): resource|false ``` ### Parameters `host` The name or ip address of the database host. You can define the port by adding '/' and port number. If no port is specified, port 3050 will be used. `dba_username` The name of any valid user. `dba_password` The user's password. ### Return Values Returns a Interbase / Firebird link identifier on success or **`false`** on failure. ### Examples **Example #1 **ibase\_service\_attach()** example** ``` <?php     // Attach to the remote Firebird server by ip address     if (($service = ibase_service_attach('10.1.1.199', 'sysdba', 'masterkey')) != FALSE) {                  // Successfully attached.          // Fetch server version (something like 'LI-V3.0.4.33054 Firebird 3.0')         $server_version  = ibase_server_info($service, IBASE_SVC_SERVER_VERSION);         // Fetch server implementation (something like 'Firebird/Linux/AMD/Intel/x64')         $server_implementation = ibase_server_info($service, IBASE_SVC_IMPLEMENTATION);         // Detach from server (disconnect)         ibase_service_detach($service);         // Output the info         echo "Server version: " . $server_version . "<br/>";         echo "Server implementation: " . $server_implementation;     }     else {         // Output message on error         $conn_error = ibase_errmsg();         die($conn_error);     } ?> ``` **Example #2 **ibase\_service\_attach()** example using `hostname/port` syntax** ``` <?php     // Attach to the remote Firebird server by name. Use Port 3050.     if (($service = ibase_service_attach('FB-SRV-01.contoso.local/3050', 'sysdba', 'masterkey')) != FALSE) {                  // Successfully attached.          // Fetch server version (something like 'LI-V3.0.4.33054 Firebird 3.0')         $server_version  = ibase_server_info($service, IBASE_SVC_SERVER_VERSION);         // Fetch server implementation (something like 'Firebird/Linux/AMD/Intel/x64')         $server_implementation = ibase_server_info($service, IBASE_SVC_IMPLEMENTATION);         // Detach from server (disconnect)         ibase_service_detach($service);         // Output the info         echo "Server version: " . $server_version . "<br/>";         echo "Server implementation: " . $server_implementation;     }     else {         // Output message on error         $conn_error = ibase_errmsg();         die($conn_error);     } ?> ``` ### See Also * [ibase\_service\_detach()](function.ibase-service-detach) - Disconnect from the service manager php gmp_hamdist gmp\_hamdist ============ (PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8) gmp\_hamdist — Hamming distance ### Description ``` gmp_hamdist(GMP|int|string $num1, GMP|int|string $num2): int ``` Returns the hamming distance between `num1` and `num2`. Both operands should be non-negative. ### Parameters `num1` A [GMP](class.gmp) object, an int or a numeric string. It should be positive. `num2` A [GMP](class.gmp) object, an int or a numeric string. It should be positive. ### Return Values The hamming distance between `num1` and `num2`, as an int. ### Examples **Example #1 **gmp\_hamdist()** example** ``` <?php $ham1 = gmp_init("1001010011", 2); $ham2 = gmp_init("1011111100", 2); echo gmp_hamdist($ham1, $ham2) . "\n"; /* hamdist is equivalent to: */ echo gmp_popcount(gmp_xor($ham1, $ham2)) . "\n"; ?> ``` The above example will output: ``` 6 6 ``` ### See Also * [gmp\_popcount()](function.gmp-popcount) - Population count * [gmp\_xor()](function.gmp-xor) - Bitwise XOR php sin sin === (PHP 4, PHP 5, PHP 7, PHP 8) sin — Sine ### Description ``` sin(float $num): float ``` **sin()** returns the sine of the `num` parameter. The `num` parameter is in radians. ### Parameters `num` A value in radians ### Return Values The sine of `num` ### Examples **Example #1 **sin()** example** ``` <?php // Precision depends on your precision directive echo sin(deg2rad(60));  //  0.866025403 ... echo sin(60);           // -0.304810621 ... ?> ``` ### See Also * [asin()](function.asin) - Arc sine * [sinh()](function.sinh) - Hyperbolic sine * [cos()](function.cos) - Cosine * [tan()](function.tan) - Tangent * [deg2rad()](function.deg2rad) - Converts the number in degrees to the radian equivalent php UnhandledMatchError UnhandledMatchError =================== Introduction ------------ (PHP 8) An **UnhandledMatchError** is thrown when the subject passed to a match expression is not handled by any arm of the match expression. Class synopsis -------------- class **UnhandledMatchError** extends [Error](class.error) { /\* Inherited properties \*/ protected string [$message](class.error#error.props.message) = ""; private string [$string](class.error#error.props.string) = ""; protected int [$code](class.error#error.props.code); protected string [$file](class.error#error.props.file) = ""; protected int [$line](class.error#error.props.line); private array [$trace](class.error#error.props.trace) = []; private ?[Throwable](class.throwable) [$previous](class.error#error.props.previous) = null; /\* Inherited methods \*/ ``` final public Error::getMessage(): string ``` ``` final public Error::getPrevious(): ?Throwable ``` ``` final public Error::getCode(): int ``` ``` final public Error::getFile(): string ``` ``` final public Error::getLine(): int ``` ``` final public Error::getTrace(): array ``` ``` final public Error::getTraceAsString(): string ``` ``` public Error::__toString(): string ``` ``` private Error::__clone(): void ``` } php The IntlBreakIterator class The IntlBreakIterator class =========================== Introduction ------------ (PHP 5 >= 5.5.0, PHP 7, PHP 8) A “break iterator” is an ICU object that exposes methods for locating boundaries in text (e.g. word or sentence boundaries). The PHP **IntlBreakIterator** serves as the base class for all types of ICU break iterators. Where extra functionality is available, the intl extension may expose the ICU break iterator with suitable subclasses, such as [IntlRuleBasedBreakIterator](class.intlrulebasedbreakiterator) or [IntlCodePointBreakIterator](class.intlcodepointbreakiterator). This class implements [IteratorAggregate](class.iteratoraggregate). Traversing an **IntlBreakIterator** yields non-negative integer values representing the successive locations of the text boundaries, expressed as UTF-8 code units (byte) counts, taken from the beginning of the text (which has the location `0`). The keys yielded by the iterator simply form the sequence of natural numbers `{0, 1, 2, …}`. Class synopsis -------------- class **IntlBreakIterator** implements [IteratorAggregate](class.iteratoraggregate) { /\* Constants \*/ public const int [DONE](class.intlbreakiterator#intlbreakiterator.constants.done); public const int [WORD\_NONE](class.intlbreakiterator#intlbreakiterator.constants.word-none); public const int [WORD\_NONE\_LIMIT](class.intlbreakiterator#intlbreakiterator.constants.word-none-limit); public const int [WORD\_NUMBER](class.intlbreakiterator#intlbreakiterator.constants.word-number); public const int [WORD\_NUMBER\_LIMIT](class.intlbreakiterator#intlbreakiterator.constants.word-number-limit); public const int [WORD\_LETTER](class.intlbreakiterator#intlbreakiterator.constants.word-letter); public const int [WORD\_LETTER\_LIMIT](class.intlbreakiterator#intlbreakiterator.constants.word-letter-limit); public const int [WORD\_KANA](class.intlbreakiterator#intlbreakiterator.constants.word-kana); public const int [WORD\_KANA\_LIMIT](class.intlbreakiterator#intlbreakiterator.constants.word-kana-limit); public const int [WORD\_IDEO](class.intlbreakiterator#intlbreakiterator.constants.word-ideo); public const int [WORD\_IDEO\_LIMIT](class.intlbreakiterator#intlbreakiterator.constants.word-ideo-limit); public const int [LINE\_SOFT](class.intlbreakiterator#intlbreakiterator.constants.line-soft); public const int [LINE\_SOFT\_LIMIT](class.intlbreakiterator#intlbreakiterator.constants.line-soft-limit); public const int [LINE\_HARD](class.intlbreakiterator#intlbreakiterator.constants.line-hard); public const int [LINE\_HARD\_LIMIT](class.intlbreakiterator#intlbreakiterator.constants.line-hard-limit); public const int [SENTENCE\_TERM](class.intlbreakiterator#intlbreakiterator.constants.sentence-term); public const int [SENTENCE\_TERM\_LIMIT](class.intlbreakiterator#intlbreakiterator.constants.sentence-term-limit); public const int [SENTENCE\_SEP](class.intlbreakiterator#intlbreakiterator.constants.sentence-sep); public const int [SENTENCE\_SEP\_LIMIT](class.intlbreakiterator#intlbreakiterator.constants.sentence-sep-limit); /\* Methods \*/ private [\_\_construct](intlbreakiterator.construct)() ``` public static createCharacterInstance(?string $locale = null): ?IntlBreakIterator ``` ``` public static createCodePointInstance(): IntlCodePointBreakIterator ``` ``` public static createLineInstance(?string $locale = null): ?IntlBreakIterator ``` ``` public static createSentenceInstance(?string $locale = null): ?IntlBreakIterator ``` ``` public static createTitleInstance(?string $locale = null): ?IntlBreakIterator ``` ``` public static createWordInstance(?string $locale = null): ?IntlBreakIterator ``` ``` public current(): int ``` ``` public first(): int ``` ``` public following(int $offset): int ``` ``` public getErrorCode(): int ``` ``` public getErrorMessage(): string ``` ``` public getLocale(int $type): string|false ``` ``` public getPartsIterator(string $type = IntlPartsIterator::KEY_SEQUENTIAL): IntlPartsIterator ``` ``` public getText(): ?string ``` ``` public isBoundary(int $offset): bool ``` ``` public last(): int ``` ``` public next(?int $offset = null): int ``` ``` public preceding(int $offset): int ``` ``` public previous(): int ``` ``` public setText(string $text): ?bool ``` } Predefined Constants -------------------- **`IntlBreakIterator::DONE`** **`IntlBreakIterator::WORD_NONE`** **`IntlBreakIterator::WORD_NONE_LIMIT`** **`IntlBreakIterator::WORD_NUMBER`** **`IntlBreakIterator::WORD_NUMBER_LIMIT`** **`IntlBreakIterator::WORD_LETTER`** **`IntlBreakIterator::WORD_LETTER_LIMIT`** **`IntlBreakIterator::WORD_KANA`** **`IntlBreakIterator::WORD_KANA_LIMIT`** **`IntlBreakIterator::WORD_IDEO`** **`IntlBreakIterator::WORD_IDEO_LIMIT`** **`IntlBreakIterator::LINE_SOFT`** **`IntlBreakIterator::LINE_SOFT_LIMIT`** **`IntlBreakIterator::LINE_HARD`** **`IntlBreakIterator::LINE_HARD_LIMIT`** **`IntlBreakIterator::SENTENCE_TERM`** **`IntlBreakIterator::SENTENCE_TERM_LIMIT`** **`IntlBreakIterator::SENTENCE_SEP`** **`IntlBreakIterator::SENTENCE_SEP_LIMIT`** Changelog --------- | Version | Description | | --- | --- | | 8.0.0 | **IntlBreakIterator** implements [IteratorAggregate](class.iteratoraggregate) now. Previously, [Traversable](class.traversable) was implemented instead. | Table of Contents ----------------- * [IntlBreakIterator::\_\_construct](intlbreakiterator.construct) — Private constructor for disallowing instantiation * [IntlBreakIterator::createCharacterInstance](intlbreakiterator.createcharacterinstance) — Create break iterator for boundaries of combining character sequences * [IntlBreakIterator::createCodePointInstance](intlbreakiterator.createcodepointinstance) — Create break iterator for boundaries of code points * [IntlBreakIterator::createLineInstance](intlbreakiterator.createlineinstance) — Create break iterator for logically possible line breaks * [IntlBreakIterator::createSentenceInstance](intlbreakiterator.createsentenceinstance) — Create break iterator for sentence breaks * [IntlBreakIterator::createTitleInstance](intlbreakiterator.createtitleinstance) — Create break iterator for title-casing breaks * [IntlBreakIterator::createWordInstance](intlbreakiterator.createwordinstance) — Create break iterator for word breaks * [IntlBreakIterator::current](intlbreakiterator.current) — Get index of current position * [IntlBreakIterator::first](intlbreakiterator.first) — Set position to the first character in the text * [IntlBreakIterator::following](intlbreakiterator.following) — Advance the iterator to the first boundary following specified offset * [IntlBreakIterator::getErrorCode](intlbreakiterator.geterrorcode) — Get last error code on the object * [IntlBreakIterator::getErrorMessage](intlbreakiterator.geterrormessage) — Get last error message on the object * [IntlBreakIterator::getLocale](intlbreakiterator.getlocale) — Get the locale associated with the object * [IntlBreakIterator::getPartsIterator](intlbreakiterator.getpartsiterator) — Create iterator for navigating fragments between boundaries * [IntlBreakIterator::getText](intlbreakiterator.gettext) — Get the text being scanned * [IntlBreakIterator::isBoundary](intlbreakiterator.isboundary) — Tell whether an offset is a boundaryʼs offset * [IntlBreakIterator::last](intlbreakiterator.last) — Set the iterator position to index beyond the last character * [IntlBreakIterator::next](intlbreakiterator.next) — Advance the iterator the next boundary * [IntlBreakIterator::preceding](intlbreakiterator.preceding) — Set the iterator position to the first boundary before an offset * [IntlBreakIterator::previous](intlbreakiterator.previous) — Set the iterator position to the boundary immediately before the current * [IntlBreakIterator::setText](intlbreakiterator.settext) — Set the text being scanned
programming_docs
php streamWrapper::stream_stat streamWrapper::stream\_stat =========================== (PHP 4 >= 4.3.2, PHP 5, PHP 7, PHP 8) streamWrapper::stream\_stat — Retrieve information about a file resource ### Description ``` public streamWrapper::stream_stat(): array|false ``` This method is called in response to [fstat()](function.fstat). ### Parameters This function has no parameters. ### Return Values See [stat()](function.stat). ### Errors/Exceptions Emits **`E_WARNING`** if call to this method fails (i.e. not implemented). ### See Also * [stat()](function.stat) - Gives information about a file * [streamwrapper::url\_stat()](streamwrapper.url-stat) - Retrieve information about a file php The Parle\RLexer class The Parle\RLexer class ====================== Introduction ------------ (PECL parle >= 0.5.1) Multistate lexer class. Lexemes can be defined on the fly. If the particular lexer instance is meant to be used with [Parle\RParser](class.parle-rparser), the token IDs need to be taken from there. Otherwise, arbitrary token IDs can be supplied. Note, that [Parle\Parser](class.parle-parser) is not compatible with this lexer. Class synopsis -------------- class **Parle\RLexer** { /\* Constants \*/ const int [ICASE](class.parle-rlexer#parle-rlexer.constants.flag-regex-icase) = 1; const int [DOT\_NOT\_LF](class.parle-rlexer#parle-rlexer.constants.flag-regex-dot-not-lf) = 2; const int [DOT\_NOT\_CRLF](class.parle-rlexer#parle-rlexer.constants.flag-regex-dot-not-cr-lf) = 4; const int [SKIP\_WS](class.parle-rlexer#parle-rlexer.constants.flag-regex-skip-ws) = 8; const int [MATCH\_ZERO\_LEN](class.parle-rlexer#parle-rlexer.constants.flag-regex-match-zero-len) = 16; /\* Properties \*/ public bool [$bol](class.parle-rlexer#parle-rlexer.props.bol) = **`false`**; public int [$flags](class.parle-rlexer#parle-rlexer.props.flags) = 0; public int [$state](class.parle-rlexer#parle-rlexer.props.state) = 0; public int [$marker](class.parle-rlexer#parle-rlexer.props.marker) = 0; public int [$cursor](class.parle-rlexer#parle-rlexer.props.cursor) = 0; /\* Methods \*/ ``` public advance(): void ``` ``` public build(): void ``` ``` public callout(int $id, callable $callback): void ``` ``` public consume(string $data): void ``` ``` public dump(): void ``` ``` public getToken(): Parle\Token ``` ``` public insertMacro(string $name, string $regex): void ``` ``` public push(string $regex, int $id): void ``` ``` public push( string $state, string $regex, int $id, string $newState ): void ``` ``` public push(string $state, string $regex, string $newState): void ``` ``` public pushState(string $state): int ``` ``` public reset(int $pos): void ``` } Predefined Constants -------------------- **`Parle\RLexer::ICASE`** **`Parle\RLexer::DOT_NOT_LF`** **`Parle\RLexer::DOT_NOT_CRLF`** **`Parle\RLexer::SKIP_WS`** **`Parle\RLexer::MATCH_ZERO_LEN`** Properties ---------- bol Start of input flag. flags Lexer flags. state Current lexer state, readonly. marker Position of the latest token match, readonly. cursor Current input offset, readonly. Table of Contents ----------------- * [Parle\RLexer::advance](parle-rlexer.advance) — Process next lexer rule * [Parle\RLexer::build](parle-rlexer.build) — Finalize the lexer rule set * [Parle\RLexer::callout](parle-rlexer.callout) — Define token callback * [Parle\RLexer::consume](parle-rlexer.consume) — Pass the data for processing * [Parle\RLexer::dump](parle-rlexer.dump) — Dump the state machine * [Parle\RLexer::getToken](parle-rlexer.gettoken) — Retrieve the current token * [Parle\RLexer::insertMacro](parle-rlexer.insertmacro) — Insert regex macro * [Parle\RLexer::push](parle-rlexer.push) — Add a lexer rule * [Parle\RLexer::pushState](parle-rlexer.pushstate) — Push a new start state * [Parle\RLexer::reset](parle-rlexer.reset) — Reset lexer php imap_mail imap\_mail ========== (PHP 4, PHP 5, PHP 7, PHP 8) imap\_mail — Send an email message ### Description ``` imap_mail( string $to, string $subject, string $message, ?string $additional_headers = null, ?string $cc = null, ?string $bcc = null, ?string $return_path = null ): bool ``` This function allows sending of emails with correct handling of Cc and Bcc receivers. The parameters `to`, `cc` and `bcc` are all strings and are all parsed as [» RFC822](http://www.faqs.org/rfcs/rfc822) address lists. ### Parameters `to` The receiver `subject` The mail subject `message` The mail body, see [imap\_mail\_compose()](function.imap-mail-compose) `additional_headers` As string with additional headers to be set on the mail `cc` `bcc` The receivers specified in `bcc` will get the mail, but are excluded from the headers. `return_path` Use this parameter to specify return path upon mail delivery failure. This is useful when using PHP as a mail client for multiple users. ### Return Values Returns **`true`** on success or **`false`** on failure. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | `additional_headers`, `cc`, `bcc`, and `return_path` are now nullable. | ### See Also * [mail()](function.mail) - Send mail * [imap\_mail\_compose()](function.imap-mail-compose) - Create a MIME message based on given envelope and body sections php IntlDateFormatter::setPattern IntlDateFormatter::setPattern ============================= datefmt\_set\_pattern ===================== (PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0) IntlDateFormatter::setPattern -- datefmt\_set\_pattern — Set the pattern used for the IntlDateFormatter ### Description Object-oriented style ``` public IntlDateFormatter::setPattern(string $pattern): bool ``` Procedural style ``` datefmt_set_pattern(IntlDateFormatter $formatter, string $pattern): bool ``` Set the pattern used for the IntlDateFormatter. ### Parameters `formatter` The formatter resource. `pattern` New pattern string to use. Possible patterns are documented at [» https://unicode-org.github.io/icu/userguide/format\_parse/datetime/](https://unicode-org.github.io/icu/userguide/format_parse/datetime/). ### Return Values Returns **`true`** on success or **`false`** on failure. Bad formatstrings are usually the cause of the failure. ### Examples **Example #1 **datefmt\_set\_pattern()** example** ``` <?php $fmt = datefmt_create(     'en_US',     IntlDateFormatter::FULL,IntlDateFormatter::FULL,     'America/Los_Angeles',     IntlDateFormatter::GREGORIAN,     'MM/dd/yyyy' ); echo 'Pattern of the formatter is : ', datefmt_get_pattern($fmt), PHP_EOL; echo 'First Formatted output with pattern is ', datefmt_format($fmt, 0), PHP_EOL; datefmt_set_pattern($fmt, 'yyyyMMdd hh:mm:ss z'); echo 'Now pattern of the formatter is : ', datefmt_get_pattern($fmt), PHP_EOL; echo 'Second Formatted output with pattern is ', datefmt_format($fmt, 0), PHP_EOL; ?> ``` **Example #2 OO example** ``` <?php $fmt = new IntlDateFormatter(     'en_US',     IntlDateFormatter::FULL,IntlDateFormatter::FULL,     'America/Los_Angeles',     IntlDateFormatter::GREGORIAN,     'MM/dd/yyyy' ); echo 'Pattern of the formatter is : ', $fmt->getPattern(), PHP_EOL; echo 'First Formatted output is ', $fmt->format(0), PHP_EOL; $fmt->setPattern('yyyyMMdd hh:mm:ss z'); echo 'Now pattern of the formatter is : ', $fmt->getPattern(), PHP_EOL; echo 'Second Formatted output is ', $fmt->format(0), PHP_EOL; ?> ``` The above example will output: ``` Pattern of the formatter is : MM/dd/yyyy First Formatted output is 12/31/1969 Now pattern of the formatter is : yyyyMMdd hh:mm:ss z Second Formatted output is 19691231 04:00:00 PST ``` ### See Also * [datefmt\_get\_pattern()](intldateformatter.getpattern) - Get the pattern used for the IntlDateFormatter * [datefmt\_create()](intldateformatter.create) - Create a date formatter php Gmagick::modulateimage Gmagick::modulateimage ====================== (PECL gmagick >= Unknown) Gmagick::modulateimage — Control the brightness, saturation, and hue ### Description ``` public Gmagick::modulateimage(float $brightness, float $saturation, float $hue): Gmagick ``` Lets you control the brightness, saturation, and hue of an image. Hue is the percentage of absolute rotation from the current position. For example 50 results in a counter-clockwise rotation of 90 degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200 both resulting in a rotation of 180 degrees. ### Parameters `brightness` The percent change in brighness (-100 thru +100). `saturation` The percent change in saturation (-100 thru +100) `hue` The percent change in hue (-100 thru +100) ### Return Values The [Gmagick](class.gmagick) object. ### Errors/Exceptions Throws an **GmagickException** on error. php IntlRuleBasedBreakIterator::getRuleStatusVec IntlRuleBasedBreakIterator::getRuleStatusVec ============================================ (PHP 5 >= 5.5.0, PHP 7, PHP 8) IntlRuleBasedBreakIterator::getRuleStatusVec — Get the status values from the break rules that determined the current break position ### Description ``` public IntlRuleBasedBreakIterator::getRuleStatusVec(): array|false ``` **Warning**This function is currently not documented; only its argument list is available. ### Parameters This function has no parameters. ### Return Values php Imagick::minifyImage Imagick::minifyImage ==================== (PECL imagick 2, PECL imagick 3) Imagick::minifyImage — Scales an image proportionally to half its size ### Description ``` public Imagick::minifyImage(): bool ``` Is a convenience method that scales an image proportionally to one-half its original size ### Parameters This function has no parameters. ### Return Values Returns **`true`** on success. php ArrayObject::unserialize ArrayObject::unserialize ======================== (PHP 5 >= 5.3.0, PHP 7, PHP 8) ArrayObject::unserialize — Unserialize an ArrayObject ### Description ``` public ArrayObject::unserialize(string $data): void ``` Unserializes a serialized [ArrayObject](class.arrayobject). **Warning**This function is currently not documented; only its argument list is available. ### Parameters `data` The serialized [ArrayObject](class.arrayobject). ### Return Values No value is returned. ### See Also * [ArrayIterator::serialize()](arrayiterator.serialize) - Serialize * [unserialize()](function.unserialize) - Creates a PHP value from a stored representation * [Serializing Objects](language.oop5.serialization) php Imagick::filter Imagick::filter =============== (PECL imagick 3 >= 3.3.0) Imagick::filter — Description **Warning**This function has been *DEPRECATED* as of Imagick 3.4.4. Relying on this function is highly discouraged. ### Description ``` public Imagick::filter(ImagickKernel $ImagickKernel, int $channel = Imagick::CHANNEL_UNDEFINED): bool ``` Applies a custom convolution kernel to the image. ### Parameters `ImagickKernel` An instance of ImagickKernel that represents either a single kernel or a linked series of kernels. `channel` Provide any channel constant that is valid for your channel mode. To apply to more than one channel, combine [channel constants](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.channel) using bitwise operators. Defaults to **`Imagick::CHANNEL_DEFAULT`**. Refer to this list of [channel constants](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.channel) ### Return Values Returns **`true`** on success. ### Examples **Example #1 **Imagick::filter()**** ``` <?php function filter($imagePath) {     $imagick = new \Imagick(realpath($imagePath));     $matrix = [         [-1, 0, -1],         [0,  5,  0],         [-1, 0, -1],     ];          $kernel = \ImagickKernel::fromMatrix($matrix);     $strength = 0.5;         $kernel->scale($strength, \Imagick::NORMALIZE_KERNEL_VALUE);         $kernel->addUnityKernel(1 - $strength);     $imagick->filter($kernel);     header("Content-Type: image/jpg");     echo $imagick->getImageBlob(); } ?> ``` php EvIo::__construct EvIo::\_\_construct =================== (PECL ev >= 0.2.0) EvIo::\_\_construct — Constructs EvIo watcher object ### Description public **EvIo::\_\_construct**( [mixed](language.types.declarations#language.types.declarations.mixed) `$fd` , int `$events` , [callable](language.types.callable) `$callback` , [mixed](language.types.declarations#language.types.declarations.mixed) `$data` = ?, int `$priority` = ? ) Constructs EvIo watcher object and starts the watcher automatically. ### Parameters `fd` Can be a stream opened with [fopen()](function.fopen) or similar functions, numeric file descriptor, or socket. `events` **`Ev::READ`** and/or **`Ev::WRITE`** . See [the bit masks](class.ev#ev.constants.watcher-revents) . `callback` See [Watcher callbacks](https://www.php.net/manual/en/ev.watcher-callbacks.php) . `data` Custom data associated with the watcher. `priority` [Watcher priority](class.ev#ev.constants.watcher-pri) ### See Also * [EvIo::createStopped()](evio.createstopped) - Create stopped EvIo watcher object * [EvLoop::io()](evloop.io) - Create EvIo watcher object associated with the current event loop instance php hash_copy hash\_copy ========== (PHP 5 >= 5.3.0, PHP 7, PHP 8) hash\_copy — Copy hashing context ### Description ``` hash_copy(HashContext $context): HashContext ``` ### Parameters `context` Hashing context returned by [hash\_init()](function.hash-init). ### Return Values Returns a copy of Hashing Context. ### Changelog | Version | Description | | --- | --- | | 7.2.0 | Accept and return [HashContext](class.hashcontext) instead of resource. | ### Examples **Example #1 **hash\_copy()** example** ``` <?php $context = hash_init("md5"); hash_update($context, "data"); /* copy context to be able to continue using it */ $copy_context = hash_copy($context); echo hash_final($context), "\n"; hash_update($copy_context, "data"); echo hash_final($copy_context), "\n"; ?> ``` The above example will output: ``` 8d777f385d3dfec8815d20f7496026dc 511ae0b1c13f95e5f08f1a0dd3da3d93 ``` php DOMDocument::createAttributeNS DOMDocument::createAttributeNS ============================== (PHP 5, PHP 7, PHP 8) DOMDocument::createAttributeNS — Create new attribute node with an associated namespace ### Description ``` public DOMDocument::createAttributeNS(?string $namespace, string $qualifiedName): DOMAttr|false ``` This function creates a new instance of class [DOMAttr](class.domattr). This node will not show up in the document unless it is inserted with (e.g.) [DOMNode::appendChild()](domnode.appendchild). ### Parameters `namespace` The URI of the namespace. `qualifiedName` The tag name and prefix of the attribute, as `prefix:tagname`. ### Return Values The new [DOMAttr](class.domattr) or **`false`** if an error occurred. ### Errors/Exceptions **`DOM_INVALID_CHARACTER_ERR`** Raised if `qualifiedName` contains an invalid character. **`DOM_NAMESPACE_ERR`** Raised if `qualifiedName` is a malformed qualified name, or if `qualifiedName` has a prefix and `namespace` is **`null`**. ### See Also * [DOMNode::appendChild()](domnode.appendchild) - Adds new child at the end of the children * [DOMDocument::createAttribute()](domdocument.createattribute) - Create new attribute * [DOMDocument::createCDATASection()](domdocument.createcdatasection) - Create new cdata node * [DOMDocument::createComment()](domdocument.createcomment) - Create new comment node * [DOMDocument::createDocumentFragment()](domdocument.createdocumentfragment) - Create new document fragment * [DOMDocument::createElement()](domdocument.createelement) - Create new element node * [DOMDocument::createElementNS()](domdocument.createelementns) - Create new element node with an associated namespace * [DOMDocument::createEntityReference()](domdocument.createentityreference) - Create new entity reference node * [DOMDocument::createProcessingInstruction()](domdocument.createprocessinginstruction) - Creates new PI node * [DOMDocument::createTextNode()](domdocument.createtextnode) - Create new text node php imap_uid imap\_uid ========= (PHP 4, PHP 5, PHP 7, PHP 8) imap\_uid — This function returns the UID for the given message sequence number ### Description ``` imap_uid(IMAP\Connection $imap, int $message_num): int|false ``` This function returns the UID for the given message sequence number. An UID is a unique identifier that will not change over time while a message sequence number may change whenever the content of the mailbox changes. This function is the inverse of [imap\_msgno()](function.imap-msgno). ### Parameters `imap` An [IMAP\Connection](class.imap-connection) instance. `message_num` The message number. ### Return Values The UID of the given message. ### Changelog | Version | Description | | --- | --- | | 8.1.0 | The `imap` parameter expects an [IMAP\Connection](class.imap-connection) instance now; previously, a [resource](language.types.resource) was expected. | ### Notes > > **Note**: > > > This function is not supported by POP3 mailboxes. > > ### See Also * [imap\_msgno()](function.imap-msgno) - Gets the message sequence number for the given UID php SNMP::close SNMP::close =========== (PHP 5 >= 5.4.0, PHP 7, PHP 8) SNMP::close — Close SNMP session ### Description ``` public SNMP::close(): bool ``` Frees previously allocated SNMP session object. ### Parameters This function has no parameters. ### Return Values Returns **`true`** on success or **`false`** on failure. ### Examples **Example #1 **SNMP::close()** example** ``` <?php   $session = new SNMP(SNMP::VERSION_1, "127.0.0.1", "public");   # ...   # get, walk, etc goes here   # ...   $session->close(); ?> ``` ### See Also * [SNMP::\_\_construct()](snmp.construct) - Creates SNMP instance representing session to remote SNMP agent php Worker::unstack Worker::unstack =============== (PECL pthreads >= 2.0.0) Worker::unstack — Unstacking work ### Description ``` public Worker::unstack(): int ``` Removes the first task (the oldest one) in the stack. ### Parameters This function has no parameters. ### Return Values The new size of the stack. ### Changelog | Version | Description | | --- | --- | | v3 | The parameter to specify the task to unstack has been removed. Now, only the first task in the stack is removed. | ### Examples **Example #1 Removing objects from the stack of Workers** ``` <?php $my = new Worker(); $work = new class extends Threaded {}; var_dump($my->stack($work)); var_dump($my->unstack()); ``` The above example will output: ``` int(1) int(0) ``` php ReflectionGenerator::getThis ReflectionGenerator::getThis ============================ (PHP 7, PHP 8) ReflectionGenerator::getThis — Gets the `$this` value of the generator ### Description ``` public ReflectionGenerator::getThis(): ?object ``` Get the `$this` value that the generator has access to. ### Parameters This function has no parameters. ### Return Values Returns the `$this` value, or **`null`** if the generator was not created in a class context. ### Examples **Example #1 **ReflectionGenerator::getThis()** example** ``` <?php class GenExample {     public function gen()     {         yield 1;     } } $gen = (new GenExample)->gen(); $reflectionGen = new ReflectionGenerator($gen); var_dump($reflectionGen->getThis()); ``` The above example will output something similar to: ``` object(GenExample)#3 (0) { } ``` ### See Also * [ReflectionGenerator::getFunction()](reflectiongenerator.getfunction) - Gets the function name of the generator * [ReflectionGenerator::getTrace()](reflectiongenerator.gettrace) - Gets the trace of the executing generator
programming_docs
php OAuthException class OAuthException class ==================== Introduction ------------ (PECL OAuth >= 0.99.1) This exception is thrown when exceptional errors occur while using the OAuth extension and contains useful debugging information. Class synopsis -------------- class **OAuthException** extends [Exception](class.exception) { /\* Properties \*/ public [$lastResponse](class.oauthexception#oauthexception.props.lastresponse); public [$debugInfo](class.oauthexception#oauthexception.props.debuginfo); /\* Inherited properties \*/ protected string [$message](class.exception#exception.props.message) = ""; private string [$string](class.exception#exception.props.string) = ""; protected int [$code](class.exception#exception.props.code); protected string [$file](class.exception#exception.props.file) = ""; protected int [$line](class.exception#exception.props.line); private array [$trace](class.exception#exception.props.trace) = []; private ?[Throwable](class.throwable) [$previous](class.exception#exception.props.previous) = null; /\* Inherited methods \*/ ``` final public Exception::getMessage(): string ``` ``` final public Exception::getPrevious(): ?Throwable ``` ``` final public Exception::getCode(): int ``` ``` final public Exception::getFile(): string ``` ``` final public Exception::getLine(): int ``` ``` final public Exception::getTrace(): array ``` ``` final public Exception::getTraceAsString(): string ``` ``` public Exception::__toString(): string ``` ``` private Exception::__clone(): void ``` } Properties ---------- lastResponse The response of the exception which occurred, if any debugInfo php enchant_broker_get_dict_path enchant\_broker\_get\_dict\_path ================================ (PHP 5 >= 5.3.1, PHP 7, PHP 8, PECL enchant >= 1.0.1) enchant\_broker\_get\_dict\_path — Get the directory path for a given backend **Warning**This function has been *DEPRECATED* as of PHP 8.0.0. Relying on this function is highly discouraged. ### Description ``` enchant_broker_get_dict_path(EnchantBroker $broker, int $type): string|false ``` Get the directory path for a given backend. ### Parameters `broker` An Enchant broker returned by [enchant\_broker\_init()](function.enchant-broker-init). `type` The type of the dictionaries, i.e. **`ENCHANT_MYSPELL`** or **`ENCHANT_ISPELL`**. ### Return Values Returns the path of the dictionary directory on success or **`false`** on failure. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | `broker` expects an [EnchantBroker](class.enchantbroker) instance now; previoulsy, a [resource](language.types.resource) was expected. | ### Notes > > **Note**: > > > This function is only available if the extension has been compiled with Enchant v1. > > ### See Also * [enchant\_broker\_set\_dict\_path()](function.enchant-broker-set-dict-path) - Set the directory path for a given backend php imap_unsubscribe imap\_unsubscribe ================= (PHP 4, PHP 5, PHP 7, PHP 8) imap\_unsubscribe — Unsubscribe from a mailbox ### Description ``` imap_unsubscribe(IMAP\Connection $imap, string $mailbox): bool ``` Unsubscribe from the specified `mailbox`. ### Parameters `imap` An [IMAP\Connection](class.imap-connection) instance. `mailbox` The mailbox name, see [imap\_open()](function.imap-open) for more information **Warning** Passing untrusted data to this parameter is *insecure*, unless [imap.enable\_insecure\_rsh](https://www.php.net/manual/en/imap.configuration.php#ini.imap.enable-insecure-rsh) is disabled. ### Return Values Returns **`true`** on success or **`false`** on failure. ### Changelog | Version | Description | | --- | --- | | 8.1.0 | The `imap` parameter expects an [IMAP\Connection](class.imap-connection) instance now; previously, a [resource](language.types.resource) was expected. | ### See Also * [imap\_subscribe()](function.imap-subscribe) - Subscribe to a mailbox php Phar::extractTo Phar::extractTo =============== (PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 2.0.0) Phar::extractTo — Extract the contents of a phar archive to a directory ### Description ``` public Phar::extractTo(string $directory, array|string|null $files = null, bool $overwrite = false): bool ``` Extract all files within a phar archive to disk. Extracted files and directories preserve permissions as stored in the archive. The optional parameters allow optional control over which files are extracted, and whether existing files on disk can be overwritten. The second parameter `files` can be either the name of a file or directory to extract, or an array of names of files and directories to extract. By default, this method will not overwrite existing files, the third parameter can be set to true to enable overwriting of files. This method is similar to [ZipArchive::extractTo()](ziparchive.extractto). ### Parameters `directory` Path to extract the given `files` to `files` The name of a file or directory to extract, or an array of files/directories to extract, **`null`** to skip this param `overwrite` Set to **`true`** to enable overwriting existing files ### Return Values returns **`true`** on success, but it is better to check for thrown exception, and assume success if none is thrown. ### Errors/Exceptions Throws [PharException](class.pharexception) if errors occur while flushing changes to disk. ### Examples **Example #1 A **Phar::extractTo()** example** ``` <?php try {     $phar = new Phar('myphar.phar');     $phar->extractTo('/full/path'); // extract all files     $phar->extractTo('/another/path', 'file.txt'); // extract only file.txt     $phar->extractTo('/this/path',         array('file1.txt', 'file2.txt')); // extract 2 files only     $phar->extractTo('/third/path', null, true); // extract all files, and overwrite } catch (Exception $e) {     // handle errors } ?> ``` ### Notes > > **Note**: > > > Windows NTFS file systems do not support some characters in filenames, namely `<|>*?":`. Filenames with a trailing dot are not supported either. Contrary to some extraction tools, this method does not replace these characters with an underscore, but instead fails to extract such files. > > > ### See Also * [PharData::extractTo()](phardata.extractto) - Extract the contents of a tar/zip archive to a directory php imagecreatefromavif imagecreatefromavif =================== (PHP 8 >= 8.1.0) imagecreatefromavif — Create a new image from file or URL ### Description ``` imagecreatefromavif(string $filename): GdImage|false ``` **imagecreatefromavif()** returns an image object representing the image obtained from the given filename. ### Parameters `filename` Path to the AVIF raster image. ### Return Values Returns an image object on success, **`false`** on errors. php CachingIterator::getFlags CachingIterator::getFlags ========================= (PHP 5 >= 5.2.0, PHP 7, PHP 8) CachingIterator::getFlags — Get flags used ### Description ``` public CachingIterator::getFlags(): int ``` **Warning**This function is currently not documented; only its argument list is available. Get the bitmask of the flags used for this CachingIterator instance. ### Parameters This function has no parameters. ### Return Values Description... php imap_savebody imap\_savebody ============== (PHP 5 >= 5.1.3, PHP 7, PHP 8) imap\_savebody — Save a specific body section to a file ### Description ``` imap_savebody( IMAP\Connection $imap, resource|string|int $file, int $message_num, string $section = "", int $flags = 0 ): bool ``` Saves a part or the whole body of the specified message. ### Parameters `imap` An [IMAP\Connection](class.imap-connection) instance. `file` The path to the saved file as a string, or a valid file descriptor returned by [fopen()](function.fopen). `message_num` The message number `section` The part number. It is a string of integers delimited by period which index into a body part list as per the IMAP4 specification `flags` A bitmask with one or more of the following: * **`FT_UID`** - The `message_num` is a UID * **`FT_PEEK`** - Do not set the \Seen flag if not already set * **`FT_INTERNAL`** - The return string is in internal format, will not canonicalize to CRLF. ### Return Values Returns **`true`** on success or **`false`** on failure. ### Changelog | Version | Description | | --- | --- | | 8.1.0 | The `imap` parameter expects an [IMAP\Connection](class.imap-connection) instance now; previously, a [resource](language.types.resource) was expected. | ### See Also * [imap\_fetchbody()](function.imap-fetchbody) - Fetch a particular section of the body of the message php SyncMutex::__construct SyncMutex::\_\_construct ======================== (PECL sync >= 1.0.0) SyncMutex::\_\_construct — Constructs a new SyncMutex object ### Description ``` public SyncMutex::__construct(string $name = ?) ``` Constructs a named or unnamed countable mutex. ### Parameters `name` The name of the mutex if this is a named mutex object. > > **Note**: > > > If the name already exists, it must be able to be opened by the current user that the process is running as or an exception will be thrown with a meaningless error message. > > ### Return Values The new [SyncMutex](class.syncmutex) object. ### Errors/Exceptions An exception is thrown if the mutex cannot be created or opened. ### Examples **Example #1 **SyncMutex::\_\_construct()** named mutex with lock timeout example** ``` <?php $mutex = new SyncMutex("UniqueName"); if (!$mutex->lock(3000)) {     echo "Unable to lock mutex.";     exit(); } /* ... */ $mutex->unlock(); ?> ``` **Example #2 **SyncMutex::\_\_construct()** unnamed mutex example** ``` <?php $mutex = new SyncMutex(); $mutex->lock(); /* ... */ $mutex->unlock(); ?> ``` ### See Also * [SyncMutex::lock()](syncmutex.lock) - Waits for an exclusive lock * [SyncMutex::unlock()](syncmutex.unlock) - Unlocks the mutex php tan tan === (PHP 4, PHP 5, PHP 7, PHP 8) tan — Tangent ### Description ``` tan(float $num): float ``` **tan()** returns the tangent of the `num` parameter. The `num` parameter is in radians. ### Parameters `num` The argument to process in radians ### Return Values The tangent of `num` ### Examples **Example #1 **tan()** example** ``` <?php echo tan(M_PI_4); // 1 ?> ``` ### See Also * [atan()](function.atan) - Arc tangent * [atan2()](function.atan2) - Arc tangent of two variables * [sin()](function.sin) - Sine * [cos()](function.cos) - Cosine * [tanh()](function.tanh) - Hyperbolic tangent * [deg2rad()](function.deg2rad) - Converts the number in degrees to the radian equivalent php dio_tcsetattr dio\_tcsetattr ============== (PHP 4 >= 4.3.0, PHP 5 < 5.1.0) dio\_tcsetattr — Sets terminal attributes and baud rate for a serial port ### Description ``` dio_tcsetattr(resource $fd, array $options): bool ``` **dio\_tcsetattr()** sets the terminal attributes and baud rate of the open `fd`. ### Parameters `fd` The file descriptor returned by [dio\_open()](function.dio-open). `options` The currently available options are: * 'baud' - baud rate of the port - can be 38400,19200,9600,4800,2400,1800, 1200,600,300,200,150,134,110,75 or 50, default value is 9600. * 'bits' - data bits - can be 8,7,6 or 5. Default value is 8. * 'stop' - stop bits - can be 1 or 2. Default value is 1. * 'parity' - can be 0,1 or 2. Default value is 0. ### Return Values No value is returned. ### Examples **Example #1 Setting the baud rate on a serial port** ``` <?php $fd = dio_open('/dev/ttyS0', O_RDWR | O_NOCTTY | O_NONBLOCK); dio_fcntl($fd, F_SETFL, O_SYNC); dio_tcsetattr($fd, array(   'baud' => 9600,   'bits' => 8,   'stop'  => 1,   'parity' => 0 ));  while (1) {   $data = dio_read($fd, 256);   if ($data) {       echo $data;   } }  ?> ``` ### Notes > **Note**: This function is not implemented on Windows platforms. > > php stats_stat_powersum stats\_stat\_powersum ===================== (PECL stats >= 1.0.0) stats\_stat\_powersum — Returns the power sum of a vector ### Description ``` stats_stat_powersum(array $arr, float $power): float ``` Returns the sum of the `power`-th power of a vector represented as an array `arr`. ### Parameters `arr` The input array `power` The power ### Return Values Returns the power sum of the input array. php socket_send socket\_send ============ (PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8) socket\_send — Sends data to a connected socket ### Description ``` socket_send( Socket $socket, string $data, int $length, int $flags ): int|false ``` The function **socket\_send()** sends `length` bytes to the socket `socket` from `data`. ### Parameters `socket` A [Socket](class.socket) instance created with [socket\_create()](function.socket-create) or [socket\_accept()](function.socket-accept). `data` A buffer containing the data that will be sent to the remote host. `length` The number of bytes that will be sent to the remote host from `data`. `flags` The value of `flags` can be any combination of the following flags, joined with the binary OR (`|`) operator. **Possible values for `flags`**| **`MSG_OOB`** | Send OOB (out-of-band) data. | | **`MSG_EOR`** | Indicate a record mark. The sent data completes the record. | | **`MSG_EOF`** | Close the sender side of the socket and include an appropriate notification of this at the end of the sent data. The sent data completes the transaction. | | **`MSG_DONTROUTE`** | Bypass routing, use direct interface. | ### Return Values **socket\_send()** returns the number of bytes sent, or **`false`** on error. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | `socket` is a [Socket](class.socket) instance now; previously, it was a resource. | ### See Also * [socket\_sendto()](function.socket-sendto) - Sends a message to a socket, whether it is connected or not php ReflectionProperty::getModifiers ReflectionProperty::getModifiers ================================ (PHP 5, PHP 7, PHP 8) ReflectionProperty::getModifiers — Gets the property modifiers ### Description ``` public ReflectionProperty::getModifiers(): int ``` Gets the modifiers. ### Parameters This function has no parameters. ### Return Values A numeric representation of the modifiers. The actual meaning of these modifiers are described under [predefined constants](class.reflectionproperty#reflectionproperty.constants.modifiers). ### See Also * [ReflectionProperty::isPrivate()](reflectionproperty.isprivate) - Checks if property is private * [Reflection::getModifierNames()](reflection.getmodifiernames) - Gets modifier names php RecursiveIteratorIterator::callGetChildren RecursiveIteratorIterator::callGetChildren ========================================== (PHP 5 >= 5.1.0, PHP 7, PHP 8) RecursiveIteratorIterator::callGetChildren — Get children ### Description ``` public RecursiveIteratorIterator::callGetChildren(): ?RecursiveIterator ``` Get children of the current element. ### Parameters This function has no parameters. ### Return Values A **RecursiveIterator()** on success, or **`null`** on failure. php Imagick::getImageBluePrimary Imagick::getImageBluePrimary ============================ (PECL imagick 2, PECL imagick 3) Imagick::getImageBluePrimary — Returns the chromaticy blue primary point ### Description ``` public Imagick::getImageBluePrimary(): array ``` Returns the chromaticity blue primary point for the image. ### Parameters `x` The chromaticity blue primary x-point. `y` The chromaticity blue primary y-point. ### Return Values Array consisting of "x" and "y" coordinates of point. ### Errors/Exceptions Throws ImagickException on error. php Imagick::getImageType Imagick::getImageType ===================== (PECL imagick 2, PECL imagick 3) Imagick::getImageType — Gets the potential image type ### Description ``` public Imagick::getImageType(): int ``` Gets the potential image type. ### Parameters This function has no parameters. ### Return Values Returns the potential image type. * **`imagick::IMGTYPE_UNDEFINED`** * **`imagick::IMGTYPE_BILEVEL`** * **`imagick::IMGTYPE_GRAYSCALE`** * **`imagick::IMGTYPE_GRAYSCALEMATTE`** * **`imagick::IMGTYPE_PALETTE`** * **`imagick::IMGTYPE_PALETTEMATTE`** * **`imagick::IMGTYPE_TRUECOLOR`** * **`imagick::IMGTYPE_TRUECOLORMATTE`** * **`imagick::IMGTYPE_COLORSEPARATION`** * **`imagick::IMGTYPE_COLORSEPARATIONMATTE`** * **`imagick::IMGTYPE_OPTIMIZE`** ### Errors/Exceptions Throws ImagickException on error. php intdiv intdiv ====== (PHP 7, PHP 8) intdiv — Integer division ### Description ``` intdiv(int $num1, int $num2): int ``` Returns the integer quotient of the division of `num1` by `num2`. ### Parameters `num1` Number to be divided. `num2` Number which divides the `num1`. ### Return Values The integer quotient of the division of `num1` by `num2`. ### Errors/Exceptions If `num2` is `0`, a [DivisionByZeroError](class.divisionbyzeroerror) exception is thrown. If the `num1` is **`PHP_INT_MIN`** and the `num2` is `-1`, then an [ArithmeticError](class.arithmeticerror) exception is thrown. ### Examples **Example #1 **intdiv()** example** ``` <?php var_dump(intdiv(3, 2)); var_dump(intdiv(-3, 2)); var_dump(intdiv(3, -2)); var_dump(intdiv(-3, -2)); var_dump(intdiv(PHP_INT_MAX, PHP_INT_MAX)); var_dump(intdiv(PHP_INT_MIN, PHP_INT_MIN)); var_dump(intdiv(PHP_INT_MIN, -1)); var_dump(intdiv(1, 0)); ?> ``` ``` int(1) int(-1) int(-1) int(1) int(1) int(1) Fatal error: Uncaught ArithmeticError: Division of PHP_INT_MIN by -1 is not an integer in %s on line 8 Fatal error: Uncaught DivisionByZeroError: Division by zero in %s on line 9 ``` ### See Also * [`/`](language.operators.arithmetic) - Floating-point division * [`%`](language.operators.arithmetic) - Integer modulus * [fmod()](function.fmod) - Floating-point modulo php SQLite3Result::numColumns SQLite3Result::numColumns ========================= (PHP 5 >= 5.3.0, PHP 7, PHP 8) SQLite3Result::numColumns — Returns the number of columns in the result set ### Description ``` public SQLite3Result::numColumns(): int ``` Returns the number of columns in the result set. ### Parameters This function has no parameters. ### Return Values Returns the number of columns in the result set. php DatePeriod::getDateInterval DatePeriod::getDateInterval =========================== (PHP 5 >= 5.6.5, PHP 7, PHP 8) DatePeriod::getDateInterval — Gets the interval ### Description Object-oriented style ``` public DatePeriod::getDateInterval(): DateInterval ``` Gets a [DateInterval](class.dateinterval) object representing the interval used for the period. ### Parameters This function has no parameters. ### Return Values Returns a [DateInterval](class.dateinterval) object ### Examples **Example #1 **DatePeriod::getDateInterval()** example** ``` <?php $period = new DatePeriod('R7/2016-05-16T00:00:00Z/P1D'); $interval = $period->getDateInterval(); echo $interval->format('%d day'); ?> ``` The above example will output: ``` 1 day ``` ### See Also * [DatePeriod::getStartDate()](dateperiod.getstartdate) - Gets the start date * [DatePeriod::getEndDate()](dateperiod.getenddate) - Gets the end date
programming_docs
php None Iterables --------- [Iterable](language.types.iterable) is a built-in compile time type alias for `array|Traversable`. From its introduction in PHP 7.1.0 and prior to PHP 8.2.0, [iterable](language.types.iterable) was a built-in pseudo-type that acted as the aforementioned type alias and can be used as a type declaration. An iterable type can be used in [foreach](control-structures.foreach) and with **yield from** within a [generator](https://www.php.net/manual/en/language.generators.php). > > **Note**: > > > Functions declaring iterable as a return type may also be [generators](https://www.php.net/manual/en/language.generators.php). > > > **Example #1 Iterable generator return type example** > > > ``` > <?php > > function gen(): iterable { >     yield 1; >     yield 2; >     yield 3; > } > > ?> > ``` > php DOMText::isWhitespaceInElementContent DOMText::isWhitespaceInElementContent ===================================== (PHP 5, PHP 7, PHP 8) DOMText::isWhitespaceInElementContent — Indicates whether this text node contains whitespace ### Description ``` public DOMText::isWhitespaceInElementContent(): bool ``` Indicates whether this text node contains only whitespace or it is empty. The text node is determined to contain whitespace in element content during the load of the document. ### Parameters This function has no parameters. ### Return Values Returns **`true`** if node contains zero or more whitespace characters and nothing else. Returns **`false`** otherwise. php ImagickDraw::setClipPath ImagickDraw::setClipPath ======================== (PECL imagick 2, PECL imagick 3) ImagickDraw::setClipPath — Associates a named clipping path with the image ### Description ``` public ImagickDraw::setClipPath(string $clip_mask): bool ``` **Warning**This function is currently not documented; only its argument list is available. Associates a named clipping path with the image. Only the areas drawn on by the clipping path will be modified as long as it remains in effect. ### Parameters `clip_mask` the clipping path name ### Return Values No value is returned. ### Examples **Example #1 **ImagickDraw::setClipPath()** example** ``` <?php function setClipPath($strokeColor, $fillColor, $backgroundColor) {     $draw = new \ImagickDraw();     $draw->setStrokeColor($strokeColor);     $draw->setFillColor($fillColor);     $draw->setStrokeOpacity(1);     $draw->setStrokeWidth(2);     $clipPathName = 'testClipPath';     $draw->pushClipPath($clipPathName);     $draw->rectangle(0, 0, 250, 250);     $draw->popClipPath();     $draw->setClipPath($clipPathName);     $draw->rectangle(100, 100, 400, 400);     $imagick = new \Imagick();     $imagick->newImage(500, 500, $backgroundColor);     $imagick->setImageFormat("png");     $imagick->drawImage($draw);     header("Content-Type: image/png");     echo $imagick->getImageBlob(); } ?> ``` php RarEntry::getCrc RarEntry::getCrc ================ (PECL rar >= 0.1) RarEntry::getCrc — Get CRC of the entry ### Description ``` public RarEntry::getCrc(): string ``` Returns an hexadecimal string representation of the CRC of the archive entry. ### Parameters This function has no parameters. ### Return Values Returns the CRC of the archive entry or **`false`** on error. ### Changelog | Version | Description | | --- | --- | | PECL rar 2.0.0 | This method now returns correct values for multiple volume archives. | php preg_match_all preg\_match\_all ================ (PHP 4, PHP 5, PHP 7, PHP 8) preg\_match\_all — Perform a global regular expression match ### Description ``` preg_match_all( string $pattern, string $subject, array &$matches = null, int $flags = 0, int $offset = 0 ): int|false ``` Searches `subject` for all matches to the regular expression given in `pattern` and puts them in `matches` in the order specified by `flags`. After the first match is found, the subsequent searches are continued on from end of the last match. ### Parameters `pattern` The pattern to search for, as a string. `subject` The input string. `matches` Array of all matches in multi-dimensional array ordered according to `flags`. `flags` Can be a combination of the following flags (note that it doesn't make sense to use **`PREG_PATTERN_ORDER`** together with **`PREG_SET_ORDER`**): **`PREG_PATTERN_ORDER`** Orders results so that $matches[0] is an array of full pattern matches, $matches[1] is an array of strings matched by the first parenthesized subpattern, and so on. ``` <?php preg_match_all("|<[^>]+>(.*)</[^>]+>|U",     "<b>example: </b><div align=left>this is a test</div>",     $out, PREG_PATTERN_ORDER); echo $out[0][0] . ", " . $out[0][1] . "\n"; echo $out[1][0] . ", " . $out[1][1] . "\n"; ?> ``` The above example will output: ``` <b>example: </b>, <div align=left>this is a test</div> example: , this is a test ``` So, $out[0] contains array of strings that matched full pattern, and $out[1] contains array of strings enclosed by tags. If the pattern contains named subpatterns, $matches additionally contains entries for keys with the subpattern name. If the pattern contains duplicate named subpatterns, only the rightmost subpattern is stored in $matches[NAME]. ``` <?php preg_match_all(     '/(?J)(?<match>foo)|(?<match>bar)/',     'foo bar',     $matches,     PREG_PATTERN_ORDER ); print_r($matches['match']); ?> ``` The above example will output: ``` Array ( [0] => [1] => bar ) ``` **`PREG_SET_ORDER`** Orders results so that $matches[0] is an array of first set of matches, $matches[1] is an array of second set of matches, and so on. ``` <?php preg_match_all("|<[^>]+>(.*)</[^>]+>|U",     "<b>example: </b><div align=\"left\">this is a test</div>",     $out, PREG_SET_ORDER); echo $out[0][0] . ", " . $out[0][1] . "\n"; echo $out[1][0] . ", " . $out[1][1] . "\n"; ?> ``` The above example will output: ``` <b>example: </b>, example: <div align="left">this is a test</div>, this is a test ``` **`PREG_OFFSET_CAPTURE`** If this flag is passed, for every occurring match the appendant string offset (in bytes) will also be returned. Note that this changes the value of `matches` into an array of arrays where every element is an array consisting of the matched string at offset `0` and its string offset into `subject` at offset `1`. ``` <?php preg_match_all('/(foo)(bar)(baz)/', 'foobarbaz', $matches, PREG_OFFSET_CAPTURE); print_r($matches); ?> ``` The above example will output: ``` Array ( [0] => Array ( [0] => Array ( [0] => foobarbaz [1] => 0 ) ) [1] => Array ( [0] => Array ( [0] => foo [1] => 0 ) ) [2] => Array ( [0] => Array ( [0] => bar [1] => 3 ) ) [3] => Array ( [0] => Array ( [0] => baz [1] => 6 ) ) ) ``` **`PREG_UNMATCHED_AS_NULL`** If this flag is passed, unmatched subpatterns are reported as **`null`**; otherwise they are reported as an empty string. If no order flag is given, **`PREG_PATTERN_ORDER`** is assumed. `offset` Normally, the search starts from the beginning of the subject string. The optional parameter `offset` can be used to specify the alternate place from which to start the search (in bytes). > > **Note**: > > > Using `offset` is not equivalent to passing `substr($subject, $offset)` to **preg\_match\_all()** in place of the subject string, because `pattern` can contain assertions such as *^*, *$* or *(?<=x)*. See [preg\_match()](function.preg-match) for examples. > > ### Return Values Returns the number of full pattern matches (which might be zero), or **`false`** on failure. ### Errors/Exceptions If the regex pattern passed does not compile to a valid regex, an **`E_WARNING`** is emitted. ### Changelog | Version | Description | | --- | --- | | 7.2.0 | The **`PREG_UNMATCHED_AS_NULL`** is now supported for the `$flags` parameter. | ### Examples **Example #1 Getting all phone numbers out of some text.** ``` <?php preg_match_all("/\(?  (\d{3})?  \)?  (?(1)  [\-\s] ) \d{3}-\d{4}/x",                 "Call 555-1212 or 1-800-555-1212", $phones); ?> ``` **Example #2 Find matching HTML tags (greedy)** ``` <?php // The \\2 is an example of backreferencing. This tells pcre that // it must match the second set of parentheses in the regular expression // itself, which would be the ([\w]+) in this case. The extra backslash is // required because the string is in double quotes. $html = "<b>bold text</b><a href=howdy.html>click me</a>"; preg_match_all("/(<([\w]+)[^>]*>)(.*?)(<\/\\2>)/", $html, $matches, PREG_SET_ORDER); foreach ($matches as $val) {     echo "matched: " . $val[0] . "\n";     echo "part 1: " . $val[1] . "\n";     echo "part 2: " . $val[2] . "\n";     echo "part 3: " . $val[3] . "\n";     echo "part 4: " . $val[4] . "\n\n"; } ?> ``` The above example will output: ``` matched: <b>bold text</b> part 1: <b> part 2: b part 3: bold text part 4: </b> matched: <a href=howdy.html>click me</a> part 1: <a href=howdy.html> part 2: a part 3: click me part 4: </a> ``` **Example #3 Using named subpattern** ``` <?php $str = <<<FOO a: 1 b: 2 c: 3 FOO; preg_match_all('/(?P<name>\w+): (?P<digit>\d+)/', $str, $matches); /* Alternative */ // preg_match_all('/(?<name>\w+): (?<digit>\d+)/', $str, $matches); print_r($matches); ?> ``` The above example will output: ``` Array ( [0] => Array ( [0] => a: 1 [1] => b: 2 [2] => c: 3 ) [name] => Array ( [0] => a [1] => b [2] => c ) [1] => Array ( [0] => a [1] => b [2] => c ) [digit] => Array ( [0] => 1 [1] => 2 [2] => 3 ) [2] => Array ( [0] => 1 [1] => 2 [2] => 3 ) ) ``` ### See Also * [PCRE Patterns](https://www.php.net/manual/en/pcre.pattern.php) * [preg\_quote()](function.preg-quote) - Quote regular expression characters * [preg\_match()](function.preg-match) - Perform a regular expression match * [preg\_replace()](function.preg-replace) - Perform a regular expression search and replace * [preg\_split()](function.preg-split) - Split string by a regular expression * [preg\_last\_error()](function.preg-last-error) - Returns the error code of the last PCRE regex execution php rewinddir rewinddir ========= (PHP 4, PHP 5, PHP 7, PHP 8) rewinddir — Rewind directory handle ### Description ``` rewinddir(?resource $dir_handle = null): void ``` Resets the directory stream indicated by `dir_handle` to the beginning of the directory. ### Parameters `dir_handle` The directory handle resource previously opened with [opendir()](function.opendir). If the directory handle is not specified, the last link opened by [opendir()](function.opendir) is assumed. ### Return Values No value is returned. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | `dir_handle` is now nullable. | php RarArchive::isSolid RarArchive::isSolid =================== rar\_solid\_is ============== (PECL rar >= 2.0.0) RarArchive::isSolid -- rar\_solid\_is — Check whether the RAR archive is solid ### Description Object-oriented style (method): ``` public RarArchive::isSolid(): bool ``` Procedural style: ``` rar_solid_is(RarArchive $rarfile): bool ``` Check whether the RAR archive is solid. Individual file extraction is slower on solid archives. ### Parameters `rarfile` A [RarArchive](class.rararchive) object, opened with [rar\_open()](rararchive.open). ### Return Values Returns **`true`** if the archive is solid, **`false`** otherwise. ### Examples **Example #1 Object-oriented style** ``` <?php $arch1 = RarArchive::open("store_method.rar"); $arch2 = RarArchive::open("solid.rar"); echo "$arch1: " . ($arch1->isSolid()?'yes':'no') ."\n"; echo "$arch2: " . ($arch2->isSolid()?'yes':'no') . "\n"; ?> ``` The above example will output something similar to: ``` RAR Archive "C:\php_rar\trunk\tests\store_method.rar": no RAR Archive "C:\php_rar\trunk\tests\solid.rar": yes ``` **Example #2 Procedural style** ``` <?php $arch1 = rar_open("store_method.rar"); $arch2 = rar_open("solid.rar"); echo "$arch1: " . (rar_solid_is($arch1)?'yes':'no') ."\n"; echo "$arch2: " . (rar_solid_is($arch2)?'yes':'no') . "\n"; ?> ``` php Phar::__construct Phar::\_\_construct =================== (PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 1.0.0) Phar::\_\_construct — Construct a Phar archive object ### Description public **Phar::\_\_construct**(string `$filename`, int `$flags` = FilesystemIterator::SKIP\_DOTS | FilesystemIterator::UNIX\_PATHS, ?string `$alias` = **`null`**) ### Parameters `filename` Path to an existing Phar archive or to-be-created archive. The file name's extension must contain .phar. `flags` Flags to pass to parent class [RecursiveDirectoryIterator](class.recursivedirectoryiterator). `alias` Alias with which this Phar archive should be referred to in calls to stream functionality. ### Errors/Exceptions Throws [BadMethodCallException](class.badmethodcallexception) if called twice, [UnexpectedValueException](class.unexpectedvalueexception) if the phar archive can't be opened. ### Examples **Example #1 A **Phar::\_\_construct()** example** ``` <?php try {     $p = new Phar('/path/to/my.phar', FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::KEY_AS_FILENAME,                   'my.phar'); } catch (UnexpectedValueException $e) {     die('Could not open my.phar'); } catch (BadMethodCallException $e) {     echo 'technically, this cannot happen'; } // this works now echo file_get_contents('phar://my.phar/example.txt'); // and works as if we had typed echo file_get_contents('phar:///path/to/my.phar/example.txt'); ?> ``` php xml_parser_create_ns xml\_parser\_create\_ns ======================= (PHP 4 >= 4.0.5, PHP 5, PHP 7, PHP 8) xml\_parser\_create\_ns — Create an XML parser with namespace support ### Description ``` xml_parser_create_ns(?string $encoding = null, string $separator = ":"): XMLParser ``` **xml\_parser\_create\_ns()** creates a new XML parser with XML namespace support and returns a [XMLParser](class.xmlparser) instance to be used by the other XML functions. ### Parameters `encoding` The input encoding is automatically detected, so that the `encoding` parameter specifies only the output encoding. The default output charset is UTF-8. The supported encodings are `ISO-8859-1`, `UTF-8` and `US-ASCII`. `separator` With a namespace aware parser tag parameters passed to the various handler functions will consist of namespace and tag name separated by the string specified in `separator`. ### Return Values Returns a new [XMLParser](class.xmlparser) instance. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | This function returns an [XMLParser](class.xmlparser) instance now; previously, a resource was returned, or **`false`** on failure. | | 8.0.0 | `encoding` is nullable now. | ### See Also * [xml\_parser\_create()](function.xml-parser-create) - Create an XML parser * [xml\_parser\_free()](function.xml-parser-free) - Free an XML parser php SQLite3Stmt::__construct SQLite3Stmt::\_\_construct ========================== (No version information available, might only be in Git) SQLite3Stmt::\_\_construct — Constructs an SQLite3Stmt object ### Description private **SQLite3Stmt::\_\_construct**([SQLite3](class.sqlite3) `$sqlite3`, string `$query`) [SQLite3Stmt](class.sqlite3stmt) instances are created by [SQLite3::prepare()](sqlite3.prepare). ### Parameters `sqlite3` `query` php mb_internal_encoding mb\_internal\_encoding ====================== (PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8) mb\_internal\_encoding — Set/Get internal character encoding ### Description ``` mb_internal_encoding(?string $encoding = null): string|bool ``` Set/Get the internal character encoding ### Parameters `encoding` `encoding` is the character encoding name used for the HTTP input character encoding conversion, HTTP output character encoding conversion, and the default character encoding for string functions defined by the mbstring module. You should notice that the internal encoding is totally different from the one for multibyte regex. ### Return Values If `encoding` is set, then Returns **`true`** on success or **`false`** on failure. In this case, the character encoding for multibyte regex is NOT changed. If `encoding` is omitted, then the current character encoding name is returned. ### Errors/Exceptions As of PHP 8.0.0, a [ValueError](class.valueerror) is thrown if the value of `encoding` is an invalid encoding. Prior to PHP 8.0.0, a **`E_WARNING`** was emitted instead. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | `encoding` is nullable now. | | 8.0.0 | Now throws a [ValueError](class.valueerror) if `encoding` is an invalid encoding. Previously a **`E_WARNING`** was emitted instead. | ### Examples **Example #1 **mb\_internal\_encoding()** example** ``` <?php /* Set internal character encoding to UTF-8 */ mb_internal_encoding("UTF-8"); /* Display current internal character encoding */ echo mb_internal_encoding(); ?> ``` ### See Also * [mb\_http\_input()](function.mb-http-input) - Detect HTTP input character encoding * [mb\_http\_output()](function.mb-http-output) - Set/Get HTTP output character encoding * [mb\_detect\_order()](function.mb-detect-order) - Set/Get character encoding detection order * [mb\_regex\_encoding()](function.mb-regex-encoding) - Set/Get character encoding for multibyte regex php EvLoop::check EvLoop::check ============= (PECL ev >= 0.2.0) EvLoop::check — Creates EvCheck object associated with the current event loop instance ### Description ``` final public EvLoop::check( string $callback , string $data = ?, string $priority = ?): EvCheck ``` Creates EvCheck object associated with the current event loop instance. ### Parameters All parameters have the same meaning as for [EvCheck::\_\_construct()](evcheck.construct) ### Return Values Returns EvCheck object on success. ### See Also * [EvCheck::\_\_construct()](evcheck.construct) - Constructs the EvCheck watcher object php EvLoop::invokePending EvLoop::invokePending ===================== (PECL ev >= 0.2.0) EvLoop::invokePending — Invoke all pending watchers while resetting their pending state ### Description ``` public EvLoop::invokePending(): void ``` Invoke all pending watchers while resetting their pending state. ### Parameters This function has no parameters. ### Return Values No value is returned. php svn_ls svn\_ls ======= (PECL svn >= 0.1.0) svn\_ls — Returns list of directory contents in repository URL, optionally at revision number ### Description ``` svn_ls( string $repos_url, int $revision_no = SVN_REVISION_HEAD, bool $recurse = false, bool $peg = false ): array ``` This function queries the repository URL and returns a list of files and directories, optionally from a specific revision. This is equivalent to **`svn list $repos_url[@$revision_no]`** > > **Note**: > > > This function does not work with working copies. `repos_url` *must* be a repository URL. > > ### Parameters `url` URL of the repository, eg. **`http://www.example.com/svnroot`**. To access a local Subversion repository via filesystem, use the file URI scheme, eg. **`file:///home/user/svn-repos`** `revision` Integer revision number to retrieve listing of. When omitted, the HEAD revision is used. `recurse` Enables recursion. ### Return Values On success, this function returns an array file listing in the format of: ``` [0] => Array ( [created_rev] => integer revision number of last edit [last_author] => string author name of last edit [size] => integer byte file size of file [time] => string date of last edit in form 'M d H:i' or 'M d Y', depending on how old the file is [time_t] => integer unix timestamp of last edit [name] => name of file/directory [type] => type, can be 'file' or 'dir' ) [1] => ... ``` ### Examples **Example #1 **svn\_ls()** example** ``` <?php print_r( svn_ls('http://www.example.com/svnroot/') ); ?> ``` The above example will output something similar to: ``` Array ( [0] => Array ( [created_rev] => 20 [last_author] => Joe [size] => 0 [time] => Apr 02 09:28 [time_t] => 1175520529 [name] => tags [type] => dir ) [1] => Array ( [created_rev] => 23 [last_author] => Bob [size] => 0 [time] => Apr 02 15:15 [time_t] => 1175541322 [name] => trunk [type] => dir ) ) ``` ### Notes **Warning**This function is *EXPERIMENTAL*. The behaviour of this function, its name, and surrounding documentation may change without notice in a future release of PHP. This function should be used at your own risk. ### See Also * [» SVN documentation on svn list](http://svnbook.red-bean.com/en/1.2/svn.ref.svn.c.list.html)
programming_docs
php EventHttpConnection::makeRequest EventHttpConnection::makeRequest ================================ (PECL event >= 1.4.0-beta) EventHttpConnection::makeRequest — Makes an HTTP request over the specified connection ### Description ``` public EventHttpConnection::makeRequest( EventHttpRequest $req , int $type , string $uri ): bool ``` Makes an HTTP request over the specified connection. `type` is one of `EventHttpRequest::CMD_*` constants. ### Parameters `req` The connection object over which to send the request. `type` One of [`EventHttpRequest::CMD_*` constants](class.eventhttprequest#eventhttprequest.constants) . `uri` The URI associated with the request. ### Return Values Returns **`true`** on success or **`false`** on failure. ### Examples **Example #1 **EventHttpConnection::makeRequest()** example** ``` <?php function _request_handler($req, $base) {     echo __FUNCTION__, PHP_EOL;     if (is_null($req)) {         echo "Timed out\n";     } else {         $response_code = $req->getResponseCode();         if ($response_code == 0) {             echo "Connection refused\n";         } elseif ($response_code != 200) {             echo "Unexpected response: $response_code\n";         } else {             echo "Success: $response_code\n";             $buf = $req->getInputBuffer();             echo "Body:\n";             while ($s = $buf->readLine(EventBuffer::EOL_ANY)) {                 echo $s, PHP_EOL;             }         }     }     $base->exit(NULL); } $address = "127.0.0.1"; $port = 80; $base = new EventBase(); $conn = new EventHttpConnection($base, NULL, $address, $port); $conn->setTimeout(5); $req = new EventHttpRequest("_request_handler", $base); $req->addHeader("Host", $address, EventHttpRequest::OUTPUT_HEADER); $req->addHeader("Content-Length", "0", EventHttpRequest::OUTPUT_HEADER); $conn->makeRequest($req, EventHttpRequest::CMD_GET, "/index.cphp"); $base->loop(); ?> ``` The above example will output something similar to: ``` _request_handler Success: 200 Body: PHP, date: 2013-03-13T20:27:52+05:00 ``` ### See Also * [EventHttpRequest::addHeader()](eventhttprequest.addheader) - Adds an HTTP header to the headers of the request php ImagickDraw::getStrokeWidth ImagickDraw::getStrokeWidth =========================== (PECL imagick 2, PECL imagick 3) ImagickDraw::getStrokeWidth — Returns the width of the stroke used to draw object outlines ### Description ``` public ImagickDraw::getStrokeWidth(): float ``` **Warning**This function is currently not documented; only its argument list is available. Returns the width of the stroke used to draw object outlines. ### Return Values Returns a float describing the stroke width. php The ReflectionAttribute class The ReflectionAttribute class ============================= Introduction ------------ (PHP 8) The **ReflectionAttribute** class provides information about an [Attributes](https://www.php.net/manual/en/language.attributes.php). Class synopsis -------------- class **ReflectionAttribute** implements [Reflector](class.reflector) { /\* Constants \*/ public const int [IS\_INSTANCEOF](class.reflectionattribute#reflectionattribute.constants.is-instanceof); /\* Methods \*/ private [\_\_construct](reflectionattribute.construct)() ``` public getArguments(): array ``` ``` public getName(): string ``` ``` public getTarget(): int ``` ``` public isRepeated(): bool ``` ``` public newInstance(): object ``` } Predefined Constants -------------------- ReflectionAttribute Flags ------------------------- **`ReflectionAttribute::IS_INSTANCEOF`** Retrieve attributes using an `instanceof` check. > > **Note**: > > > The values of these constants may change between PHP versions. It is recommended to always use the constants and not rely on the values directly. > > Table of Contents ----------------- * [ReflectionAttribute::\_\_construct](reflectionattribute.construct) — Private constructor to disallow direct instantiation * [ReflectionAttribute::getArguments](reflectionattribute.getarguments) — Gets arguments passed to attribute * [ReflectionAttribute::getName](reflectionattribute.getname) — Gets attribute name * [ReflectionAttribute::getTarget](reflectionattribute.gettarget) — Returns the target of the attribute as bitmask * [ReflectionAttribute::isRepeated](reflectionattribute.isrepeated) — Returns whether the attribute of this name has been repeated on a code element * [ReflectionAttribute::newInstance](reflectionattribute.newinstance) — Instantiates the attribute class represented by this ReflectionAttribute class and arguments php ImagickDraw::setTextKerning ImagickDraw::setTextKerning =========================== (PECL imagick 2 >= 2.3.0, PECL imagick 3) ImagickDraw::setTextKerning — Description ### Description ``` public ImagickDraw::setTextKerning(float $kerning): bool ``` Sets the text kerning **Warning**This function is currently not documented; only its argument list is available. ### Parameters `kerning` ### Return Values Returns **`true`** on success. php openal_buffer_get openal\_buffer\_get =================== (PECL openal >= 0.1.0) openal\_buffer\_get — Retrieve an OpenAL buffer property ### Description ``` openal_buffer_get(resource $buffer, int $property): int|false ``` ### Parameters `buffer` An [Open AL(Buffer)](https://www.php.net/manual/en/openal.resources.php) resource (previously created by [openal\_buffer\_create()](function.openal-buffer-create)). `property` Specific property, one of: **`AL_FREQUENCY`**, **`AL_BITS`**, **`AL_CHANNELS`** and **`AL_SIZE`**. ### Return Values Returns an integer value appropriate to the `property` requested or **`false`** on failure. ### See Also * [openal\_buffer\_create()](function.openal-buffer-create) - Generate OpenAL buffer php ImagickDraw::pathLineToHorizontalRelative ImagickDraw::pathLineToHorizontalRelative ========================================= (PECL imagick 2, PECL imagick 3) ImagickDraw::pathLineToHorizontalRelative — Draws a horizontal line ### Description ``` public ImagickDraw::pathLineToHorizontalRelative(float $x): bool ``` **Warning**This function is currently not documented; only its argument list is available. Draws a horizontal line path from the current point to the target point using relative coordinates. The target point then becomes the new current point. ### Parameters `x` x coordinate ### Return Values No value is returned. php SolrQuery::removeExpandSortField SolrQuery::removeExpandSortField ================================ (PECL solr >= 2.2.0) SolrQuery::removeExpandSortField — Removes an expand sort field from the expand.sort parameter ### Description ``` public SolrQuery::removeExpandSortField(string $field): SolrQuery ``` Removes an expand sort field from the expand.sort parameter. ### Parameters `field` field name ### Return Values [SolrQuery](class.solrquery) ### See Also * [SolrQuery::setExpand()](solrquery.setexpand) - Enables/Disables the Expand Component * [SolrQuery::addExpandSortField()](solrquery.addexpandsortfield) - Orders the documents within the expanded groups (expand.sort parameter) * [SolrQuery::setExpandRows()](solrquery.setexpandrows) - Sets the number of rows to display in each group (expand.rows). Server Default 5 * [SolrQuery::setExpandQuery()](solrquery.setexpandquery) - Sets the expand.q parameter * [SolrQuery::addExpandFilterQuery()](solrquery.addexpandfilterquery) - Overrides main filter query, determines which documents to include in the main group * [SolrQuery::removeExpandFilterQuery()](solrquery.removeexpandfilterquery) - Removes an expand filter query php Ds\Deque::reversed Ds\Deque::reversed ================== (PECL ds >= 1.0.0) Ds\Deque::reversed — Returns a reversed copy ### Description ``` public Ds\Deque::reversed(): Ds\Deque ``` Returns a reversed copy of the deque. ### Parameters This function has no parameters. ### Return Values A reversed copy of the deque. > > **Note**: > > > The current instance is not affected. > > ### Examples **Example #1 **Ds\Deque::reversed()** example** ``` <?php $deque = new \Ds\Deque(["a", "b", "c"]); print_r($deque->reversed()); print_r($deque); ?> ``` The above example will output something similar to: ``` Ds\Deque Object ( [0] => c [1] => b [2] => a ) Ds\Deque Object ( [0] => a [1] => b [2] => c ) ``` php fdf_enum_values fdf\_enum\_values ================= (PHP 4 >= 4.3.0, PHP 5 < 5.3.0, PECL fdf SVN) fdf\_enum\_values — Call a user defined function for each document value ### Description ``` fdf_enum_values(resource $fdf_document, callable $function, mixed $userdata = ?): bool ``` **Warning**This function is currently not documented; only its argument list is available. php Ev::recommendedBackends Ev::recommendedBackends ======================= (PECL ev >= 0.2.0) Ev::recommendedBackends — Returns a bit mask of recommended backends for current platform ### Description ``` final public static Ev::recommendedBackends(): int ``` Returns the set of all backends compiled into this binary of `libev` and also recommended for this platform, meaning it will work for most file descriptor types. This set is often smaller than the one returned by **ev\_supported\_backends()** , as for example `kqueue` is broken on most `BSD` systems and will not be auto-detected unless it is requested explicitly. This is the set of backends that `libev` will probe no backends specified explicitly. ### Parameters This function has no parameters. ### Return Values Returns a bit mask which can containing [backend flags](class.ev#ev.constants.watcher-backends) combined using bitwise *OR* operator. ### Examples **Example #1 Embedding one loop into another** ``` <?php /* * Try to get an embeddable event loop and embed it into the default event loop. * If it is impossible, use the default * loop. The default loop is stored in $loop_hi, while the embeddable loop is * stored in $loop_lo(which is $loop_hi in the case no embeddable loop can be * used). * * Sample translated to PHP * http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#Examples_CONTENT-9 */ $loop_hi = EvLoop::defaultLoop(); $loop_lo = NULL; $embed   = NULL; /* * See if there is a chance of getting one that works * (flags' value of 0 means autodetection) */ $loop_lo = Ev::embeddableBackends() & Ev::recommendedBackends()  ? new EvLoop(Ev::embeddableBackends() & Ev::recommendedBackends())  : 0; if ($loop_lo) {  $embed = new EvEmbed($loop_lo, function () {}); } else {  $loop_lo = $loop_hi; } ?> ``` ### See Also * [EvEmbed](class.evembed) * [Ev::embeddableBackends()](ev.embeddablebackends) - Returns the set of backends that are embeddable in other event loops * [Ev::supportedBackends()](ev.supportedbackends) - Returns the set of backends supported by current libev configuration * [Backend flags](class.ev#ev.constants.watcher-backends) * [Examples](https://www.php.net/manual/en/ev.examples.php) php UConverter::getErrorCode UConverter::getErrorCode ======================== intl\_get\_error\_code ====================== (PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1) UConverter::getErrorCode -- intl\_get\_error\_code — Get last error code on the object ### Description ``` public UConverter::getErrorCode(): int ``` **Warning**This function is currently not documented; only its argument list is available. ### Parameters This function has no parameters. ### Return Values php The OuterIterator interface The OuterIterator interface =========================== Introduction ------------ (PHP 5 >= 5.1.0, PHP 7, PHP 8) Classes implementing **OuterIterator** can be used to iterate over iterators. Interface synopsis ------------------ interface **OuterIterator** extends [Iterator](class.iterator) { /\* Methods \*/ ``` public getInnerIterator(): ?Iterator ``` /\* Inherited methods \*/ ``` public Iterator::current(): mixed ``` ``` public Iterator::key(): mixed ``` ``` public Iterator::next(): void ``` ``` public Iterator::rewind(): void ``` ``` public Iterator::valid(): bool ``` } Table of Contents ----------------- * [OuterIterator::getInnerIterator](outeriterator.getinneriterator) — Returns the inner iterator for the current entry php ReflectionClass::isReadOnly ReflectionClass::isReadOnly =========================== (PHP 8 >= 8.2.0) ReflectionClass::isReadOnly — Checks if class is readonly ### Description ``` public ReflectionClass::isReadOnly(): bool ``` Checks if a class is [readonly](language.oop5.basic#language.oop5.basic.class.readonly). ### Parameters This function has no parameters. ### Return Values **`true`** if a class is readonly, **`false`** otherwise. ### Examples **Example #1 **ReflectionClass::isReadOnly()** example** ``` <?php class TestClass { } readonly class TestReadOnlyClass { } $normalClass = new ReflectionClass('TestClass'); $readonlyClass = new ReflectionClass('TestReadOnlyClass'); var_dump($normalClass->isReadOnly()); var_dump($readonlyClass->isReadOnly()); ?> ``` The above example will output: ``` bool(false) bool(true) ``` ### See Also * [ReflectionClass::isAbstract()](reflectionclass.isabstract) - Checks if class is abstract * [Readonly classes](language.oop5.basic#language.oop5.basic.class.readonly) php ZipArchive::setEncryptionName ZipArchive::setEncryptionName ============================= (PHP >= 7.2.0, PHP 8, PECL zip >= 1.14.0) ZipArchive::setEncryptionName — Set the encryption method of an entry defined by its name ### Description ``` public ZipArchive::setEncryptionName(string $name, int $method, ?string $password = null): bool ``` Set the encryption method of an entry defined by its name. ### Parameters `name` Name of the entry. `method` The encryption method defined by one of the ZipArchive::EM\_ constants. `password` Optional password, default used when missing. ### Return Values Returns **`true`** on success or **`false`** on failure. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | `password` is now nullable. | ### Examples This example creates a ZIP file archive test.zip and add the file test.txt encrypted using the AES 256 method. **Example #1 Archive and encrypt a file** ``` <?php $zip = new ZipArchive(); if ($zip->open('test.zip', ZipArchive::CREATE) === TRUE) {     $zip->setPassword('secret');     $zip->addFile('text.txt');     $zip->setEncryptionName('text.txt', ZipArchive::EM_AES_256);     $zip->close();     echo "Ok\n"; } else {     echo "KO\n"; } ?> ``` ### Notes > > **Note**: > > > This function is only available if built against libzip ≥ 1.2.0. > > ### See Also * [ZipArchive::setPassword()](ziparchive.setpassword) - Set the password for the active archive * [ZipArchive::setEncryptionIndex()](ziparchive.setencryptionindex) - Set the encryption method of an entry defined by its index php SplPriorityQueue::setExtractFlags SplPriorityQueue::setExtractFlags ================================= (PHP 5 >= 5.3.0, PHP 7, PHP 8) SplPriorityQueue::setExtractFlags — Sets the mode of extraction ### Description ``` public SplPriorityQueue::setExtractFlags(int $flags): int ``` ### Parameters `flags` Defines what is extracted by [SplPriorityQueue::current()](splpriorityqueue.current), [SplPriorityQueue::top()](splpriorityqueue.top) and [SplPriorityQueue::extract()](splpriorityqueue.extract). * **`SplPriorityQueue::EXTR_DATA`** (0x00000001): Extract the data * **`SplPriorityQueue::EXTR_PRIORITY`** (0x00000002): Extract the priority * **`SplPriorityQueue::EXTR_BOTH`** (0x00000003): Extract an array containing both The default mode is **`SplPriorityQueue::EXTR_DATA`**. ### Return Values Returns the flags of extraction. php WeakReference::create WeakReference::create ===================== (PHP 7 >= 7.4.0, PHP 8) WeakReference::create — Create a new weak reference ### Description ``` public static WeakReference::create(object $object): WeakReference ``` Creates a new [WeakReference](class.weakreference). ### Parameters `object` The object to be weakly referenced. ### Return Values Returns the freshly instantiated object. php Imagick::orderedPosterizeImage Imagick::orderedPosterizeImage ============================== (PECL imagick 2 >= 2.2.2, PECL imagick 3) Imagick::orderedPosterizeImage — Performs an ordered dither **Warning**This function has been *DEPRECATED* as of Imagick 3.4.4. Relying on this function is highly discouraged. ### Description ``` public Imagick::orderedPosterizeImage(string $threshold_map, int $channel = Imagick::CHANNEL_DEFAULT): bool ``` Performs an ordered dither based on a number of pre-defined dithering threshold maps, but over multiple intensity levels, which can be different for different channels, according to the input arguments. This method is available if Imagick has been compiled against ImageMagick version 6.3.1 or newer. ### Parameters `threshold_map` A string containing the name of the threshold dither map to use `channel` Provide any channel constant that is valid for your channel mode. To apply to more than one channel, combine channeltype constants using bitwise operators. Refer to this list of [channel constants](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.channel). ### Return Values Returns **`true`** on success. ### Errors/Exceptions Throws ImagickException on error. ### Examples **Example #1 **Imagick::orderedPosterizeImage()**** ``` <?php function orderedPosterizeImage($imagePath, $orderedPosterizeType) {     $imagick = new \Imagick(realpath($imagePath));             $imagick->orderedPosterizeImage($orderedPosterizeType);     $imagick->setImageFormat('png');          header("Content-Type: image/png");     echo $imagick->getImageBlob(); } //orderedPosterizeImage($imagePath, 'o4x4,3,3'); //orderedPosterizeImage($imagePath, 'o8x8,6,6'); orderedPosterizeImage($imagePath, 'h8x8a'); ?> ``` php XMLWriter::endDtdElement XMLWriter::endDtdElement ======================== xmlwriter\_end\_dtd\_element ============================ (PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL xmlwriter >= 0.1.0) XMLWriter::endDtdElement -- xmlwriter\_end\_dtd\_element — End current DTD element ### Description Object-oriented style ``` public XMLWriter::endDtdElement(): bool ``` Procedural style ``` xmlwriter_end_dtd_element(XMLWriter $writer): bool ``` Ends the current DTD element. ### Parameters `writer` Only for procedural calls. The [XMLWriter](class.xmlwriter) instance that is being modified. This object is returned from a call to [xmlwriter\_open\_uri()](xmlwriter.openuri) or [xmlwriter\_open\_memory()](xmlwriter.openmemory). ### Return Values Returns **`true`** on success or **`false`** on failure. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | `writer` expects an [XMLWriter](class.xmlwriter) instance now; previously, a resource was expected. | ### See Also * [XMLWriter::startDtdElement()](xmlwriter.startdtdelement) - Create start DTD element * [XMLWriter::writeDtdElement()](xmlwriter.writedtdelement) - Write full DTD element tag php Imagick::getImageTicksPerSecond Imagick::getImageTicksPerSecond =============================== (PECL imagick 2, PECL imagick 3) Imagick::getImageTicksPerSecond — Gets the image ticks-per-second ### Description ``` public Imagick::getImageTicksPerSecond(): int ``` Gets the image ticks-per-second. ### Parameters This function has no parameters. ### Return Values Returns the image ticks-per-second. ### Errors/Exceptions Throws ImagickException on error.
programming_docs
php Gmagick::despeckleimage Gmagick::despeckleimage ======================= (PECL gmagick >= Unknown) Gmagick::despeckleimage — The despeckleimage purpose ### Description ``` public Gmagick::despeckleimage(): Gmagick ``` Reduces the speckle noise in an image while preserving the edges of the original image. ### Parameters This function has no parameters. ### Return Values The despeckled [Gmagick](class.gmagick) object. ### Errors/Exceptions Throws an **GmagickException** on error. ### Examples **Example #1 **Gmagick::despeckleimage()** example** ``` <?php /* ... */ ?> ``` The above example will output something similar to: ``` ... ``` php imagecreate imagecreate =========== (PHP 4, PHP 5, PHP 7, PHP 8) imagecreate — Create a new palette based image ### Description ``` imagecreate(int $width, int $height): GdImage|false ``` **imagecreate()** returns an image identifier representing a blank image of specified size. In general, we recommend the use of [imagecreatetruecolor()](function.imagecreatetruecolor) instead of **imagecreate()** so that image processing occurs on the highest quality image possible. If you want to output a palette image, then [imagetruecolortopalette()](function.imagetruecolortopalette) should be called immediately before saving the image with [imagepng()](function.imagepng) or [imagegif()](function.imagegif). ### Parameters `width` The image width. `height` The image height. ### Return Values Returns an image object on success, **`false`** on errors. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | On success, this function returns a [GDImage](class.gdimage) instance now; previously, a resource was returned. | ### Examples **Example #1 Creating a new GD image stream and outputting an image.** ``` <?php header("Content-Type: image/png"); $im = @imagecreate(110, 20)     or die("Cannot Initialize new GD image stream"); $background_color = imagecolorallocate($im, 0, 0, 0); $text_color = imagecolorallocate($im, 233, 14, 91); imagestring($im, 1, 5, 5,  "A Simple Text String", $text_color); imagepng($im); imagedestroy($im); ?> ``` The above example will output something similar to: ### See Also * [imagedestroy()](function.imagedestroy) - Destroy an image * [imagecreatetruecolor()](function.imagecreatetruecolor) - Create a new true color image php eio_symlink eio\_symlink ============ (PECL eio >= 0.0.1dev) eio\_symlink — Create a symbolic link ### Description ``` eio_symlink( string $path, string $new_path, int $pri = EIO_PRI_DEFAULT, callable $callback = NULL, mixed $data = NULL ): resource ``` **eio\_symlink()** creates a symbolic link `new_path` to `path`. ### Parameters `path` Source path `new_path` Target path `pri` The request priority: **`EIO_PRI_DEFAULT`**, **`EIO_PRI_MIN`**, **`EIO_PRI_MAX`**, or **`null`**. If **`null`** passed, `pri` internally is set to **`EIO_PRI_DEFAULT`**. `callback` `callback` function is called when the request is done. It should match the following prototype: ``` void callback(mixed $data, int $result[, resource $req]); ``` `data` is custom data passed to the request. `result` request-specific result value; basically, the value returned by corresponding system call. `req` is optional request resource which can be used with functions like [eio\_get\_last\_error()](function.eio-get-last-error) `data` Arbitrary variable passed to `callback`. ### Return Values **eio\_symlink()** returns request resource on success, or **`false`** on failure. ### Examples **Example #1 **eio\_symlink()** example** ``` <?php $filename = dirname(__FILE__)."/symlink.dat"; touch($filename); $link = dirname(__FILE__)."/symlink.link"; function my_symlink_cb($data, $result) {     global $link, $filename;     var_dump(file_exists($data) && is_link($data));     if (!eio_readlink($data, EIO_PRI_DEFAULT, "my_readlink_cb", NULL)) {         @unlink($link);         @unlink($filename);     } } function my_readlink_cb($data, $result) {     global $filename, $link;     var_dump($result);     @unlink($link);     @unlink($filename); } eio_symlink($filename, $link, EIO_PRI_DEFAULT, "my_symlink_cb", $link); eio_event_loop(); ?> ``` The above example will output something similar to: ``` bool(true) string(16) "/tmp/symlink.dat" ``` ### See Also * [eio\_link()](function.eio-link) - Create a hardlink for file php DOMElement::getAttribute DOMElement::getAttribute ======================== (PHP 5, PHP 7, PHP 8) DOMElement::getAttribute — Returns value of attribute ### Description ``` public DOMElement::getAttribute(string $qualifiedName): string ``` Gets the value of the attribute with name `qualifiedName` for the current node. ### Parameters `qualifiedName` The name of the attribute. ### Return Values The value of the attribute, or an empty string if no attribute with the given `qualifiedName` is found. ### See Also * [DOMElement::hasAttribute()](domelement.hasattribute) - Checks to see if attribute exists * [DOMElement::setAttribute()](domelement.setattribute) - Adds new or modifies existing attribute * [DOMElement::removeAttribute()](domelement.removeattribute) - Removes attribute php Memcached::getDelayedByKey Memcached::getDelayedByKey ========================== (PECL memcached >= 0.1.0) Memcached::getDelayedByKey — Request multiple items from a specific server ### Description ``` public Memcached::getDelayedByKey( string $server_key, array $keys, bool $with_cas = ?, callable $value_cb = ? ): bool ``` **Memcached::getDelayedByKey()** is functionally equivalent to [Memcached::getDelayed()](memcached.getdelayed), except that the free-form `server_key` can be used to map the `keys` to a specific server. ### Parameters `server_key` The key identifying the server to store the value on or retrieve it from. Instead of hashing on the actual key for the item, we hash on the server key when deciding which memcached server to talk to. This allows related items to be grouped together on a single server for efficiency with multi operations. `keys` Array of keys to request. `with_cas` Whether to request CAS token values also. `value_cb` The result callback or **`null`**. ### Return Values Returns **`true`** on success or **`false`** on failure. Use [Memcached::getResultCode()](memcached.getresultcode) if necessary. ### See Also * [Memcached::getDelayed()](memcached.getdelayed) - Request multiple items * [Memcached::fetch()](memcached.fetch) - Fetch the next result * [Memcached::fetchAll()](memcached.fetchall) - Fetch all the remaining results php Thread::getCurrentThreadId Thread::getCurrentThreadId ========================== (PECL pthreads >= 2.0.0) Thread::getCurrentThreadId — Identification ### Description ``` public static Thread::getCurrentThreadId(): int ``` Will return the identity of the currently executing Thread ### Parameters This function has no parameters. ### Return Values A numeric identity ### Examples **Example #1 Return the identity of the currently executing Thread** ``` <?php class My extends Thread {     public function run() {         printf("%s is Thread #%lu\n", __CLASS__, Thread::getCurrentThreadId());     } } $my = new My(); $my->start(); ?> ``` The above example will output: ``` My is Thread #123456778899 ``` php GearmanClient::returnCode GearmanClient::returnCode ========================= (PECL gearman >= 0.5.0) GearmanClient::returnCode — Get the last Gearman return code ### Description ``` public GearmanClient::returnCode(): int ``` Returns the last Gearman return code. ### Parameters This function has no parameters. ### Return Values A valid Gearman return code. php SolrInputDocument::setBoost SolrInputDocument::setBoost =========================== (PECL solr >= 0.9.2) SolrInputDocument::setBoost — Sets the boost value for this document ### Description ``` public SolrInputDocument::setBoost(float $documentBoostValue): bool ``` Sets the boost value for this document. ### Parameters `documentBoostValue` The index-time boost value for this document. ### Return Values Returns **`true`** on success or **`false`** on failure. php Imagick::identifyFormat Imagick::identifyFormat ======================= (PECL imagick 3 >= 3.3.0) Imagick::identifyFormat — Description ### Description ``` public Imagick::identifyFormat(string $embedText): string|false ``` Replaces any embedded formatting characters with the appropriate image property and returns the interpreted text. See http://www.imagemagick.org/script/escape.php for escape sequences. ### Parameters `embedText` A string containing formatting sequences e.g. "Trim box: %@ number of unique colors: %k". ### Return Values Returns format or **`false`** on failure. ### Examples **Example #1 **Imagick::identifyFormat()**** ``` <?php         $output = "Output of 'Trim box: %@ number of unique colors: %k' is: <br/>";         $imagick = new \Imagick(realpath("./images/artifact/mask.png"));         $output .= $imagick->identifyFormat("Trim box: %@ number of unique colors: %k"); ?> ``` php enchant_broker_set_dict_path enchant\_broker\_set\_dict\_path ================================ (PHP 5 >= 5.3.1, PHP 7, PHP 8, PECL enchant >= 1.0.1) enchant\_broker\_set\_dict\_path — Set the directory path for a given backend **Warning**This function has been *DEPRECATED* as of PHP 8.0.0. Relying on this function is highly discouraged. ### Description ``` enchant_broker_set_dict_path(EnchantBroker $broker, int $type, string $path): bool ``` Set the directory path for a given backend. ### Parameters `broker` An Enchant broker returned by [enchant\_broker\_init()](function.enchant-broker-init). `type` The type of the dictionaries, i.e. **`ENCHANT_MYSPELL`** or **`ENCHANT_ISPELL`**. `path` The path of the dictionary directory. ### Return Values Returns **`true`** on success or **`false`** on failure. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | `broker` expects an [EnchantBroker](class.enchantbroker) instance now; previoulsy, a [resource](language.types.resource) was expected. | ### Notes > > **Note**: > > > This function is only available if the extension has been compiled with Enchant v1. > > ### See Also * [enchant\_broker\_get\_dict\_path()](function.enchant-broker-get-dict-path) - Get the directory path for a given backend php socket_addrinfo_connect socket\_addrinfo\_connect ========================= (PHP 7 >= 7.2.0, PHP 8) socket\_addrinfo\_connect — Create and connect to a socket from a given addrinfo ### Description ``` socket_addrinfo_connect(AddressInfo $address): Socket|false ``` Create a [Socket](class.socket) instance, and connect it to the provided [AddressInfo](class.addressinfo) instance. The return value of this function may be used with the rest of the socket functions. ### Parameters `address` [AddressInfo](class.addressinfo) instance created from [socket\_addrinfo\_lookup()](function.socket-addrinfo-lookup) ### Return Values Returns a [Socket](class.socket) instance on success or **`false`** on failure. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | On success, this function returns a [Socket](class.socket) instance now; previously, a resource was returned. | | 8.0.0 | `address` is an [AddressInfo](class.addressinfo) instance now; previously, it was a resource. | ### See Also * [socket\_addrinfo\_bind()](function.socket-addrinfo-bind) - Create and bind to a socket from a given addrinfo * [socket\_addrinfo\_explain()](function.socket-addrinfo-explain) - Get information about addrinfo * [socket\_addrinfo\_lookup()](function.socket-addrinfo-lookup) - Get array with contents of getaddrinfo about the given hostname php The ZipArchive class The ZipArchive class ==================== Introduction ------------ (PHP 5 >= 5.2.0, PHP 7, PHP 8, PECL zip >= 1.1.0) A file archive, compressed with Zip. Class synopsis -------------- class **ZipArchive** implements [Countable](class.countable) { /\* Properties \*/ public readonly int [$lastId](class.ziparchive#ziparchive.props.lastid); public readonly int [$status](class.ziparchive#ziparchive.props.status); public readonly int [$statusSys](class.ziparchive#ziparchive.props.statussys); public readonly int [$numFiles](class.ziparchive#ziparchive.props.numfiles); public readonly string [$filename](class.ziparchive#ziparchive.props.filename); public readonly string [$comment](class.ziparchive#ziparchive.props.comment); /\* Methods \*/ public [\_\_construct](ziparchive.construct)() ``` public addEmptyDir(string $dirname, int $flags = 0): bool ``` ``` public addFile( string $filepath, string $entryname = "", int $start = 0, int $length = 0, int $flags = ZipArchive::FL_OVERWRITE ): bool ``` ``` public addFromString(string $name, string $content, int $flags = ZipArchive::FL_OVERWRITE): bool ``` ``` public addGlob(string $pattern, int $flags = 0, array $options = []): array|false ``` ``` public addPattern(string $pattern, string $path = ".", array $options = []): array|false ``` ``` public clearError(): void ``` ``` public close(): bool ``` ``` public count(): int ``` ``` public deleteIndex(int $index): bool ``` ``` public deleteName(string $name): bool ``` ``` public extractTo(string $pathto, array|string|null $files = null): bool ``` ``` public getArchiveComment(int $flags = 0): string|false ``` ``` public getCommentIndex(int $index, int $flags = 0): string|false ``` ``` public getCommentName(string $name, int $flags = 0): string|false ``` ``` public getExternalAttributesIndex( int $index, int &$opsys, int &$attr, int $flags = 0 ): bool ``` ``` public getExternalAttributesName( string $name, int &$opsys, int &$attr, int $flags = 0 ): bool ``` ``` public getFromIndex(int $index, int $len = 0, int $flags = 0): string|false ``` ``` public getFromName(string $name, int $len = 0, int $flags = 0): string|false ``` ``` public getNameIndex(int $index, int $flags = 0): string|false ``` ``` public getStatusString(): string ``` ``` public getStream(string $name): resource|false ``` ``` public getStreamIndex(int $index, int $flags = 0): resource|false ``` ``` public getStreamName(string $name, int $flags = 0): resource|false ``` ``` public static isCompressionMethodSupported(int $method, bool $enc = true): bool ``` ``` public static isEncryptionMethodSupported(int $method, bool $enc = true): bool ``` ``` public locateName(string $name, int $flags = 0): int|false ``` ``` public open(string $filename, int $flags = 0): bool|int ``` ``` public registerCancelCallback(callable $callback): bool ``` ``` public registerProgressCallback(float $rate, callable $callback): bool ``` ``` public renameIndex(int $index, string $new_name): bool ``` ``` public renameName(string $name, string $new_name): bool ``` ``` public replaceFile( string $filepath, int $index, int $start = 0, int $length = 0, int $flags = 0 ): bool ``` ``` public setArchiveComment(string $comment): bool ``` ``` public setCommentIndex(int $index, string $comment): bool ``` ``` public setCommentName(string $name, string $comment): bool ``` ``` public setCompressionIndex(int $index, int $method, int $compflags = 0): bool ``` ``` public setCompressionName(string $name, int $method, int $compflags = 0): bool ``` ``` public setEncryptionIndex(int $index, int $method, ?string $password = null): bool ``` ``` public setEncryptionName(string $name, int $method, ?string $password = null): bool ``` ``` public setExternalAttributesIndex( int $index, int $opsys, int $attr, int $flags = 0 ): bool ``` ``` public setExternalAttributesName( string $name, int $opsys, int $attr, int $flags = 0 ): bool ``` ``` public setMtimeIndex(int $index, int $timestamp, int $flags = 0): bool ``` ``` public setMtimeName(string $name, int $timestamp, int $flags = 0): bool ``` ``` public setPassword(string $password): bool ``` ``` public statIndex(int $index, int $flags = 0): array|false ``` ``` public statName(string $name, int $flags = 0): array|false ``` ``` public unchangeAll(): bool ``` ``` public unchangeArchive(): bool ``` ``` public unchangeIndex(int $index): bool ``` ``` public unchangeName(string $name): bool ``` } Properties ---------- lastId Index value of last added entry (file or directory). Available as of PHP 8.0.0 and PECL zip 1.18.0. status Status of the Zip Archive. Available for closed archive, as of PHP 8.0.0 and PECL zip 1.18.0. statusSys System status of the Zip Archive. Available for closed archive, as of PHP 8.0.0 and PECL zip 1.18.0. numFiles Number of files in archive filename File name in the file system comment Comment for the archive Table of Contents ----------------- * [ZipArchive::addEmptyDir](ziparchive.addemptydir) — Add a new directory * [ZipArchive::addFile](ziparchive.addfile) — Adds a file to a ZIP archive from the given path * [ZipArchive::addFromString](ziparchive.addfromstring) — Add a file to a ZIP archive using its contents * [ZipArchive::addGlob](ziparchive.addglob) — Add files from a directory by glob pattern * [ZipArchive::addPattern](ziparchive.addpattern) — Add files from a directory by PCRE pattern * [ZipArchive::clearError](ziparchive.clearerror) — Clear the status error message, system and/or zip messages * [ZipArchive::close](ziparchive.close) — Close the active archive (opened or newly created) * [ZipArchive::\_\_construct](ziparchive.construct) — Construct a new ZipArchive instance * [ZipArchive::count](ziparchive.count) — Counts the number of files in the archive * [ZipArchive::deleteIndex](ziparchive.deleteindex) — Delete an entry in the archive using its index * [ZipArchive::deleteName](ziparchive.deletename) — Delete an entry in the archive using its name * [ZipArchive::extractTo](ziparchive.extractto) — Extract the archive contents * [ZipArchive::getArchiveComment](ziparchive.getarchivecomment) — Returns the Zip archive comment * [ZipArchive::getCommentIndex](ziparchive.getcommentindex) — Returns the comment of an entry using the entry index * [ZipArchive::getCommentName](ziparchive.getcommentname) — Returns the comment of an entry using the entry name * [ZipArchive::getExternalAttributesIndex](ziparchive.getexternalattributesindex) — Retrieve the external attributes of an entry defined by its index * [ZipArchive::getExternalAttributesName](ziparchive.getexternalattributesname) — Retrieve the external attributes of an entry defined by its name * [ZipArchive::getFromIndex](ziparchive.getfromindex) — Returns the entry contents using its index * [ZipArchive::getFromName](ziparchive.getfromname) — Returns the entry contents using its name * [ZipArchive::getNameIndex](ziparchive.getnameindex) — Returns the name of an entry using its index * [ZipArchive::getStatusString](ziparchive.getstatusstring) — Returns the status error message, system and/or zip messages * [ZipArchive::getStream](ziparchive.getstream) — Get a file handler to the entry defined by its name (read only) * [ZipArchive::getStreamIndex](ziparchive.getstreamindex) — Get a file handler to the entry defined by its index (read only) * [ZipArchive::getStreamName](ziparchive.getstreamname) — Get a file handler to the entry defined by its name (read only) * [ZipArchive::isCompressionMethodSupported](ziparchive.iscompressionmethoddupported) — Check if a compression method is supported by libzip * [ZipArchive::isEncryptionMethodSupported](ziparchive.isencryptionmethoddupported) — Check if a encryption method is supported by libzip * [ZipArchive::locateName](ziparchive.locatename) — Returns the index of the entry in the archive * [ZipArchive::open](ziparchive.open) — Open a ZIP file archive * [ZipArchive::registerCancelCallback](ziparchive.registercancelcallback) — Register a callback to allow cancellation during archive close. * [ZipArchive::registerProgressCallback](ziparchive.registerprogresscallback) — Register a callback to provide updates during archive close. * [ZipArchive::renameIndex](ziparchive.renameindex) — Renames an entry defined by its index * [ZipArchive::renameName](ziparchive.renamename) — Renames an entry defined by its name * [ZipArchive::replaceFile](ziparchive.replacefile) — Replace file in ZIP archive with a given path * [ZipArchive::setArchiveComment](ziparchive.setarchivecomment) — Set the comment of a ZIP archive * [ZipArchive::setCommentIndex](ziparchive.setcommentindex) — Set the comment of an entry defined by its index * [ZipArchive::setCommentName](ziparchive.setcommentname) — Set the comment of an entry defined by its name * [ZipArchive::setCompressionIndex](ziparchive.setcompressionindex) — Set the compression method of an entry defined by its index * [ZipArchive::setCompressionName](ziparchive.setcompressionname) — Set the compression method of an entry defined by its name * [ZipArchive::setEncryptionIndex](ziparchive.setencryptionindex) — Set the encryption method of an entry defined by its index * [ZipArchive::setEncryptionName](ziparchive.setencryptionname) — Set the encryption method of an entry defined by its name * [ZipArchive::setExternalAttributesIndex](ziparchive.setexternalattributesindex) — Set the external attributes of an entry defined by its index * [ZipArchive::setExternalAttributesName](ziparchive.setexternalattributesname) — Set the external attributes of an entry defined by its name * [ZipArchive::setMtimeIndex](ziparchive.setmtimeindex) — Set the modification time of an entry defined by its index * [ZipArchive::setMtimeName](ziparchive.setmtimename) — Set the modification time of an entry defined by its name * [ZipArchive::setPassword](ziparchive.setpassword) — Set the password for the active archive * [ZipArchive::statIndex](ziparchive.statindex) — Get the details of an entry defined by its index * [ZipArchive::statName](ziparchive.statname) — Get the details of an entry defined by its name * [ZipArchive::unchangeAll](ziparchive.unchangeall) — Undo all changes done in the archive * [ZipArchive::unchangeArchive](ziparchive.unchangearchive) — Revert all global changes done in the archive * [ZipArchive::unchangeIndex](ziparchive.unchangeindex) — Revert all changes done to an entry at the given index * [ZipArchive::unchangeName](ziparchive.unchangename) — Revert all changes done to an entry with the given name
programming_docs
php Ds\Vector::merge Ds\Vector::merge ================ (PECL ds >= 1.0.0) Ds\Vector::merge — Returns the result of adding all given values to the vector ### Description ``` public Ds\Vector::merge(mixed $values): Ds\Vector ``` Returns the result of adding all given values to the vector. ### Parameters `values` A [traversable](class.traversable) object or an array. ### Return Values The result of adding all given values to the vector, effectively the same as adding the values to a copy, then returning that copy. > > **Note**: > > > The current instance won't be affected. > > ### Examples **Example #1 **Ds\Vector::merge()** example** ``` <?php $vector = new \Ds\Vector([1, 2, 3]); var_dump($vector->merge([4, 5, 6])); var_dump($vector); ?> ``` The above example will output something similar to: ``` object(Ds\Vector)#2 (6) { [0]=> int(1) [1]=> int(2) [2]=> int(3) [3]=> int(4) [4]=> int(5) [5]=> int(6) } object(Ds\Vector)#1 (3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) } ``` php The Vector class The Vector class ================ Introduction ------------ (No version information available, might only be in Git) A Vector is a sequence of values in a contiguous buffer that grows and shrinks automatically. It’s the most efficient sequential structure because a value’s index is a direct mapping to its index in the buffer, and the growth factor isn't bound to a specific multiple or exponent. Strengths --------- * Supports array syntax (square brackets). * Uses less overall memory than an array for the same number of values. * Automatically frees allocated memory when its size drops low enough. * Capacity does not have to be a power of 2. * **get()**, **set()**, **push()**, **pop()** are all O(1). Weaknesses ---------- * **shift()**, **unshift()**, **insert()** and **remove()** are all O(n). Class synopsis -------------- class **Ds\Vector** implements **Ds\Sequence**, [ArrayAccess](class.arrayaccess) { /\* Constants \*/ const int [MIN\_CAPACITY](class.ds-vector#ds-vector.constants.min-capacity) = 10; /\* Methods \*/ ``` public allocate(int $capacity): void ``` ``` public apply(callable $callback): void ``` ``` public capacity(): int ``` ``` public clear(): void ``` ``` public contains(mixed ...$values): bool ``` ``` public copy(): Ds\Vector ``` ``` public filter(callable $callback = ?): Ds\Vector ``` ``` public find(mixed $value): mixed ``` ``` public first(): mixed ``` ``` public get(int $index): mixed ``` ``` public insert(int $index, mixed ...$values): void ``` ``` public isEmpty(): bool ``` ``` public join(string $glue = ?): string ``` ``` public last(): mixed ``` ``` public map(callable $callback): Ds\Vector ``` ``` public merge(mixed $values): Ds\Vector ``` ``` public pop(): mixed ``` ``` public push(mixed ...$values): void ``` ``` public reduce(callable $callback, mixed $initial = ?): mixed ``` ``` public remove(int $index): mixed ``` ``` public reverse(): void ``` ``` public reversed(): Ds\Vector ``` ``` public rotate(int $rotations): void ``` ``` public set(int $index, mixed $value): void ``` ``` public shift(): mixed ``` ``` public slice(int $index, int $length = ?): Ds\Vector ``` ``` public sort(callable $comparator = ?): void ``` ``` public sorted(callable $comparator = ?): Ds\Vector ``` ``` public sum(): int|float ``` ``` public toArray(): array ``` ``` public unshift(mixed $values = ?): void ``` } Predefined Constants -------------------- **`Ds\Vector::MIN_CAPACITY`** Changelog --------- | Version | Description | | --- | --- | | PECL ds 1.3.0 | The class now implements [ArrayAccess](class.arrayaccess). | Table of Contents ----------------- * [Ds\Vector::allocate](ds-vector.allocate) — Allocates enough memory for a required capacity * [Ds\Vector::apply](ds-vector.apply) — Updates all values by applying a callback function to each value * [Ds\Vector::capacity](ds-vector.capacity) — Returns the current capacity * [Ds\Vector::clear](ds-vector.clear) — Removes all values * [Ds\Vector::\_\_construct](ds-vector.construct) — Creates a new instance * [Ds\Vector::contains](ds-vector.contains) — Determines if the vector contains given values * [Ds\Vector::copy](ds-vector.copy) — Returns a shallow copy of the vector * [Ds\Vector::count](ds-vector.count) — Returns the number of values in the collection * [Ds\Vector::filter](ds-vector.filter) — Creates a new vector using a callable to determine which values to include * [Ds\Vector::find](ds-vector.find) — Attempts to find a value's index * [Ds\Vector::first](ds-vector.first) — Returns the first value in the vector * [Ds\Vector::get](ds-vector.get) — Returns the value at a given index * [Ds\Vector::insert](ds-vector.insert) — Inserts values at a given index * [Ds\Vector::isEmpty](ds-vector.isempty) — Returns whether the vector is empty * [Ds\Vector::join](ds-vector.join) — Joins all values together as a string * [Ds\Vector::jsonSerialize](ds-vector.jsonserialize) — Returns a representation that can be converted to JSON * [Ds\Vector::last](ds-vector.last) — Returns the last value * [Ds\Vector::map](ds-vector.map) — Returns the result of applying a callback to each value * [Ds\Vector::merge](ds-vector.merge) — Returns the result of adding all given values to the vector * [Ds\Vector::pop](ds-vector.pop) — Removes and returns the last value * [Ds\Vector::push](ds-vector.push) — Adds values to the end of the vector * [Ds\Vector::reduce](ds-vector.reduce) — Reduces the vector to a single value using a callback function * [Ds\Vector::remove](ds-vector.remove) — Removes and returns a value by index * [Ds\Vector::reverse](ds-vector.reverse) — Reverses the vector in-place * [Ds\Vector::reversed](ds-vector.reversed) — Returns a reversed copy * [Ds\Vector::rotate](ds-vector.rotate) — Rotates the vector by a given number of rotations * [Ds\Vector::set](ds-vector.set) — Updates a value at a given index * [Ds\Vector::shift](ds-vector.shift) — Removes and returns the first value * [Ds\Vector::slice](ds-vector.slice) — Returns a sub-vector of a given range * [Ds\Vector::sort](ds-vector.sort) — Sorts the vector in-place * [Ds\Vector::sorted](ds-vector.sorted) — Returns a sorted copy * [Ds\Vector::sum](ds-vector.sum) — Returns the sum of all values in the vector * [Ds\Vector::toArray](ds-vector.toarray) — Converts the vector to an array * [Ds\Vector::unshift](ds-vector.unshift) — Adds values to the front of the vector php gmp_sqrtrem gmp\_sqrtrem ============ (PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8) gmp\_sqrtrem — Square root with remainder ### Description ``` gmp_sqrtrem(GMP|int|string $num): array ``` Calculate the square root of a number, with remainder. ### Parameters `num` The number being square rooted. A [GMP](class.gmp) object, an int or a numeric string. ### Return Values Returns array where first element is the integer square root of `num` and the second is the remainder (i.e., the difference between `num` and the first element squared). ### Examples **Example #1 **gmp\_sqrtrem()** example** ``` <?php list($sqrt1, $sqrt1rem) = gmp_sqrtrem("9"); list($sqrt2, $sqrt2rem) = gmp_sqrtrem("7"); list($sqrt3, $sqrt3rem) = gmp_sqrtrem("1048576"); echo gmp_strval($sqrt1) . ", " . gmp_strval($sqrt1rem) . "\n"; echo gmp_strval($sqrt2) . ", " . gmp_strval($sqrt2rem) . "\n"; echo gmp_strval($sqrt3) . ", " . gmp_strval($sqrt3rem) . "\n"; ?> ``` The above example will output: ``` 3, 0 2, 3 1024, 0 ``` php XMLReader::readOuterXml XMLReader::readOuterXml ======================= (PHP 5 >= 5.2.0, PHP 7, PHP 8) XMLReader::readOuterXml — Retrieve XML from current node, including itself ### Description ``` public XMLReader::readOuterXml(): string ``` Reads the contents of the current node, including the node itself. ### Parameters This function has no parameters. ### Return Values Returns the contents of current node, including itself, as a string. Empty string on failure. ### Notes **Caution**This function is only available when PHP is compiled against libxml 20620 or later. ### See Also * [XMLReader::readString()](xmlreader.readstring) - Reads the contents of the current node as a string * [XMLReader::readInnerXml()](xmlreader.readinnerxml) - Retrieve XML from current node * [XMLReader::expand()](xmlreader.expand) - Returns a copy of the current node as a DOM object php Gmagick::getimagedispose Gmagick::getimagedispose ======================== (PECL gmagick >= Unknown) Gmagick::getimagedispose — Gets the image disposal method ### Description ``` public Gmagick::getimagedispose(): int ``` Gets the image disposal method ### Parameters This function has no parameters. ### Return Values Returns the dispose method on success. ### Errors/Exceptions Throws an **GmagickException** on error. php GearmanJob::handle GearmanJob::handle ================== (PECL gearman >= 0.5.0) GearmanJob::handle — Get the job handle ### Description ``` public GearmanJob::handle(): string ``` Returns the opaque job handle assigned by the job server. ### Parameters This function has no parameters. ### Return Values An opaque job handle. ### See Also * [GearmanTask::jobHandle()](gearmantask.jobhandle) - Get the job handle php sodium_crypto_kx_seed_keypair sodium\_crypto\_kx\_seed\_keypair ================================= (PHP 7 >= 7.2.0, PHP 8) sodium\_crypto\_kx\_seed\_keypair — Description ### Description ``` sodium_crypto_kx_seed_keypair(string $seed): string ``` **Warning**This function is currently not documented; only its argument list is available. ### Parameters `seed` ### Return Values php RecursiveIteratorIterator::__construct RecursiveIteratorIterator::\_\_construct ======================================== (PHP 5 >= 5.1.3, PHP 7, PHP 8) RecursiveIteratorIterator::\_\_construct — Construct a RecursiveIteratorIterator ### Description public **RecursiveIteratorIterator::\_\_construct**([Traversable](class.traversable) `$iterator`, int `$mode` = RecursiveIteratorIterator::LEAVES\_ONLY, int `$flags` = 0) Creates a [RecursiveIteratorIterator](class.recursiveiteratoriterator) from a [RecursiveIterator](class.recursiveiterator). ### Parameters `iterator` The iterator being constructed from. Either a [RecursiveIterator](class.recursiveiterator) or [IteratorAggregate](class.iteratoraggregate). `mode` Optional mode. Possible values are * **`RecursiveIteratorIterator::LEAVES_ONLY`** - The default. Lists only leaves in iteration. * **`RecursiveIteratorIterator::SELF_FIRST`** - Lists leaves and parents in iteration with parents coming first. * **`RecursiveIteratorIterator::CHILD_FIRST`** - Lists leaves and parents in iteration with leaves coming first. `flags` Optional flag. Possible values are **`RecursiveIteratorIterator::CATCH_GET_CHILD`** which will then ignore exceptions thrown in calls to **RecursiveIteratorIterator::getChildren()**. ### Examples **Example #1 Iterating a RecursiveIteratorIterator** ``` <?php $array = array(     array(         array(             array(                 'leaf-0-0-0-0',                 'leaf-0-0-0-1'             ),             'leaf-0-0-0'         ),         array(             array(                 'leaf-0-1-0-0',                 'leaf-0-1-0-1'             ),             'leaf-0-1-0'         ),         'leaf-0-0'     ) ); $iterator = new RecursiveIteratorIterator(     new RecursiveArrayIterator($array),     $mode ); foreach ($iterator as $key => $leaf) {     echo "$key => $leaf", PHP_EOL; } ?> ``` Output with `$mode = RecursiveIteratorIterator::LEAVES_ONLY` ``` 0 => leaf-0-0-0-0 1 => leaf-0-0-0-1 0 => leaf-0-0-0 0 => leaf-0-1-0-0 1 => leaf-0-1-0-1 0 => leaf-0-1-0 0 => leaf-0-0 ``` Output with `$mode = RecursiveIteratorIterator::SELF_FIRST` ``` 0 => Array 0 => Array 0 => Array 0 => leaf-0-0-0-0 1 => leaf-0-0-0-1 1 => leaf-0-0-0 1 => Array 0 => Array 0 => leaf-0-1-0-0 1 => leaf-0-1-0-1 1 => leaf-0-1-0 2 => leaf-0-0 ``` Output with `$mode = RecursiveIteratorIterator::CHILD_FIRST` ``` 0 => leaf-0-0-0-0 1 => leaf-0-0-0-1 0 => Array 1 => leaf-0-0-0 0 => Array 0 => leaf-0-1-0-0 1 => leaf-0-1-0-1 0 => Array 1 => leaf-0-1-0 1 => Array 2 => leaf-0-0 0 => Array ``` php ReflectionClass::getExtension ReflectionClass::getExtension ============================= (PHP 5, PHP 7, PHP 8) ReflectionClass::getExtension — Gets a [ReflectionExtension](class.reflectionextension) object for the extension which defined the class ### Description ``` public ReflectionClass::getExtension(): ?ReflectionExtension ``` Gets a [ReflectionExtension](class.reflectionextension) object for the extension which defined the class. ### Parameters This function has no parameters. ### Return Values A [ReflectionExtension](class.reflectionextension) object representing the extension which defined the class, or **`null`** for user-defined classes. ### Examples **Example #1 Basic usage of **ReflectionClass::getExtension()**** ``` <?php $class = new ReflectionClass('ReflectionClass'); $extension = $class->getExtension(); var_dump($extension); ?> ``` The above example will output: ``` object(ReflectionExtension)#2 (1) { ["name"]=> string(10) "Reflection" } ``` ### See Also * [ReflectionClass::getExtensionName()](reflectionclass.getextensionname) - Gets the name of the extension which defined the class php Collator::getErrorMessage Collator::getErrorMessage ========================= collator\_get\_error\_message ============================= (PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0) Collator::getErrorMessage -- collator\_get\_error\_message — Get text for collator's last error code ### Description Object-oriented style ``` public Collator::getErrorMessage(): string|false ``` Procedural style ``` collator_get_error_message(Collator $object): string|false ``` Retrieves the message for the last error. ### Parameters `object` [Collator](class.collator) object. ### Return Values Description of an error occurred in the last Collator API function call, or **`false`** on failure. ### Examples **Example #1 **collator\_get\_error\_message()** example** ``` <?php $coll = collator_create( 'lt' ); if( collator_compare( $coll, 'y', 'k' ) === false ) {     echo collator_get_error_message( $coll ); } ?> ``` ### See Also * [collator\_get\_error\_code()](collator.geterrorcode) - Get collator's last error code php Perl Differences Perl Differences ================ The differences described here are with respect to Perl 5.005. 1. By default, a whitespace character is any character that the C library function isspace() recognizes, though it is possible to compile PCRE with alternative character type tables. Normally isspace() matches space, formfeed, newline, carriage return, horizontal tab, and vertical tab. Perl 5 no longer includes vertical tab in its set of whitespace characters. The \v escape that was in the Perl documentation for a long time was never in fact recognized. However, the character itself was treated as whitespace at least up to 5.002. In 5.004 and 5.005 it does not match \s. 2. PCRE does not allow repeat quantifiers on lookahead assertions. Perl permits them, but they do not mean what you might think. For example, (?!a){3} does not assert that the next three characters are not "a". It just asserts that the next character is not "a" three times. 3. Capturing subpatterns that occur inside negative lookahead assertions are counted, but their entries in the offsets vector are never set. Perl sets its numerical variables from any such patterns that are matched before the assertion fails to match something (thereby succeeding), but only if the negative lookahead assertion contains just one branch. 4. Though binary zero characters are supported in the subject string, they are not allowed in a pattern string because it is passed as a normal C string, terminated by zero. The escape sequence "\x00" can be used in the pattern to represent a binary zero. 5. The following Perl escape sequences are not supported: \l, \u, \L, \U. In fact these are implemented by Perl's general string-handling and are not part of its pattern matching engine. 6. The Perl \G assertion is not supported as it is not relevant to single pattern matches. 7. Fairly obviously, PCRE does not support the (?{code}) and (??{code}) construction. However, there is support for recursive patterns. 8. There are at the time of writing some oddities in Perl 5.005\_02 concerned with the settings of captured strings when part of a pattern is repeated. For example, matching "aba" against the pattern /^(a(b)?)+$/ sets $2 to the value "b", but matching "aabbaa" against /^(aa(bb)?)+$/ leaves $2 unset. However, if the pattern is changed to /^(aa(b(b))?)+$/ then $2 (and $3) get set. In Perl 5.004 $2 is set in both cases, and that is also **`true`** of PCRE. If in the future Perl changes to a consistent state that is different, PCRE may change to follow. 9. Another as yet unresolved discrepancy is that in Perl 5.005\_02 the pattern /^(a)?(?(1)a|b)+$/ matches the string "a", whereas in PCRE it does not. However, in both Perl and PCRE /^(a)?a/ matched against "a" leaves $1 unset. 10. PCRE provides some extensions to the Perl regular expression facilities: 1. Although lookbehind assertions must match fixed length strings, each alternative branch of a lookbehind assertion can match a different length of string. Perl 5.005 requires them all to have the same length. 2. If [PCRE\_DOLLAR\_ENDONLY](reference.pcre.pattern.modifiers) is set and [PCRE\_MULTILINE](reference.pcre.pattern.modifiers) is not set, the $ meta-character matches only at the very end of the string. 3. If [PCRE\_EXTRA](reference.pcre.pattern.modifiers) is set, a backslash followed by a letter with no special meaning is faulted. 4. If [PCRE\_UNGREEDY](reference.pcre.pattern.modifiers) is set, the greediness of the repetition quantifiers is inverted, that is, by default they are not greedy, but if followed by a question mark they are. php RecursiveIteratorIterator::getDepth RecursiveIteratorIterator::getDepth =================================== (PHP 5, PHP 7, PHP 8) RecursiveIteratorIterator::getDepth — Get the current depth of the recursive iteration ### Description ``` public RecursiveIteratorIterator::getDepth(): int ``` **Warning**This function is currently not documented; only its argument list is available. ### Parameters This function has no parameters. ### Return Values The current depth of the recursive iteration. php Yaf_Controller_Abstract::initView Yaf\_Controller\_Abstract::initView =================================== (Yaf >=1.0.0) Yaf\_Controller\_Abstract::initView — The initView purpose ### Description ``` public Yaf_Controller_Abstract::initView(array $options = ?): void ``` ### Parameters `options` ### Return Values php getprotobynumber getprotobynumber ================ (PHP 4, PHP 5, PHP 7, PHP 8) getprotobynumber — Get protocol name associated with protocol number ### Description ``` getprotobynumber(int $protocol): string|false ``` **getprotobynumber()** returns the protocol name associated with protocol `protocol` as per /etc/protocols. ### Parameters `protocol` The protocol number. ### Return Values Returns the protocol name as a string, or **`false`** on failure. ### See Also * [getprotobyname()](function.getprotobyname) - Get protocol number associated with protocol name php The ReflectionObject class The ReflectionObject class ========================== Introduction ------------ (PHP 5, PHP 7, PHP 8) The **ReflectionObject** class reports information about an object. Class synopsis -------------- class **ReflectionObject** extends [ReflectionClass](class.reflectionclass) { /\* Inherited constants \*/ public const int [ReflectionClass::IS\_IMPLICIT\_ABSTRACT](class.reflectionclass#reflectionclass.constants.is-implicit-abstract); public const int [ReflectionClass::IS\_EXPLICIT\_ABSTRACT](class.reflectionclass#reflectionclass.constants.is-explicit-abstract); public const int [ReflectionClass::IS\_FINAL](class.reflectionclass#reflectionclass.constants.is-final); public const int [ReflectionClass::IS\_READONLY](class.reflectionclass#reflectionclass.constants.is-readonly); /\* Inherited properties \*/ public string [$name](class.reflectionclass#reflectionclass.props.name); /\* Methods \*/ public [\_\_construct](reflectionobject.construct)(object `$object`) /\* Inherited methods \*/ ``` public static ReflectionClass::export(mixed $argument, bool $return = false): string ``` ``` public ReflectionClass::getAttributes(?string $name = null, int $flags = 0): array ``` ``` public ReflectionClass::getConstant(string $name): mixed ``` ``` public ReflectionClass::getConstants(?int $filter = null): array ``` ``` public ReflectionClass::getConstructor(): ?ReflectionMethod ``` ``` public ReflectionClass::getDefaultProperties(): array ``` ``` public ReflectionClass::getDocComment(): string|false ``` ``` public ReflectionClass::getEndLine(): int|false ``` ``` public ReflectionClass::getExtension(): ?ReflectionExtension ``` ``` public ReflectionClass::getExtensionName(): string|false ``` ``` public ReflectionClass::getFileName(): string|false ``` ``` public ReflectionClass::getInterfaceNames(): array ``` ``` public ReflectionClass::getInterfaces(): array ``` ``` public ReflectionClass::getMethod(string $name): ReflectionMethod ``` ``` public ReflectionClass::getMethods(?int $filter = null): array ``` ``` public ReflectionClass::getModifiers(): int ``` ``` public ReflectionClass::getName(): string ``` ``` public ReflectionClass::getNamespaceName(): string ``` ``` public ReflectionClass::getParentClass(): ReflectionClass|false ``` ``` public ReflectionClass::getProperties(?int $filter = null): array ``` ``` public ReflectionClass::getProperty(string $name): ReflectionProperty ``` ``` public ReflectionClass::getReflectionConstant(string $name): ReflectionClassConstant|false ``` ``` public ReflectionClass::getReflectionConstants(?int $filter = null): array ``` ``` public ReflectionClass::getShortName(): string ``` ``` public ReflectionClass::getStartLine(): int|false ``` ``` public ReflectionClass::getStaticProperties(): ?array ``` ``` public ReflectionClass::getStaticPropertyValue(string $name, mixed &$def_value = ?): mixed ``` ``` public ReflectionClass::getTraitAliases(): array ``` ``` public ReflectionClass::getTraitNames(): array ``` ``` public ReflectionClass::getTraits(): array ``` ``` public ReflectionClass::hasConstant(string $name): bool ``` ``` public ReflectionClass::hasMethod(string $name): bool ``` ``` public ReflectionClass::hasProperty(string $name): bool ``` ``` public ReflectionClass::implementsInterface(ReflectionClass|string $interface): bool ``` ``` public ReflectionClass::inNamespace(): bool ``` ``` public ReflectionClass::isAbstract(): bool ``` ``` public ReflectionClass::isAnonymous(): bool ``` ``` public ReflectionClass::isCloneable(): bool ``` ``` public ReflectionClass::isEnum(): bool ``` ``` public ReflectionClass::isFinal(): bool ``` ``` public ReflectionClass::isInstance(object $object): bool ``` ``` public ReflectionClass::isInstantiable(): bool ``` ``` public ReflectionClass::isInterface(): bool ``` ``` public ReflectionClass::isInternal(): bool ``` ``` public ReflectionClass::isIterable(): bool ``` ``` public ReflectionClass::isReadOnly(): bool ``` ``` public ReflectionClass::isSubclassOf(ReflectionClass|string $class): bool ``` ``` public ReflectionClass::isTrait(): bool ``` ``` public ReflectionClass::isUserDefined(): bool ``` ``` public ReflectionClass::newInstance(mixed ...$args): object ``` ``` public ReflectionClass::newInstanceArgs(array $args = []): ?object ``` ``` public ReflectionClass::newInstanceWithoutConstructor(): object ``` ``` public ReflectionClass::setStaticPropertyValue(string $name, mixed $value): void ``` ``` public ReflectionClass::__toString(): string ``` } Table of Contents ----------------- * [ReflectionObject::\_\_construct](reflectionobject.construct) — Constructs a ReflectionObject * [ReflectionObject::export](reflectionobject.export) — Export
programming_docs
php tidy::getStatus tidy::getStatus =============== tidy\_get\_status ================= (PHP 5, PHP 7, PHP 8, PECL tidy >= 0.5.2) tidy::getStatus -- tidy\_get\_status — Get status of specified document ### Description Object-oriented style ``` public tidy::getStatus(): int ``` Procedural style ``` tidy_get_status(tidy $tidy): int ``` Returns the status for the specified tidy `tidy`. ### Parameters `tidy` The [Tidy](class.tidy) object. ### Return Values Returns 0 if no error/warning was raised, 1 for warnings or accessibility errors, or 2 for errors. ### Examples **Example #1 **tidy::getStatus()** example** ``` <?php $html = '<p>paragraph</i>'; $tidy = new tidy(); $tidy->parseString($html); $tidy2 = new tidy(); $html2 = '<bogus>test</bogus>'; $tidy2->parseString($html2); echo $tidy->getStatus(); //1 echo $tidy2->getStatus(); //2 ?> ``` php ImagickKernel::fromBuiltIn ImagickKernel::fromBuiltIn ========================== (PECL imagick >= 3.3.0) ImagickKernel::fromBuiltIn — Description ### Description ``` public static ImagickKernel::fromBuiltin(int $kernelType, string $kernelString): ImagickKernel ``` Create a kernel from a builtin in kernel. See http://www.imagemagick.org/Usage/morphology/#kernel for examples. Currently the 'rotation' symbols are not supported. Example: $diamondKernel = ImagickKernel::fromBuiltIn(\Imagick::KERNEL\_DIAMOND, "2"); ### Parameters `kerneltype` The type of kernel to build e.g. \Imagick::KERNEL\_DIAMOND `kernelString` A string that describes the parameters e.g. "4,2.5" ### Return Values ### Examples **Example #1 **ImagickKernel::fromBuiltin()**** ``` <?php function renderKernel(ImagickKernel $imagickKernel) {     $matrix = $imagickKernel->getMatrix();          $imageMargin = 20;          $tileSize = 20;     $tileSpace = 4;     $shadowSigma = 4;     $shadowDropX = 20;     $shadowDropY = 0;     $radius = ($tileSize / 2) * 0.9;          $rows = count($matrix);     $columns = count($matrix[0]);       $imagickDraw = new \ImagickDraw();     $imagickDraw->setFillColor('#afafaf');     $imagickDraw->setStrokeColor('none');          $imagickDraw->translate($imageMargin, $imageMargin);     $imagickDraw->push();     ksort($matrix);          foreach ($matrix as $row) {         ksort($row);         $imagickDraw->push();         foreach ($row as $cell) {             if ($cell !== false) {                 $color = intval(255 * $cell);                 $colorString = sprintf("rgb(%f, %f, %f)", $color, $color, $color);                 $imagickDraw->setFillColor($colorString);                 $imagickDraw->rectangle(0, 0, $tileSize, $tileSize);             }             $imagickDraw->translate(($tileSize + $tileSpace), 0);         }         $imagickDraw->pop();         $imagickDraw->translate(0, ($tileSize + $tileSpace));     }     $imagickDraw->pop();     $width = ($columns * $tileSize) + (($columns - 1) * $tileSpace);     $height = ($rows * $tileSize) + (($rows - 1) * $tileSpace);     $imagickDraw->push();     $imagickDraw->translate($width/2 , $height/2);     $imagickDraw->setFillColor('rgba(0, 0, 0, 0)');     $imagickDraw->setStrokeColor('white');     $imagickDraw->circle(0, 0, $radius - 1, 0);     $imagickDraw->setStrokeColor('black');     $imagickDraw->circle(0, 0, $radius, 0);     $imagickDraw->pop();     $canvasWidth = $width + (2 * $imageMargin);      $canvasHeight = $height + (2 * $imageMargin);     $kernel = new \Imagick();     $kernel->newPseudoImage(         $canvasWidth,         $canvasHeight,         'canvas:none'     );     $kernel->setImageFormat('png');     $kernel->drawImage($imagickDraw);       /* create drop shadow on it's own layer */     $canvas = $kernel->clone();     $canvas->setImageBackgroundColor(new \ImagickPixel('rgb(0, 0, 0)'));     $canvas->shadowImage(100, $shadowSigma, $shadowDropX, $shadowDropY);     $canvas->setImagePage($canvasWidth, $canvasHeight, -5, -5);     $canvas->cropImage($canvasWidth, $canvasHeight, 0, 0);          /* composite original text_layer onto shadow_layer */     $canvas->compositeImage($kernel, \Imagick::COMPOSITE_OVER, 0, 0);     $canvas->setImageFormat('png');     return $canvas; } function createFromBuiltin($kernelType, $kernelFirstTerm, $kernelSecondTerm, $kernelThirdTerm) {     $string = '';     if ($kernelFirstTerm != false && strlen(trim($kernelFirstTerm)) != 0) {         $string .= $kernelFirstTerm;         if ($kernelSecondTerm != false && strlen(trim($kernelSecondTerm)) != 0) {             $string .= ','.$kernelSecondTerm;             if ($kernelThirdTerm != false && strlen(trim($kernelThirdTerm)) != 0) {                 $string .= ','.$kernelThirdTerm;             }         }     }     $kernel = ImagickKernel::fromBuiltIn(         $kernelType,         $string     );     return $kernel; }      function fromBuiltin($kernelType, $kernelFirstTerm, $kernelSecondTerm, $kernelThirdTerm) {     $diamondKernel = createFromBuiltin($kernelType, $kernelFirstTerm, $kernelSecondTerm, $kernelThirdTerm);     $imagick = renderKernel($diamondKernel);     header("Content-Type: image/png");     echo $imagick->getImageBlob(); } fromBuiltin(\Imagick::KERNEL_DIAMOND, 2, false, false); ?> ``` php SolrQuery::getTermsIncludeUpperBound SolrQuery::getTermsIncludeUpperBound ==================================== (PECL solr >= 0.9.2) SolrQuery::getTermsIncludeUpperBound — Returns whether or not to include the upper bound term in the result set ### Description ``` public SolrQuery::getTermsIncludeUpperBound(): bool ``` Returns whether or not to include the upper bound term in the result set ### Parameters This function has no parameters. ### Return Values Returns a boolean on success and **`null`** if not set. php Gmagick::addnoiseimage Gmagick::addnoiseimage ====================== (PECL gmagick >= Unknown) Gmagick::addnoiseimage — Adds random noise to the image ### Description ``` public Gmagick::addnoiseimage(int $noise_type): Gmagick ``` Adds random noise to the image. ### Parameters `noise_type` The type of the noise. Refer to this list of [noise constants](https://www.php.net/manual/en/gmagick.constants.php#gmagick.constants.noise). ### Return Values The Gmagick object with noise added. ### Errors/Exceptions Throws an **GmagickException** on error. php Stomp::subscribe Stomp::subscribe ================ stomp\_subscribe ================ (PECL stomp >= 0.1.0) Stomp::subscribe -- stomp\_subscribe — Registers to listen to a given destination ### Description Object-oriented style (method): ``` public Stomp::subscribe(string $destination, array $headers = ?): bool ``` Procedural style: ``` stomp_subscribe(resource $link, string $destination, array $headers = ?): bool ``` Registers to listen to a given destination. ### Parameters `link` Procedural style only: The stomp link identifier returned by [stomp\_connect()](stomp.construct). `destination` Destination to subscribe to. `headers` Associative array containing the additional headers (example: receipt). ### Return Values Returns **`true`** on success or **`false`** on failure. ### Examples See [stomp\_ack()](stomp.ack). ### Notes **Tip**Stomp is inherently asynchronous. Synchronous communication can be implemented adding a receipt header. This will cause methods to not return anything until the server has acknowledged receipt of the message or until read timeout was reached. php ReflectionClass::isTrait ReflectionClass::isTrait ======================== (PHP 5 >= 5.4.0, PHP 7, PHP 8) ReflectionClass::isTrait — Returns whether this is a trait ### Description ``` public ReflectionClass::isTrait(): bool ``` **Warning**This function is currently not documented; only its argument list is available. ### Parameters This function has no parameters. ### Return Values Returns **`true`** if this is a trait, **`false`** otherwise. Returns **`null`** in case of an error. php GearmanWorker::clone GearmanWorker::clone ==================== (PECL gearman >= 0.5.0) GearmanWorker::clone — Create a copy of the worker ### Description ``` public GearmanWorker::clone(): void ``` Creates a copy of the worker. ### Parameters This function has no parameters. ### Return Values A [GearmanWorker](class.gearmanworker) object php APCUIterator::rewind APCUIterator::rewind ==================== (PECL apcu >= 5.0.0) APCUIterator::rewind — Rewinds iterator ### Description ``` public APCUIterator::rewind(): void ``` Rewinds back the iterator to the first element. ### Parameters This function has no parameters. ### Return Values No value is returned. ### See Also * [APCUIterator::next()](apcuiterator.next) - Move pointer to next item * [Iterator::next()](iterator.next) - Move forward to next element php Gmagick::cropimage Gmagick::cropimage ================== (PECL gmagick >= Unknown) Gmagick::cropimage — Extracts a region of the image ### Description ``` public Gmagick::cropimage( int $width , int $height , int $x, int $y ): Gmagick ``` Extracts a region of the image. ### Parameters `width` The width of the crop. `height` The height of the crop. `x` The X coordinate of the cropped region's top left corner. `y` The Y coordinate of the cropped region's top left corner. ### Return Values The cropped [Gmagick](class.gmagick) object. ### Errors/Exceptions Throws an **GmagickException** on error. php SplFixedArray::offsetUnset SplFixedArray::offsetUnset ========================== (PHP 5 >= 5.3.0, PHP 7, PHP 8) SplFixedArray::offsetUnset — Unsets the value at the specified $index ### Description ``` public SplFixedArray::offsetUnset(int $index): void ``` Unsets the value at the specified index. ### Parameters `index` The index being unset. ### Return Values No value is returned. ### Errors/Exceptions Throws [RuntimeException](class.runtimeexception) when `index` is outside the defined size of the array or when `index` cannot be parsed as an integer. php pg_query pg\_query ========= (PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8) pg\_query — Execute a query ### Description ``` pg_query(PgSql\Connection $connection = ?, string $query): PgSql\Result|false ``` **pg\_query()** executes the `query` on the specified database `connection`. [pg\_query\_params()](function.pg-query-params) should be preferred in most cases. If an error occurs, and **`false`** is returned, details of the error can be retrieved using the [pg\_last\_error()](function.pg-last-error) function if the connection is valid. > **Note**: Although `connection` can be omitted, it is not recommended, since it can be the cause of hard to find bugs in scripts. > > > > **Note**: > > > This function used to be called **pg\_exec()**. **pg\_exec()** is still available for compatibility reasons, but users are encouraged to use the newer name. > > ### Parameters `connection` An [PgSql\Connection](class.pgsql-connection) instance. When `connection` is unspecified, the default connection is used. The default connection is the last connection made by [pg\_connect()](function.pg-connect) or [pg\_pconnect()](function.pg-pconnect). **Warning**As of PHP 8.1.0, using the default connection is deprecated. `query` The SQL statement or statements to be executed. When multiple statements are passed to the function, they are automatically executed as one transaction, unless there are explicit BEGIN/COMMIT commands included in the query string. However, using multiple transactions in one function call is not recommended. **Warning** String interpolation of user-supplied data is extremely dangerous and is likely to lead to [SQL injection](https://www.php.net/manual/en/security.database.sql-injection.php) vulnerabilities. In most cases [pg\_query\_params()](function.pg-query-params) should be preferred, passing user-supplied values as parameters rather than substituting them into the query string. Any user-supplied data substituted directly into a query string should be [properly escaped](function.pg-escape-string). ### Return Values An [PgSql\Result](class.pgsql-result) instance on success, or **`false`** on failure. ### Changelog | Version | Description | | --- | --- | | 8.1.0 | Returns an [PgSql\Result](class.pgsql-result) instance now; previously, a [resource](language.types.resource) was returned. | | 8.1.0 | The `connection` parameter expects an [PgSql\Connection](class.pgsql-connection) instance now; previously, a [resource](language.types.resource) was expected. | ### Examples **Example #1 **pg\_query()** example** ``` <?php $conn = pg_pconnect("dbname=publisher"); if (!$conn) {   echo "An error occurred.\n";   exit; } $result = pg_query($conn, "SELECT author, email FROM authors"); if (!$result) {   echo "An error occurred.\n";   exit; } while ($row = pg_fetch_row($result)) {   echo "Author: $row[0]  E-mail: $row[1]";   echo "<br />\n"; }   ?> ``` **Example #2 Using **pg\_query()** with multiple statements** ``` <?php $conn = pg_pconnect("dbname=publisher"); // these statements will be executed as one transaction $query = "UPDATE authors SET author=UPPER(author) WHERE id=1;"; $query .= "UPDATE authors SET author=LOWER(author) WHERE id=2;"; $query .= "UPDATE authors SET author=NULL WHERE id=3;"; pg_query($conn, $query); ?> ``` ### See Also * [pg\_connect()](function.pg-connect) - Open a PostgreSQL connection * [pg\_pconnect()](function.pg-pconnect) - Open a persistent PostgreSQL connection * [pg\_fetch\_array()](function.pg-fetch-array) - Fetch a row as an array * [pg\_fetch\_object()](function.pg-fetch-object) - Fetch a row as an object * [pg\_num\_rows()](function.pg-num-rows) - Returns the number of rows in a result * [pg\_affected\_rows()](function.pg-affected-rows) - Returns number of affected records (tuples) php The DateTimeZone class The DateTimeZone class ====================== Introduction ------------ (PHP 5 >= 5.2.0, PHP 7, PHP 8) Representation of time zone. Class synopsis -------------- class **DateTimeZone** { /\* Constants \*/ public const int [AFRICA](class.datetimezone#datetimezone.constants.africa); public const int [AMERICA](class.datetimezone#datetimezone.constants.america); public const int [ANTARCTICA](class.datetimezone#datetimezone.constants.antarctica); public const int [ARCTIC](class.datetimezone#datetimezone.constants.arctic); public const int [ASIA](class.datetimezone#datetimezone.constants.asia); public const int [ATLANTIC](class.datetimezone#datetimezone.constants.atlantic); public const int [AUSTRALIA](class.datetimezone#datetimezone.constants.australia); public const int [EUROPE](class.datetimezone#datetimezone.constants.europe); public const int [INDIAN](class.datetimezone#datetimezone.constants.indian); public const int [PACIFIC](class.datetimezone#datetimezone.constants.pacific); public const int [UTC](class.datetimezone#datetimezone.constants.utc); public const int [ALL](class.datetimezone#datetimezone.constants.all); public const int [ALL\_WITH\_BC](class.datetimezone#datetimezone.constants.all-with-bc); public const int [PER\_COUNTRY](class.datetimezone#datetimezone.constants.per-country); /\* Methods \*/ public [\_\_construct](datetimezone.construct)(string `$timezone`) ``` public getLocation(): array|false ``` ``` public getName(): string ``` ``` public getOffset(DateTimeInterface $datetime): int ``` ``` public getTransitions(int $timestampBegin = PHP_INT_MIN, int $timestampEnd = PHP_INT_MAX): array|false ``` ``` public static listAbbreviations(): array ``` ``` public static listIdentifiers(int $timezoneGroup = DateTimeZone::ALL, ?string $countryCode = null): array ``` } Predefined Constants -------------------- **`DateTimeZone::AFRICA`** Africa time zones. **`DateTimeZone::AMERICA`** America time zones. **`DateTimeZone::ANTARCTICA`** Antarctica time zones. **`DateTimeZone::ARCTIC`** Arctic time zones. **`DateTimeZone::ASIA`** Asia time zones. **`DateTimeZone::ATLANTIC`** Atlantic time zones. **`DateTimeZone::AUSTRALIA`** Australia time zones. **`DateTimeZone::EUROPE`** Europe time zones. **`DateTimeZone::INDIAN`** Indian time zones. **`DateTimeZone::PACIFIC`** Pacific time zones. **`DateTimeZone::UTC`** UTC time zones. **`DateTimeZone::ALL`** All time zones. **`DateTimeZone::ALL_WITH_BC`** All time zones including backwards compatible. **`DateTimeZone::PER_COUNTRY`** Time zones per country. Table of Contents ----------------- * [DateTimeZone::\_\_construct](datetimezone.construct) — Creates new DateTimeZone object * [DateTimeZone::getLocation](datetimezone.getlocation) — Returns location information for a timezone * [DateTimeZone::getName](datetimezone.getname) — Returns the name of the timezone * [DateTimeZone::getOffset](datetimezone.getoffset) — Returns the timezone offset from GMT * [DateTimeZone::getTransitions](datetimezone.gettransitions) — Returns all transitions for the timezone * [DateTimeZone::listAbbreviations](datetimezone.listabbreviations) — Returns associative array containing dst, offset and the timezone name * [DateTimeZone::listIdentifiers](datetimezone.listidentifiers) — Returns a numerically indexed array containing all defined timezone identifiers php Memcached::deleteMulti Memcached::deleteMulti ====================== (PECL memcached >= 2.0.0) Memcached::deleteMulti — Delete multiple items ### Description ``` public Memcached::deleteMulti(array $keys, int $time = 0): array ``` Delete the array of `keys` from the server. ### Parameters `keys` The keys to be deleted. `time` The amount of time the server will wait to delete the items. > **Note**: As of memcached 1.3.0 (released 2009) this feature is no longer supported. Passing a non-zero `time` will cause the deletion to fail. [Memcached::getResultCode()](memcached.getresultcode) will return **`MEMCACHED_INVALID_ARGUMENTS`**. > > ### Return Values Returns an array indexed by `keys`. Each element is **`true`** if the corresponding key was deleted, or one of the **`Memcached::RES_*`** constants if the corresponding deletion failed. The [Memcached::getResultCode()](memcached.getresultcode) will return the result code for the last executed delete operation, that is, the delete operation for the last element of `keys`. ### See Also * [Memcached::delete()](memcached.delete) - Delete an item * [Memcached::deleteByKey()](memcached.deletebykey) - Delete an item from a specific server * [Memcached::deleteMultiByKey()](memcached.deletemultibykey) - Delete multiple items from a specific server php restore_include_path restore\_include\_path ====================== (PHP 4 >= 4.3.0, PHP 5, PHP 7) restore\_include\_path — Restores the value of the include\_path configuration option **Warning**This function has been *DEPRECATED* as of PHP 7.4.0, and *REMOVED* as of PHP 8.0.0. Relying on this function is highly discouraged. ### Description ``` restore_include_path(): void ``` Restores the [include\_path](https://www.php.net/manual/en/ini.core.php#ini.include-path) configuration option back to its original master value as set in php.ini ### Parameters This function has no parameters. ### Return Values No value is returned. ### Examples **Example #1 **restore\_include\_path()** example** ``` <?php echo get_include_path();  // .:/usr/local/lib/php set_include_path('/inc'); echo get_include_path();  // /inc restore_include_path(); // Or using ini_restore() ini_restore('include_path'); echo get_include_path();  // .:/usr/local/lib/php ?> ``` ### See Also * [ini\_restore()](function.ini-restore) - Restores the value of a configuration option * [get\_include\_path()](function.get-include-path) - Gets the current include\_path configuration option * [set\_include\_path()](function.set-include-path) - Sets the include\_path configuration option * [include](function.include) - include
programming_docs
php array_walk_recursive array\_walk\_recursive ====================== (PHP 5, PHP 7, PHP 8) array\_walk\_recursive — Apply a user function recursively to every member of an array ### Description ``` array_walk_recursive(array|object &$array, callable $callback, mixed $arg = null): bool ``` Applies the user-defined `callback` function to each element of the `array`. This function will recurse into deeper arrays. ### Parameters `array` The input array. `callback` Typically, `callback` takes on two parameters. The `array` parameter's value being the first, and the key/index second. > > **Note**: > > > If `callback` needs to be working with the actual values of the array, specify the first parameter of `callback` as a [reference](https://www.php.net/manual/en/language.references.php). Then, any changes made to those elements will be made in the original array itself. > > `arg` If the optional `arg` parameter is supplied, it will be passed as the third parameter to the `callback`. ### Return Values Returns **`true`** on success or **`false`** on failure. ### Examples **Example #1 **array\_walk\_recursive()** example** ``` <?php $sweet = array('a' => 'apple', 'b' => 'banana'); $fruits = array('sweet' => $sweet, 'sour' => 'lemon'); function test_print($item, $key) {     echo "$key holds $item\n"; } array_walk_recursive($fruits, 'test_print'); ?> ``` The above example will output: ``` a holds apple b holds banana sour holds lemon ``` You may notice that the key '`sweet`' is never displayed. Any key that holds an array will not be passed to the function. ### See Also * [array\_walk()](function.array-walk) - Apply a user supplied function to every member of an array php imagecreatefromtga imagecreatefromtga ================== (PHP 7 >= 7.4.0, PHP 8) imagecreatefromtga — Create a new image from file or URL ### Description ``` imagecreatefromtga(string $filename): GdImage|false ``` **imagecreatefromtga()** returns an image object representing the image obtained from the given filename. ### Parameters `filename` Path to the Truevision TGA image. ### Return Values Returns an image object on success, **`false`** on errors. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | On success, this function returns a [GDImage](class.gdimage) instance now; previously, a [resource](language.types.resource) was returned. | php mysqli::$affected_rows mysqli::$affected\_rows ======================= mysqli\_affected\_rows ====================== (PHP 5, PHP 7, PHP 8) mysqli::$affected\_rows -- mysqli\_affected\_rows — Gets the number of affected rows in a previous MySQL operation ### Description Object-oriented style int|string [$mysqli->affected\_rows](mysqli.affected-rows); Procedural style ``` mysqli_affected_rows(mysqli $mysql): int|string ``` Returns the number of rows affected by the last `INSERT`, `UPDATE`, `REPLACE` or `DELETE` query. Works like [mysqli\_num\_rows()](mysqli-result.num-rows) for `SELECT` statements. ### Parameters `mysql` Procedural style only: A [mysqli](class.mysqli) object returned by [mysqli\_connect()](function.mysqli-connect) or [mysqli\_init()](mysqli.init) ### Return Values An integer greater than zero indicates the number of rows affected or retrieved. Zero indicates that no records were updated for an `UPDATE` statement, no rows matched the `WHERE` clause in the query or that no query has yet been executed. `-1` indicates that the query returned an error or that **mysqli\_affected\_rows()** was called for an unbuffered `SELECT` query. > > **Note**: > > > If the number of affected rows is greater than the maximum int value (**`PHP_INT_MAX`**), the number of affected rows will be returned as a string. > > ### Examples **Example #1 $mysqli->affected\_rows example** Object-oriented style ``` <?php mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); $mysqli = new mysqli("localhost", "my_user", "my_password", "world"); /* Insert rows */ $mysqli->query("CREATE TABLE Language SELECT * from CountryLanguage"); printf("Affected rows (INSERT): %d\n", $mysqli->affected_rows); $mysqli->query("ALTER TABLE Language ADD Status int default 0"); /* update rows */ $mysqli->query("UPDATE Language SET Status=1 WHERE Percentage > 50"); printf("Affected rows (UPDATE): %d\n", $mysqli->affected_rows); /* delete rows */ $mysqli->query("DELETE FROM Language WHERE Percentage < 50"); printf("Affected rows (DELETE): %d\n", $mysqli->affected_rows); /* select all rows */ $result = $mysqli->query("SELECT CountryCode FROM Language"); printf("Affected rows (SELECT): %d\n", $mysqli->affected_rows); /* Delete table Language */ $mysqli->query("DROP TABLE Language"); ``` Procedural style ``` <?php mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); $link = mysqli_connect("localhost", "my_user", "my_password", "world"); /* Insert rows */ mysqli_query($link, "CREATE TABLE Language SELECT * from CountryLanguage"); printf("Affected rows (INSERT): %d\n", mysqli_affected_rows($link)); mysqli_query($link, "ALTER TABLE Language ADD Status int default 0"); /* update rows */ mysqli_query($link, "UPDATE Language SET Status=1 WHERE Percentage > 50"); printf("Affected rows (UPDATE): %d\n", mysqli_affected_rows($link)); /* delete rows */ mysqli_query($link, "DELETE FROM Language WHERE Percentage < 50"); printf("Affected rows (DELETE): %d\n", mysqli_affected_rows($link)); /* select all rows */ $result = mysqli_query($link, "SELECT CountryCode FROM Language"); printf("Affected rows (SELECT): %d\n", mysqli_affected_rows($link)); /* Delete table Language */ mysqli_query($link, "DROP TABLE Language"); ``` The above examples will output: ``` Affected rows (INSERT): 984 Affected rows (UPDATE): 168 Affected rows (DELETE): 815 Affected rows (SELECT): 169 ``` ### See Also * [mysqli\_num\_rows()](mysqli-result.num-rows) - Gets the number of rows in the result set * [mysqli\_info()](mysqli.info) - Retrieves information about the most recently executed query php ReflectionFunctionAbstract::getNamespaceName ReflectionFunctionAbstract::getNamespaceName ============================================ (PHP 5 >= 5.3.0, PHP 7, PHP 8) ReflectionFunctionAbstract::getNamespaceName — Gets namespace name ### Description ``` public ReflectionFunctionAbstract::getNamespaceName(): string ``` Get the namespace name where the class is defined. ### Parameters This function has no parameters. ### Return Values The namespace name. ### See Also * [ReflectionFunctionAbstract::getFileName()](reflectionfunctionabstract.getfilename) - Gets file name * [namespaces](https://www.php.net/manual/en/language.namespaces.php) php bin2hex bin2hex ======= (PHP 4, PHP 5, PHP 7, PHP 8) bin2hex — Convert binary data into hexadecimal representation ### Description ``` bin2hex(string $string): string ``` Returns an ASCII string containing the hexadecimal representation of `string`. The conversion is done byte-wise with the high-nibble first. ### Parameters `string` A string. ### Return Values Returns the hexadecimal representation of the given string. ### Examples **Example #1 **bin2hex()** example** ``` <?php $hex = bin2hex('Hello world!'); var_dump($hex); var_dump(hex2bin($hex)); ?> ``` The above example will output: ``` string(24) "48656c6c6f20776f726c6421" string(12) "Hello world!" ``` ### See Also * [hex2bin()](function.hex2bin) - Decodes a hexadecimally encoded binary string * [pack()](function.pack) - Pack data into binary string php imap_delete imap\_delete ============ (PHP 4, PHP 5, PHP 7, PHP 8) imap\_delete — Mark a message for deletion from current mailbox ### Description ``` imap_delete(IMAP\Connection $imap, string $message_nums, int $flags = 0): bool ``` Marks messages listed in `message_nums` for deletion. Messages marked for deletion will stay in the mailbox until either [imap\_expunge()](function.imap-expunge) is called or [imap\_close()](function.imap-close) is called with the optional parameter **`CL_EXPUNGE`**. ### Parameters `imap` An [IMAP\Connection](class.imap-connection) instance. `message_nums` A string representing one or more messages in IMAP4-style sequence format (`"n"`, `"n:m"`, or combination of these delimited by commas). `flags` You can set the **`FT_UID`** which tells the function to treat the `message_nums` argument as a `UID`. ### Return Values Returns **`true`**. ### Changelog | Version | Description | | --- | --- | | 8.1.0 | The `imap` parameter expects an [IMAP\Connection](class.imap-connection) instance now; previously, a [resource](language.types.resource) was expected. | ### Examples **Example #1 **imap\_delete()** example** ``` <?php $mbox = imap_open("{imap.example.org}INBOX", "username", "password")     or die("Can't connect: " . imap_last_error()); $check = imap_mailboxmsginfo($mbox); echo "Messages before delete: " . $check->Nmsgs . "<br />\n"; imap_delete($mbox, 1); $check = imap_mailboxmsginfo($mbox); echo "Messages after  delete: " . $check->Nmsgs . "<br />\n"; imap_expunge($mbox); $check = imap_mailboxmsginfo($mbox); echo "Messages after expunge: " . $check->Nmsgs . "<br />\n"; imap_close($mbox); ?> ``` ### Notes > > **Note**: > > > IMAP mailboxes may not have their message flags saved between connections, so [imap\_expunge()](function.imap-expunge) should be called during the same connection in order to guarantee that messages marked for deletion will actually be purged. > > ### See Also * [imap\_undelete()](function.imap-undelete) - Unmark the message which is marked deleted * [imap\_expunge()](function.imap-expunge) - Delete all messages marked for deletion * [imap\_close()](function.imap-close) - Close an IMAP stream php Gmagick::getsize Gmagick::getsize ================ (PECL gmagick >= Unknown) Gmagick::getsize — Returns the size associated with the Gmagick object ### Description ``` public Gmagick::getsize(): array ``` Returns the size associated with the [Gmagick](class.gmagick) object as an array with the keys "columns" and "rows". ### Parameters This function has no parameters. ### Return Values Returns the size associated with the [Gmagick](class.gmagick) object as an array with the keys "columns" and "rows". ### Errors/Exceptions Throws an **GmagickException** on error. php GmagickPixel::__construct GmagickPixel::\_\_construct =========================== (PECL gmagick >= Unknown) GmagickPixel::\_\_construct — The GmagickPixel constructor ### Description public **GmagickPixel::\_\_construct**(string `$color` = ?) Constructs an [GmagickPixel](class.gmagickpixel) object. If a color is specified, the object is constructed and then initialised with that color before being returned. ### Parameters `color` The optional color string to use as the initial value of this object. php atan atan ==== (PHP 4, PHP 5, PHP 7, PHP 8) atan — Arc tangent ### Description ``` atan(float $num): float ``` Returns the arc tangent of `num` in radians. **atan()** is the inverse function of [tan()](function.tan), which means that `a==tan(atan(a))` for every value of a that is within **atan()**'s range. ### Parameters `num` The argument to process ### Return Values The arc tangent of `num` in radians. ### See Also * [tan()](function.tan) - Tangent * [atanh()](function.atanh) - Inverse hyperbolic tangent * [asin()](function.asin) - Arc sine * [acos()](function.acos) - Arc cosine php RecursiveIteratorIterator::beginChildren RecursiveIteratorIterator::beginChildren ======================================== (PHP 5 >= 5.1.0, PHP 7, PHP 8) RecursiveIteratorIterator::beginChildren — Begin children ### Description ``` public RecursiveIteratorIterator::beginChildren(): void ``` Is called after calling **RecursiveIteratorIterator::getChildren()**, and its associated [RecursiveIteratorIterator::rewind()](recursiveiteratoriterator.rewind). **Warning**This function is currently not documented; only its argument list is available. ### Parameters This function has no parameters. ### Return Values No value is returned. php time_sleep_until time\_sleep\_until ================== (PHP 5 >= 5.1.0, PHP 7, PHP 8) time\_sleep\_until — Make the script sleep until the specified time ### Description ``` time_sleep_until(float $timestamp): bool ``` Makes the script sleep until the specified `timestamp`. ### Parameters `timestamp` The timestamp when the script should wake. ### Return Values Returns **`true`** on success or **`false`** on failure. ### Errors/Exceptions If the specified `timestamp` is in the past, this function will generate a **`E_WARNING`**. ### Examples **Example #1 A **time\_sleep\_until()** example** ``` <?php //returns false and generates a warning var_dump(time_sleep_until(time()-1)); // may only work on faster computers, will sleep up to 0.2 seconds var_dump(time_sleep_until(microtime(true)+0.2)); ?> ``` ### Notes > **Note**: All signals will be delivered after the script wakes up. > > ### See Also * [sleep()](function.sleep) - Delay execution * [usleep()](function.usleep) - Delay execution in microseconds * [time\_nanosleep()](function.time-nanosleep) - Delay for a number of seconds and nanoseconds * [set\_time\_limit()](function.set-time-limit) - Limits the maximum execution time php ValueError ValueError ========== Introduction ------------ (PHP 8) A **ValueError** is thrown when the type of an argument is correct but the value of it is incorrect. For example, passing a negative integer when the function expects a positive one, or passing an empty string/array when the function expects it to not be empty. Class synopsis -------------- class **ValueError** extends [Error](class.error) { /\* Inherited properties \*/ protected string [$message](class.error#error.props.message) = ""; private string [$string](class.error#error.props.string) = ""; protected int [$code](class.error#error.props.code); protected string [$file](class.error#error.props.file) = ""; protected int [$line](class.error#error.props.line); private array [$trace](class.error#error.props.trace) = []; private ?[Throwable](class.throwable) [$previous](class.error#error.props.previous) = null; /\* Inherited methods \*/ ``` final public Error::getMessage(): string ``` ``` final public Error::getPrevious(): ?Throwable ``` ``` final public Error::getCode(): int ``` ``` final public Error::getFile(): string ``` ``` final public Error::getLine(): int ``` ``` final public Error::getTrace(): array ``` ``` final public Error::getTraceAsString(): string ``` ``` public Error::__toString(): string ``` ``` private Error::__clone(): void ``` } php ssh2_tunnel ssh2\_tunnel ============ (PECL ssh2 >= 0.9.0) ssh2\_tunnel — Open a tunnel through a remote server ### Description ``` ssh2_tunnel(resource $session, string $host, int $port): resource ``` Open a socket stream to an arbitrary host/port by way of the currently connected SSH server. ### Parameters `session` An SSH connection link identifier, obtained from a call to [ssh2\_connect()](function.ssh2-connect). `host` `port` ### Return Values ### Examples **Example #1 Opening a tunnel to an arbitrary host** ``` <?php $connection = ssh2_connect('shell.example.com', 22); ssh2_auth_pubkey_file($connection, 'username', 'id_dsa.pub', 'id_dsa'); $tunnel = ssh2_tunnel($connection, '10.0.0.101', 12345); ?> ``` ### See Also * [ssh2\_connect()](function.ssh2-connect) - Connect to an SSH server * [fsockopen()](function.fsockopen) - Open Internet or Unix domain socket connection php fbird_restore fbird\_restore ============== (PHP 5, PHP 7 < 7.4.0) fbird\_restore — Alias of [ibase\_restore()](function.ibase-restore) ### Description This function is an alias of: [ibase\_restore()](function.ibase-restore). php Reflection::getModifierNames Reflection::getModifierNames ============================ (PHP 5, PHP 7, PHP 8) Reflection::getModifierNames — Gets modifier names ### Description ``` public static Reflection::getModifierNames(int $modifiers): array ``` Gets modifier names. ### Parameters `modifiers` Bitfield of the modifiers to get. ### Return Values An array of modifier names. ### Examples **Example #1 **Reflection::getModifierNames()** example** ``` <?php class Testing {     final public static function foo()     {         return;     }     public function bar()     {         return;     } } $foo = new ReflectionMethod('Testing', 'foo'); echo "Modifiers for method foo():\n"; echo $foo->getModifiers() . "\n"; echo implode(' ', Reflection::getModifierNames($foo->getModifiers())) . "\n"; $bar = new ReflectionMethod('Testing', 'bar'); echo "Modifiers for method bar():\n"; echo $bar->getModifiers() . "\n"; echo implode(' ', Reflection::getModifierNames($bar->getModifiers())); ``` The above example will output something similar to: ``` Modifiers for method foo(): 261 final public static Modifiers for method bar(): 65792 public ``` ### See Also * [ReflectionClass::getModifiers()](reflectionclass.getmodifiers) - Gets the class modifiers * [ReflectionClassConstant::getModifiers()](reflectionclassconstant.getmodifiers) - Gets the class constant modifiers * [ReflectionMethod::getModifiers()](reflectionmethod.getmodifiers) - Gets the method modifiers * [ReflectionProperty::getModifiers()](reflectionproperty.getmodifiers) - Gets the property modifiers php ssh2_publickey_add ssh2\_publickey\_add ==================== (PECL ssh2 >= 0.10) ssh2\_publickey\_add — Add an authorized publickey ### Description ``` ssh2_publickey_add( resource $pkey, string $algoname, string $blob, bool $overwrite = false, array $attributes = ? ): bool ``` > **Note**: The public key subsystem is used for managing public keys on a server to which the client is *already* authenticated. To authenticate to a remote system using public key authentication, use the [ssh2\_auth\_pubkey\_file()](function.ssh2-auth-pubkey-file) function instead. > > ### Parameters `pkey` Publickey Subsystem resource created by [ssh2\_publickey\_init()](function.ssh2-publickey-init). `algoname` Publickey algorithm (e.g.): ssh-dss, ssh-rsa `blob` Publickey blob as raw binary data `overwrite` If the specified key already exists, should it be overwritten? `attributes` Associative array of attributes to assign to this public key. Refer to ietf-secsh-publickey-subsystem for a list of supported attributes. To mark an attribute as mandatory, precede its name with an asterisk. If the server is unable to support an attribute marked mandatory, it will abort the add process. ### Return Values Returns **`true`** on success or **`false`** on failure. ### Examples **Example #1 Adding a publickey with **ssh2\_publickey\_add()**** ``` <?php $ssh2 = ssh2_connect('shell.example.com', 22); ssh2_auth_password($ssh2, 'jdoe', 'password'); $pkey = ssh2_publickey_init($ssh2); $keyblob = base64_decode(' AAAAB3NzaC1yc2EAAAABIwAAAIEA5HVt6VqSGd5PTrLRdjNONxXH1tVFGn0 Bd26BF0aCP9qyJRlvdJ3j4WBeX4ZmrveGrjMgkseSYc4xZ26sDHwfL351xj zaLpipu\BGRrw17mWVBhuCExo476ri5tQFzbTc54VEHYckxQ16CjSTibI5X 69GmnYC9PNqEYq/1TP+HF10='); ssh2_publickey_add($pkey, 'ssh-rsa', $keyblob, false, array('comment'=>"John's Key")); ?> ``` ### See Also * [ssh2\_publickey\_init()](function.ssh2-publickey-init) - Initialize Publickey subsystem * [ssh2\_publickey\_remove()](function.ssh2-publickey-remove) - Remove an authorized publickey * [ssh2\_publickey\_list()](function.ssh2-publickey-list) - List currently authorized publickeys
programming_docs
php SolrQuery::addGroupFunction SolrQuery::addGroupFunction =========================== (PECL solr >= 2.2.0) SolrQuery::addGroupFunction — Allows grouping results based on the unique values of a function query (group.func parameter) ### Description ``` public SolrQuery::addGroupFunction(string $value): SolrQuery ``` Adds a group function (group.func parameter) Allows grouping results based on the unique values of a function query. ### Parameters `value` ### Return Values [SolrQuery](class.solrquery) ### See Also * [SolrQuery::setGroup()](solrquery.setgroup) - Enable/Disable result grouping (group parameter) * [SolrQuery::addGroupField()](solrquery.addgroupfield) - Add a field to be used to group results * [SolrQuery::addGroupQuery()](solrquery.addgroupquery) - Allows grouping of documents that match the given query * [SolrQuery::addGroupSortField()](solrquery.addgroupsortfield) - Add a group sort field (group.sort parameter) * [SolrQuery::setGroupFacet()](solrquery.setgroupfacet) - Sets group.facet parameter * [SolrQuery::setGroupOffset()](solrquery.setgroupoffset) - Sets the group.offset parameter * [SolrQuery::setGroupLimit()](solrquery.setgrouplimit) - Specifies the number of results to return for each group. The server default value is 1 * [SolrQuery::setGroupMain()](solrquery.setgroupmain) - If true, the result of the first field grouping command is used as the main result list in the response, using group.format=simple * [SolrQuery::setGroupNGroups()](solrquery.setgroupngroups) - If true, Solr includes the number of groups that have matched the query in the results * [SolrQuery::setGroupTruncate()](solrquery.setgrouptruncate) - If true, facet counts are based on the most relevant document of each group matching the query * [SolrQuery::setGroupFormat()](solrquery.setgroupformat) - Sets the group format, result structure (group.format parameter) * [SolrQuery::setGroupCachePercent()](solrquery.setgroupcachepercent) - Enables caching for result grouping php OAuth::enableDebug OAuth::enableDebug ================== (PECL OAuth >= 0.99.3) OAuth::enableDebug — Turn on verbose debugging ### Description ``` public OAuth::enableDebug(): bool ``` Turns on verbose request information useful for debugging, the debug information is stored in the `debugInfo` member. Alternatively, the `debug` member can be set to a non-**`false`** value to turn debug on. ### Parameters This function has no parameters. ### Return Values **`true`** ### Changelog | Version | Description | | --- | --- | | PECL oauth 0.99.8 | The `debug` and `debugInfo` members were added | ### See Also * [OAuth::disableDebug()](oauth.disabledebug) - Turn off verbose debugging php Yaf_Router::getCurrentRoute Yaf\_Router::getCurrentRoute ============================ (Yaf >=1.0.0) Yaf\_Router::getCurrentRoute — Get the effective route name ### Description ``` public Yaf_Router::getCurrentRoute(): string ``` Get the name of the route which is effective in the route process. > > **Note**: > > > You should call this method after the route process finished, since before that, this method will always return **`null`**. > > ### Parameters This function has no parameters. ### Return Values String, the name of the effective route. ### Examples **Example #1 Register some routes in Bootstrap** ``` <?php class Bootstrap extends Yaf_Bootstrap_Abstract{     public function _initConfig() {         $config = Yaf_Application::app()->getConfig();         Yaf_Registry::set("config", $config);     }     public function _initRoute(Yaf_Dispatcher $dispatcher) {         $router = $dispatcher->getRouter();         $rewrite_route  = new Yaf_Route_Rewrite(             "/product/list/:page",             array(                 "controller" => "product",                 "action"     => "list",             )         );          $regex_route  = new Yaf_Route_Rewrite(             "#^/product/info/(\d+)",             array(                 "controller" => "product",                 "action"     => "info",             )         );                   $router->addRoute('rewrite', $rewrite_route)->addRoute('regex', $regex_route);     }      /**      * register plugin       */     public function __initPlugins(Yaf_Dispatcher $dispatcher) {         $dispatcher->registerPlugin(new DummyPlugin());     } } ?> ``` **Example #2 plugin Dummy.php (under [application.directory](https://www.php.net/manual/en/yaf.appconfig.php#configuration.yaf.directory)/plugins)** ``` <?php class DummyPlugin extends Yaf_Plugin_Abstract {     public function routerShutdown(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response) {          var_dump(Yaf_Dispatcher::getInstance()->getRouter()->getCurrentRoute());     } } ?> ``` The above example will output something similar to: ``` /* for http://yourdomain.com/product/list/1 * DummyPlugin will output: */ string(7) "rewrite" /* for http://yourdomain.com/product/info/34 * DummyPlugin will output: */ string(5) "regex" /* for other request URI * DummyPlugin will output: */ string(8) "_default" ``` ### See Also * [Yaf\_Bootstrap\_Abstract](class.yaf-bootstrap-abstract) * [Yaf\_Plugin\_Abstract](class.yaf-plugin-abstract) * [Yaf\_Router::addRoute()](yaf-router.addroute) - Add new Route into Router php RarArchive::setAllowBroken RarArchive::setAllowBroken ========================== (PECL rar >= 3.0.0) RarArchive::setAllowBroken — Whether opening broken archives is allowed ### Description Object-oriented style (method): ``` public RarArchive::setAllowBroken(bool $allow_broken): bool ``` Procedural style: ``` rar_allow_broken_set(RarArchive $rarfile, bool $allow_broken): bool ``` This method defines whether broken archives can be read or all the operations that attempt to extract the archive entries will fail. Broken archives are archives for which no error is detected when the file is opened but an error occurs when reading the entries. ### Parameters `rarfile` A [RarArchive](class.rararchive) object, opened with [rar\_open()](rararchive.open). `allow_broken` Whether to allow reading broken files (**`true`**) or not (**`false`**). ### Return Values Returns **`true`** or **`false`** on failure. It will only fail if the file has already been closed. ### Examples **Example #1 Object-oriented style** ``` <?php function retnull() { return null; } $file = dirname(__FILE__) . "/multi_broken.part1.rar"; /* Third argument omits "volume not found" message */ $a = RarArchive::open($file, null, 'retnull'); $a->setAllowBroken(true); foreach ($a->getEntries() as $e) {     echo "$e\n"; } var_dump(count($a)); ?> ``` The above example will output something similar to: ``` RarEntry for file "file1.txt" (52b28202) int(1) ``` **Example #2 Procedural style** ``` <?php function retnull() { return null; } $file = dirname(__FILE__) . "/multi_broken.part1.rar"; /* Third argument omits "volume not found" message */ $a = rar_open($file, null, 'retnull'); rar_allow_broken_set($a, true); foreach (rar_list($a) as $e) {     echo "$e\n"; } var_dump(count($a)); ?> ``` ### See Also * [RarArchive::isBroken()](rararchive.isbroken) - Test whether an archive is broken (incomplete) php SolrQuery::getTermsField SolrQuery::getTermsField ======================== (PECL solr >= 0.9.2) SolrQuery::getTermsField — Returns the field from which the terms are retrieved ### Description ``` public SolrQuery::getTermsField(): string ``` Returns the field from which the terms are retrieved ### Parameters This function has no parameters. ### Return Values Returns a string on success and **`null`** if not set. php Ds\Queue::clear Ds\Queue::clear =============== (PECL ds >= 1.0.0) Ds\Queue::clear — Removes all values ### Description ``` public Ds\Queue::clear(): void ``` Removes all values from the queue. ### Parameters This function has no parameters. ### Return Values No value is returned. ### Examples **Example #1 **Ds\Queue::clear()** example** ``` <?php $queue = new \Ds\Queue([1, 2, 3]); print_r($queue); $queue->clear(); print_r($queue); ?> ``` The above example will output something similar to: ``` Ds\Queue Object ( [0] => 1 [1] => 2 [2] => 3 ) Ds\Queue Object ( ) ``` php ImagickDraw::clear ImagickDraw::clear ================== (PECL imagick 2, PECL imagick 3) ImagickDraw::clear — Clears the ImagickDraw ### Description ``` public ImagickDraw::clear(): bool ``` **Warning**This function is currently not documented; only its argument list is available. Clears the ImagickDraw object of any accumulated commands, and resets the settings it contains to their defaults. ### Return Values Returns an [ImagickDraw](class.imagickdraw) object. php property_exists property\_exists ================ (PHP 5 >= 5.1.0, PHP 7, PHP 8) property\_exists — Checks if the object or class has a property ### Description ``` property_exists(object|string $object_or_class, string $property): bool ``` This function checks if the given `property` exists in the specified class. > > **Note**: > > > As opposed with [isset()](function.isset), **property\_exists()** returns **`true`** even if the property has the value **`null`**. > > ### Parameters `object_or_class` The class name or an object of the class to test for `property` The name of the property ### Return Values Returns **`true`** if the property exists, **`false`** if it doesn't exist or **`null`** in case of an error. ### Examples **Example #1 A **property\_exists()** example** ``` <?php class myClass {     public $mine;     private $xpto;     static protected $test;     static function test() {         var_dump(property_exists('myClass', 'xpto')); //true     } } var_dump(property_exists('myClass', 'mine'));   //true var_dump(property_exists(new myClass, 'mine')); //true var_dump(property_exists('myClass', 'xpto'));   //true var_dump(property_exists('myClass', 'bar'));    //false var_dump(property_exists('myClass', 'test'));   //true myClass::test(); ?> ``` ### Notes > > **Note**: > > > Using this function will use any registered [autoloaders](language.oop5.autoload) if the class is not already known. > > > > > **Note**: > > > The **property\_exists()** function cannot detect properties that are magically accessible using the [`__get`](language.oop5.overloading#language.oop5.overloading.members) magic method. > > ### See Also * [method\_exists()](function.method-exists) - Checks if the class method exists php mailparse_msg_get_part mailparse\_msg\_get\_part ========================= (PECL mailparse >= 0.9.0) mailparse\_msg\_get\_part — Returns a handle on a given section in a mimemessage ### Description ``` mailparse_msg_get_part(resource $mimemail, string $mimesection): resource ``` **Warning**This function is currently not documented; only its argument list is available. ### Parameters `mimemail` A valid `MIME` resource. `mimesection` php strnatcasecmp strnatcasecmp ============= (PHP 4, PHP 5, PHP 7, PHP 8) strnatcasecmp — Case insensitive string comparisons using a "natural order" algorithm ### Description ``` strnatcasecmp(string $string1, string $string2): int ``` This function implements a comparison algorithm that orders alphanumeric strings in the way a human being would. The behaviour of this function is similar to [strnatcmp()](function.strnatcmp), except that the comparison is not case sensitive. For more information see: Martin Pool's [» Natural Order String Comparison](https://github.com/sourcefrog/natsort) page. ### Parameters `string1` The first string. `string2` The second string. ### Return Values Similar to other string comparison functions, this one returns `-1` if `string1` is less than `string2` `1` if `string1` is greater than `string2`, and `0` if they are equal. ### Changelog | Version | Description | | --- | --- | | 8.2.0 | This function now returns `-1` or `1`, where it previously returned a negative or positive number. | ### Examples **Example #1 **strnatcasecmp()** example** ``` <?php var_dump(strnatcasecmp('Apple', 'Banana')); var_dump(strnatcasecmp('Banana', 'Apple')); var_dump(strnatcasecmp('apple', 'Apple')); ?> ``` The above example will output: ``` int(-1) int(1) int(0) ``` ### See Also * [preg\_match()](function.preg-match) - Perform a regular expression match * [strcmp()](function.strcmp) - Binary safe string comparison * [strcasecmp()](function.strcasecmp) - Binary safe case-insensitive string comparison * [substr()](function.substr) - Return part of a string * [stristr()](function.stristr) - Case-insensitive strstr * [strncasecmp()](function.strncasecmp) - Binary safe case-insensitive string comparison of the first n characters * [strncmp()](function.strncmp) - Binary safe string comparison of the first n characters * [strstr()](function.strstr) - Find the first occurrence of a string * [setlocale()](function.setlocale) - Set locale information php DOMCdataSection::__construct DOMCdataSection::\_\_construct ============================== (PHP 5, PHP 7, PHP 8) DOMCdataSection::\_\_construct — Constructs a new DOMCdataSection object ### Description public **DOMCdataSection::\_\_construct**(string `$data`) Constructs a new CDATA node. This works like the [DOMText](class.domtext) class. ### Parameters `data` The value of the CDATA node. If not supplied, an empty CDATA node is created. ### Examples **Example #1 Creating a new DOMCdataSection object** ``` <?php $dom = new DOMDocument('1.0', 'utf-8'); $element = $dom->appendChild(new DOMElement('root')); $text = $element->appendChild(new DOMCdataSection('root value')); echo $dom->saveXML(); ?> ``` The above example will output: ``` <?xml version="1.0" encoding="utf-8"?> <root><![CDATA[root value]]></root> ``` ### See Also * [DOMText::\_\_construct()](domtext.construct) - Creates a new DOMText object * [DOMDocument::createTextNode()](domdocument.createtextnode) - Create new text node php imagecreatefromgd2 imagecreatefromgd2 ================== (PHP 4 >= 4.0.7, PHP 5, PHP 7, PHP 8) imagecreatefromgd2 — Create a new image from GD2 file or URL ### Description ``` imagecreatefromgd2(string $filename): GdImage|false ``` Create a new image from GD2 file or URL. **Tip**A URL can be used as a filename with this function if the [fopen wrappers](https://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen) have been enabled. See [fopen()](function.fopen) for more details on how to specify the filename. See the [Supported Protocols and Wrappers](https://www.php.net/manual/en/wrappers.php) for links to information about what abilities the various wrappers have, notes on their usage, and information on any predefined variables they may provide. ### Parameters `filename` Path to the GD2 image. ### Return Values Returns an image object on success, **`false`** on errors. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | On success, this function returns a [GDImage](class.gdimage) instance now; previously, a resource was returned. | ### Examples **Example #1 **imagecreatefromgd2()** example** ``` <?php // Load the gd2 image $im = imagecreatefromgd2('./test.gd2'); // Apply an effect on the image, in this  // case negate the image if(function_exists('imagefilter')) {     imagefilter($im, IMG_FILTER_NEGATE); } // Save the image imagegd2($im, './test_updated.gd2'); imagedestroy($im); ?> ``` ### Notes **Warning**The GD and GD2 image formats are proprietary image formats of libgd. They have to be regarded *obsolete*, and should only be used for development and testing purposes. php The Set class The Set class ============= Introduction ------------ (No version information available, might only be in Git) A Set is a sequence of unique values. This implementation uses the same hash table as **Ds\Map**, where values are used as keys and the mapped value is ignored. Strengths --------- * Values can be any type, including objects. * Supports array syntax (square brackets). * Insertion order is preserved. * Automatically frees allocated memory when its size drops low enough. * **add()**, **remove()** and **contains()** are all O(1). Weaknesses ---------- * Doesn’t support **push()**, **pop()**, **insert()**, **shift()**, or **unshift()**. * **get()** is O(n) if there are deleted values in the buffer before the accessed index, O(1) otherwise. Class synopsis -------------- class **Ds\Set** implements **Ds\Collection**, [ArrayAccess](class.arrayaccess) { /\* Constants \*/ const int [MIN\_CAPACITY](class.ds-set#ds-set.constants.min-capacity) = 16; /\* Methods \*/ ``` public add(mixed ...$values): void ``` ``` public allocate(int $capacity): void ``` ``` public capacity(): int ``` ``` public clear(): void ``` ``` public contains(mixed ...$values): bool ``` ``` public copy(): Ds\Set ``` ``` public diff(Ds\Set $set): Ds\Set ``` ``` public filter(callable $callback = ?): Ds\Set ``` ``` public first(): mixed ``` ``` public get(int $index): mixed ``` ``` public intersect(Ds\Set $set): Ds\Set ``` ``` public isEmpty(): bool ``` ``` public join(string $glue = ?): string ``` ``` public last(): mixed ``` ``` public merge(mixed $values): Ds\Set ``` ``` public reduce(callable $callback, mixed $initial = ?): mixed ``` ``` public remove(mixed ...$values): void ``` ``` public reverse(): void ``` ``` public reversed(): Ds\Set ``` ``` public slice(int $index, int $length = ?): Ds\Set ``` ``` public sort(callable $comparator = ?): void ``` ``` public sorted(callable $comparator = ?): Ds\Set ``` ``` public sum(): int|float ``` ``` public toArray(): array ``` ``` public union(Ds\Set $set): Ds\Set ``` ``` public xor(Ds\Set $set): Ds\Set ``` } Predefined Constants -------------------- **`Ds\Set::MIN_CAPACITY`** Changelog --------- | Version | Description | | --- | --- | | PECL ds 1.3.0 | The class now implements [ArrayAccess](class.arrayaccess). | Table of Contents ----------------- * [Ds\Set::add](ds-set.add) — Adds values to the set * [Ds\Set::allocate](ds-set.allocate) — Allocates enough memory for a required capacity * [Ds\Set::capacity](ds-set.capacity) — Returns the current capacity * [Ds\Set::clear](ds-set.clear) — Removes all values * [Ds\Set::\_\_construct](ds-set.construct) — Creates a new instance * [Ds\Set::contains](ds-set.contains) — Determines if the set contains all values * [Ds\Set::copy](ds-set.copy) — Returns a shallow copy of the set * [Ds\Set::count](ds-set.count) — Returns the number of values in the set * [Ds\Set::diff](ds-set.diff) — Creates a new set using values that aren't in another set * [Ds\Set::filter](ds-set.filter) — Creates a new set using a callable to determine which values to include * [Ds\Set::first](ds-set.first) — Returns the first value in the set * [Ds\Set::get](ds-set.get) — Returns the value at a given index * [Ds\Set::intersect](ds-set.intersect) — Creates a new set by intersecting values with another set * [Ds\Set::isEmpty](ds-set.isempty) — Returns whether the set is empty * [Ds\Set::join](ds-set.join) — Joins all values together as a string * [Ds\Set::jsonSerialize](ds-set.jsonserialize) — Returns a representation that can be converted to JSON * [Ds\Set::last](ds-set.last) — Returns the last value in the set * [Ds\Set::merge](ds-set.merge) — Returns the result of adding all given values to the set * [Ds\Set::reduce](ds-set.reduce) — Reduces the set to a single value using a callback function * [Ds\Set::remove](ds-set.remove) — Removes all given values from the set * [Ds\Set::reverse](ds-set.reverse) — Reverses the set in-place * [Ds\Set::reversed](ds-set.reversed) — Returns a reversed copy * [Ds\Set::slice](ds-set.slice) — Returns a sub-set of a given range * [Ds\Set::sort](ds-set.sort) — Sorts the set in-place * [Ds\Set::sorted](ds-set.sorted) — Returns a sorted copy * [Ds\Set::sum](ds-set.sum) — Returns the sum of all values in the set * [Ds\Set::toArray](ds-set.toarray) — Converts the set to an array * [Ds\Set::union](ds-set.union) — Creates a new set using values from the current instance and another set * [Ds\Set::xor](ds-set.xor) — Creates a new set using values in either the current instance or in another set, but not in both
programming_docs
php socket_create_listen socket\_create\_listen ====================== (PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8) socket\_create\_listen — Opens a socket on port to accept connections ### Description ``` socket_create_listen(int $port, int $backlog = 128): Socket|false ``` **socket\_create\_listen()** creates a new [Socket](class.socket) instance of type **`AF_INET`** listening on *all* local interfaces on the given port waiting for new connections. This function is meant to ease the task of creating a new socket which only listens to accept new connections. ### Parameters `port` The port on which to listen on all interfaces. `backlog` The `backlog` parameter defines the maximum length the queue of pending connections may grow to. **`SOMAXCONN`** may be passed as `backlog` parameter, see [socket\_listen()](function.socket-listen) for more information. ### Return Values **socket\_create\_listen()** returns a new [Socket](class.socket) instance on success or **`false`** on error. The error code can be retrieved with [socket\_last\_error()](function.socket-last-error). This code may be passed to [socket\_strerror()](function.socket-strerror) to get a textual explanation of the error. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | On success, this function returns a [Socket](class.socket) instance now; previously, a resource was returned. | ### Notes > > **Note**: > > > If you want to create a socket which only listens on a certain interface you need to use [socket\_create()](function.socket-create), [socket\_bind()](function.socket-bind) and [socket\_listen()](function.socket-listen). > > ### See Also * [socket\_create()](function.socket-create) - Create a socket (endpoint for communication) * [socket\_create\_pair()](function.socket-create-pair) - Creates a pair of indistinguishable sockets and stores them in an array * [socket\_bind()](function.socket-bind) - Binds a name to a socket * [socket\_listen()](function.socket-listen) - Listens for a connection on a socket * [socket\_last\_error()](function.socket-last-error) - Returns the last error on the socket * [socket\_strerror()](function.socket-strerror) - Return a string describing a socket error php The Yac class The Yac class ============= Introduction ------------ (PECL yac >= 1.0.0) Class synopsis -------------- class **Yac** { /\* Properties \*/ protected [$\_prefix](class.yac#yac.props.prefix); /\* Methods \*/ public [\_\_construct](yac.construct)(string `$prefix` = "") ``` public add(string $keys, mixed $value, int $ttl = 0): bool ``` ``` public add(array $key_vals): bool ``` ``` public delete(string|array $keys, int $ttl = ?): bool ``` ``` public dump(int $$num): mixed ``` ``` public flush(): bool ``` ``` public get(string|array $key, int &$cas = null): mixed ``` ``` public __get(string $key): mixed ``` ``` public info(): array ``` ``` public set(string $keys, mixed $value, int $ttl = 0): bool ``` ``` public add(array $key_vals): bool ``` ``` public __set(string $keys, mixed $value): mixed ``` } Properties ---------- \_prefix Table of Contents ----------------- * [Yac::add](yac.add) — Store into cache * [Yac::\_\_construct](yac.construct) — Constructor * [Yac::delete](yac.delete) — Remove items from cache * [Yac::dump](yac.dump) — Dump cache * [Yac::flush](yac.flush) — Flush the cache * [Yac::get](yac.get) — Retrieve values from cache * [Yac::\_\_get](yac.getter) — Getter * [Yac::info](yac.info) — Status of cache * [Yac::set](yac.set) — Store into cache * [Yac::\_\_set](yac.setter) — Setter php substr_count substr\_count ============= (PHP 4, PHP 5, PHP 7, PHP 8) substr\_count — Count the number of substring occurrences ### Description ``` substr_count( string $haystack, string $needle, int $offset = 0, ?int $length = null ): int ``` **substr\_count()** returns the number of times the `needle` substring occurs in the `haystack` string. Please note that `needle` is case sensitive. > > **Note**: > > > This function doesn't count overlapped substrings. See the example below! > > ### Parameters `haystack` The string to search in `needle` The substring to search for `offset` The offset where to start counting. If the offset is negative, counting starts from the end of the string. `length` The maximum length after the specified offset to search for the substring. It outputs a warning if the offset plus the length is greater than the `haystack` length. A negative length counts from the end of `haystack`. ### Return Values This function returns an int. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | `length` is nullable now. | | 7.1.0 | Support for negative `offset`s and `length`s has been added. `length` may also be `0` now. | ### Examples **Example #1 A **substr\_count()** example** ``` <?php $text = 'This is a test'; echo strlen($text); // 14 echo substr_count($text, 'is'); // 2 // the string is reduced to 's is a test', so it prints 1 echo substr_count($text, 'is', 3); // the text is reduced to 's i', so it prints 0 echo substr_count($text, 'is', 3, 3); // generates a warning because 5+10 > 14 echo substr_count($text, 'is', 5, 10); // prints only 1, because it doesn't count overlapped substrings $text2 = 'gcdgcdgcd'; echo substr_count($text2, 'gcdgcd'); ?> ``` ### See Also * [count\_chars()](function.count-chars) - Return information about characters used in a string * [strpos()](function.strpos) - Find the position of the first occurrence of a substring in a string * [substr()](function.substr) - Return part of a string * [strstr()](function.strstr) - Find the first occurrence of a string php fbird_query fbird\_query ============ (PHP 5, PHP 7 < 7.4.0) fbird\_query — Alias of [ibase\_query()](function.ibase-query) ### Description This function is an alias of: [ibase\_query()](function.ibase-query). ### See Also * [fbird\_errmsg()](function.fbird-errmsg) - Alias of ibase\_errmsg * [fbird\_fetch\_row()](function.fbird-fetch-row) - Alias of ibase\_fetch\_row * [fbird\_fetch\_object()](function.fbird-fetch-object) - Alias of ibase\_fetch\_object * [fbird\_free\_result()](function.fbird-free-result) - Alias of ibase\_free\_result php Imagick::getImageClipMask Imagick::getImageClipMask ========================= (PECL imagick 2 >= 2.3.0, PECL imagick 3) Imagick::getImageClipMask — Gets image clip mask **Warning**This function has been *DEPRECATED* as of Imagick 3.4.4. Relying on this function is highly discouraged. ### Description ``` public Imagick::getImageClipMask(): Imagick ``` Returns the image clip mask. The clip mask is an Imagick object containing the clip mask. This method is available if Imagick has been compiled against ImageMagick version 6.3.6 or newer. ### Parameters This function has no parameters. ### Return Values Returns an Imagick object containing the clip mask. ### Errors/Exceptions Throws ImagickException on error. php radius_strerror radius\_strerror ================ (PECL radius >= 1.1.0) radius\_strerror — Returns an error message ### Description ``` radius_strerror(resource $radius_handle): string ``` If Radius-functions fail then they record an error message. This error message can be retrieved with this function. ### Parameters `radius_handle` The RADIUS resource. ### Return Values Returns error messages as string from failed radius functions. php sapi_windows_cp_is_utf8 sapi\_windows\_cp\_is\_utf8 =========================== (PHP 7 >= 7.1.0, PHP 8) sapi\_windows\_cp\_is\_utf8 — Indicates whether the codepage is UTF-8 compatible ### Description ``` sapi_windows_cp_is_utf8(): bool ``` Indicates whether the codepage of the current process is UTF-8 compatible. ### Parameters This function has no parameters. ### Return Values Returns whether the codepage of the current process is UTF-8 compatible. ### See Also * [sapi\_windows\_cp\_get()](function.sapi-windows-cp-get) - Get current codepage php IntlGregorianCalendar::setGregorianChange IntlGregorianCalendar::setGregorianChange ========================================= (PHP 5 >= 5.5.0, PHP 7, PHP 8) IntlGregorianCalendar::setGregorianChange — Set the Gregorian Calendar the change date ### Description ``` public IntlGregorianCalendar::setGregorianChange(float $timestamp): bool ``` **Warning**This function is currently not documented; only its argument list is available. ### Parameters `timestamp` ### Return Values Returns **`true`** on success or **`false`** on failure. php inflate_add inflate\_add ============ (PHP 7, PHP 8) inflate\_add — Incrementally inflate encoded data ### Description ``` inflate_add(InflateContext $context, string $data, int $flush_mode = ZLIB_SYNC_FLUSH): string|false ``` Incrementally inflates encoded data in the specified `context`. Limitation: header information from GZIP compressed data are not made available. ### Parameters `context` A context created with [inflate\_init()](function.inflate-init). `data` A chunk of compressed data. `flush_mode` One of **`ZLIB_BLOCK`**, **`ZLIB_NO_FLUSH`**, **`ZLIB_PARTIAL_FLUSH`**, **`ZLIB_SYNC_FLUSH`** (default), **`ZLIB_FULL_FLUSH`**, **`ZLIB_FINISH`**. Normally you will want to set **`ZLIB_NO_FLUSH`** to maximize compression, and **`ZLIB_FINISH`** to terminate with the last chunk of data. See the [» zlib manual](http://www.zlib.net/manual.html) for a detailed description of these constants. ### Return Values Returns a chunk of uncompressed data, or **`false`** on failure. ### Errors/Exceptions If invalid parameters are given, inflating the data requires a preset dictionary, but none is specified, the compressed stream is corrupt or has an invalid checksum, an error of level **`E_WARNING`** is generated. ### Changelog | Version | Description | | --- | --- | | 8.0.0 | `context` expects an [InflateContext](class.inflatecontext) instance now; previously, a resource was expected. | ### See Also * [inflate\_init()](function.inflate-init) - Initialize an incremental inflate context php EventBufferEvent::createPair EventBufferEvent::createPair ============================ (PECL event >= 1.2.6-beta) EventBufferEvent::createPair — Creates two buffer events connected to each other ### Description ``` public static EventBufferEvent::createPair( EventBase $base , int $options = 0 ): array ``` Returns array of two [EventBufferEvent](class.eventbufferevent) objects connected to each other. All the usual options are supported, except for **`EventBufferEvent::OPT_CLOSE_ON_FREE`** , which has no effect, and **`EventBufferEvent::OPT_DEFER_CALLBACKS`** , which is always on. ### Parameters `base` Associated event base `options` [EventBufferEvent::OPT\_\* constants](eventbufferevent.createpair) combined with bitwise `OR` operator. ### Return Values Returns array of two [EventBufferEvent](class.eventbufferevent) objects connected to each other. ### Changelog | Version | Description | | --- | --- | | PECL event 1.9.0 | Method made static. | php dba_key_split dba\_key\_split =============== (PHP 5, PHP 7, PHP 8) dba\_key\_split — Splits a key in string representation into array representation ### Description ``` dba_key_split(string|false|null $key): array|false ``` **dba\_key\_split()** splits a key (string representation) into an array representation. ### Parameters `key` The key in string representation. ### Return Values Returns an array of the form `array(0 => group, 1 => value_name)`. This function will return **`false`** if `key` is **`null`** or **`false`**. ### See Also * [dba\_firstkey()](function.dba-firstkey) - Fetch first key * [dba\_nextkey()](function.dba-nextkey) - Fetch next key * [dba\_fetch()](function.dba-fetch) - Fetch data specified by key php EvWatcher::feed EvWatcher::feed =============== (PECL ev >= 0.2.0) EvWatcher::feed — Feeds the given revents set into the event loop ### Description ``` public EvWatcher::feed( int $revents ): void ``` Feeds the given revents set into the event loop, as if the specified event had happened for the watcher. ### Parameters `revents` Bit mask of watcher [received events](class.ev#ev.constants.watcher-revents) . ### Return Values No value is returned. php Parle\Parser::errorInfo Parle\Parser::errorInfo ======================= (PECL parle >= 0.5.1) Parle\Parser::errorInfo — Retrieve the error information ### Description ``` public Parle\Parser::errorInfo(): Parle\ErrorInfo ``` Retrieve the error information in case **Parle\Parser::action()** returned the error action. ### Parameters This function has no parameters. ### Return Values Returns an instance of [Parle\ErrorInfo](class.parle-errorinfo). php imap_alerts imap\_alerts ============ (PHP 4, PHP 5, PHP 7, PHP 8) imap\_alerts — Returns all IMAP alert messages that have occurred ### Description ``` imap_alerts(): array|false ``` Returns all of the IMAP alert messages generated since the last **imap\_alerts()** call, or the beginning of the page. When **imap\_alerts()** is called, the alert stack is subsequently cleared. The IMAP specification requires that these messages be passed to the user. ### Parameters This function has no parameters. ### Return Values Returns an array of all of the IMAP alert messages generated or **`false`** if no alert messages are available. ### See Also * [imap\_errors()](function.imap-errors) - Returns all of the IMAP errors that have occurred php EvChild::createStopped EvChild::createStopped ====================== (PECL ev >= 0.2.0) EvChild::createStopped — Create instance of a stopped EvCheck watcher ### Description ``` final public static EvChild::createStopped( int $pid , bool $trace , callable $callback , mixed $data = ?, int $priority = ? ): object ``` The same as [EvChild::\_\_construct()](evchild.construct) , but doesn't start the watcher automatically. ### Parameters `pid` The same as for [EvChild::\_\_construct()](evchild.construct) `trace` The same as for [EvChild::\_\_construct()](evchild.construct) `callback` See [Watcher callbacks](https://www.php.net/manual/en/ev.watcher-callbacks.php) . `data` Custom data associated with the watcher. `priority` [Watcher priority](class.ev#ev.constants.watcher-pri) ### Return Values ### See Also * [EvChild::\_\_construct()](evchild.construct) - Constructs the EvChild watcher object * [EvLoop::child()](evloop.child) - Creates EvChild object associated with the current event loop php Memcached::setOptions Memcached::setOptions ===================== (PECL memcached >= 2.0.0) Memcached::setOptions — Set Memcached options ### Description ``` public Memcached::setOptions(array $options): bool ``` **Memcached::setOptions()** is a variation of the [Memcached::setOption()](memcached.setoption) that takes an array of options to be set. ### Parameters `options` An associative array of options where the key is the option to set and the value is the new value for the option. ### Return Values Returns **`true`** on success or **`false`** on failure. ### Examples **Example #1 Setting Memcached options** ``` <?php $m = new Memcached(); var_dump($m->getOption(Memcached::OPT_HASH) == Memcached::HASH_DEFAULT); $m->setOptions(array(Memcached::OPT_HASH => Memcached::HASH_MURMUR, Memcached::OPT_PREFIX_KEY => "widgets")); var_dump($m->getOption(Memcached::OPT_HASH) == Memcached::HASH_DEFAULT); echo "Prefix key is now: ", $m->getOption(Memcached::OPT_PREFIX_KEY), "\n"; ?> ``` The above example will output: ``` bool(true) bool(false) Prefix key is now: widgets ``` ### See Also * [Memcached::getOption()](memcached.getoption) - Retrieve a Memcached option value * [Memcached::setOption()](memcached.setoption) - Set a Memcached option * [Memcached Constants](https://www.php.net/manual/en/memcached.constants.php) php ldap_next_entry ldap\_next\_entry ================= (PHP 4, PHP 5, PHP 7, PHP 8) ldap\_next\_entry — Get next result entry ### Description ``` ldap_next_entry(LDAP\Connection $ldap, LDAP\ResultEntry $entry): LDAP\ResultEntry|false ``` Retrieve the entries stored in the result. Successive calls to the **ldap\_next\_entry()** return entries one by one till there are no more entries. The first call to **ldap\_next\_entry()** is made after the call to [ldap\_first\_entry()](function.ldap-first-entry) with the `entry` as returned from the [ldap\_first\_entry()](function.ldap-first-entry). ### Parameters `ldap` An [LDAP\Connection](class.ldap-connection) instance, returned by [ldap\_connect()](function.ldap-connect). `entry` An [LDAP\ResultEntry](class.ldap-result-entry) instance. ### Return Values Returns an [LDAP\ResultEntry](class.ldap-result-entry) instance for the next entry in the result whose entries are being read starting with [ldap\_first\_entry()](function.ldap-first-entry). If there are no more entries in the result then it returns **`false`**. ### Changelog | Version | Description | | --- | --- | | 8.1.0 | The `ldap` parameter expects an [LDAP\Connection](class.ldap-connection) instance now; previously, a [resource](language.types.resource) was expected. | | 8.1.0 | The `entry` parameter expects an [LDAP\ResultEntry](class.ldap-result-entry) instance now; previously, a [resource](language.types.resource) was expected. | | 8.1.0 | Returns an [LDAP\Result](class.ldap-result) instance now; previously, a [resource](language.types.resource) was returned. | ### See Also * [ldap\_get\_entries()](function.ldap-get-entries) - Get all result entries php is_dir is\_dir ======= (PHP 4, PHP 5, PHP 7, PHP 8) is\_dir — Tells whether the filename is a directory ### Description ``` is_dir(string $filename): bool ``` Tells whether the given filename is a directory. ### Parameters `filename` Path to the file. If `filename` is a relative filename, it will be checked relative to the current working directory. If `filename` is a symbolic or hard link then the link will be resolved and checked. If you have enabled [open\_basedir](https://www.php.net/manual/en/ini.core.php#ini.open-basedir) further restrictions may apply. ### Return Values Returns **`true`** if the filename exists and is a directory, **`false`** otherwise. ### Errors/Exceptions Upon failure, an **`E_WARNING`** is emitted. ### Examples **Example #1 **is\_dir()** example** ``` <?php var_dump(is_dir('a_file.txt')); var_dump(is_dir('bogus_dir/abc')); var_dump(is_dir('..')); //one dir up ?> ``` The above example will output: ``` bool(false) bool(false) bool(true) ``` ### Notes > **Note**: The results of this function are cached. See [clearstatcache()](function.clearstatcache) for more details. > > **Tip**As of PHP 5.0.0, this function can also be used with *some* URL wrappers. Refer to [Supported Protocols and Wrappers](https://www.php.net/manual/en/wrappers.php) to determine which wrappers support [stat()](function.stat) family of functionality. ### See Also * [chdir()](function.chdir) - Change directory * [dir()](function.dir) - Return an instance of the Directory class * [opendir()](function.opendir) - Open directory handle * [is\_file()](function.is-file) - Tells whether the filename is a regular file * [is\_link()](function.is-link) - Tells whether the filename is a symbolic link
programming_docs