Archive

Archive for January, 2017

Intro to Vue.js: Components, Props, and Slots

January 31st, 2017 No comments

This is the second part in a five-part series about the JavaScript framework, Vue.js. In this part, we’ll go over Components, Props, and Slots. This is not intended to be a complete guide, but rather an overview of the basics to get you up and running so you can get to know Vue.js and understand what the framework has to offer.

Article Series:

  1. Rendering, Directives, and Events
  2. Components, Props, and Slots (You are here!)
  3. Vue-cli (Coming soon!)
  4. Vuex (Coming soon!)
  5. Animations (Coming soon!)

Components and Passing Data

If you’re familiar with React or Angular2, the idea of components and passing state won’t be new to you. In case you’re not, let’s go through some of the main concepts.

Websites large and small are usually composed of different pieces, and abstracting them into smaller pieces makes them easy to structure, reason about, reuse, and makes our code more legible. Instead of digging through all of the markup in long, multi-faceted page, we could comprise it of components like this:

<header></header>
<aside>
  <sidebar-item v-for="item in items"></sidebar-item>
</aside>
<main>
  <blogpost v-for="post in posts"></blogpost>
</main>
<footer></footer>

This is a simplified example, but you can see how useful this type of composition can be as you start to build out the structure of your site. If you were to dive into this code as a maintainer, it wouldn’t take much to understand how the application is structured or where to look for each piece.

Vue lets us create components in a few different ways. Let’s work from simple to complex, keeping in mind that the complex example is truest to form for what an average Vue application would look like.

app.$mount('#app');

var app = new Vue({
  el: 'hello',
  template: '<h1>Hello World!</h1>'
});

This works, but isn’t terribly useful as it can only be used once and we’re not yet passing the information to different components. One way to pass data from a parent to a child is called props.

This is as simple an example as I could make, so that it’s super clear. Remember that the :text in the HTML is a shortcut for Vue binding. We covered this last time in the section on directives. Binding can be used for all kinds of things but in this instance, it keeps us from having to place the state in a mustache template, like this {{ message }}.

In the code below, Vue.component is the component, and new Vue is called the instance. You can have more than one instance in an applicatio. Typically, we’ll have one instance and several components, as the instance is the main app.

Vue.component('child', {
  props: ['text'],
  template: `<div>{{ text }}<div>`
});

new Vue({
  el: "#app",
  data() {
    return {
      message: 'hello mr. magoo'
    }
  }
});
<div id="app">
  <child :text="message"></child>
</div>

See the Pen.

Now we can reuse this component as many times as we like through our application:

<div id="app">
  <child :text="message"></child>
  <child :text="message"></child>
</div>

See the Pen.

We can also add validation to our props, which is similar to PropTypes in React. This is nice because it’s self-documenting, and will return an error if it’s not what we expected, but only in development mode:

Vue.component('child', {
  props: {
    text: {
      type: String,
      required: true
    }
  },
  template: `<div>{{ text }}<div>`
});

In the example below, I’m loading Vue in development mode, and purposefully passing an invalid type into our prop validation. You can see the error in the console. (It also helpful lets you know you can use Vue’s devtools and where to find them).

Vue.component('child', {
  props: {
    text: {
      type: Boolean,
      required: true
    }
  },
  template: `<div>{{ text }}<div>`
});

See the Pen simple props with validation by Sarah Drasner (@sdras) on CodePen.

Objects should be returned as a factory function and you can even pass as a custom validator function, which is really nice because you can check values against business, input, or other logic. There’s a nice write-up of how you’d use each type in the guide here.

You don’t need to necessarily pass the data in props to the child, either, you have the option of using state or a static value as you see fit:

Vue.component('child', {
  props: { 
    count: {
      type: Number,
      required: true
    }
  },
  template: `<div class="num">{{ count }}</div>`
})

new Vue({
  el: '#app',
  data() {
    return {
      count: 0    
    }
  },
  methods: {
    increment() {
      this.count++;
    },
    decrement() {
      this.count--;
    }
  }
})
<div id="app">
  <h3>
    <button @click="increment">+</button>
    Adjust the state
    <button @click="decrement">-</button>
  </h3>
  <h2>This is the app state: <span class="num">{{ count }}</span></h2>
  <hr>
  <h4><child count="1"></child></h4> 
  <p>This is a child counter that is using a static integer as props</p>
  <hr>
  <h4><child :count="count"></child></h4>
  <p>This is the same child counter and it is using the state as props</p>
</div>

See the Pen child component using and not using props by Sarah Drasner (@sdras) on CodePen.

The difference is whether or not you’re passing a property and binding it:

Not using the state

vs

Using the state

Up until now, we’ve been creating content in our child component with a string, and of course if you’re using babel so that you can process ES6 in all browsers (which I highly suggest), you could use a template literal to avoid potentially hard-to-read string concatenation:

Vue.component('individual-comment', {
  template: 
  `<li> {{ commentpost }} </li>`,
  props: ['commentpost']
});

