jQuery UI CSS Framework

Page history last edited by Todd Parker 1 mo ago

jQuery UI 1.6rc6/1.7 is built upon a brand new, themable CSS framework.

 

The new CSS framework is built to support not only jQuery UI's own plugins, but also custom plugin development. The framework itself is static with comment tokens which can be manipulated by ThemeRoller to generate a customized look and feel. Framework adoption will promote shared markup conventions and ease of code integration across the plugin community at large.

 

The following classes are split between ui.core.css and ui.theme.css, depending on whether styles are fixed and structural, or themeable (colors, fonts, backgrounds, etc) respectively.

 

jQuery UI CSS Class Framework Documentation:

 

Layout helpers

 

  • .ui-helper-hidden: Applies display: none to elements.
  • .ui-helper-hidden-accessible: Applies accessible hiding to elements (via abs positioning off the page)
  • .ui-helper-reset:  A basic style reset for UI elements. Resets things such as padding, margins, text-decoration, list-style, etc.

  • .ui-helper-clearfix: Applies float wrapping properties to parent elements
  • .ui-helper-zfix: Applies iframe "fix" css to iframe elements when needed in overlays.

 

Component containers

 

  • .ui-widget: Class to be applied on outer container of all widgets. Applies font family and font size to widget. Also applies same family and 1em font size to child form elements specifically, to combat inheritance issues in Win browsers.
  • .ui-widget-header: Class to be applied to header containers. Applies header container styles to an element and its child text, links, and icons.
  • .ui-widget-content: Class to be applied to content containers. Applies content container styles to an element and its child text, links, and icons. (can be applied to parent or sibling of header)

 

Interaction states

 

  • .ui-state-default: Class to be applied to clickable button-like elements. Applies "clickable default" container styles to an element and its child text, links, and icons.
  • .ui-state-hover: Class to be applied on mouseover to clickable button-like elements. Applies "clickable hover" container styles to an element and its child text, links, and icons.
  • .ui-state-active: Class to be applied on mousedown to clickable button-like elements. Applies "clickable active" container styles to an element and its child text, links, and icons.

 

Interaction Cues

 

  • .ui-state-highlight: Class to be applied to highlighted or selected elements. Applies "highlight" container styles to an element and its child text, links, and icons.
  • .ui-state-error: Class to be applied to error messaging container elements. Applies "error" container styles to an element and its child text, links, and icons.
  • .ui-state-error-text: An additional class that applies just the error text color without background. Can be used on form labels for instance. Also applies error icon color to child icons.
  • .ui-state-disabled: Applies a dimmed opacity to disabled UI elements. Meant to be added in addition to an already-styled element.
  • .ui-priority-primary: Class to be applied to a priority-1 button in situations where button hierarchy is needed. Applies bold text.
  • .ui-priority-secondary: Class to be applied to a priority-2 button in situations where button hierarchy is needed. Applies normal weight text and slight transparency to element.

 

Icons

 

States and images

  • .ui-icon: Base class to be applied to an icon element. Sets dimensions to 16px square block, hides inner text, sets background image to "content" state sprite image. Note: .ui-icon class will be given a different sprite background image depending on its parent container. For example, a ui-icon element within a ui-state-default container will get colored according to the ui-state-default's icon color.

 

Icon types

 

 

Misc visuals

 

Corner Radius helpers:

  • .ui-corner-tl: Applies corner-radius to top left corner of element.
  • .ui-corner-tr: Applies corner-radius to top right corner of element.
  • .ui-corner-bl: Applies corner-radius to bottom left corner of element.
  • .ui-corner-br: Applies corner-radius to bottom right corner of element.
  • .ui-corner-top: Applies corner-radius to both top corners of element.
  • .ui-corner-bottom: Applies corner-radius to both bottom corners of element.
  • .ui-corner-right: Applies corner-radius to both right corners of element.
  • .ui-corner-left: Applies corner-radius to both left corners of element.
  • .ui-corner-all: Applies corner-radius to all 4 corners of element.

 

Overlay & Shadow

  • .ui-widget-overlay: Applies 100% wxh dimensions to an overlay screen, along with background color/texture, and screen opacity.
  • .ui-widget-shadow: Class to be applied to overlay widget shadow elements. Applies background color/texture, custom corner radius, opacity, top/left offsets and shadow "thickness". Thickness is applied via padding to all sides of a shadow that is set to match the dimensions of the overlay element. Offsets are applied via top and left margins (can be positive or negative).

 

 

