# UI-Patterns.com: all design patterns Source: https://ui-patterns.com/patterns. Content by Anders Toxboe, licensed under Creative Commons Attribution-Noncommercial-Share Alike 2.5 Denmark. Please cite and link the pattern page. --- # Drag and drop - Type: User interface design pattern - Category: Getting input > Forms - URL: https://ui-patterns.com/patterns/drag-and-drop - Examples: 1 screenshots on the page ## Problem summary The user needs to perform operations on one or more objects by moving them from one place to another. ## Usage - Use when you want to let users to perform more complex tasks through direct manipulation – through a What-you-see-is-what-you-get (WYSIWYG) approach. - Use when you want to avoid forcing the user to go to another page in order to re-arrange the layout ## Solution Let users pick up and rearrange content by dragging it across the screen ## Rationale Instinctively, many users try dragging and dropping objects in user interfaces. This conceptual metaphor with clear ties to the physical world provides a level of direct manipulation few methods can match. It is seen as one of the most effective ways to rearrange items in a list, move objects from one place to the other, or even upload files. ## Discussion As Drag and drop is not fully accessible you may want to consider supporting alternate ways to re-arrange your content modules. --- # Structured Format - Type: User interface design pattern - Category: Getting input > Forms - URL: https://ui-patterns.com/patterns/StructuredFormat - Examples: 2 screenshots on the page ## Problem summary The user needs to quickly enter data into the system but the format of the data must adhere to a predefined structure. ## Usage - Use when the more explicit form elements like select boxes, radio buttons, and checkboxes make entering data for everyday tasks a too complicated process - Use when the time it takes to complete a task proportional exceeds the importance of the goal the user wants to accomplish. - Use when the input you want to collect is a specific data type. For instance a zip code, a date or time, a phone number. - Use when the expected user input follows a specific format which can readily be interpreted by a computer program. - Do not use for inputs that can possibly be interpreted in many ways. For this purpose, see the [Forgiving Format pattern](/patterns/ForgivingFormat). ## Solution Represent input fields in a way that clearly guides or limits the user as to what input format to use. An input field is presented with an accompanying label describing the input that is expected in the field. The label describes a specific structure the user must follow to input a valid value. In some cases the user is presented with the possibility to use helping mechanisms such as a date selection calendar to fill out the input box in the correct way. When the user has done this multiple times, they slowly learn how the input is formatted, so that they can copy the same format on their own. ## Rationale Set clear expectations by ordering input fields in a Structured Format: clue users as to what kind of input is being requested. By chunking large input fields into smaller bits, data entry errors can be decreased dramatically. It is easier to transcribe or memorize a long number when it is broken up into chunks. Where the Structured Format is well suited for predictable input, the Forgiving Format is well suited for open-ended input. Using a structured format in an input field saves time for the user, when they are required to fill out the same input field repeatedly as a part of a frequent task. The structured data pattern aids the user through streamlined and controlled inputs, which in turn speeds up data capturing tasks and reduces the garbage in, garbage out problem. --- # Keyboard Shortcuts - Type: User interface design pattern - Category: Getting input > Forms - URL: https://ui-patterns.com/patterns/keyboard-shortcuts - Also known as: Command Shortcurt - Examples: 4 screenshots on the page ## Problem summary The user wants to perform repetitive tasks faster ## Usage - Use when your application contains repetitive tasks that involves switching modes from keyboard to mouse. ## Solution Allow users to trigger actions faster with keyboard commands. Typically keyboard shortcuts are made for commands that are part of frequent or repetitive user tasks. When adding shortcuts to your application, keep away from using existing system shortcuts or shortcuts that already used elsewhere in another context in the same application. Avoid repurposing shortcuts that users have already adapted into their workflow1. You might want to consider adding keyboard shortcut information to menu items and button and icon tooltips, if available. ## Rationale Ease access to repetitive tasks by providing skilled users with keyboard shortcuts to their associated actions. Reduce the total time spent, the steps needed, and mental energy wasted to complete a task without making it harder on novice users. Keyboard shortcuts accelerate exposition of program function to users through keypresses rather than mouse clicks. This can greatly help speed up task completion time as the user does not need to switch modes from using they keyboard to the mouse; hands can stay on the keyboard1. ## Discussion ### Keyboard shortcut strategies #### Mnemonics Assist user recall memory by creating mnemonic associations with letters used in key combinations. However, as there are only so many keys available, a common strategy is to use the middle or end letter of a function rather than the initial letter. On Macs, `O` is used for “Open File” while `L` is used for “Open Location”. #### Speed Finally, placing keys of command pairs close to each other, even though there is no mnemonic association can make sense as well. `C` is often used for “Copy” while `V` is used for Paste. ## Sources