new Vue({
  el: '#app',
  data: {
    newComment: '',
    comments: [
      'Looks great Julianne!',
      'I love the sea',
      'Where are you at?'
    ]
  },
  methods: {
    addComment: function () {
      this.comments.push(this.newComment)
      this.newComment = ''
    }
  }
});
<ul>
    <li
      is="individual-comment"
      v-for="comment in comments"
      v-bind:commentpost="comment"
    ></li>
  </ul>
  <input
    v-model="newComment"
    v-on:keyup.enter="addComment"
    placeholder="Add a comment"
  >

See the Pen cd81de1463229a9612dca7559dd666e0 by Sarah Drasner (@sdras) on CodePen.

This is a little more useful, but there’s still a limit to how much content we probably want to put in that string, even with the help of template literals. Eventually in this comment form we’d want to have photos and the names of the authors, and you can already probably guess how crowded it would get with all that information. We also won’t have any useful syntax highlighting within that string.

With all those things in mind, let’s create a template. We’ll wrap some regular HTML in special script tags and use an id to reference it to create a component. You can see that this is a lot more legible when we have a lot of text and elements:

<!-- This is the Individual Comment Component -->
<script type="text/x-template" id="comment-template">
<li> 
  <img class="post-img" :src="commentpost.authorImg" /> 
  <small>{{ commentpost.author }}</small>
  <p class="post-comment">"{{ commentpost.text }}"</p>
</li>
</script>
Vue.component('individual-comment', {
  template: '#comment-template',
  props: ['commentpost']
});

See the Pen Photo App post with Vue.js by Sarah Drasner (@sdras) on CodePen.

Slots

This is a lot better. But what happens when we have two components with slight variations, either content or style deviations? We could pass all the different content and styles down into the component with props, and switch everything out each time, or we could fork the components themselves and create different versions of them. But it would be really nice if we could reuse the components, and populate them with the same data or functionality. This is where slots come in really handy.

Let’s say we have a main app instance using the same component twice. Inside each child we want some of the same content, and some different content. For the content we want to stay consistent, we would use a standard p tag, and for the content we want to switch out, we’ll put an empty tag.

<script type="text/x-template" id="childarea">
  <div class="child">
    <slot></slot>
    <p>It's a veritable slot machine!<br> 
    Ha ha aw</p>
  </div>
</script>

Then, in the app instance, we can pass content inside the component tags and it will automatically fill up the slots:

<div id="app">
  <h2>We can use slots to populate content</h2>
  <app-child>
    <h3>This is slot number one</h3>
  </app-child>
  <app-child>
    <h3>This is slot number two</h3>
    <small>I can put more info in, too!</small>
  </app-child>
</div>

See the Pen.

Alternatively, we can have particular styles assigned for different components, and keep all of the content inside the same, therefore quickly and easily changing out the appearance of something. In the wine label maker below, one of the buttons will toggle the component and color based on what the user selects, and the background of the bottle and label and text will all switch, while keeping the content within stable.

const app = new Vue({
  ...
  components: {
    'appBlack': {
      template: '#black'
    }
  }
});

Main Vue App HTML:

  <component :is="selected">
    ...
    <path class="label" d="M12,295.9s56.5,5,137.6,0V409S78.1,423.6,12,409Z" transform="translate(-12 -13.8)" :style="{ fill: labelColor }"/>
    ...
  </component>

<h4>Color</h4>
  <button @click="selected ='appBlack', labelColor = '#000000'">Black Label</button>
  <button @click="selected ='appWhite', labelColor = '#ffffff'">White Label</button>
  <input type="color" v-model="labelColor" defaultValue="#ff0000">

White Component HTML:

<script type="text/x-template" id="white">
  <div class="white">
     <slot></slot>
  </div>
</script>

(This is a larger demo, so it might make more sense if you play with it in a separate window/tab)

See the Pen.

Wine Label Switching Out

Now, we’re putting all of the SVG image data in the main app, but it’s actually placed inside the in each component. This allows us to switch out pieces of content, or style things differently based on the usage, which is a really nice feature. You can see that we’ve allowed the user to decide which component they’ll be using by creating a button that changes the “selected” value of the component.

Right now we have everything in one slot but we could also use multiple slots, and differentiate them through naming if we’d like:

<!-- main vue app instance -->
<app-comment>
  <p slot="comment">{{ comment.text }}</p>
</app-comment>

<!-- individual component -->
<script type="text/x-template" id="comment-template">
  <div>
    <slot name="comment"></slot>
  </div>
</script>

We can switch between different components with the same referenced slots easily, but what happens when we want to be able to switch back and forth, but hold on to the individual state of each component? Currently, when we switch between black and white the templates switch out and the content stays the same. But maybe we have a situation where we want the black label to be completely different than the white label. There’s a special component you can wrap it in called that will retain the state as you switch.

Check out this deviation of the example above- create a black label, and then a different white label, and switch between them. You will see that the state of each is preserved, and are different from one another:

<keep-alive>
  <component :is="selected">
    ...
  </component>
</keep-alive>
Wine Label Keep-Alive Demo

See the Pen Vue Wine Label Maker- with keep-alive by Sarah Drasner (@sdras) on CodePen.

I love this feature of the API.

