InterfaceSwitched

InterfaceSwitched[size1expr1,size2expr2,|>]

is a construct that behaves as if it were expri when it is in an interface environment with width sizei.

InterfaceSwitched["param",key1expr1,key2expr2,|>]

behaves as if it were expri when the value of the interface parameter param corresponds to keyi.

Details

  • InterfaceSwitched can be used to create responsive web interfaces that change depending on their display environments.
  • InterfaceSwitched does not evaluate in the kernel, but resolves only in the web browser.
  • InterfaceSwitched constructs can be nested.
  • Possible values of param include:
  • "Width"pixel width of viewport area
    "Height"pixel height of viewport area
    "Orientation"orientation of device
    "DeviceType"type of device
  • Possible values of size for "Width" and "Height" are:
  • nsize of at least n pixels
    {min, max}size between min and max pixels
  • Possible values of key for "Orientation" are:
  • "Vertical", "Portrait"device held vertically
    "Horizontal", "Landscape"device held horizontally
  • Possible values of key for "DeviceType" are:
  • "Print"used when printing
    "Screen"used for displays on computers, tablets, phones
    "Speech"used for screen readers
  • Typical widths of various devices are:
  • Phone480 pixels
    Tablet768 pixels
    Desktop992 pixels
    Large screen1200 pixels
  • In all cases, the following keys can be used:
  • Automaticfallthrough for unspecified cases
    case1|case2|several alternative cases

Examples

open allclose all

Basic Examples  (2)

Use a List to specify a range of values for a property:

Single integers specify a size of at least that many pixels:

Deploy a single WebItem that changes according to the device size:

It can be used to switch any property:

Applications  (1)

Use InterfaceSwitched to specify some content that should only appear when the webpage is printed:

Properties & Relations  (1)

InterfaceSwitched can be used to change the content of a WebItem, WebRow and WebColumn:

Wolfram Research (2021), InterfaceSwitched, Wolfram Language function, https://reference.wolfram.com/language/ref/InterfaceSwitched.html.

Text

Wolfram Research (2021), InterfaceSwitched, Wolfram Language function, https://reference.wolfram.com/language/ref/InterfaceSwitched.html.

CMS

Wolfram Language. 2021. "InterfaceSwitched." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/InterfaceSwitched.html.

APA

Wolfram Language. (2021). InterfaceSwitched. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/InterfaceSwitched.html

BibTeX

@misc{reference.wolfram_2022_interfaceswitched, author="Wolfram Research", title="{InterfaceSwitched}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/InterfaceSwitched.html}", note=[Accessed: 02-July-2022 ]}

BibLaTeX

@online{reference.wolfram_2022_interfaceswitched, organization={Wolfram Research}, title={InterfaceSwitched}, year={2021}, url={https://reference.wolfram.com/language/ref/InterfaceSwitched.html}, note=[Accessed: 02-July-2022 ]}