1 Keyboard Shortcuts at the Atlassian Design library.

--- # Captcha - Type: User interface design pattern - Category: Getting input > Forms - URL: https://ui-patterns.com/patterns/Captcha - Examples: 13 screenshots on the page ## Problem summary The application needs to verify that the data submitted originates from an actual human and not a robot. ## Usage Websites featuring the ability for visitors to comment, register as a user, or otherwise actively post content on the website are often exposed to attacks from spam-robots. The content posted by such spam-robots can be compared to spam sent by e-mail. The main purpose of spam-robots on the web is to create and spread links to a specific website, in order to increase the websites search rating on search engines like google.com. These spam-posts rarely have anything to do with the subject of the website, hence the spam categorization. To avoid such spam, captchas are introduced. The whole idea behind Captchas is to create a way to distinguish real human beings from automated robots. - Use when your web application experiences attacks from malicious web-robots trying to post spam-content on your site - Use to protect your website from automated robots - Use when the capability to post content to your website is not blocked by the need to be logged in. Registration processes are included. ## Solution The most popular form of Captchas are images that represent letters and numbers inside. The user is prompted to write in a separate form field what the image reads in a separate form field. To prevent spammers from using OCR software to read the image, the image is manipulated in different ways, which makes it hard for computers while maintaining readability for humans. If the user succeeds in typing what the image says, his content is posted to the website. If not, the action will be refused. It is common to allow a number of tries to enter the captcha text, as some captcha images are even unreadable to humans due to the strong image manipulation is has been exposed to. ## Rationale Captchas are short for ‘Completely Automated Public Turing test to tell Computers and Humans Apart’. The whole idea behind Captchas is to distinguish humans from computers letting the user perform an action a computer can’t. A captcha is a simple Turing test. There is a fine line between making a captcha unrecognizable for OCR scanners and still readable for human beings. Readability for the human has to come first. Other problems with implementing captchas to protect your website include a lock-out from visually impaired users as they can’t use voice software to speak what the captcha reads. Other forms of protection from malicious spammers are asking questions like “what is 2 + 3” or “what is two plus three” or using voice captchas, --- # Rule Builder - Type: User interface design pattern - Category: Getting input > Forms - URL: https://ui-patterns.com/patterns/rule-builder - Also known as: Query Builder, Smart Filter, Segment Builder - Examples: 6 screenshots on the page ## Problem summary The user needs to, often repeatedly, conduct a search query based on a custom set of rules ## Usage - Use to build a search query based on several conditions - Use to save a segment rather than static selection - Use to help users build dynamic lists, making the selected rules static rather than the actual search result - Use when a search query involves an unknown number of undefined conditions - Do not use when users can find what they need using only a text input. - Do not use when the type of search query requires the same types of variables to be chosen every single time. ## Solution Let the user build a dynamic list of rules to narrow down matching results from a dataset. Each rule is represented by a separate line or box and divided from each other vertically. ### Any or all The user must specify whether a rule is needed (AND) or is optional (OR). A common approach to simplify the implementation of this pattern is to provide an option to choose whether **all** rules chosen should be matched – or just **any** of the rules. A more nuanced approach is to allow *each rule* to be a required match or just an optional match. ### Treat each rule type differently? As the user choses the kind of rule he or she wants to impose, those rules can have very different impacts on what corresponding data needs to be entered for the rule to give meaning. This is why many rule builders provide smart mini-forms that vary depending on what kind of rule is selected. One rule might impose a text search, wherein options like “contains”, “does not contain”, “matches”, or “do not match” make sense. Other rules could be to select an option from a dynamic list or to provide numeric- or range inputs. ### Adding and removing rules The smartest feature rule builders provide is to dynamically add and remove rules. The “Add” button is typically located either directly under the rules and remains so as new rules are added or removed, or it located alongside the remove rule button. In the case of the latter, this allows for new rules to be inserted directly beneath a desired rule. Removing a rule is most often allowed at the beginning or end of the line the rule is presented on. ## Rationale A rule builder allows a user to specify unique conditions to discover and group items across one or more datasets. The results returned by an active rule can be dynamic in nature as its related datasets change over time. An active rule can trigger a set of actions to be performed when the conditions, criteria and values of the rule are met. Rules sets can be grouped into discrete units and linked together with condition logic to create highly complex rule conditions. ## Discussion ### Pattern authors - [Richard Barrett](http://richardbarrett.co/) - [Anders Toxboe](http://ui-patterns.com) ## Sources