This is all nice, but for simplicity’s sake, we’ve been sticking everything in one or two files. It would be much better organized while we build out our site if we could separate the components out into different files, and import them as we need them, and truly that’s how real development in Vue is typically done, so let’s run through that next. Tune in for the next part when we talk about Vue-cli, build processes, and Vuex for state management!

Article Series:

  1. Rendering, Directives, and Events
  2. Components, Props, and Slots (You are here!)
  3. Vue-cli (Coming soon!)
  4. Vuex (Coming soon!)
  5. Animations (Coming soon!)

Intro to Vue.js: Components, Props, and Slots is a post from CSS-Tricks

Categories: Designing, Others Tags:

Luminar: The Hot Editing App That Adapts to You

January 31st, 2017 No comments

As an online professional, you naturally have your share of problems to solve and challenges to face. You look for tools to help you work your problems, ease your workload, and contribute to building better products.

One of the challenges you likely face is working with images. Unless you happen to be a professional photographer or at least a very experience one, you have to rely on other sources when you are in need of quality photos. Even if you have a basic photo editing tool, it may not suffice, and you’ve found that tools that can do the job are often cumbersome to work with, or have a steep learning curve.

If you happen to be a Mac user, here’s some good news for you.

Check out Luminar; the new photo editor for Mac that adjusts to your skillset.

  • Luminar is the perfect photo editor for your creative imagery projects.
  • Online marketing? Luminar enables you to create the attractive images required to adequately support a marketing campaign.
  • Luminar can help to brand you as a pro blogger.

Luminar Mac photo editor is precisely what you need to get your output to the next level.

The World’s First Photo Editing Software That Adapts to Your Skill Level and Style

Highly sophisticated, complex apps can be more trouble to try to work with that they are worth; or so it seems at times. This isn’t true with Luminar. Luminar is indeed a sophisticated, complex piece of software, but it’s UI is oh so friendly and easy to work with. You can do a bang-up photo editing and enhancing job the first time through, and you’ll only get better.

This brief tutorial demonstrates just how easily Luminar adapts to your skill level in spite of its many powerful and versatile features. Check out this table comparing Luminar’s features with those of Aperture and Lightroom to see for yourself.

Color Splash

There are several ways to create a color splash effect, each of which is quite simple. You can, for example, create the effect with a B&W filter and masking brush. Load the file and click on the “Add Filter” button to see the image in B&W. Then, click on the Brush icon, select the Brush Erasing mode, and brush out the monochrome to restore the color.

Image Resizing

Upload an image in Luminar, edit it, and click “Shift-Command-E” to launch the export menu. The choose the appropriate sizing more, and click Save. The result? Your image is resized to your specifications.

Get Creative with Luminar

Nestled within Luminar’s amazing toolkit are three filters designed to get your creative juices flowing. You can do some amazing things with the Texture Overlay, Dramatic, and Color Temperature filters, as you will see when viewing the videos.

The Color Temperature Filter

You can make some images more relaxing by cooling them down using a bluish hue. Others can be made more intense, by warming them up using a reddish hue. Simply pick Color Temperature from the menu, and adjust the red or blue slider buttons (temperature and tint) as shown in the video. Like the other features found in this Mac image editor, this one is a breeze to work with.

Adding Texture with the Texture Overlay Filter

This can be an enjoyable experience; one in which you can do a great deal of experimenting to get a result that you find especially appealing. This could be a grungy look, a vintage look, or something that could best be described as uniquely creative.

It’s simply a matter of selecting the Texture Overlay filter, choosing a texture, and adjusting the lightness/darkness as you’ll see in this video:

The Dramatic Filter

As the name implies, the Dramatic filter allows you to create some downright exciting images. This filter helps make Luminar an image editor Mac users simply love working with. The video demonstrates the stunning results you can achieve by giving a photo an urban, gritty look. Simply select “Dramatic” in the menu, and use the slider button to get the result you want.

5 Cool Features Unique to Luminar that Offer a Special Touch

With these unique features, you can get results like this!

  1. Split Color Warmth – One slider is for warm colors, one is for cool colors. Adjusting them to add warmth, or produce a cool hue, enables you to do some creative toning, or increase a photo’s vibrancy.

2. Split Toning – You may wish to add color to either highlighted or shadowy regions in a photograph. Simply select the region type, and adjust the hue and saturation sliders. The “Amount slider” is used to increase overall intensity.

3. Golden Hour – This is a must-have filter when your sunset or sunrise photos are either too dark, or the anticipated subtle lighting effects appear washed out. Golden Hour’s sliders allow you to intensify subtle sunrise/sunset tones; or emulate them.

4. DeHaze – This filter lets you cut through haze and fog to bring out details that risk being lost in the mist. This tool consists of a single slider button.

5. Workspaces – This cool feature is a time saver. It allows you to set up one or more workspaces consisting of filters commonly used for various types of photographs. Once you’ve selected a workspace, you can modify it if needed.

Luminar can be used in several ways. You can use it as standalone software, as a plugin for Lightroom, Aperture, or Photoshop, or as an extension for Photos.

The easiest and best way to learn more about this impressive photo editor is to take it for a test drive.

Read More at Luminar: The Hot Editing App That Adapts to You

Categories: Designing, Others Tags:

The Promise of a Burger Party

