Skip to content

Commit

Permalink
Added prefix and postfix classes which also change the radius of inpu…
Browse files Browse the repository at this point in the history
…ts accordingly.
  • Loading branch information
cereallarceny authored and lozandier committed Aug 20, 2014
1 parent fadd0d8 commit da2ade6
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 10 deletions.
18 changes: 15 additions & 3 deletions doc/includes/form/examples_form_labels.html
Expand Up @@ -8,7 +8,7 @@
</div>
</div>
<div class="row">
<div class="large-6 columns">
<div class="large-12 columns">
<div class="row collapse">
<div class="small-10 columns">
<input type="text" placeholder="Hex Value">
Expand All @@ -18,8 +18,20 @@
</div>
</div>
</div>
</div>
<div class="row">
<div class="large-6 columns">
<div class="row collapse">
<div class="row collapse prefix-radius">
<div class="small-3 columns">
<span class="prefix radius">Label</span>
</div>
<div class="small-9 columns">
<input type="text" placeholder="Value">
</div>
</div>
</div>
<div class="large-6 columns">
<div class="row collapse postfix-radius">
<div class="small-9 columns">
<input type="text" placeholder="Value">
</div>
Expand All @@ -29,4 +41,4 @@
</div>
</div>
</div>
</form>
</form>
18 changes: 15 additions & 3 deletions doc/includes/form/examples_form_labels_rendered.html
Expand Up @@ -10,7 +10,7 @@
</div>
</div>
<div class="row">
<div class="large-6 columns">
<div class="large-12 columns">
<div class="row collapse">
<div class="small-10 columns">
<input type="text" placeholder="Hex Value">
Expand All @@ -20,8 +20,20 @@
</div>
</div>
</div>
</div>
<div class="row">
<div class="large-6 columns">
<div class="row collapse">
<div class="row collapse prefix-radius">
<div class="small-3 columns">
<span class="prefix radius">Label</span>
</div>
<div class="small-9 columns">
<input type="text" placeholder="Value">
</div>
</div>
</div>
<div class="large-6 columns">
<div class="row collapse postfix-radius">
<div class="small-9 columns">
<input type="text" placeholder="Value">
</div>
Expand All @@ -33,4 +45,4 @@
</div>
</form>
```
{{/markdown}}
{{/markdown}}
2 changes: 1 addition & 1 deletion doc/pages/components/forms.html
Expand Up @@ -83,7 +83,7 @@ <h4>Rendered HTML</h4>

### Pre/Postfix Labels &amp; Actions

Foundation forms support actions tied to buttons, and prefix / postfix labels, through a versatile approach using special grid properties. Essentially you can use `<div class="row collapse">` to create label / action / input combinations. You use the Foundation columns to define the size of the pre/postfix `<span class="postfix">` or `<span class="prefix">`. Here are a few examples:
Foundation forms support actions tied to buttons, and prefix / postfix labels, through a versatile approach using special grid properties. Essentially you can use `<div class="row collapse">` to create label / action / input combinations. You use the Foundation columns to define the size of the pre/postfix `<span class="postfix">` or `<span class="prefix">`. Keep in mind, if you also want to make sure the input has a radius then you can wrap your input and prefix/postfix in `<div class="row collapse prefix-radius">` or `<div class="row collapse postfix-radius">` accordingly. Here are a few examples:

<div class="row">
<div class="large-6 columns">
Expand Down
21 changes: 18 additions & 3 deletions scss/foundation/components/_forms.scss
Expand Up @@ -321,14 +321,14 @@ $select-hover-bg-color: scale-color($select-bg-color, $lightness: -3%) !default;
-webkit-appearance: none !important;
-webkit-border-radius: 0px;
background-color: $select-bg-color;

// The custom arrow have some fake horizontal padding so we can align it
// from the right side of the element without relying on CSS3
background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgeD0iMTJweCIgeT0iMHB4IiB3aWR0aD0iMjRweCIgaGVpZ2h0PSIzcHgiIHZpZXdCb3g9IjAgMCA2IDMiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDYgMyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHBvbHlnb24gcG9pbnRzPSI1Ljk5MiwwIDIuOTkyLDMgLTAuMDA4LDAgIi8+PC9zdmc+);

// We can safely use leftmost and rightmost now
background-position: if($text-direction == 'rtl', 0%, 100%) center;

background-repeat: no-repeat;
border: $input-border-width $input-border-style $input-border-color;
padding: $form-spacing / 2;
Expand Down Expand Up @@ -431,6 +431,21 @@ $select-hover-bg-color: scale-color($select-bg-color, $lightness: -3%) !default;
}
}

form {
.row {
.prefix-radius.row.collapse {
input,
textarea,
select { @include radius(0); @include side-radius($opposite-direction, $global-radius); }
}
.postfix-radius.row.collapse {
input,
textarea,
select { @include radius(0); @include side-radius($default-float, $global-radius); }
}
}
}

input[type="submit"] {
-webkit-appearance: none;
-webkit-border-radius: 0px;
Expand Down

0 comments on commit da2ade6

Please sign in to comment.