New framework levers being considered for future releases

A few considerations: there are always lots of new things we could add to the framework to accomodate new widget types, but we need to carefully grow this framework so we strike a good balance between the power/breadth/richness of these levers and the ThemeRoller's UI complexity (and file size). For example, each new lever adds around 6-7kb because the bg texture image is 1k, icon sprite is 5k and then there are the style rules in the CSS. So adding the 3 levers for the forms will add about 20kb to each theme which isn't huge, but it's something to consider.

 

The TR's UI is designed to scale by just adding spindown sections but we already have 11 and adding more will make this a pretty intimidating form. One easy thing we can do is add labels to group logical sections together and make it easier to visually scan but there is a point where too many levers will make it too time-consuming to use so we want to make sure we really know that a new lever is going to be widely used across widgets.

 

Here is the list of new levers that have been requested and are under consideration:

 

  • Form states: There have been a bunch of requests for styling form elements with ThemeRoller. This would allow for a complete set of custom styled textareas, inputs, dropdowns, custom radio and checkboxes, spinners, etc. To do this right, it would require a full set of interaction state levers to do properly (default, hover, active) because I think you'd want to be able to style your inputs, dropdowns, custom radio and checkboxes independently from the normal clickable elements.
    • ui-form-default :: normal appearance of a form element
    • ui-form-hover :: appearance on mouse over
    • ui-form-active :: appearance in the selected state (checked radiobutton, checkbox, etc.)
  • pressed/down state
    • ui-state-down :: new 4th state for when you mouse down on a clickable element to give additional feedback that it's been clicked. also good for touchscreen based UIs
  • toolbar
    • ui-widget-toolbar :: for basic toolbars, grid header/footer, dialog button bar etc.. this is useful because there are times where you need a bar that isn't a header, button or content area.
  • secondary content area
    • ui-widget-content-secondary :: for table striping or differentiation in menu panels, etc.

       

Comments (24)

profile picture

Kevin Dalman said

at 6:35 pm on Dec 12, 2008

I have a request for additional icon types:

.ui-icon-pin-up
.ui-icon-pin-down
.ui-icon-circle-pin-up
.ui-icon-circle-pin-down

These standard UI icons match well with the arrow and magnifier icons.

profile picture

Todd Parker said

at 8:56 pm on Dec 12, 2008

Good idea. We'll add these pin icons to the sprite.

profile picture

Todd Parker said

at 2:59 pm on Dec 22, 2008

@kevin: I've been looking around on the web for examples of the pin up/down icons you requested and I'm not finding many examples of this in use. I remember seeing the pin metaphor a long time ago on an old Microsoft app (Encarta?) to "pin" open a panel that auto-hid on mouse out. Is this the type of use you had in mind or is this more of a pin in a map kind of interaction? Seems like it might not be needed until there is an application that calls for it.

profile picture

Kevin Dalman said

at 6:15 pm on Dec 23, 2008

@Todd: I requested pin graphics because the Layout Manager widget I created can automatically synchronize 'pin buttons' with the state of the layout. You can see example of this - on the toolbar and in the pane-headers - in this demo:

http://layout.jquery-dev.net/demos/complex.html

I'm currently reformatting the widget to conform to the UI API. After that I'll be creating some layout 'themes'. Since the icon sprite has *everything else* I would need, I thought if would be nice if no custom graphics were needed. I'm also hoping to get ThemeRoller support for Layout soon, so I am trying to use *only* the CSS framework.

I can provide a set of 2-color pin graphics in 16px format, if you want them.

profile picture

scottjehl said

at 2:06 pm on Jan 21, 2009

@kevin: The framework icons have been updated and now include two pin icons (ui-icon-pin-w and ui-icon-pin-s).
You can find them documented here as well: http://docs.jquery.com/UI/Theming/API

profile picture

Kevin Dalman said

at 1:57 pm on Jan 22, 2009

@Todd: That's great Todd - thanks. Once UI 1.6 is final, I'll upate one of my demos to use all the new icons.

profile picture

Todd Parker said

at 12:06 pm on Jan 23, 2009

@Kevin - There are also some nice gripper and arrow icons that you can use for the re-sizable panels in the icon sprite. I tried to make sure we had the bits you'd need for a layout panel system when creating the set. Missed the pins tho.

profile picture

Bohdan Ganicky said