January 31st, 2017 No comments

Mariko Kosaka with an elaborate and wonderful metaphor.

What is a Promise in JavaScript? It’s like if you go to a restaurant and order a burger and a shake. The restaurant needs to prepare your food, so after you pay, you get a tray with a buzzer on it. The tray is the Promise.

Direct Link to ArticlePermalink


The Promise of a Burger Party is a post from CSS-Tricks

Categories: Designing, Others Tags:

Implementing “Save For Offline” with Service Workers

January 31st, 2017 No comments

A straightforward tutorial by Una Kravets on caching assets and individually requested articles with Service Workers for offline reading.

I’m curious what the best practice will become. It’s possible that asking users to click something is it. Also possible: passively caching articles based on recently published, currently viewing, or related to currently viewing.

Direct Link to ArticlePermalink


Implementing “Save For Offline” with Service Workers is a post from CSS-Tricks

Categories: Designing, Others Tags:

5 ways effective UI design promotes UX

January 31st, 2017 No comments

A user experience is something that every website offers to those who visit it. However, the experience will differ from website to website in a wide variety of ways. Some are easy to navigate, some are a joy to use, some are clunky but you can still plod your way to where you want to go, and some are so difficult to understand that you just hit the back arrow on your browser.

One of the biggest influences on user experience is the user interface—the actual design that users will interact with—there are several factors that make up an interface, such as how easy it is to navigate through a website or how easy it is to read content. Users will also form their opinions based on the website’s perceived value and usefulness. The better it helps them accomplish their goals, the more useful it will be perceived to be.

The emotions that users feel while using your website, will end up having an impact on the associated business. If users can easily find what they are looking for on the website and feel satisfied, they are more likely to purchase from it, meanwhile, if they feel frustrated or confused, it is quite likely they will move along and purchase from someone else that offers them a better user experience. Lackluster user experiences hold many businesses back from their full potential, leaving their websites underperforming, and wasting valuable advertising dollars when visitors are not converted into customers.

Below are 5 simple, but potent, ways in which clever user interface design promotes successful user experience:

1. Improving page load speed

The page load speed of your website is an extremely important element of user experience. While designers often get caught up in trying to show off their visual design skills, the truth of the matter is that website visitors generally care more about page load speed than gaudy adornments.

According to a recent study by Kissmetrics, nearly half (47%) of all consumers expect a web page to load in 2 seconds or less; if your page takes longer than that to load, it is reducing the quality of the user experience. If your page takes more than three seconds to load, you will have, on average, 40% of visitors abandon your website; that will increase by 7% for each additional second it takes your website to load. A slow website translates into lost opportunities and lost sales.

Additionally, while slow load times cut down on the number of conversions your website generates, slow load times also work to reduce the number of opportunities your website will give rise to by having a negative impact on its search engine ranking. The effect is small, but you certainly want to do everything you can to improve your website’s search engine ranking.

To help keep your pages loading in under 3 seconds, try utilizing the following tips: first, opt for a simpler design style avoiding unnecessary items and flashy decorations (in A/B tests, simpler designs generally outperform ornate designs anyway); second, optimize your images in a graphics program, you don’t want to use html to resize them; third, avoid using too many plugins, they slow down the experience for site visitors; fourth, if your site is popular, consider utilizing a content delivery network to improve server response time.

2. Leveraging white space

White space is often overlooked but it is a very important part of effective user interface design. I am sure you have been in the same situation as most designers where clients view white space as empty space and rush to fill it, thinking white space is a waste. In fact, the opposite is the case; white space is one of the most important parts of a website.

If used properly, white space can dramatically improve the user experience of a website. White space helps make a user interface easy on the eye, which helps retain visitors and keeps them reading. It does this by making content more legible. The white space around website text and images helps people improve comprehension and creates a better user experience.

White space also helps improve the appearance of your website, giving it a nice, clean professional look. White space helps reduce confusion on the part of visitors as websites lacking in white space often look disorganized. You want to create a nice balanced look for your website using white space to separate different blocks of content.

White space is also effective to highlight something important such as your call to action. The proper use of white space in your design helps guide your visitors’ attention to key parts of your website and without it, visitors may overlook important items.

A wonderful example of this is the Chanel website. It is a beautiful, clean site that uses white space well to draw your attention to key areas of the site.

3. Cutting down the amount of text

Website visitors will generally just skim your web pages looking for important keywords, significant headings, and scannable lists. Visitors are typically in a hurry to find the information they’re looking for and will skip over content that appears to be inconvenient or irrelevant. Because of this, you should understand that visitors will most likely not read your content if it is not formatted to this pattern of behavior. Avoid creating long blocks of text that appear uninviting to users wanting to quickly scan your website. When it comes to the modern web, less is definitely more.

You also want to avoid over-indulging in promotional writing, as customers will quickly see through fluff and stop reading. Having the correct tone is important. According to the Nielsen Norman Group, objective copywriting in a concise, scannable style results in 124% better usability.

When and where it is possible, utilize visuals as people tend to be better engaged by visual content. Utilize icons, attention grabbing images, video clips and infographics to help get your message across rather than relying on large blocks of text.

