 
         self.title = title
         self.label = NSTextField.newWrappingLabel(title: title, controlSize: NSSmallControlSize)
+        self.label.alignment = .center
 
         self.image = image
         self.imageView = NSImageView()


        super.init(frame: frame)

        self.imageView.translatesAutoresizingMaskIntoConstraints = false
        self.addSubview(self.imageView)

        self.label.translatesAutoresizingMaskIntoConstraints = false
        self.addSubview(self.label)

        let viewsDict: [String : Any] = ["imageView" : self.imageView, "label" : self.label]
        self.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "V:|-4-[imageView]-4-[label]-4-|", options: [], metrics: nil, views: viewsDict))
        self.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "H:|-(>=4)-[label]-(>=4)-|", options: [], metrics: nil, views: viewsDict))
        imageView.setContentCompressionResistancePriority(NSLayoutPriorityDefaultLow, for: NSLayoutConstraintOrientation.vertical)
        self.addConstraints([
            NSLayoutConstraint(item: self.imageView, attribute: NSLayoutAttribute.centerX, relatedBy: NSLayoutRelation.equal, toItem: self, attribute: NSLayoutAttribute.centerX, multiplier: 1, constant: 0),
            NSLayoutConstraint(item: self.label, attribute: NSLayoutAttribute.centerX, relatedBy: NSLayoutRelation.equal, toItem: self, attribute: NSLayoutAttribute.centerX, multiplier: 1, constant: 0),
            ])

    }

    required public init?(coder: NSCoder) {
        fatalError("init(coder:) not implemented")
    }

    // MARK: - Custom Drawing

//  Copyright © 2017 Christian Tietze. All rights reserved. Distributed under the MIT License.

import Cocoa

extension NSLayoutConstraint {

    func prioritized(_ priority: NSLayoutPriority) -> NSLayoutConstraint {
        self.priority = priority
        return self
    }
}

public class FatSidebarItem: NSView {

