UI-Bootstrap Components
Boomstrap and UI-Bootstrap
Our basic components are built atop the AngularUI team's UI-Bootstrap project but styled like the rest of the components in Boomstrap. The UI-Bootstrap components employed by Boomstrap are listed below. For background and documentation directly related to UI-Bootstrap, head over to the UI-Bootstrap page on GitHub.
Alert (ui.bootstrap.alert)
Carousel (ui.bootstrap.carousel)
Slide
Enter a negative number to stop the interval.
Carousel creates a carousel similar to bootstrap's image carousel.
Use a <carousel>
element with <slide>
elements inside it. It will automatically cycle through the slides at a given rate, and a current-index variable will be kept in sync with the currently visible slide.
<div ng-controller="CarouselDemoCtrl">
<div style="height: 305px">
<carousel interval="myInterval">
<slide ng-repeat="slide in slides" active="slide.active">
<img ng-src="" style="margin:auto;">
<div class="carousel-caption">
<h4>Slide </h4>
<p></p>
</div>
</slide>
</carousel>
</div>
<div class="row">
<div class="col-md-6">
<a class="btn btn-info" ng-click="addSlide()">Add Slide</a>
</div>
<div class="col-md-6">
Interval, in milliseconds: <input type="number" class="form-control" ng-model="myInterval">
<br />Enter a negative number to stop the interval.
</div>
</div>
</div>
function CarouselDemoCtrl($scope) {
$scope.myInterval = 5000;
var slides = $scope.slides = [];
$scope.addSlide = function() {
var newWidth = 600 + slides.length;
slides.push({
image: 'http://placekitten.com/' + newWidth + '/300',
text: ['More','Extra','Lots of','Surplus'][slides.length % 4] + ' ' +
['Cats', 'Kittys', 'Felines', 'Cutes'][slides.length % 4]
});
};
for (var i=0; i<4; i++) {
$scope.addSlide();
}
}
Cards
Data Requirement
Property cards rely on an object passed as the property
attribute. See the shape of the data here.
Single Card
Multiple Cards
Small Card
Cards With Carousels
Card Data
Each card expects a data object. The data is described as follows.
/* YourCardCtrl.js */ $scope.property = { imageSrc: ['/images/some/path/to-img.jpg'], // must be array. one renders image; multiple renders carousel. listPrice: '$2,250,000', listingUrl: 'http://www.superhellaawesomerealestate.com/listing/12345/', /* only choose one of the following! * the others don't have to be explicitly false; * just skip the ones you don't want. */ // a note about relative dates (2 days ago, 1 yr ago, etc.) // given a date string from the server, e.g. '2014-04-26T18:27:19' // wrap your date in a JS date object. like this: // new Date('1979-01-16T00:00:00') // the am-time-ago directive will take it from there offMarket: new Date('2014-04-27T18:27:19'), // only populated for off market listings (triggers sash) newProperty: new Date('2014-04-26T18:27:19'), // only populated for new listings (triggers sash) reduced: '30 mins ago', // only for reductions (triggers sash). when present, an object: // reduced: { // 'when': new Date('2014-04-29T18:27:19'), // 'change': '-$250,000', // 'changePercent': '2%' // }, backOnMarket: new Date('2014-05-26T18:27:19'), // only populated for back on market (triggers sash) /* ^^^ only choose one of those */ bestFits: '1444', favs: '33', mls: '1324961', listed: '6 days ago', pricePerSqft: '$1.99', beds: '5', baths: '3.5', sqft: '4,195', acres: '2.75', type: 'Frat House', address: { street: '123 Fourth St.', city: 'Charleston', state: 'SC', neighborhood: 'Craig\'s Landing' }, history: [ { 'when': '5 hrs ago', 'change': '-$250,000', 'changePercent': '2%', 'price': '$2,250,000' }, { 'when': '6 hrs ago', 'change': '-$500,000', 'changePercent': '5%', 'price': '$2,500,000' } ] }
Then just pass the data from your controller to the view. The property attribute takes the property object.
/* your-view.html */ <bt-property-card property="property"></bt-property-card>
Single Image vs. Carousel
Simple. imageSrc
must be an array. If it contains one string, that string will be a single image. If it contains multiple strings, those will be rendered as a carousel.
/* SomeCtrlCtrl.js */ /* single item in imageSrc array is rendered as an image */ property = { imageSrc: ['/images/im/just-a/poor-boy-nobody-loves-me.jpg'], etc: 'and the rest of the property object...' } /* multiple items in imageSrc array are rendered in a carousel */ property = { imageSrc: [ '/images/musketeers/athos.jpg', '/images/musketeers/aramis.jpg', '/images/musketeers/porthos.jpg' ], etc: 'and the rest...' }
Collapse (ui.bootstrap.collapse)
Datepicker (bootstrap-datepicker)
Data Requirement
btDatePicker requires that the date passed in is of the shape { value: dateValue }
.
Usage
Create an object on the scope with a key/value pair of value: myDate
and add the bt-date-picker attribute to the item you wish to control.
<button class="btn btn-default" bt-date-picker="date">Click me!</button>
btDatePicker is just a thin wrapper on the bootstrap-datepicker.
All options can be included as data-date-* attributes on an element with bt-date-picker and will be passed down unto the date picker. Full documentation is here.
Dropdown (ui.bootstrap.dropdownToggle)
Lead Category
Usage
<bt-lead-category category="[number (required)]" abbreviated (optional) equal (optional)></bt-lead-category>
bt-lead-category
simply takes a category
attribute (see values below) and, optionally, a sizing attribute (either equal
, abbreviated
or both). Angular creates the necessary HTML, CSS and text based on the category value. Setting width
to equal
renders all category labels the same width. Setting width
to abbreviated
renders all category labels the same width with abbreviated names (e.g. 'nurt' instead of 'nurture').
Examples
Values
/* Lead category values: * just provide the value * to the category attribute. */ { value: 0, name: 'new' }, { value: 3, name: 'qualify' }, { value: 5, name: 'hot' }, { value: 4, name: 'nurture' }, { value: 2, name: 'watch' }, { value: 11, name: 'pending' }, { value: 10, name: 'closed' }, { value: 6, name: 'archive' }, { value: 1, name: 'trash' }
Loaders
<bt-loader></bt-loader>
Want to center the loader animation? No hay problemo! Just add the .text-center
class.
<bt-loader class="text-center"></bt-loader>
You may want to append your loader straight to the body element outside of your Angular app. Use <bt-body-loader>
. This is useful when your Angular app sits within a container with position: absolute;
and you're looking to absolutely center the loader over the page.
Control the visibility of the loader with $scope.isLoading
in your controller. Even though the loader itself sites outside of the controller, two-way data binding handles the loader's visibility.
// HTML
<bt-body-loader is-loading="isLoading"></bt-body-loader>
// CONTROLLER
// you may want to start as true if your app relies on data to initialize
$scope.isLoading = { value: false }; // needs to be an object for two-way binding to work
$scope.toggleLoader = function() { // flip the boolean to toggle
$scope.isLoading.value = !$scope.isLoading.value;
}
Modal (ui.bootstrap.modal)
Pagination (ui.bootstrap.pagination)
Minimal Pagination
Page: /
<script type="text/javascript"> angular.module('boomstrap').controller('btPagerTest', function($scope) { $scope.currentPage = 2; $scope.totalItems = 90; $scope.itemsPerPage = 10; }) </script> <bt-pager current-page="currentPage" total-items="totalItems" items-per-page="itemsPerPage"></bt-pager> <pre>Page: / </pre>
Popover (ui.bootstrap.popover)
Template Popover (wraps ui.bootstrap.popover)
Progressbar (ui.bootstrap.progressbar)
Ranges
Relative Time
am-time-ago
takes a date and passes it to moment.js. In the examples below, a date string is passed to the JavaScript Date()
object and handed off to the directive.
Take a look at the bt-property-card
directive to see am-time-ago
used in the directive template.
Select ui-select
Custom select is a third-party plugin using button dropdown. See https://github.com/angular-ui/ui-select for options and documentation.
Scores
Options
Color options for ranking / scoring data.
<script type="text/javascript"> angular.module('boomstrap').controller('btScoreTest', function($scope) { $scope.scores { excellent: 99, good: 75, average: 50, 'default': 25 }; }); </script> <bt-score score="scores.excellent"/> <bt-score score="scores.good"/> <bt-score score="scores.average"/> <bt-score score="scores.default"/>
Sizes
Fancy larger or smaller scores? Add size='lg'
, size='sm'
, or size='xs'
to the directive for additional sizes.
<p> <bt-score score="scores.excellent" size="lg"></bt-score> <bt-score score="scores.good" size="lg"></bt-score> <bt-score score="scores.average" size="lg"></bt-score> <bt-score score="scores.default" size="lg"></bt-score> </p> <p> <bt-score score="scores.excellent"></bt-score> <bt-score score="scores.good"></bt-score> <bt-score score="scores.average"></bt-score> <bt-score score="scores.default"></bt-score> </p> <p> <bt-score score="scores.excellent" size="sm"></bt-score> <bt-score score="scores.good" size="sm"></bt-score> <bt-score score="scores.average" size="sm"></bt-score> <bt-score score="scores.default" size="sm"></bt-score> </p> <p> <bt-score score="scores.excellent" size="xs"></bt-score> <bt-score score="scores.good" size="xs"></bt-score> <bt-score score="scores.average" size="xs"></bt-score> <bt-score score="scores.default" size="xs"></bt-score> </p>
Scrollbar (baron.js)
Adds a simulated scrollbar to any element. It wraps the jQuery baron library.
Either add the bt-scrollbar
attribute, or use the <bt-scrollbar>
element.
Bacon ipsum dolor sit amet bresaola meatball ground round pariatur proident mollit prosciutto incididunt exercitation. Short ribs short loin qui jerky culpa. Ut ad hamburger shankle frankfurter aliqua. Kevin anim filet mignon bacon. Hamburger non quis, bacon flank rump commodo magna dolor enim pariatur dolore id nostrud. Short ribs minim adipisicing, boudin commodo dolore irure cillum turducken tail ground round. Do in occaecat quis salami veniam commodo cupidatat in flank spare ribs ham t-bone turducken shoulder.
Leberkas irure nisi veniam boudin id tempor eiusmod. Incididunt dolore commodo tongue reprehenderit, leberkas venison. Proident incididunt meatloaf sirloin. Consectetur ut frankfurter, pariatur drumstick enim proident. Swine occaecat beef, deserunt venison culpa corned beef short ribs meatball eu tail dolore filet mignon est kevin.
Non capicola velit pork loin. Cupidatat pastrami sausage pork loin ullamco jerky eiusmod. Est sunt ut frankfurter boudin dolore porchetta jowl. Ullamco sed kielbasa irure excepteur sausage. Pariatur bacon beef swine doner nostrud.
Minim meatloaf chuck sint, occaecat ea rump drumstick beef cillum salami nisi est. Salami shoulder occaecat turkey ribeye in pancetta est ut drumstick dolor biltong velit. Drumstick brisket adipisicing elit exercitation, in meatball ut ham doner irure pork id et. Turkey tongue elit in, aute kevin andouille biltong flank fugiat ullamco in. Doner hamburger bresaola tail porchetta pork consequat tongue magna pastrami.
Venison velit frankfurter, excepteur magna shank dolore. Cillum do short ribs aliqua doner drumstick. Eiusmod labore laboris sed kielbasa short ribs sint bacon corned beef adipisicing aute tri-tip. Ad biltong consequat ball tip sint consectetur, nulla chuck jowl fugiat pig est pork boudin.
<div bt-scrollbar>
scrollable content goes here
</div>
Set the height
You will have to set the height of <bt-scrollbar>
.