Bellroy illustrates this concept well on their website as they keep text down to a minimum amount and showcase their products with big, easy to view images.

4. Reducing visual clutter

Treat your website visitors’ attention as a precious resource. As visitors arrive at your website, remember that they will be quickly scanning for pertinent information and not paying full attention to everything on the page. If you clutter up your user interface, it will overload website visitors with too much information, make your website seem complicated and reduce the quality of the user experience.

Start by removing items that are not essential. By getting rid of anything that isn’t necessary to the user completing their intended actions, you will reduce the clutter and improve visitors’ ability to focus on and comprehend essential information.

ETQ‘s website shows how by eliminating clutter you are able to focus on the products themselves.

5. Providing a clear call to action

You should have a clear goal for visitors who arrive at your website. You want this to be obvious to visitors and easy for them to complete. Perhaps you want visitors to make a purchase, request a quote, or just to call you, let them know what to do to keep them moving forward after landing on your website.

Your call to action is how you tell visitors what action they should take while on your website. We regularly see websites with no clear call to action and it is no surprise when we find out they are not performing the way their owners’ hope. Your call to action should stand out and make it easy for the visitors to take the desired action.

Before deciding on your website’s call to action it is best to understand your visitors’ reasons for coming to your website. Having a call to action that runs counter to visitors’ intentions will reduce its effectiveness. If visitors just want to make a purchase but you push them to ask for a quote it can cut down on the effectiveness of your call to action.

Dollar Shave Club’s buttons just beg to be pushed. Their website illustrates how clear calls to action can draw your attention and promote forward movement.

Foundation 6 Website Themes + Visual Editor Foundation Framer – 40% off

Source

Categories: Designing, Others Tags:

From The Community With Love: Unique And Inspiring Wallpapers For Your Desktop

January 31st, 2017 No comments

Time flies by! February is already here and artists and designers from across the globe have once again diligently created a potpourri of unique wallpaper calendars to freshen up your desktop. This monthly wallpapers mission has been going on for eight years already and we are very thankful to all the creative minds who challenge their skills and contribute to it each month anew.

This post features their desktop artwork for February 2017. The wallpapers all come in versions with and without a calendar and can be downloaded for free. Now there’s only one question left to answer: Which one will make it to your desktop this month?

The post From The Community With Love: Unique And Inspiring Wallpapers For Your Desktop appeared first on Smashing Magazine.

Categories: Others Tags:

Emotional People: 75 Completely Free Images Reflecting Special Moods

January 31st, 2017 No comments

Photos again? Of course, you need them all the time. Today, I’ve got a solid photo pack with 75 pictures of people reflecting touching moods for you. The Emotional People Photo Pack offers 75 completely free images of high quality and resolution.

Fancy Crave: Two Free High-Resolution Photos a Day

The Emotional People Photo Pack is provided by the photographer Igor Ovsyannykov, who has been running the photo service Fancy Cave since the beginning of last year. Day by day, he consistently expands his supply with two new high-resolution photos. All of his photos are under the Creative Commons Zero (CC0), which basically translates to the public domain, meaning that all images may be used for private, commercial, and customer projects, without any attribution.

Examples From the Emotional People Photo Pack

As you probably expected, the Emotional People Photo Pack deals with people. But it’s not about simple photos of humans. Instead, the focus is on the expression of emotions. Solitude is a big topic, but humility and happiness are also expressed in some photos. Although people and their feelings are the focus of each image, Igor has also endeavored to capture harmonious environments. Thus, some of the backgrounds consist of breathtaking landscapes and places from all around the world.

Even More Examples From the Emotional People Photo Pack

The total package with 75 photos weighs 187 MB and is offered for download as a Zip archive. The process is taken care of by the portal Gumroad, which is usually used as a sales platform. In this case, you need to enter the value 0 in the field “Name a Fair Price,” and click on “I Want This.” Of course, you can also enter any amount you see fit. Igor won’t decline that. Enter your email address in the following step. You can download the package right after. In this case, a disposable address would do the trick as well.

The Emotional People Photo Pack is free, free to use, and of high quality and resolution. I don’t know a reason why you shouldn’t load it into your toolbox.

Categories: Others Tags:

Unveil Secrets of the Best Converting CTA Buttons

January 30th, 2017 No comments
call-to-action buttons

The power of call-to-action buttons shouldn’t be underestimated. This is probably one of the most effective conversion-generating elements on your site. Although it may not seem to be as informative as the main body of your page/article/headline, but is probably the last chance to motivate your visitors to take an action as they scan through your content. So, what are the secrets of the proper use of CTA buttons on your site or blog? How to make them bring you the desired results? Let’s find it out.

CTA buttons play a huge role in your online marketing efforts. In the contemporary highly competitive world, it’s not enough to create “good” content only. Every piece of information that you share on your blog or site should be compelling and appealing to your audience so that it triggers their emotions and motivates for an action. Text links within your copy can also help you encourage the readers to click. Still, call-to-action buttons are considered as the most effective clickable element of your site, which can also boost your conversion rates.

