Note: This answer was written before the photo was added to the question and country identified.
Problem
when I toggle the switch the breaker trips
You have connected the wires incorrectly. You have probably connected the switch between neutral and live.
Wiring a light fixture
In the UK, a pre-2004 ceiling box with three sets of wires would be connected like this:
A comes from the breaker, B goes to the next light fitting. The wires to the lamp holder use the post-1977 colours.
Note that C is labelled "twin red & earth" this means it has a second red wire instead of the black wire. In practise, most electricians use normal "twn * earth" for the cable to the switch. This means the black wire is switched-live not neutral. It should be marked with red-tape to indicate this.
If you then just connect all the black wires together, you would connect the switch across live and neutral, creating the problem you describe.
The correct wiring looks like this in a typical UK ceiling rose (with post-2006 fixed-wiring colours. Arrangement is inverted compared with above diagram):
Photo - own work, © RedGrittyBrick. Licence: Creative-Commons Attribution-ShareAlike 3.0
Note the red tape on the blue wire from the switch, indicating this is switched-live not a normal neutral. See that this particular wire is NOT connected to the other same-coloured wires (blue in this example).
Colours of wires
A brief history of wiring colours in the UK
neutral live earth
Before 1977: black red green
1977-2004:
Wires in wall black red green
Other† wires blue brown green/yellow striped
After 2006‡: blue brown green/yellow striped
† pendant light cords, appliance cords, lamp cords, etc
‡ Between 2004-2006 you could use either set of colours in fixed wiring in walls.
Other countries
The same principles apply but the wiring colours will differ. For example, the US usually has white for neutral, black for hot (live). The specific methods for connecting wires will differ. For example, a US home will probably use wire-nuts.
However, to repeat, the principles are the same, make sure the cable from the switch is not connected incorrectly, you do not connect all wires of the same colour together.
Related reading