at 12:35 pm on Jan 28, 2009

Hi all, I have an icon suggestion: .ui-icon-map

profile picture

Sasha said

at 2:26 am on May 26, 2009

something wrong with images, when i try edit in photoshop, im getting it without transparency, how did u seved it, which format of PNG there?

profile picture

Todd Parker said

at 7:56 am on May 26, 2009

The icons and background images are saved as PNG8 which Photoshop should be able to open. Sometimes, PS can display masked (transparent) parts of a PNG as black for some odd reason. This is just Photoshop's bad PNG support.

profile picture

Jan V said

at 3:10 pm on Jun 1, 2009

I have a request for additional icon types too: double carat (we use them e.g. for fieldset collapse)
.ui-icon-carat-2-n (two carats stacked close to each other, pointing north)
.ui-icon-carat-2-e
.ui-icon-carat-2-w
.ui-icon-carat-2-s

profile picture

Jan V said

at 11:57 am on Jun 2, 2009

I have proposal for 'ui-state-pressed'
Class to be applied on mousedown and removed on mouseup to all clickable button-like elements
UI TheameRoller would add forth section "clickable pressed"

read more:
http://groups.google.com/group/jquery-ui/browse_thread/thread/eb8b56189628966c

profile picture

sompylasar said

at 8:30 am on Jun 3, 2009

How to declare an element as being focused?

profile picture

Scott González said

at 8:49 am on Jun 3, 2009

There's a ui-state-focus class, which seems to be missing, along with ui-state-hover and possibly others.

profile picture

sompylasar said

at 4:15 pm on Jun 4, 2009

Thanks, I'll be using it in my future development. Hope it will soon get to ThemeRoller.

profile picture

sompylasar said

at 4:21 pm on Jun 4, 2009

On separate form element states in response to: 'because I think you'd want to be able to style your inputs, dropdowns, custom radio and checkboxes independently from the normal clickable elements.'

I think, it would be better to set up a single class for a form element (e.g 'ui-form-element') and style an element with a combination of this one and the states defined before. This proposes more consistency on states of elements (as being active, disabled or focused). More specific states may be added later.

profile picture

sompylasar said

at 12:46 am on Jun 5, 2009

Propose an additional class for a ui-icon:

.ui-icon-empty { width: 0px; }

This will unobtrusively hide the icon for controls that should not have icons.

profile picture

sompylasar said

at 4:58 pm on Jun 6, 2009

Eventually found a better name for an empty icon class: .ui-icon-none

profile picture

malko said

at 5:36 pm on Jun 29, 2009

my vote for ui-icon-none (even if it may sounds weird to define something that's not there)
Plus i propose two additional states like ui-state-highlight:
- ui-state-success
- ui-state-info and/or ui-state-notice.
This will be in help when displaying application messages such as form submission / validation.
regarding icons it may be nice to also have some of them representing some basics in text editing i will personnaly liked to use such icons for my RichTextEditor plugin to keep theme consitency.

profile picture

Todd Parker said

at 9:07 pm on Jun 29, 2009

We designed ui-state-highlight and ui-state-error for these form submission scenarios. For example, if there is a validation error, use error. If te form was submitted successfully, you could drop in a div with the highlight class, then maybe fade away after a timeout using a class transition. Highlight state the check icon would make a good success message, info message or anything that needs attention but isn't an error.

profile picture

malko said

at 1:52 am on Jun 30, 2009

I'm already using them in such manner. I'm ok that ui-state-highlight may serve for info/notice but i still think that a ui-state-success would be meaningfull and a good complementary to ui-state-error. Also it would be nice to have a green color as opposite of error wich is red as users are used to see green/red message for success/error.

profile picture

Jeremy Martin said

at 11:28 am on Jul 1, 2009

I second this request. User messaging systems commonly contain 3 levels of "urgency" - specifically error, warning, and success/confirmation. An equivalent ui-state would be helpful when implementing jQuery UI based notifications.

profile picture

malko said

at 5:37 pm on Jun 29, 2009

also as a side note it would be really nice to have some examples of using overlay and shadow classes

profile picture

malko said

at 6:12 am on Jul 3, 2009

My vote also for an ui-widget-content-secondary or stuff like that.
Would be nice too to have an ui-class to add default border style to elements perhaps in a way much like for corners this to allow ui-theme user to get consistent borders for elements.

You don't have permission to comment on this page.