A good call to action is the one that encourages people to click. If it neither catches the eye nor triggers any emotions, then there is no point to keep it on the page. Believe it or not, but with some simple tweaks can turn a CTA button into a powerful lead generating engine that can grow your site’s conversions to a great degree. Before we dig deeper in investigating the major secrets of clickable call-to-action buttons, let’s cast a glance at the basic tips to consider.

Must-follow tips:

  • Any CTA button that you add to your website should complement with its overall design and look contrasting to its background.
  • The button should look natural within interface. The key factors that influence the way you need to present it on your web project are the industry to which you are related, your audience, the type of content/products you represent, etc.

CTA buttons come in different shapes, colors, sizes. They also feature different texts and positioning. Which choices are the most effective for your web project? Which ones will bring the desired conversions? Let’s now uncover the major principles of clickable call-to-action buttons.

Wording for CTA Buttons

When it comes to CTAs, texts are far more important than their graphical presentation. Call-to-action buttons should clearly communicate what action a person will make with a click. A word or a phrase that you write on it should trigger clicks and sales, as well as communicate the benefit. So, what are the right words to add to CTA buttons?

      • To make people curious about what you are saying, you can enhance a CTA button with “See …” phrase.
      • Those users who are thirsty for knowledge will find phrases starting with “Read …” appealing.

call to action button

call to action button

Keep the copy short and easy to understand for a wide audience. You can also make call-to-action buttons more actionable while adding “Now” to the text. Moreover, you can enhance the buttons with widely-recognizable signs like arrows pointing at the button and images/cartoons/animations staring at it.

A message containing a CTA button converts 2.5 times better than the one featuring pure texts. The stats is taken from a study conducted by Adroll on Facebook back in 2014. Still, different buttons target different audiences. For example, a “Book Now” is more likely to convert better on travel sites, “Learn More” is for education resources, “Download” is for marketing experts interested in getting a new e-book, etc.

call to action button
In order to make your business a success, you need to guide people to the places where they are expected to take an action. Before we move to specific practical tips, let’s consider the key ways how to “prepare” the audience for conversion.

  • Resonate with the needs of your audience.
  • Show a reason to take the next step.
  • Communicate every statement clearly.
  • Ask to click and explain what the reader will get after hitting a call to action button.

What Color to Use

Words and size of call-to-action buttons are not the only factors letting you communicate with your audience. Colors into which CTAs are painted play a predefining role as well. There is no one specific color that will appeal to different audiences in a similar manner. When thinking about the color choice, remember about the people whom you target. Are those males or females? Do you target youngsters or adults? Based on the way you answer these question, you can decide upon the most appropriate colors for CTAs. For example, call-to-action buttons painted in warm colors (like red and orange) will be more appealing to women. Men, in their turn, give preference to cool colors, like green and blue.

call to action button

You shouldn’t forget about your business niche as well. If you work in the food-related industry, then combinations of red, yellow and greed colors will have an appetizing effect on your visitors. A general rule that you need to consider is making a CTA button contrasting to the content and backgrounds surrounding it.

call to action button

Call-to-Action Button Placement

This is one of the most important factors that one needs to consider. Is one button per page enough? Maybe you should put more than two CTAs on one page? What is the optimal placement of a call to action button on the page? Well, there is no one fit it all rule. In order to find the best and the most effective placement of the button on your site, you need to run A/B testing to find out what solution fits your project the best.

One of the most popular recommendations provided by online marketers is that you need to include at least 2 call-to-action buttons to the text of your offer – 1 in the beginning after the introduction, and another one in the end. Thus, you can welcome people to learn more about the things that you are talking about as they land on the page and motivate them for a purchase after they have looked though the entire publication.

When placing a button above or below the fold, you need to make it accessible to a person when they are ready to buy. Thus, you can choose from the following options:
Place CTAs in navigation.
CTAs in navigation
Put it at the bottom of the page for those people who will scroll the text to its end.
cta bottom

After ad copy for motivated users who will have a desire to buy after they read an advertisement. Here is a good example from TemplateMonster’s team.

cta copy
On any other page of your site, which is frequently visited by your audience (like reviews, privacy policy, features, about story, etc.).

Use the Power of Animation

What we are talking about at this point is a hover effect, which can change the button’s color on the mouse-over. By changing its physical appearance, the call-to-action buttons looks far more captivating. A changing color keeps the users alerted that it is ready to be used. From the physiological point of view, a blinking button plays with a user’s mind and motivates them for an action.

Conclusion

Wrapping it up, we should say that only A/B testing will show what color, size, texts or whatsoever work better on your site. A call to action button is an integral part of your online marketing campaign. It should correspond to your own corporate style and stand out from the rest of the content provided on the page. A CTA button is like a final step that leads people towards conversion after they have learned the necessary details about your product/service. The position of CTAs on your site should stand out with its clarity and visibility. Simple, short urgent phrases will keep the audience alerted and motivated for an action.

We hope that you find the aforementioned tips and examples useful, and they will help you attain the desired conversion boost on your website.

Good luck!

Read More at Unveil Secrets of the Best Converting CTA Buttons

Categories: Designing, Others Tags:

Intro to Vue.js: Rendering, Directives, and Events

January 30th, 2017 No comments