1 UI design for rule builder by Two Rivers Consulting

2 Interesting StackExchange discussion

--- # Inplace Editor - Type: User interface design pattern - Category: Getting input > Forms - URL: https://ui-patterns.com/patterns/InplaceEditor - Also known as: Direct Manipulation - Examples: 1 screenshots on the page ## Problem summary The user needs to quickly and easily edit a value on a page ## Usage - Use when the user only needs to edit one value (or very few) and not many - Use when the value the user needs to edit is of a simple format, i.e. a text string, in a dropdown box. - Use if you want the user to be able to edit a value without actually going to an administration page, but by staying on the same page. ## Solution Let users edit values in the same place as they are displayed. Provide an easy way to let users edit parts of a page without having to be redirected to an edit page. Typically, hover effects are used to invite editing. The Inplace Editor pattern allows for localized editing of elements on the fly. The pattern provides ease of editing by placing the controls right next to the elements they affect. For example, when in editing mode of an application, a page title element will display editing controls when the user hovers their mouse over it. The elements background color is highlighted and a tooltip is shown prompting the user to click the element to edit it. Once the user clicks the element, it is transformed into an input field (text, dropdown, etc.). A save button and a cancel button are also displayed. Often, the input field matches the styling of the original element. If the original element was a header written in size 20pt, the size of the font in the input field would also be 20pt. This styling is mirrored to ensure that the user can connect the original element with the new editable The user can then edit the value of the input field (which is the same as the original elements value) and click save or cancel. If ‘save’ is clicked, the value is saved through an AJAX call to the underlying database, the value of the element is updated and the element is returned to normal view. If cancel is clicked, the element is changed back to the original view without any changes. This pattern is often combined with AJAX techniques, which is an asynchronous call to the server through javascript that does not require a refresh of the page. There are many javascript libraries available online that deliver ready-to-use inplace editors. ## Rationale An in-place editor provides an easy way to let the user edit parts of a page without having to be redirected to an edit page. Instead, the user can just click around on a page and edit the elements he or she wishes to change – without reloading the page. --- # Preview - Type: User interface design pattern - Category: Getting input > Forms - URL: https://ui-patterns.com/patterns/LivePreview - Also known as: Live Preview - Examples: 5 screenshots on the page ## Problem summary The user wants to check how changes in form fields affect an end result as quickly as possible. ## Usage - Use when you want to provide the user with a real-time preview of what he or she is creating - Use when it is hard for the user to comprehend how the final output will be without having a preview to reference - Do not use when the input is straightforward and the resulting output does not depend on a specific layout ## Solution Let users preview consequences of an action before committing to it. Update a preview of what modifying a form will result in throughout the entire interaction with the form. Instead of waiting for the user to submit the form, the changes are shown immediately in a preview. Each user event of significance results in a browser-side processing. ## Rationale Previews make it easier for users to decide whether or not to commit to a change and thus invite safe exploration and playful creativity. Show feedback immediately in live previews to further spark fun, play, and exploration. The result is increased interactivity. The user does not need to wait for page reload on a form submit to find out whether data was inputted correctly into the form. The feedback is immediate. --- # Autosave - Type: User interface design pattern - Category: Getting input > Forms - URL: https://ui-patterns.com/patterns/autosave - Examples: 1 screenshots on the page ## Problem summary The user wants to keep their data safe and saved while focusing on working without having to remember to do so. ## Usage - Use when you want to help the user focus on producing great content without worrying about whether their data is safe and saved. ## Solution Prevent accidental data loss by automatically saving user input at fixed intervals or at events of interest. Consider at what frequency it makes sense to auto-save inputted content for your application, and at what events it makes sense to trigger an auto-save. The most obvious event is clicking the save-button, but the event of moving the focus to another field might also be interesting to observe. ### The save button To better guide users as to what state their document is in, consider changing the label of the save button from “Save”, when the form contains uncommited changes to “Saved” when the current form represents what has been saved in storage. ## Rationale Let users worry about creating great content rather than about loosing it. Removing the save button entirely can create fear, so consider keeping it around to make users feel safe. Leave an unobtrusive trace of conducted user actions and consider complementing with the Undo pattern. ## Discussion When implementing auto-save functionality, consider not removing the “Save” button. Users tend to panic, when there is no “Save and close” button. Even though the “Save” button does nothing or only closes the window, it provides confidence and reassurance in users that their data is safe. It’s an issue of trust. Did the system hear me? Am I sure that I am sure? --- # Password Strength Meter - Type: User interface design pattern - Category: Getting input > Forms - URL: https://ui-patterns.com/patterns/PasswordStrengthMeter - Examples: 5 screenshots on the page ## Problem summary You want to make sure your users' passwords are sufficiently strong in order to prevent malicious attacks. ## Usage - Use when you want your users to choose passwords for their user accounts that are hard to break or guess by either human or computerized help. - Use when you want to increase the complexity of your users’ passwords and raise the barrier for attackers tampering with your system. - Use when you want to be sure that your users know what a good password is and that their chosen password follows such guidelines. ## Solution A password’s strength is measured according to predefined rules and is displayed using a horizontal scale next to the input field. If the password is weak then only a small portion of the horizontal bar is highlighted. The greater the strength of the password the more the horizontal bar is highlighted. The password strength is also appropriately indicated by coloring the bar in a color associative with good or bad: Green indicating a strong password and red indicating a weak password. ### How strong a password? The definition of a strong password can be intensely argued. A forced complex password at first glance only spells increased security, but forcing too complex and rigid rules on password can have the opposite effect. As passwords are forced to be complex, they also become increasingly harder to remember by the user. This occasionally leads to a self-destruction of the increased security, as some users simply write it down on a small sticky note and paste it up on their screen in order to remember their new complex password. This is especially a problem in places with the policy of forced password renewal every 3 months. ### What is a strong password? With the above mentioned in mind, I should stress that a sufficiently strong password does not necessarily need to fulfill all of the rules below, but merely a few will do. Consider the following rules, for each rules followed add a point to the passwords strength level (so that 0 points is the weakest, and 5 is the strongest). UI-patterns.com defines a strong password when it…: - Has more than 8 characters - Contains both lowercase and uppercase letters - Contains at least one numerical character - Contains special characters - Has more than 12 characters This would result in 6 levels of password strength depending on how many of the above mentioned criteria are being met. ### Dictionary attacks While the above mentioned password check can easily be done using only client-side javascript, it does not prevent against dictionary attacks. To ease the memorization of passwords, people tend to use real words as passwords and merely substitute characters with numbers or special characters. An example of such a password could be “P@ssw0rd”, which really isn’t a strong password. Modern password breaking software is fairly good at guessing such number/letter substitutions. To check against such strength, you would need to do ajax calls that would check with your own dictionary if the password was strong or not. ### Choosing an appropriate level of password strength You need to determine the password strength and complexity according to what you want to protect. You need to draw the line somewhere. For 99% of the content out there it can easily be argued that merely the first 2 or 3 rules mentioned above will be sufficient. ### General guidelines on choosing a password - Use a password of a seemingly random selection of letters and numbers - Use a password that you can type without you having to look at the keyboard (decreases possibility of people stealing your password) - Change your password regularly - Do not use your network ID in any form (capitalized, reversed, doubled, etc.) - Do not use your first, middle or last name or anyone else’s in any form. - Do not use your initials or any nicknames you or somebody else might have. - Do not use a word contained in any dictionary (English or foreign), spelling list, abbreviation list, etc. - Do not use information that people can easily obtain about you (license plate, pet name, date of birth, telephone numbers) - Do not use password of all alphabetical characters or only numeric characters – mix them up. - Do not use keyboard sequences (for instance qwerty or asdf) ## Rationale By showing a password strength meter beside the password field, the user is forced to consider using a password with an appropriate strength. By putting a minimum level of password strength you can even use the password strength meter to force a heightened security to your website. Using a password strength indicator on the website, adds another level of security is added to the site. This not only makes the current users of the site feel more secure, but potential clients might use this as a requisite when deciding to conduct business with a company. --- # Fill in the Blanks - Type: User interface design pattern - Category: Getting input > Forms - URL: https://ui-patterns.com/patterns/FillInTheBlanks - Also known as: Natural language form - Examples: 16 screenshots on the page ## Problem summary The user needs to enter data into the system ## Usage - Use when you find yourself creating labels for input fields that do not really explain what the input field is all about. - Use when you find yourself creating long and complicated labels for input fields, which in turn makes it hard for users to understand. - Use when you can possibly express the context of the input field by placing it in a sentence. - Use when filling out the input field is mandatory or strongly appreciated. Leaving parts of a sentence unfilled creates annoyance in the user. - Use when you have a relatively small set of input fields to place as part of the sentence. If you have many input fields, placing them all in a sentence can seem tiresome for the user, as the sentence structure forces the user to read all sentences and place all input fields in the context of those sentences. - Do not use if you have many fields that are not required to be filled out. ## Solution Order input fields in the form of a sentence with input fields as blank spaces to be filled by the user. Write a sentence and let the user fill in the blanks of the sentence by selecting or filling out input fields that are in place of words. When the input field is not inserted at the end or the beginning of the sentence, it is important for the general readability and understandability of the interface, that the input fields does not take up more space than the height of one text-line. Input text boxes, and drop-down lists therefore work the best for this sort of usage. The pattern is often seen in applications that filter large lists out by conditions. In Apple’s iTunes, the pattern is used to create conditions for smart playlists (See examples at bottom of page). The biggest drawback of the pattern is its poor ability to be localized into different languages as the placement of each input will possibly have to be rearranged to match the grammar of each language. Using “Fill in the blanks” in this way hinders immediate conversion of a user interface to other languages. ## Rationale We all know how to finish a sentence. By inserting input fields into a sentence of words, the user interface is made self-explanatory, possible misundestandings are minimized, and the context is understood more clearly. Sometimes, it can be hard to find a describing label for an input that does not alienate the user to the system. Consider the example in the bottom of the page from the Ruby On Rails wiki. Here, both the submit button (“Save”), the input field for the author name, as well as a back in history link are presented all in the same sentence. These three options could have easily been represented on separate lines with a separate label for each option. Instead, the three options are presented as a sentence, and thus put in context of each other. Furthermore, the example above uses the [Input Prompt pattern](/patterns/InputPrompt) to encourage users to fill out the text field. The “Fill in the blanks” makes the interface somewhat self-explanatory. Our semantic capabilities as human beings allow us to fill in the missing parts of a sentence. --- # WYSIWYG - Type: User interface design pattern - Category: Getting input > Forms - URL: https://ui-patterns.com/patterns/WYSIWYG - Also known as: What You See Is What You Get - Examples: 1 screenshots on the page ## Problem summary The user wants to create content that contains rich media and formatted text but does not the knowledge or time to write HTML. ## Usage - Use when you want to give the user a clear indication of what their content will look like when it is published. WYSIWYG is an acronym for **W**hat **Y**ou **S**ee **I**s **W**hat **Y**ou **G**et. - Use when the users of a site are not comfortable with formatting text using HTML codes or a markup language such as [textile](http://textism.com/tools/textile/) or [markdown](http://daringfireball.net/projects/markdown/). - Use to lower the barrier of letting your users add formatted content to your site. - Use when you want an easy way to integrate media into the formatted content of your site that does not require HTML or any other syntax knowledge. - Use when the user is inclined to spend time correcting small details on their content. WYSIWYG allows users to see formatted results as they edit, this increases their confidence and allows for quick and good looking results. - Do not use if you want to keep the HTML syntax clean. Many WYSIWYG editors are known to produce bloated and untidy HTML code. - Do not use if you want the editor to function in all browsers. WYSIWYG editors rarely support all browsers, and if they do, it is often only the latest releases of the browsers. ## Solution There are many javascript libraries available online that will convert a `