If I was going to sum up my experiences with Vue in a sentence, I’d probably say something like “it’s just so reasonable” or “It gives me the tools I want when I want them, and never gets in my way”. Again and again, when learning Vue, I smiled to myself. It just made sense, elegantly.

This is my own introductory take on Vue. It’s the article I wish I had when I was first learning Vue. If you’d like a more non-partisan approach, please visit Vue’s very well thought out and easy to follow Guide.

Article Series:

  1. Rendering, Directives, and Events (You are here!)
  2. Components, Props, and Slots (Coming soon!)
  3. Vue-cli (Coming soon!)
  4. Vuex (Coming soon!)
  5. Animations (Coming soon!)

One of my favorite things about Vue is that it takes all of the successful things from other frameworks, and incorporates them without getting disorganized. Some examples that stand out for me:

  • A virtual DOM with reactive components that offer the View layer only, props and a Redux-like store similar to React.
  • Conditional rendering, and services, similar to Angular.
  • Inspired by Polymer in part in terms of simplicity and performance, Vue offers a similar development style as HTML, styles, and JavaScript are composed in tandem.

Some benefits I’ve enjoyed over Vue’s competitors: cleaner, more semantic API offerings, slightly better performance than React, no use of polyfills like Polymer, and an isolated, less opinionated view than Angular, which is an MVC.

I could go on, but it’s probably better if you read their comprehensive and community-driven comparison with other frameworks. It’s worth a read, but you can skip back to it later if you’d like to dive into the code.

Let’s Get Started!

We can’t kick this off without the obligatory “Hello, world!” example. Let’s do that so you can get up and running:

<div id="app">
 {{ text }} Nice to meet Vue.
</div>
new Vue({
 el: '#app',
 data: {
   text: 'Hello World!'
 }
});

See the Pen Vue Hello World by Sarah Drasner (@sdras) on CodePen.

If you’re familiar with React, this will have some similarities. We’ve escaped into JavaScript in the middle of the content with the mustache template and used a variable, but one difference is we are working with straight up HTML instead of JSX. JSX is pretty easy to work with, but I do think it’s nice that I don’t have to spend time changing class to className, etc. You’ll also notice that this is pretty lightweight to get up and running.

Now let’s try Vue out with something I really love: loops and conditional rendering.

Conditional Rendering

Let’s say I have a set of items, like navigation, that I know I’m going to reuse. It might make sense to put it in an array to update it in a few places dynamically and consistently. In vanilla JS (with Babel) we might do something like this: create the array, then create an empty string where we add each item wrapped in an

  • , and then wrap all of that in a
      and add it to the DOM with innerHTML:

      <div id="container"></div>
      const items = [
        'thingie',
        'another thingie',
        'lots of stuff',
        'yadda yadda'
      ];
      
      function listOfStuff() {
        let full_list = '';
        for (let i = 0; i < items.length; i++) {
            full_list = full_list + `<li> ${items[i]} </li>`
        }
        const contain = document.querySelector('#container');
        contain.innerHTML = `<ul> ${full_list} </ul>`;     
      }
      
      listOfStuff();

      See the Pen e699f60b79b90a35401cc2bcbc588159 by Sarah Drasner (@sdras) on CodePen.

      This works fine, but it’s a bit messy for something so standard. Now let’s implement that same thing with Vue’s loop with v-for:

      <div id="app">
        <ul>
          <li v-for="item in items">
            {{ item }}
          </li>
        </ul>
      </div>
      const app4 = new Vue({
        el: '#app',
        data: {
          items: [
            'thingie',
            'another thingie',
            'lots of stuff',
            'yadda yadda'
          ]
        }
      });

      See the Pen Conditional Rendering in Vue by Sarah Drasner (@sdras) on CodePen.

      Pretty clean and declarative. If you’re familiar with Angular, this will likely be familiar to you. I find this to be such a clean and legible way to conditionally render. If you jumped into the code and had to update it, you could do so very easily.

      Another really nice offering is dynamic binding with v-model. Check this out:

      <div id="app">
        <h3>Type here:</h3>
        <textarea v-model="message" class="message" rows="5" maxlength="72"></textarea><br>
        <p class="booktext">{{ message }} </p>
      </div>
      new Vue({
        el: '#app',
        data() {
          return {
            message: 'This is a good place to type things.'  
          }
        }
      });

      See the Pen Vue Book v-model basic by Sarah Drasner (@sdras) on CodePen.

      You’ll probably notice two things about this demo. First, that it really took nothing at all to type directly into the book and dynamically update the text. Vue enables us to very easily set up two-way binding between the v-pre none Skip compiling for raw content, can boost performance

      {{ raw content with no methods}}

      v-once none Don’t rerender

      Keep me from rerendering

      v-show none Will show or hide a component/element based on state, but will leave it in the DOM without unmounting (unlike v-if) (toggles visibility when showComponent is true)

  • There are also really nice event modifiers and other API offerings to speed up development like:

    • @mousemove.stop is comparable to e.stopPropogation()
    • @mousemove.prevent this is like e.preventDelegation()
    • @submit.prevent this will no longer reload the page on submission
    • @click.once not to be confused with v-once, this click event will be triggered once.
    • v-model.lazy won’t populate the content automatically, it will wait to bind until an event happens.

    You can even configure your own keycodes.

    We’ll use these in examples a bit more coming up!

    Event Handling

    Binding that data is all well and good but only gets us so far without event handling, so let’s cover that next! This is one of my favorite parts. We’ll use the binding and listeners above to listen to DOM events.

    There are a few different ways to create usable methods within our application. Just like in vanilla JS, you can pick your function names, but methods are intuitively called, well, methods!

    new Vue({
      el: '#app',
      data() {
       return {
        counter: 0
       }
      },
      methods: {
       increment() {
         this.counter++;
       }
    });
    <div id="app">
      <p><button @click="increment">+</button> {{ counter }}</p>
    </div>

    We’re creating a method called increment, and you can see that this automatically binds to this and will refer to the data in this instance and component. I love this kind of automatic binding, it’s so nice to not have to console.log to see what this is referring to. We’re using shorthand @click to bind to the click event here.

    Methods aren’t the only way to create a custom function. You can also use watch. The main difference is that methods are good for small, synchronous calculations, while watch is helpful with more tasking or asynchronous or expensive operations in response to changing data. I tend to use watch most often with animations.

    Let’s go a little further and see how we’d pass in the event itself and do some dynamic style bindings. If you recall in the table above, instead of writing v-bind, you can use the shortcut :, so we can bind pretty easily to style (as well as other attributes) by using :style and passing in state, or :class. There are truly a lot of uses for this kind of binding.

    In the example below, we’re using hsl(), in which hue calculated as a circle of degrees of color that wraps all the way around. This is good for our use as it will never fail, so as we track our mouse in pixels across the screen, the background style will update accordingly. We’re using ES6 template literals here.

    new Vue({
      el: '#app',
      data() {
        return {
          counter: 0,
          x: 0
        }
      },
      methods: {
        increment() {
          this.counter++;
       },
       decrement() {
         this.counter--;
       },
       xCoordinate(e) {
         this.x = e.clientX;
       }
      }
    });
    <div id="app" :style="{ backgroundColor: `hsl(${x}, 80%, 50%)` }" @mousemove="xCoordinate">
      <p><button @click="increment">+</button> {{ counter }} <button @click="decrement">-</button></p>
      <p>Pixels across: {{ x }}</p>
    </div>

    See the Pen Showing simple event handling by Sarah Drasner (@sdras) on CodePen.

    You can see that we didn’t even need to pass in the event to the @click handler, Vue will automatically pass it for you to be available as a parameter for the method. (shown as e here).

    Also, native methods can also be used, such as event.clientX, and it’s simple to pair them with this instances. In the style binding on the element there’s camel casing for hyphenated CSS properties. In this example, you can see how simple and declarative Vue is to work with.

    We don’t even actually need to create a method at all, we could also increase the counter directly inline in the component if the event is simple enough:

    <div id="app">
      <div class="item">
        <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/28963/backpack.jpg" width="235" height="300"/>
        <div class="quantity">
          <button class="inc" @click="counter > 0 ? counter -= 1 : 0">-</button>
          <span class="quant-text">Quantity: {{ counter }}</span>
          <button class="inc" @click="counter += 1">+</button>
        </div>
        <button class="submit" @click="">Submit</button>
      </div><!--item-->
    </div>
    new Vue({
      el: '#app',
      data() {
        return {
          counter: 0
        }
      }
    });

    See the Pen Backpack Shop Counter by Sarah Drasner (@sdras) on CodePen.

    You can see that we’re updating the state directly in the @click handler without a method at all- you can also see that we can add a little bit of logic in there as well (as you wouldn’t have lower than zero items on a shopping site). Once this logic gets too complex, though, you sacrifice legibility, so it’s good to move it into a method. It’s nice to have the option for either, though.

    Article Series:

    1. Rendering, Directives, and Events (You are here!)
    2. Components, Props, and Slots (Coming soon!)
    3. Vue-cli (Coming soon!)
    4. Vuex (Coming soon!)
    5. Animations (Coming soon!)

    Intro to Vue.js: Rendering, Directives, and Events is a post from CSS-Tricks

    Categories: Designing, Others Tags:

    A practical guide to Progressive Web Apps for organisations who don’t know anything about Progressive Web Apps

    January 30th, 2017 No comments

    Sally Jenkinson:

    Progressive Web Apps (sometimes referred to as PWAs, because everything in tech needs an acronym) is the encapsulating term for websites following a certain approach, that meet particular technical criteria. The “app” involvement in the name isn’t an accident – these creations share much of the functionality that you’ll find in native experiences – but really, they’re just websites.

    It’s like if you build a website that is so damn good, you get to have a home screen icon on mobile devices. And good is defined by performance and progressive enhancement.

    When you hear people say “I want the web to win” they typically mean “I don’t want to lose the web to proprietary app development”. PWAs seem like an early step toward making web apps not second-class citizens on mobile devices. Maybe there is a future where native app development is web development.

    Direct Link to ArticlePermalink


    A practical guide to Progressive Web Apps for organisations who don’t know anything about Progressive Web Apps is a post from CSS-Tricks

    Categories: Designing, Others Tags: